Public: anyone can read this; the crew can change it.
Four test files are red only when the whole suite runs: one file lowers a global and the next inherits it #310
Check · Review · Land · Live done — Landed and live in production.
Closes #302
shipped production is serving it deploy a5415ba
Fixes tests that went red only when another file ran before them in the same run: files changed a process global and never put it back. Each leak below was reproduced as a pair in one process, before and after the fix, using the machine's own FORGE_URL.
Which file was leaking what
- Log floor →
test/web.test.ts: 25 files calledsetLogLevel("error")when loaded and never restored it. Withgit-ssh.test.tsbefore it, the test "a mismatched origin is refused and logged with both origins" found nowarnline. firstFetchRetry.ms = [50]→test/fork-flow.test.ts:view-source.test.tsandorigins-security-auth.test.tsleft it lowered. "a mirror whose git is not ready yet is fetched again" then retried before its seed arrived.- The machine's
FORGE_URL→origins-security-authandorigins-oauth: on a crew machine every code exchange failedredirect_uri mismatch.origins-security-authonly cleared the variable inafterAll.origins-oauthonly passed in the full run becauseweb-origins.test.tsdeletedFORGE_URLfor every file after it. Both now clear it for their own run, andweb-originsputs it back. test/tui-workflows.test.ts: the lowered retry made the race more likely, but the file also flaked alone (2 of 8 runs). It waited for the "Mirroring" card, which is taken down as soon as the job finishes and can come and go between two looks.mainhas since switched to waiting for the outcome; the merge keeps that. On top of it, the harness records every screen pushed, so the test still asserts the card was shown without racing it.
What changed
- Source (no behaviour change):
- logLevel() in src/kernel/log.ts reads the current floor.
- FIRST_FETCH_RETRY_MS in src/origins/mirror.ts names the default waits.
- New
test/helpers/globals.ts:quietLogs(),fastFirstFetch()andwithoutEnv(...). Each sets the global inbeforeAlland puts back what it found inafterAll, for the scope it is called from. Every test that borrowed one now uses them. - Restore test:
test/helpers.test.tschecks that after each helper's scope, the log floor, retry waits and environment read back what they were. It is in the gate, so the next file that forgets to restore is caught there.
Test changes
The only assertions that changed are in tui-workflows, and that test was wrong: it sampled a card that disappears when its job finishes. No other assertion changed and nothing is skipped.
Still red in the full run
Everything left red outside the gate belongs to #290–#294. The web-origins pin toggle and web-code failures are also red on their own, so they are not leaks either (they look like #291's dashboard assertions). bun run check passes: 445 tests across 23 files. On the first gate run after merging main, one test in studio.test.ts failed ("the studio home does not wait on the decider", a timing test). It passed 3 of 3 alone and on the gate re-run, and this branch doesn't touch that file.
Try it: bun test test/git-ssh.test.ts test/web.test.ts, bun test test/view-source.test.ts test/fork-flow.test.ts, and bun test test/origins-security-auth.test.ts with FORGE_URL set.
🤖 Generated with Claude Code
Closes #302