Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/pm-stack-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: pm-stack tests

on:
push:
branches: [main]
paths:
- "pm-stack/**"
- ".github/workflows/pm-stack-tests.yml"
pull_request:
paths:
- "pm-stack/**"
- ".github/workflows/pm-stack-tests.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
test:
name: aggregator + projector
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0

- name: Install aggregator dependencies
working-directory: pm-stack/aggregator
run: bun install --frozen-lockfile

- name: Test aggregator
working-directory: pm-stack/aggregator
run: bun test
Comment on lines +32 to +34

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fix the dated registry assertion before gating on the full suite

On a clean CI runner, this newly added step encounters the existing failure in test/slice3.test.ts:506: the test requests /api/registry.json with its default seven-day window but expects the sole claude-code fixture, whose last activity is fixed at 2026-10-25T14:31:00Z. That record is already outside the window at this commit's timestamp; directly evaluating the registry query confirms it is excluded. Consequently, the new workflow reports failure on otherwise unrelated PM-stack changes and skips the subsequent projector and shell-smoke steps. Make the assertion independent of wall-clock time before enabling this gate, for example by requesting all registry history in that test.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 2296432, exactly along the suggested line: the slice-3 registry assertion now requests /api/registry.json?window=all, so the fixed-date claude-code fixture (last activity 2026-10-25) can no longer age out of the default 7-day window.

The same run exposed a second fixed-date time-bomb of the same class, also fixed in 2296432: the turso fixture history in src/sources/fixtures.ts paired relative daysAgo() snapshot dates with a hard-coded resetsAt of 2026-10-31; once that date passed, windowStartIndex collapsed the pace window to a single point and the service-detail view lost its Pace projections section (hub renders > service detail failure). The fixture reset is now future-dated relative to the snapshots.

— queue worker, task 4935


- name: Install projector dependencies
working-directory: pm-stack/projector
run: bun install --frozen-lockfile

- name: Test projector
working-directory: pm-stack/projector
run: bun test

- name: Test seed and deploy/install scripts
run: |
bash pm-stack/scripts/seed-smoke.test.sh
bash pm-stack/scripts/deploy-install-smoke.test.sh
6 changes: 3 additions & 3 deletions pm-stack/aggregator/src/sources/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ export const FIXTURE_USAGE: UsageView = {
value: 12,
unit: "pct",
limit: 100,
resetsAt: "2026-10-31T00:00:00Z",
resetsAt: `${daysAgo(-1)}T00:00:00Z`, // future-dated: a fixed past reset collapses the pace window (windowStartIndex) and the detail view loses Pace projections
source: "manual",
observedBy: "fixtures",
},
Expand All @@ -1328,7 +1328,7 @@ export const FIXTURE_USAGE: UsageView = {
value: 38,
unit: "pct",
limit: 100,
resetsAt: "2026-10-31T00:00:00Z",
resetsAt: `${daysAgo(-1)}T00:00:00Z`,
source: "manual",
observedBy: "fixtures",
},
Expand All @@ -1339,7 +1339,7 @@ export const FIXTURE_USAGE: UsageView = {
value: 82,
unit: "pct",
limit: 100,
resetsAt: "2026-10-31T00:00:00Z",
resetsAt: `${daysAgo(-1)}T00:00:00Z`,
source: "manual",
observedBy: "fixtures",
},
Expand Down
122 changes: 122 additions & 0 deletions pm-stack/aggregator/test/grist-live.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import { describe, expect, test } from "bun:test";
import { mkdtemp, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { loadConfig } from "../src/config.ts";
import { FIXTURE_ROADMAP } from "../src/sources/fixtures.ts";
import { liveSource } from "../src/sources/live.ts";

async function testConfig() {
const dir = await mkdtemp(join(tmpdir(), "pm-grist-live-"));
const feedFile = join(dir, "fleet-feed.json");
await writeFile(
feedFile,
JSON.stringify({
version: 1,
generatedAt: new Date().toISOString(),
quota: { pools: [], burn: [], choices: { hasHeadroom: [], burnBeforeReset: [], doNotStart: [] } },
attention: [],
}),
);
return loadConfig({
...Bun.env,
PM_AGG_SOURCE: "live",
PM_AGG_FEED_FILE: feedFile,
PM_PROJECTOR_URL: "off",
GRIST_URL: "http://grist.test",
GRIST_ROADMAP_DOC: "test-roadmap-doc",
GRIST_API_KEY: "test-grist-api-key",
});
}

describe("live Grist roadmap reader (#1213)", () => {
test("reads the records endpoint with bearer auth and maps roadmap fields and references", async () => {
const cfg = await testConfig();
const requests: { url: string; authorization: string | null }[] = [];
const realFetch = globalThis.fetch;
globalThis.fetch = (async (input: unknown, init?: RequestInit) => {
requests.push({
url: String(input),
authorization: new Headers(init?.headers).get("authorization"),
});
return new Response(
JSON.stringify({
records: [
{
id: 1213,
fields: {
Title: "Live roadmap row",
Area: "Aggregator",
Status: "In progress",
Horizon: "Q4 2026",
Source: "Issue: https://github.com/developing-today/code/issues/1213",
Notes: "Related PR: https://github.com/developing-today/code/pull/2435",
},
},
],
}),
{ status: 200, headers: { "Content-Type": "application/json" } },
);
}) as typeof fetch;

try {
const src = liveSource(cfg);
const rows = await src.roadmap();

expect(requests).toEqual([
{
url: "http://grist.test/api/docs/test-roadmap-doc/tables/Roadmap/records",
authorization: "Bearer test-grist-api-key",
},
]);
expect(rows).toEqual([
{
id: 1213,
subject: "grist:test-roadmap-doc/Roadmap/1213",
title: "Live roadmap row",
area: "Aggregator",
status: "In progress",
horizon: "Q4 2026",
source: "Issue: https://github.com/developing-today/code/issues/1213",
notes: "Related PR: https://github.com/developing-today/code/pull/2435",
links: [
{ ref: "developing-today/code#1213", relation: "tracks" },
{ ref: "developing-today/code#2435", relation: "tracks" },
],
gristUrl: "http://amd-6.raptor-pumpkinseed.ts.net:8484/doc/test-roadmap-doc",
},
]);
expect(src.provenance().roadmap).toBe("live (Grist)");
} finally {
globalThis.fetch = realFetch;
}
});

test("falls back to fixture rows and reports the Grist read failure", async () => {
const cfg = await testConfig();
const requests: { url: string; authorization: string | null }[] = [];
const realFetch = globalThis.fetch;
globalThis.fetch = (async (input: unknown, init?: RequestInit) => {
requests.push({
url: String(input),
authorization: new Headers(init?.headers).get("authorization"),
});
return new Response("Grist unavailable", { status: 503 });
}) as typeof fetch;

try {
const src = liveSource(cfg);

expect(await src.roadmap()).toEqual(FIXTURE_ROADMAP);
expect(src.provenance().roadmap).toBe("fixtures (grist unreachable: grist roadmap read failed)");
expect(requests).toEqual([
{
url: "http://grist.test/api/docs/test-roadmap-doc/tables/Roadmap/records",
authorization: "Bearer test-grist-api-key",
},
]);
} finally {
globalThis.fetch = realFetch;
}
});
});
3 changes: 2 additions & 1 deletion pm-stack/aggregator/test/slice3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ describe("slice-3 routes", () => {
expect(dnsJson.totalAnnualListUsd).toBe(595.62);
const sessions = await (await fetch(`http://127.0.0.1:${port}/sessions`)).text();
expect(sessions).toContain("identity registry");
const registry = (await (await fetch(`http://127.0.0.1:${port}/api/registry.json`)).json()) as {
// window=all: fixture last-activity is a fixed date; the default 7-day window ages it out and fails this test on later run dates.
const registry = (await (await fetch(`http://127.0.0.1:${port}/api/registry.json?window=all`)).json()) as {
records: { source: string }[];
identities: { kind: string }[];
};
Expand Down
57 changes: 57 additions & 0 deletions pm-stack/projector/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading