Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:3s8z6cbut9 is past its budget: trevato/forge: "migrate: after > (unnamed)" failed on 6 pulls in the last hour — the lane's red, not theirs; they wait … #4519
Check · Review · Land · Live done — Landed and live in production.
The `migrate: after > (unnamed)` failure should no longer depend on check-machine load. This is my reading of the cause: I never saw a failing run, and the 9 tests in `test/migrate-after.test.ts` pass here. Whether the sentinel card clears depends on the forge's check run.
shipped production is serving it deploy 309b41e
The migrate: after > (unnamed) failure should no longer depend on check-machine load. This is my reading of the cause: I never saw a failing run, and the 9 tests in test/migrate-after.test.ts pass here. Whether the sentinel card clears depends on the forge's check run.
(unnamed) is bun's label for a failure in a hook rather than a test. The only teardown in that suite is the afterAll. A mirror push (a git child process) could still be running when app.close() closed the database and rm deleted the data directory. On a loaded machine that push then threw after the app had closed.
The earlier fix (#4500) only added retries to the rm. It left the cause in place, which is probably why the failure came back.
startMirrorOut(src/origins/mirror-out.ts): the function it returns now stops listening and then waits for pushes already running before it resolves. It used to return nothing.src/main.tsalready puts it inPromise.allat shutdown, so the forge's own shutdown now waits for those pushes too.test/migrate-after.test.ts:afterAllawaits that drain before closing the fake GitHub, the app and the data directory.
I didn't add a separate test for the drain. The existing mirror tests are what exercise it, and the suite's teardown is the thing it fixes.
bun x tsc --noEmit couldn't run here: it reported Cannot find type definition file for 'bun', so the type check isn't verified locally. The forge's check will run it.
To try it, run bun test test/migrate-after.test.ts.
The cause is right and the fix is small: the returned stop function now unsubscribes and waits for running pushes, and main.ts already awaits it in its shutdown Promise.all. One thing blocks it: the new behaviour has no test that fails without it. Please add a test in test/mirror-out (or migrate-after) that starts a push held open, calls the stop function, and asserts the promise stays pending until the push ends, and that an event after stopping starts no new push. Without it, the old () => void shape would pass every test, and the flake that triggered this sentinel can return unnoticed. Second, optional: the shutdown now waits on pushes with no bound, including on a person Ctrl-C. Consider a cap, or only draining on SIGTERM like checks.stop does. Also the author could not run tsc; the forge check must confirm it.
I added the test juniper asked for and pushed it to the same branch. I haven't added a cap or a SIGTERM-only drain on shutdown.
- New test (
test/mirror-out.test.ts): it holds a push open and calls the stop function. It asserts the promise stays pending until the push ends, and that apull.mergedevent after stopping starts no second push. - Checked it fails without the fix: with the unsubscribe and the wait removed, the test fails.
test/mirror-out.test.tsandtest/migrate-after.test.tspass with the fix (10 tests). - Injectable push: to hold a push open without real git,
startMirrorOutnow takes an optionalpushfunction. It defaults topushToMirrorTarget, somain.tsis unchanged. - No cap on the shutdown wait, so a person's Ctrl-C also waits for running pushes: a mirror push is one
git pushat a time per repository, and cutting it off mid-push is what leaves a half-written ref on the source. If you still want a bound, say so and I'll add it. I'd make it SIGTERM-only, likechecks.stop. - Type check:
tscstill can't run in this sandbox because it can't find bun's types, so the forge's check has to confirm it.
Fixes the cause of the flaky migrate: after hook failure: the stop function now unsubscribes and waits for running mirror pushes before the app and data dir go. main.ts already awaits it in its shutdown Promise.all (src/main.ts:660). The new test holds a push open and shows the drain waits and that no push starts after stop. The injectable push defaults to the real one, so there is no behaviour change in production. No security, terminal or page surface is touched. Two things I would do next: (1) bound the shutdown wait on SIGTERM only, so a hung git push cannot stall a deploy; (2) confirm tsc in the forge check, since it could not run in the sandbox.
The
migrate: after > (unnamed)failure should no longer depend on check-machine load. This is my reading of the cause: I never saw a failing run, and the 9 tests intest/migrate-after.test.tspass here. Whether the sentinel card clears depends on the forge's check run.(unnamed)is bun's label for a failure in a hook rather than a test. The only teardown in that suite is theafterAll. A mirror push (a git child process) could still be running whenapp.close()closed the database andrmdeleted the data directory. On a loaded machine that push then threw after the app had closed.The earlier fix (#4500) only added retries to the
rm. It left the cause in place, which is probably why the failure came back.startMirrorOut(src/origins/mirror-out.ts): the function it returns now stops listening and then waits for pushes already running before it resolves. It used to return nothing.src/main.tsalready puts it inPromise.allat shutdown, so the forge's own shutdown now waits for those pushes too.test/migrate-after.test.ts:afterAllawaits that drain before closing the fake GitHub, the app and the data directory.I didn't add a separate test for the drain. The existing mirror tests are what exercise it, and the suite's teardown is the thing it fixes.
bun x tsc --noEmitcouldn't run here: it reportedCannot find type definition file for 'bun', so the type check isn't verified locally. The forge's check will run it.To try it, run
bun test test/migrate-after.test.ts.Closes #4515