flake: the two fixed clocks #1276 left standing — bare vi.waitFor (1 s) in the live seams, and the 5 s default in the 98 non-liveServer dashboard tests (ci run 19709) #1307

Closed
opened 2026-09-07 22:48:11 +00:00 by matou-build-agent · 2 comments

Symptom

ci run 19709 (push, 8910b1bf) reddened the TypeScript: build (tsc), test (vitest), lint (eslint) stage:

ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @idss/dashboard@0.0.0 test: `vitest run`

FAIL tests/unit/mountProvisioningUpdates.test.ts > P4 homes on the Fleet drill-in,
     reached over the live provision client (DDR 0101 §1) > a "set up" row opens
     P4-S1 Assess in place — no fake in the wiring
AssertionError: expected false to be true    ❯ tests/unit/mountProvisioningUpdates.test.ts:180:87

FAIL tests/unit/provisionSetup.test.ts > P4-S2 — the role re-filters availability (story 6)
     > re-reads the selection from the seam when the operator picks a role
Error: Test timed out in 5000ms.

Test Files  2 failed | 120 passed (122)
     Tests  2 failed | 1417 passed (1419)

Not a regression. Both files pass green on the same commit, on the same host, while the rehearsal drive was still running: 21/21 in 6.0 s — provisionSetup 16 tests in 397 ms, mountProvisioningUpdates 5 tests in 604 ms. A test whose steady-state cost is 0.4 s does not fail an assertion at 5 s; the budget expired.

Root cause — the two fixed clocks #1276 left standing

8654c88f (#1276) closed the 5 s-default class for the live seams by putting vi.setConfig({ testTimeout: 30_000, hookTimeout: 30_000 }) at the top of dashboard/tests/support/liveServer.ts, so the budget rides in from the shared import. Two clocks survive it, and this run hit one of each:

  1. vi.waitFor's own 1 s default — independent of testTimeout, so the 30 s outer budget does not cover it (this is exactly #1249's clock, back in a different file). mountProvisioningUpdates.test.ts does import liveServer, and has 9 bare vi.waitFor(...) calls, none passing { timeout }. Line 180 is one of them:

    await vi.waitFor(() => expect(wrapper.find('[data-field="fleet-list"]').exists()).toBe(true));
    

    On expiry waitFor rethrows the last assertion — hence expected false to be true rather than a timeout message. The live aggregating read simply had not landed inside 1 s.

  2. The 5 s testTimeout in every file that does NOT import liveServer — 98 of the 122 dashboard unit files. provisionSetup.test.ts is one: pure happy-dom over FakeAssessSource, no socket at all, and it still blew 5 s. Vue SFC compile + collect is the cost (collect alone measured 6.23 s locally), so a fake-only file is just as load-sensitive as a live one. #1276's fix is scoped to the liveServer import by design, so it can never reach these.

Why the host was slow (context, not the fix)

This host runs DRIVE_EXCLUSIVE=slot (scripts/rehearsal-cycle.sh), which deliberately lets a rehearsal drive hold one pooled slot while another heavy consumer holds the other. At the failure window that was: the ci seam's ~15 forked vitest workers (pnpm -r run test) on /tmp/matou-swarm.lock (acquired 22:31:22) co-running with rehearsal drive 20260907T221610Z on /tmp/matou-host-slot-2.lock — a qemu guest at ~98% CPU (3.7 GB RSS) plus Xvfb and three Playwright chrome-headless processes. Host at capture: load 9.70 / 18.69 / 11.15 on 8 CPUs, swap 4095 MB of 4095 MB used (0 free). This is the shape .forgejo/workflows/ci.yml already warns about (#1230 / matou-app#268). It is permitted by host policy, so the durable fix is the budgets, not the policy.

Suggested fix (closes the class, both halves)

  • Give the live seams a load-tolerant waitFor clock from the same single source #1276 used — e.g. export a waitForLive(fn) from tests/support/liveServer.ts that applies a 30 s { timeout }, and convert the bare vi.waitFor call sites in the 24 *Live/*Entry/mount seams. Setting testTimeout alone provably does not cover waitFor (this run is the proof).
  • Raise the suite-wide default in dashboard/vitest.config.ts (test.testTimeout / test.hookTimeout) so the 98 non-liveServer files stop riding vitest's 5 s. liveServer.ts's vi.setConfig still wins where it is imported; one source of truth per scope.
  • GOTCHAS #106 corollary: raising testTimeout/hookTimeout does not bound vi.waitFor, vi.waitUntil or expect.poll — each carries its own 1 s default and must be raised at its own call site.

Prior art

#1249 (vi.waitFor 1 s, pendingLive) → closed. #1276 (5 s testTimeout, pendingLive) → closed by 8654c88f. This is the third recurrence of the same class in the same suite; the previous two fixes were each scoped narrower than the class.


Filed by the swarm healer for ci run 19709 (signature 41caf9190ae5). Evidence: /tmp/matou-heal-Matou-idss.dJcz0h.

## Symptom `ci` run [19709](https://git.matou.nz/Matou/idss/actions/runs/19709) (push, `8910b1bf`) reddened the **TypeScript: build (tsc), test (vitest), lint (eslint)** stage: ``` ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @idss/dashboard@0.0.0 test: `vitest run` FAIL tests/unit/mountProvisioningUpdates.test.ts > P4 homes on the Fleet drill-in, reached over the live provision client (DDR 0101 §1) > a "set up" row opens P4-S1 Assess in place — no fake in the wiring AssertionError: expected false to be true ❯ tests/unit/mountProvisioningUpdates.test.ts:180:87 FAIL tests/unit/provisionSetup.test.ts > P4-S2 — the role re-filters availability (story 6) > re-reads the selection from the seam when the operator picks a role Error: Test timed out in 5000ms. Test Files 2 failed | 120 passed (122) Tests 2 failed | 1417 passed (1419) ``` **Not a regression.** Both files pass green on the same commit, on the same host, *while the rehearsal drive was still running*: 21/21 in 6.0 s — `provisionSetup` 16 tests in **397 ms**, `mountProvisioningUpdates` 5 tests in **604 ms**. A test whose steady-state cost is 0.4 s does not fail an assertion at 5 s; the budget expired. ## Root cause — the two fixed clocks #1276 left standing 8654c88f (#1276) closed the 5 s-default class *for the live seams* by putting `vi.setConfig({ testTimeout: 30_000, hookTimeout: 30_000 })` at the top of `dashboard/tests/support/liveServer.ts`, so the budget rides in from the shared import. Two clocks survive it, and this run hit **one of each**: 1. **`vi.waitFor`'s own 1 s default** — independent of `testTimeout`, so the 30 s outer budget does not cover it (this is exactly #1249's clock, back in a different file). `mountProvisioningUpdates.test.ts` *does* import `liveServer`, and has **9 bare `vi.waitFor(...)` calls, none passing `{ timeout }`**. Line 180 is one of them: ```ts await vi.waitFor(() => expect(wrapper.find('[data-field="fleet-list"]').exists()).toBe(true)); ``` On expiry `waitFor` rethrows the last assertion — hence `expected false to be true` rather than a timeout message. The live aggregating read simply had not landed inside 1 s. 2. **The 5 s `testTimeout` in every file that does NOT import `liveServer`** — **98 of the 122** dashboard unit files. `provisionSetup.test.ts` is one: pure happy-dom over `FakeAssessSource`, no socket at all, and it still blew 5 s. Vue SFC compile + collect is the cost (collect alone measured 6.23 s locally), so a fake-only file is just as load-sensitive as a live one. #1276's fix is scoped to the liveServer import by design, so it can never reach these. ## Why the host was slow (context, not the fix) This host runs `DRIVE_EXCLUSIVE=slot` (`scripts/rehearsal-cycle.sh`), which deliberately lets a rehearsal drive hold **one** pooled slot while another heavy consumer holds the other. At the failure window that was: the ci seam's ~15 forked vitest workers (`pnpm -r run test`) on `/tmp/matou-swarm.lock` (acquired 22:31:22) co-running with rehearsal drive `20260907T221610Z` on `/tmp/matou-host-slot-2.lock` — a qemu guest at ~98% CPU (3.7 GB RSS) plus Xvfb and three Playwright chrome-headless processes. Host at capture: **load 9.70 / 18.69 / 11.15 on 8 CPUs, swap 4095 MB of 4095 MB used (0 free)**. This is the shape `.forgejo/workflows/ci.yml` already warns about (#1230 / matou-app#268). It is permitted by host policy, so the durable fix is the budgets, not the policy. ## Suggested fix (closes the class, both halves) - Give the live seams a load-tolerant `waitFor` clock from the same single source `#1276` used — e.g. export a `waitForLive(fn)` from `tests/support/liveServer.ts` that applies a 30 s `{ timeout }`, and convert the bare `vi.waitFor` call sites in the 24 `*Live`/`*Entry`/mount seams. Setting `testTimeout` alone provably does not cover `waitFor` (this run is the proof). - Raise the **suite-wide** default in `dashboard/vitest.config.ts` (`test.testTimeout` / `test.hookTimeout`) so the 98 non-liveServer files stop riding vitest's 5 s. `liveServer.ts`'s `vi.setConfig` still wins where it is imported; one source of truth per scope. - GOTCHAS #106 corollary: raising `testTimeout`/`hookTimeout` does **not** bound `vi.waitFor`, `vi.waitUntil` or `expect.poll` — each carries its own 1 s default and must be raised at its own call site. ## Prior art #1249 (`vi.waitFor` 1 s, `pendingLive`) → closed. #1276 (5 s `testTimeout`, `pendingLive`) → closed by 8654c88f. This is the third recurrence of the same class in the same suite; the previous two fixes were each scoped narrower than the class. --- Filed by the swarm healer for ci run 19709 (signature `41caf9190ae5`). Evidence: `/tmp/matou-heal-Matou-idss.dJcz0h`.
Author
Member

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

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

close-report for #1307 — status success

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

envelope
{
  "issue": 1307,
  "status": "success",
  "commits": [
    "012cd886"
  ],
  "changed_files": [
    "dashboard/tests/unit/mountProvisioningUpdates.test.ts",
    "dashboard/vitest.config.ts",
    "docs/GOTCHAS.md"
  ],
  "tests": [
    {
      "command": "CI=true pnpm exec vitest run (dashboard, full suite)",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm exec vue-tsc -p tsconfig.json (dashboard)",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm exec eslint tests/unit/mountProvisioningUpdates.test.ts vitest.config.ts",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Give the live seams a load-tolerant vi.waitFor clock from the single source #1276 used": "mountProvisioningUpdates.test.ts: all 9 bare vi.waitFor calls now pass { timeout: LIVE_WAITFOR_TIMEOUT_MS } imported from tests/support/liveServer.ts (commit 012cd886) — the established enrollLive/pendingActsLive pattern; the only dashboard test file that still had bare vi.waitFor",
    "Raise the suite-wide default so the 98 non-liveServer files stop riding vitest's 5 s": "dashboard/vitest.config.ts: added test.testTimeout / test.hookTimeout = 20_000; liveServer.ts's 30 s vi.setConfig still wins where imported (one source per scope)",
    "GOTCHAS #106 corollary: raising testTimeout/hookTimeout does not bound vi.waitFor/vi.waitUntil/expect.poll": "docs/GOTCHAS.md: #106 corollary (#1307) added, recording the two clocks and the independent 1 s waitFor default"
  },
  "summary": "Closed the flake class's third recurrence — 9 bare vi.waitFor calls get LIVE_WAITFOR_TIMEOUT_MS and the suite-wide testTimeout/hookTimeout rises to 20 s for the non-liveServer files.",
  "blockers": []
}
**close-report** for #1307 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1307, "status": "success", "commits": [ "012cd886" ], "changed_files": [ "dashboard/tests/unit/mountProvisioningUpdates.test.ts", "dashboard/vitest.config.ts", "docs/GOTCHAS.md" ], "tests": [ { "command": "CI=true pnpm exec vitest run (dashboard, full suite)", "exit_code": 0 }, { "command": "CI=true pnpm exec vue-tsc -p tsconfig.json (dashboard)", "exit_code": 0 }, { "command": "CI=true pnpm exec eslint tests/unit/mountProvisioningUpdates.test.ts vitest.config.ts", "exit_code": 0 } ], "criteria": { "Give the live seams a load-tolerant vi.waitFor clock from the single source #1276 used": "mountProvisioningUpdates.test.ts: all 9 bare vi.waitFor calls now pass { timeout: LIVE_WAITFOR_TIMEOUT_MS } imported from tests/support/liveServer.ts (commit 012cd886) — the established enrollLive/pendingActsLive pattern; the only dashboard test file that still had bare vi.waitFor", "Raise the suite-wide default so the 98 non-liveServer files stop riding vitest's 5 s": "dashboard/vitest.config.ts: added test.testTimeout / test.hookTimeout = 20_000; liveServer.ts's 30 s vi.setConfig still wins where imported (one source per scope)", "GOTCHAS #106 corollary: raising testTimeout/hookTimeout does not bound vi.waitFor/vi.waitUntil/expect.poll": "docs/GOTCHAS.md: #106 corollary (#1307) added, recording the two clocks and the independent 1 s waitFor default" }, "summary": "Closed the flake class's third recurrence — 9 bare vi.waitFor calls get LIVE_WAITFOR_TIMEOUT_MS and the suite-wide testTimeout/hookTimeout rises to 20 s for the non-liveServer files.", "blockers": [] } ``` </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#1307
No description provided.