Repository navigation
fix: 30s budgets for the partial-lock held-file scenarios (#245) - #276
Conversation
The ubuntu flake in this file is the Bun 5s default-timeout family the maintainer root-caused on #245: a starved --parallel=4 worker spends real time past 5s inside a held-file scenario, the test dies mid-flight, afterEach deletes the fixture underneath the still-pending work, and the leftovers surface as 'Unhandled error between tests' plus false assertion failures in the tests beside it. Run 41356328156 (head b2f2929) shows the cascade exactly: a snapshotFiles ENOENT after teardown, an escaped busy error, and a superseded_by read that came back undefined in 'canonical update retains the gate's completed retirement on a later busy file'. d38e6a7 gave the three sibling files this budget; this file — the one the ticket names — was left without it. Give every test and hook here an explicit 30s budget. No assertion moves; only time is granted.
WhollyMindless
left a comment
There was a problem hiding this comment.
Reviewed head 87be831375f439140be3c10a61f132627698bb49 independently on Windows, Bun 1.4.4.
No blocking code finding in this diff. Verified that removing the added explanatory comment and the 30_000 timeout arguments reconstructs the parent test file exactly. Both hooks and all eight test registrations (nine expanded cases) receive the budget; the assertions, short lock-refusal budgets, evidence drain and error assertions remain intact.
Ran bun test ./test/lock-partial-outcomes.test.ts in a detached checkout: 9 pass / 0 fail, 70 assertions. All four hosted checks are green at this head. I did not independently rerun the full suite or reproduce the original hosted flake.
One evidence qualification for the description: the exact-file root cause remains inferred. The reported local stress runs stayed green, and the presence of default timeouts establishes exposure to timeout aborts but does not by itself reproduce the original failure. Please distinguish that inference from the verified timeout-budget hardening when describing resolution of #245. The larger budgets preserve the existing integrity assertions; they do not establish that a separate ordering race cannot remain.
This is a review of the bot-owned implementation; no competing fix or ownership claim. Maintainer judgment on merging/closing #245 remains appropriate.
There was a problem hiding this comment.
Head reviewed: 87be831375f439140be3c10a61f132627698bb49
Contract: #245 (author abogartz, trusted human) — "CI flake: 'canonical update retains the gate's completed retirement on a later busy file' fails intermittently on ubuntu". Spec anchor c502133b6bd90eb2 recomputed equal → spec frozen. The ticket body's "Fix direction" predates the maintainer's root-cause comment 6563591503 (2026-11-01T20:40:25Z), which identifies the family as "Bun's 5s default test timeout vs genuinely slow work under --parallel=4" and prescribes the shipped remedy: "every test and hook ... an explicit 30s budget, no assertion changes". Judged against that.
Per-criterion evidence:
- Fixes the root-caused family for this file —
test/lock-partial-outcomes.test.tswas the one held-file file d38e6a7 (#245, same issue) did not cover:git show d38e6a7 --name-only | grep -c lock-partial→ 0. This PR applies the identical pattern (}, 30_000);) to 2 hooks + 8 test registrations (10 total, matches PR body). - No assertion moves; only time is granted — full diff read: +20/−9, one file. All 9 deletions are
});→}, 30_000);(plus one30_000,param line fortest.each); remaining 10 additions are the explanatory comment. Zero assertion, skip, tolerance or timeout-hiding changes. This is the maintainer-prescribed budget pattern, not a timeout raised to mask an unknown failure. - Green at this head — local:
bun run typecheckexit 0;bun run lintformat clean (no fixes applied, infos only);bun run test937 pass / 19 skip / 0 fail; target file stressed 5× → 9 tests green every run (~0.9 s/file, margin well under the old 5 s default). The starvation flake itself is runner-specific and not reproducible on macOS, as with d38e6a7; the maintainer's measured margins on the same family are the diagnostic authority.
Final gate re-check (verbatim): headRefOid = 87be831375f439140be3c10a61f132627698bb49; checks: lint pass, test pass, test-windows pass, smoke pass.
Findings: none. No P0, no P1, no nit.
Human merges.
|
🎉 This PR is included in version 0.15.20 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #245
What changed
test/lock-partial-outcomes.test.ts: every test and hook now carries an explicit 30s budget (2 hooks + 8 test registrations). No assertion moved; only time is granted. Mirrors the shipped pattern of d38e6a7 (#245 budgets for the sibling files).Root cause
The flake is the Bun default-5s-timeout family the maintainer root-caused on this ticket (comment 2026-11-01T20:40:25Z, quoted below). A starved
--parallel=4ubuntu worker spends real time past Bun's default 5s inside a held-file scenario; the test dies mid-flight,afterEachdeletes the fixture underneath the still-pending work, and the leftovers surface asUnhandled error between testsplus false assertion failures in the tests beside it.The CI log of run 41356328156 (head b2f2929, the last occurrence) shows the cascade in this exact file:
ENOENT ... /tmp/osi-partial-lock-wC5try/memory/snapshots/...fromclaimSnapshot←snapshotFiles← the restore test's setup — i.e. the awaited snapshot ran after the fixture was already deleted, which only happens when the test was aborted mid-flight;memory store is busy: 2026-01-02.logfmt has been locked for 40ms — retryin the merge_review test;expect(...superseded_by).toBeDefined()receivedundefinedincanonical update retains the gate's completed retirement on a later busy file.b2f2929 predates both a175eda (the evidence-drain harness) and d38e6a7 (the sibling budgets). Current main still leaves THIS file with no explicit budget, so the exposure remains: Bun applies the default 5s to every test and hook in it.
Requirements taken from comments (owner, abogartz)
beforeEach/afterEachhooks even when the test itself carries a longer override... pass an explicit timeout to the hooks... so a starved worker degrades to slow CI instead of red CI." — comment 2026-11-01T20:00:09Z. Implemented for both hooks and all tests here.lock-partial-outcomes.test.ts, the file the ticket body names.The body's other two fix-direction clauses are already on main: the evidence
recordlifetime is owned by the a175eda harness in this file (spy + drain inafterEach+expect(evidenceErrors).toEqual([])), and the retirement the failing assertion reads is written by awaited code (src/gate/gate.ts:597-609→src/tools/update.ts:191-231), so no un-awaited write feeds it once the abort cascade cannot start.Reproduction
4cc8bf61005ff2585efe073cc0bf579f475ae213: the file carries zero explicit timeouts (verified by inspection of everytest(/beforeEach(/afterEach(call), so Bun's 5s default applies — the owner-proven kill mechanism of run 41356328156 is live on that sha.--parallel=4runs + 6 runs starved byhw.ncpuconcurrent full-suite loads — all green locally. The starvation that fires the timeout is ubuntu-shared-runner-specific; it did not fire on this macOS host.Proof (measured on branch head 87be831)
bun run typecheck— exit 0bun run lint— exit 0bun run test— 937 pass, 19 skip, 0 fail (956 tests across 90 files)bun test ./test/lock-partial-outcomes.test.ts— 9 pass, 0 fail, 70 expect() callsbun run test:e2enot run: nosrc/file changed.No regression test added: the change grants time budgets in a test file and moves no behaviour; there is no assertion that can fail without a timeout literal (d38e6a7 shipped the same pattern with no test).
Deliberately not changed
src/untouched — the fire-and-forgetvoid record("store_lock", ...)telemetry sites stay as shipped; their rejection route inside this test file is already captured by the a175eda harness.--parallel=4→ 2 question from the owner's comment is a decision for the maintainer, not implemented here.