ci seam flake: rendererBuild.test.ts runs three full Vite production builds under a 120s-per-test timeout — one timeout collapses the whole vitest fork pool (~22 unrelated files red) #1182

Closed
opened 2026-09-03 06:35:07 +00:00 by matou-build-agent · 2 comments

Filed by the swarm healer for ci run 16970 (signature 2b6783a3ce4d, commit 3daafbdc), which red the TypeScript: build (tsc), test (vitest), lint (eslint) seam stage.

Symptom

run-verdict.txt:

stage=TypeScript: build (tsc), test (vitest), lint (eslint)
exit=1
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @idss/app@0.1.0 test: `vitest run`
app test: Error: Test timed out in 120000ms.
app test: Error: [vitest-worker]: Timeout calling "snapshotSaved"
app test:  Test Files  23 failed | 89 passed (112)
app test:       Tests  3 failed | 1055 passed (1058)

What is actually happening

app/tests/unit/rendererBuild.test.ts has three its. Each one calls buildRenderer(), which runs the real production Vite renderer build (build({ root, configFile, write: false })) from scratch — no build is shared between them. Each carries an explicit }, 120_000) timeout.

On the runner (matou-workstation, 8 cores) with the box otherwise busy, the healer measured this one file at 92.9 s wall (36.9 s / 29.2 s / 26.7 s) — already three quarters of the per-test budget with no headroom. When the box is more loaded than that, one build crosses 120 s, its fork is killed mid-flight, and vitest's worker RPC then dies with Timeout calling "snapshotSaved" — which tears down the fork pool, not just that file.

That is where the 23 failed files come from. The arithmetic pins it: CI counted 1058 tests across 112 files; a healthy full run of the same tree counts 1359. ~300 tests in ~20 files never ran at all — they were aborted by the pool teardown, not failed on their merits. The 3 "failed tests" are exactly the 3 its in rendererBuild.test.ts.

Not a code defect

The healer ran the full suite on main's tip (3daafbdc) in the dev shell: 111/112 files, 1353 passed, 6 skipped. The single red (tests/unit/boot.test.ts, go build failed) passes 6/6 in isolation — itself a contention artifact. Main's tree is green; the seam is timing-fragile, not broken.

Suggested fix

Build the renderer once and share the chunks across all three assertions (a module-scope memoised promise, or beforeAll in a single describe). That cuts the file from three builds to one — roughly 93 s to ~30 s on the same box — and moves it clear of the 120 s cliff. The two describe blocks (#233 and #255) assert over the same build output, so nothing is lost by sharing it.

Worth considering alongside it: this file is the only one in the suite that does real work at build scale, so a poolOptions cap or sequential/isolate treatment for it would stop a future slow build from taking 22 unrelated files down with it. That part is a judgement call for whoever picks this up.

Contributing host condition (separate, not fixable from here)

The healer also found four stale processes on matou-workstation, 4–9 days old, burning ~3.4 of 8 cores continuously (node install.js x3, make test), all descended from an unrelated repo's cd frontend && CI=true npm ci ... cd backend && go build ./... && make test job. Swap sat at 4024/4095 MB. That is the load that pushed this file over its budget. It needs a human on the host; it is out of the healer's charter to kill them.

Filed by the swarm healer for ci run 16970 (signature `2b6783a3ce4d`, commit `3daafbdc`), which red the `TypeScript: build (tsc), test (vitest), lint (eslint)` seam stage. ## Symptom `run-verdict.txt`: ``` stage=TypeScript: build (tsc), test (vitest), lint (eslint) exit=1 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @idss/app@0.1.0 test: `vitest run` app test: Error: Test timed out in 120000ms. app test: Error: [vitest-worker]: Timeout calling "snapshotSaved" app test: Test Files 23 failed | 89 passed (112) app test: Tests 3 failed | 1055 passed (1058) ``` ## What is actually happening `app/tests/unit/rendererBuild.test.ts` has three `it`s. Each one calls `buildRenderer()`, which runs the **real** production Vite renderer build (`build({ root, configFile, write: false })`) from scratch — no build is shared between them. Each carries an explicit `}, 120_000)` timeout. On the runner (matou-workstation, 8 cores) with the box otherwise busy, the healer measured this one file at **92.9 s** wall (36.9 s / 29.2 s / 26.7 s) — already three quarters of the per-test budget with no headroom. When the box is more loaded than that, one build crosses 120 s, its fork is killed mid-flight, and vitest's worker RPC then dies with `Timeout calling "snapshotSaved"` — which tears down the **fork pool**, not just that file. That is where the 23 failed files come from. The arithmetic pins it: CI counted **1058** tests across 112 files; a healthy full run of the same tree counts **1359**. ~300 tests in ~20 files never ran at all — they were aborted by the pool teardown, not failed on their merits. The 3 "failed tests" are exactly the 3 `it`s in `rendererBuild.test.ts`. ## Not a code defect The healer ran the full suite on main's tip (`3daafbdc`) in the dev shell: **111/112 files, 1353 passed, 6 skipped**. The single red (`tests/unit/boot.test.ts`, `go build` failed) passes 6/6 in isolation — itself a contention artifact. Main's tree is green; the seam is timing-fragile, not broken. ## Suggested fix Build the renderer **once** and share the chunks across all three assertions (a module-scope memoised promise, or `beforeAll` in a single `describe`). That cuts the file from three builds to one — roughly 93 s to ~30 s on the same box — and moves it clear of the 120 s cliff. The two `describe` blocks (#233 and #255) assert over the same build output, so nothing is lost by sharing it. Worth considering alongside it: this file is the only one in the suite that does real work at build scale, so a `poolOptions` cap or `sequential`/`isolate` treatment for it would stop a future slow build from taking 22 unrelated files down with it. That part is a judgement call for whoever picks this up. ## Contributing host condition (separate, not fixable from here) The healer also found four stale processes on matou-workstation, **4–9 days old**, burning ~3.4 of 8 cores continuously (`node install.js` x3, `make test`), all descended from an unrelated repo's `cd frontend && CI=true npm ci ... cd backend && go build ./... && make test` job. Swap sat at 4024/4095 MB. That is the load that pushed this file over its budget. It needs a human on the host; it is out of the healer's charter to kill them.
Author
Member

swarm-claim host=matou-dev-server-01 run=16990
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=16990 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #1182 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1182,
  "status": "success",
  "commits": [
    "2ffcc2d9"
  ],
  "changed_files": [
    "app/tests/unit/rendererBuild.test.ts",
    "docs/GOTCHAS.md"
  ],
  "tests": [
    {
      "command": "CI=true pnpm exec vitest run tests/unit/rendererBuild.test.ts",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm exec eslint tests/unit/rendererBuild.test.ts",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Renderer built once and shared across all three assertions": "app/tests/unit/rendererBuild.test.ts: buildRendererOnce() module-scope memoised promise; all three `it`s call it (lines 62/67/85/112)",
    "File moves clear of the 120s per-test cliff": "measured vitest run: 3 tests green in 11.46s (one 9.95s build + two near-instant), down from ~93s; commit 2ffcc2d9",
    "Nothing lost by sharing the build": "both describe blocks (#233, #255) assert over the same build output; 3/3 tests still pass",
    "Hazard recorded": "docs/GOTCHAS.md #156 (⭐⭐) — one vitest test crossing its per-test timeout tears down the whole fork pool (ADR 0160)"
  },
  "summary": "rendererBuild.test.ts now builds the renderer once via a memoised promise, cutting the file from ~93s to ~11s wall and off the 120s per-test cliff that was tearing down the vitest fork pool.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1182 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1182, "status": "success", "commits": [ "2ffcc2d9" ], "changed_files": [ "app/tests/unit/rendererBuild.test.ts", "docs/GOTCHAS.md" ], "tests": [ { "command": "CI=true pnpm exec vitest run tests/unit/rendererBuild.test.ts", "exit_code": 0 }, { "command": "CI=true pnpm exec eslint tests/unit/rendererBuild.test.ts", "exit_code": 0 } ], "criteria": { "Renderer built once and shared across all three assertions": "app/tests/unit/rendererBuild.test.ts: buildRendererOnce() module-scope memoised promise; all three `it`s call it (lines 62/67/85/112)", "File moves clear of the 120s per-test cliff": "measured vitest run: 3 tests green in 11.46s (one 9.95s build + two near-instant), down from ~93s; commit 2ffcc2d9", "Nothing lost by sharing the build": "both describe blocks (#233, #255) assert over the same build output; 3/3 tests still pass", "Hazard recorded": "docs/GOTCHAS.md #156 (⭐⭐) — one vitest test crossing its per-test timeout tears down the whole fork pool (ADR 0160)" }, "summary": "rendererBuild.test.ts now builds the renderer once via a memoised promise, cutting the file from ~93s to ~11s wall and off the 120s per-test cliff that was tearing down the vitest fork pool.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1182
No description provided.