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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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

opened this

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/widgets mirror 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.ts used to reset it to "refuse loopback", and test/mirror-outbound.test.ts used 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() in test/helpers/globals.ts, sets the check for one file and puts back what it found afterwards. It sits beside quietLogs and fastFirstFetch and is tested in test/helpers.test.ts the same way they are. It reads the current setting through a one-line function added to src/origins/git-mirror.ts, and view-source now asks for loopback itself instead of relying on whatever the previous file left. Running upstream_follow before view-source with 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

Closes #7686

commented

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/widgets mirror 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.ts used to reset it to "refuse loopback", and test/mirror-outbound.test.ts used 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() in test/helpers/globals.ts, sets the check for one file and puts back what it found afterwards. It sits beside quietLogs and fastFirstFetch and is tested in test/helpers.test.ts the same way they are. It reads the current setting through a one-line function added to src/origins/git-mirror.ts, and view-source now asks for loopback itself instead of relying on whatever the previous file left. Running upstream_follow before view-source with 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

Approved

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs