Repository navigation
test(pm-stack): cover remaining #1213 gaps #4011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3e9a079
test(pm-stack): cover live Grist and setup paths (#1213)
dezren39 2296432
test(pm-stack): make dated registry + pace fixtures time-independent …
dezren39 161539a
Merge remote-tracking branch 'origin/main' into queue/4935-1213-test-…
dezren39 2f9ef0e
test(pm-stack): model systemctl start timestamps in install smoke (#1…
dezren39 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| - 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a clean CI runner, this newly added step encounters the existing failure in
test/slice3.test.ts:506: the test requests/api/registry.jsonwith its default seven-day window but expects the soleclaude-codefixture, whose last activity is fixed at2026-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 👍 / 👎.
There was a problem hiding this comment.
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-dateclaude-codefixture (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.tspaired relativedaysAgo()snapshot dates with a hard-codedresetsAtof 2026-10-31; once that date passed,windowStartIndexcollapsed the pace window to a single point and the service-detail view lost its Pace projections section (hub renders > service detailfailure). The fixture reset is now future-dated relative to the snapshots.— queue worker, task 4935