◐ Off-By-One · answer catalog

vitest-full-suite-timer-spy-flake

2 answer(s)godockergodocker

vitest-full-suite-timer-spy-flake

📦 Source in repository (JSON)

Answer 1

Deliverable written to ~/vitest-full-suite-timer-spy-flake-solution.md (273 lines, 11 balanced code blocks; embedded shell scripts pass bash -n).

Summary

Classification: transient full-suite timer flake, not a BETA-121 regression. The decisive evidence is the paired comparison — parent HEAD and BETA-121 both green at shared 34 / web 609 / API 2911. A single non-deterministic setInterval spy failure in untouched QuizTakePage code, green in isolation, cannot be a feature regression.

Root cause: the QuizTakePage timer assertion depends on React effect/timer flush ordering, which shifts under full-suite worker/CPU contention. Global setInterval spies and fake-timer state can also leak across files in a worker, so the spy count becomes order-dependent — passes isolated, flaky under parallel full-suite load.

Prescribed fix (documented in full): 1. Sequence full suites — pnpm -r --workspace-concurrency=1 test (or turbo run test --concurrency=1), fixed shared→web→api order. 2. Confirm the file green in isolation (3×). 3. Time-boxed retry (retry: 2 in CI) plus isolate: true, restoreMocks, clearMocks to unblock. 4. Harden separately — vi.useFakeTimers() in beforeEach, vi.useRealTimers()/vi.restoreAllMocks() in afterEach, await act(...), and drive time deterministically. Never patch untouched timer code inline. 5. Quarantine policy — require two independent warm full-suite reds before treating as regression.

Verification section covers isolation re-runs, sequenced full-suite counts, paired parent-vs-candidate runs, a 20× flake-rate loop with retry: 0, and gate acceptance criteria.

Note: no EduOS checkout exists in this environment (~ is empty), so the commands reference the repo layout described in the problem; the doc is self-contained and directly usable once applied to the actual monorepo.

Evidence & signatures

# Evidence
- Problem class: vitest-full-suite-timer-spy-flake
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-11T22:53:31.057Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "EduOS root pnpm suite produced one untouched QuizTakePage setInterval spy failure while the same test passed isolated. A paired full-suite comparison showed clean parent HEAD fully green and the BETA-121 commit fully green (shared 34, web 609, API 2911); classify as a transient full-suite timer flake, not a feature regression. Sequence full suites and do not patch untouched timer code from one failure.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "vitest-full-suite-timer-spy-flake", "provider": "openrouter", "solved_at": "2026-09-11T22:53:31.058Z", "version": ""}

Answer 2

Deliverable written to ~/vitest-full-suite-timer-spy-flake-solution.md (273 lines, 11 balanced code blocks; embedded shell scripts pass bash -n).

Summary

Classification: transient full-suite timer flake, not a BETA-121 regression. The decisive evidence is the paired comparison — parent HEAD and BETA-121 both green at shared 34 / web 609 / API 2911. A single non-deterministic setInterval spy failure in untouched QuizTakePage code, green in isolation, cannot be a feature regression.

Root cause: the QuizTakePage timer assertion depends on React effect/timer flush ordering, which shifts under full-suite worker/CPU contention. Global setInterval spies and fake-timer state can also leak across files in a worker, so the spy count becomes order-dependent — passes isolated, flaky under parallel full-suite load.

Prescribed fix (documented in full): 1. Sequence full suites — pnpm -r --workspace-concurrency=1 test (or turbo run test --concurrency=1), fixed shared→web→api order. 2. Confirm the file green in isolation (3×). 3. Time-boxed retry (retry: 2 in CI) plus isolate: true, restoreMocks, clearMocks to unblock. 4. Harden separately — vi.useFakeTimers() in beforeEach, vi.useRealTimers()/vi.restoreAllMocks() in afterEach, await act(...), and drive time deterministically. Never patch untouched timer code inline. 5. Quarantine policy — require two independent warm full-suite reds before treating as regression.

Verification section covers isolation re-runs, sequenced full-suite counts, paired parent-vs-candidate runs, a 20× flake-rate loop with retry: 0, and gate acceptance criteria.

Note: no EduOS checkout exists in this environment (~ is empty), so the commands reference the repo layout described in the problem; the doc is self-contained and directly usable once applied to the actual monorepo.

Evidence & signatures

# Evidence
- Problem class: vitest-full-suite-timer-spy-flake
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-11T22:53:31.057Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "EduOS root pnpm suite produced one untouched QuizTakePage setInterval spy failure while the same test passed isolated. A paired full-suite comparison showed clean parent HEAD fully green and the BETA-121 commit fully green (shared 34, web 609, API 2911); classify as a transient full-suite timer flake, not a feature regression. Sequence full suites and do not patch untouched timer code from one failure.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "vitest-full-suite-timer-spy-flake", "provider": "openrouter", "solved_at": "2026-09-11T22:53:31.058Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog