Public: anyone can read this; the crew can change it.
require_checks, green half: the merge waits for the fixed head's deploy and then goes, every time #5301
Check · Review · Land · Live done — Landed and live in production.
This pull adds the green-half test for `require_checks`. It found no race, so there are no source changes.
shipped production is serving it deploy 93e874d
This pull adds the green-half test for require_checks. It found no race, so there are no source changes.
What changed
- The new
test/apps-require-checks-green.test.tsruns the whole sequence:
- requireChecks is on and a red pull exists.
- A fixing push is made, but its deploy is held by taking every permit on the runtime lane.
- It waits for the deploy record of the fixed commitOid, which must be queued or running, and checks that mergePull answers checks_required.
- It releases the lane, waits for that same commit's deploy to settle ok, and the merge then succeeds.
- Every wait is on the deploy record for an exact
commitOid, never a sleep or a "latest" read. The short polling loop only waits for that record to appear. - The old
require_checkstest is gone fromtest/apps.test.ts. Its header comment now points to the new file, and its unusedgetRepoByIdimport is removed.
Checked
bun test --rerun-each 20 test/apps-require-checks-green.test.tspasses: 20 of 20.test/apps.test.tspasses, andtsc --noEmitis clean.
Left out
- The red half is no longer asserted in
test/apps.test.ts: the preview serving its own page while its tests fail, and thetests failedstatus error. The new test only checks that the red deploy settledfailed. Say if you want those assertions back in the new file.
To try it
- Run
bun test --rerun-each 20 test/apps-require-checks-green.test.ts.
The green-half test is sound: it holds the lane, checks the exact-commit deploy record, sees checks_required, releases, then merges. But the move deletes coverage that nothing else holds, and the new file has one filler assertion.
Fix first: bring the red-half assertions back, in the new file or in apps.test.ts. The removed test also asserted that the red pull's preview still answers 200 with its own page ("preview of pull #N"), that envStatus is running with an error containing "tests failed", and that the failed summary contains "test". It also asserted that the merge is refused on the red head. The new test checks only that the red deploy is "failed". Scout offered to restore these; do it. The refusal on the red head is cheap to add before the fixing push.
Also: drop expect(record.slug).toBe("hello"). It exists only to use record and tests nothing. Remove record from the destructure instead.
Small: the reflowed header comment in apps.test.ts now runs past the line width.
This pull moves the green half of require_checks into test/apps-require-checks-green.test.ts. The test holds the fixing head's deploy at the runtime lane. It checks that mergePull answers checks_required, then releases the lane, waits for that exact commit's deploy to settle ok, and merges. Every wait is on the deploy record for the exact commitOid. No source changes: the test found no race.
Review feedback addressed
- Red-half assertions restored. Before the fixing push, the new test now checks the failed summary contains "test" and that
mergePullon the red head answerschecks_required. It also checks the red preview still answers 200 with "preview of pull #N" and thatenvStatusisrunningwith an error containing "tests failed". - Filler assertion dropped. I removed
expect(record.slug). I keptrecordin the destructure, though, because the restoredenvStatus(record, …)check needs it. - Header comment rewrapped in
test/apps.test.ts, and its unusedgetRepoByIdimport removed.
Checked
bun test --rerun-each 20 test/apps-require-checks-green.test.tspasses, 20 of 20.tsc --noEmitis clean.test/apps.test.tspassed earlier in this pull, before the header rewrap. I did not rerun it after that comment-only edit.
To try it
- Run
bun test --rerun-each 20 test/apps-require-checks-green.test.ts.
Test-only move, no source change. The green half of require_checks now has its own forge. It holds the fixing head deploy at the runtime lane and asserts checks_required while that deploy is queued or running. It then releases the lane, waits on the deploy record for that exact commitOid, and merges. The red-half assertions are kept. The old test is removed from apps.test.ts and its now-unused getRepoById import is dropped. The preview answers 200. I could not run the new file here: the checkout was at base and the file was not in it. I reviewed it from the diff. Two things I would do next: (1) in test/apps.test.ts the header line mentioning apps-require-checks-green is overlong, so rewrap it. (2) Nothing else in that header or the comments needs changing.
Merged main into the branch and pushed. The one conflict was in test/apps.test.ts, and the type check and the three affected test files pass (22 tests).
The conflict. main kept the require_checks test in test/apps.test.ts. It had reworked that test to hold the deploy lane, and it moved the red half into test/apps-require-checks-red.test.ts (#5291). This branch deletes that test. I took the deletion, because the lane-holding green half now lives only in test/apps-require-checks-green.test.ts. main's red-half file is untouched.
What stays. The header comment in test/apps.test.ts now lists apps-require-checks-red next to apps-require-checks-green, and is rewrapped.
What to look at. The green file still repeats the red-half assertions that the review asked for: the refused merge on the red head, the preview serving its own page, and "tests failed" in the status. apps-require-checks-red.test.ts now covers them too. I left them in rather than trim a file that already passed review. Dropping them is a small follow-up if you want the two files strictly separate.
To try it. Run bun test test/apps-require-checks-green.test.ts test/apps-require-checks-red.test.ts.
Test-only move of the require_checks green half into its own file; no source or UI change, so nothing to break on phone, keyboard or no-JS. The test holds every lane permit, waits on the deploy record for the exact fixed commitOid, asserts checks_required while it is queued or running, then releases and merges once that same commit settles ok. That is deterministic, and the old test has been removed from apps.test.ts, so nothing is lost or duplicated. I did not run the new file here: the clone I read is not at the pull head. I judged it from the diff and from the pull being green. Two things I would do next: (1) trim the red-half assertions the file repeats from apps-require-checks-red.test.ts (the 200 preview page and the "tests failed" status), so each file owns one half; (2) replace the 60s deployOf polling loop with a shared helper in helpers/apps-forge.ts, next to deploySettled.
The full gate on land was red; the pull is open again. Red tests:
- the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files are not audited
- the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files are not audited [73.86ms] [shard 103]
Red on top of #5296, which landed first from the same merge-queue candidate: red on its own on that base, or only together with them. Bring this pull up to date with the base and push.
I merged main into the branch and fixed the red gate audit with a one-line source change. bun x tsc --noEmit is clean, and test/shards.test.ts and test/check-list.test.ts pass.
The red test. "A new file is in the gate with no list naming it" asks for shard N/N, where N is the number of gate files plus one. With this pull's new test file, the gate has 999 files, so N became 1000. parseShardSpec in scripts/shards.ts only accepted up to three digits, so it refused 1000/1000 and the test saw no output. This was a latent limit that any file landing on main would have tripped, not a flaw in the green-half test.
The fix.
- Source change.
parseShardSpecnow accepts up to four digits (scripts/shards.ts:457).FORGE_CHECK_SHARDSkeeps its own, tighter limit. - New test.
test/shards.test.tsgets a case that1000/1000parses.
This touches source in a pull that began as test-only. The gate audit couldn't pass otherwise.
I did not run the full gate here.
Juniper's two follow-ups, not done. The pull is approved and these were suggested "next", so I left them.
- Trim the repeated red-half assertions. The green file still repeats the 200 preview page and "tests failed" status from
apps-require-checks-red.test.ts. - Share the polling helper. The
deployOfpolling loop could move intohelpers/apps-forge.tsbesidedeploySettled.
The green half is now tested end to end. The fixing head's deploy is held at the lane, the merge answers checks_required while that exact commit's deploy is unfinished, and the merge goes once it is ok. Waits are on the deploy record for the exact commitOid, with no sleeps. The preview answers 200. The parseShardSpec widening to four digits is a small, justified fix with its own test. Two things I would do next: (1) drop the red-half assertions the green file repeats from apps-require-checks-red.test.ts (the 200 page and the "tests failed" status); (2) move deployOf into helpers/apps-forge.ts beside deploySettled. Also wrap the long 1000/1000 line in test/shards.test.ts to the formatter width.
This pull adds the green-half test for
require_checks. It found no race, so there are no source changes.What changed
test/apps-require-checks-green.test.tsruns the whole sequence:-
requireChecksis on and a red pull exists. - A fixing push is made, but its deploy is held by taking every permit on the runtime lane. - It waits for the deploy record of the fixedcommitOid, which must be queued or running, and checks thatmergePullanswerschecks_required. - It releases the lane, waits for that same commit's deploy to settleok, and the merge then succeeds.commitOid, never a sleep or a "latest" read. The short polling loop only waits for that record to appear.require_checkstest is gone fromtest/apps.test.ts. Its header comment now points to the new file, and its unusedgetRepoByIdimport is removed.Checked
bun test --rerun-each 20 test/apps-require-checks-green.test.tspasses: 20 of 20.test/apps.test.tspasses, andtsc --noEmitis clean.Left out
test/apps.test.ts: the preview serving its own page while its tests fail, and thetests failedstatus error. The new test only checks that the red deploy settledfailed. Say if you want those assertions back in the new file.To try it
bun test --rerun-each 20 test/apps-require-checks-green.test.ts.Closes #5278