Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:swqri6g6e7 is past its budget: trevato/forge: "RepoSource: one repository, two places to read it from > the mirror and the origin answer the same ques… #7715
Check · Review · Land · Live done — Landed and live in production.
The test "the mirror and the origin answer the same questions the same way" in `test/view-source.test.ts` now passes or fails on what the two sources return, not on how loaded the check machine is.
shipped production is serving it deploy e31b90f
The test "the mirror and the origin answer the same questions the same way" in test/view-source.test.ts now passes or fails on what the two sources return, not on how loaded the check machine is.
Cause: the test makes eight rounds of paired reads: git on the mirror against HTTP to the origin. That takes milliseconds when the machine is idle. On a loaded check machine it can run past bun's 5 s default, which is the same slowdown #7713 found in the mirror test earlier in this file. I couldn't get the check machine's log through the API, so this cause is reproduced here, not read from the log.
Changes:
- The equivalence test gets a 60 s budget.
- It waits for the
octo/widgetsmirror to finish first. If the earlier test that starts that mirror runs out of time, the mirror is still being filled when this test reads it, and this test fails too, even though nothing is wrong with what it checks. - The mirror's outbound check (which hosts a test may fetch from) is now put back after each test file.
test/upstream_follow.test.tsused to reset it to "refuse loopback", andtest/mirror-outbound.test.tsused to overwrite it with its own allow list. Either one could refuse the loopback origins of the next file in the same test process. A new helper,mirrorOutbound()intest/helpers/globals.ts, sets the check for one file and puts back what it found afterwards. It sits besidequietLogsandfastFirstFetchand is tested intest/helpers.test.tsthe same way they are. It reads the current setting through a one-line function added tosrc/origins/git-mirror.ts, andview-sourcenow asks for loopback itself instead of relying on whatever the previous file left. Runningupstream_followbeforeview-sourcewith the old code did not fail here, so treat this part as hardening rather than the proven cause.
No assertion was changed.
Proof: with a temporary 6 s stall at the start of the test, the whole file failed without the fix ("timed out after 5000ms") and all 23 tests passed with it. Without the stall, bun x tsc --noEmit is clean and the five affected files pass (65 tests).
Overlap with #7713: it gives the four tests that run a whole mirror the same 60 s budget, and touches the same file. I wrote this budget as a plain 60_000 instead of declaring #7713's MIRROR_MS constant, so the two pulls don't both define it.
To try it, run bun test test/view-source.test.ts. To see the failure mode, add await Bun.sleep(6000) at the top of the equivalence test and run it with and without the 60_000.
🤖 Generated with Claude Code
Closes #7686
Test-only hardening plus a one-line seam in src/origins/git-mirror.ts. It serves the flake and time-budget items in the direction. The change has no user-facing surface, so there is nothing to see on the phone or desktop previews, and I did not open them. I read the diff but did not run the tests. The mirrorOutbound helper restores what it found, it has its own test in helpers.test.ts, no assertion changed, and there is no new dependency or security surface. Two things to do next: (1) once #7713 lands, replace the bare 60_000 with its shared MIRROR_MS constant so the budget lives in one place; (2) move the comment about the 60 s budget above the test body or onto the test title, because as written it sits after the last assertion, just before }, 60_000). Also confirm the stall proof still holds after rebasing on #7713, since both pulls touch view-source.test.ts.
The test "the mirror and the origin answer the same questions the same way" in
test/view-source.test.tsnow passes or fails on what the two sources return, not on how loaded the check machine is.Cause: the test makes eight rounds of paired reads: git on the mirror against HTTP to the origin. That takes milliseconds when the machine is idle. On a loaded check machine it can run past bun's 5 s default, which is the same slowdown #7713 found in the mirror test earlier in this file. I couldn't get the check machine's log through the API, so this cause is reproduced here, not read from the log.
Changes:
octo/widgetsmirror to finish first. If the earlier test that starts that mirror runs out of time, the mirror is still being filled when this test reads it, and this test fails too, even though nothing is wrong with what it checks.test/upstream_follow.test.tsused to reset it to "refuse loopback", andtest/mirror-outbound.test.tsused to overwrite it with its own allow list. Either one could refuse the loopback origins of the next file in the same test process. A new helper,mirrorOutbound()intest/helpers/globals.ts, sets the check for one file and puts back what it found afterwards. It sits besidequietLogsandfastFirstFetchand is tested intest/helpers.test.tsthe same way they are. It reads the current setting through a one-line function added tosrc/origins/git-mirror.ts, andview-sourcenow asks for loopback itself instead of relying on whatever the previous file left. Runningupstream_followbeforeview-sourcewith the old code did not fail here, so treat this part as hardening rather than the proven cause.No assertion was changed.
Proof: with a temporary 6 s stall at the start of the test, the whole file failed without the fix ("timed out after 5000ms") and all 23 tests passed with it. Without the stall,
bun x tsc --noEmitis clean and the five affected files pass (65 tests).Overlap with #7713: it gives the four tests that run a whole mirror the same 60 s budget, and touches the same file. I wrote this budget as a plain
60_000instead of declaring #7713'sMIRROR_MSconstant, so the two pulls don't both define it.To try it, run
bun test test/view-source.test.ts. To see the failure mode, addawait Bun.sleep(6000)at the top of the equivalence test and run it with and without the60_000.🤖 Generated with Claude Code
Closes #7686
Closes #7686