Public: anyone can read this; the crew can change it.
A pull that fails a rule test on today's main still landed: the feature-notes index was red on main four times in an hour #12698
Check · Review · Land · Live done — Landed and live in production.
A person's landing of a pull whose green check was of an older base was allowed when the repo doesn't require checks. That is now refused, and the simulator has a case that fails without the fix. Asks 1 and 3 are only partly done; details below.
shipped production is serving it deploy c36cfce
3 earlier comments · 1 event
A person's landing of a pull whose green check was of an older base was allowed when the repo doesn't require checks. That is now refused, and the simulator has a case that fails without the fix. Asks 1 and 3 are only partly done; details below.
Which of the three it was (ask 1). I could not read the landing record from here. The API shows the check on #12511 (e25a18f7) passed on base 18eaf385 and reports required:false. e25a18f7's parent on main is ad943ed4, which already held the index. So the pull was green on a base that was not the one it landed on, and the repo was not requiring checks. That makes it the "landing gate ran against an older base" case, through the person's-merge path. The staleness test (checksHold) only applies when require_checks is on. The queue path lands only the tree it gated, so it is not implicated by what I can see. I did not see the landing record, so this is inferred, not confirmed.
What changed
src/core/pulls.ts(landPull): a green whose recorded base is no longer the base tip now holds the landing withchecks_required, whether or not the repo requires checks. The queue's gated landings (expect) are exempt, as before.src/actions/pulls.ts(mergePull): sets the newfreshGreengate flag. The owner's break-glass (pastGate) leaves it off, so that still works.test/support/landsim.tsandtest/landsim.test.ts(ask 2): awriteedit and arequireChecksoption on the scenario. A stub rule stands in forfeature-orphans: oncenotes/INDEX.mdexists, every note must be named in it. A newruleHoldsOnMaininvariant fails when a landing leaves main breaking that rule. The new caseruleAfterCheck(#12656) checks and approves a pull, adds the index to main, then has a person land it. On the old code it fails withcheckedIsLanded/repo-squashandruleHoldsOnMain. With the fix it passes, with no landing andland: checks_requiredas the refusal.
landsim.test.ts passes (20 tests), as do 13 landing and stale-check suites. gate.ts and tsc --noEmit are clean. fast.ts named 2,661 of 3,232 test files, so I ran the landing-related ones by hand.
What I chose not to do
- Ask 3 (main red on a rule test: name the landing and offer the revert) is not done. It needs a main-check watcher and a revert offer, which is a separate feature.
- A pull that was never checked, in a repo that doesn't require checks, still lands. That is the repo's setting. I did not turn it into a forced gate run on the exact tree.
- Ask 2's "the rule set runs on the exact tree for every landing" is met only as far as a stale green now blocks a landing. A manual landing does not run the rule tests itself.
To try it: bun test test/landsim.test.ts. Or turn off require_checks on a repo, check a pull, push to main, then merge the pull; the merge now says its check is of an older base.
🤖 Generated with Claude Code
The gate failed on three comment lines over 100 columns, and I've rewrapped them. Only comments changed; no code moved.
The three lines were test/landsim.test.ts:120, test/support/landsim.ts:549 and test/support/landsim.ts:1343.
bun scripts/gate.ts and bun x tsc --noEmit now pass. bun test test/landsim.test.ts passes (20 tests). I did not run the rest of the suite; the forge runs the full check on this push.
This is commit 41eb0fac3, pushed to the branch.
The fix is the right shape and on direction (a stale green no longer lands where checks are not required, #3316 family), and the landsim case fails without it. Two things to change in this round.
- The break-glass exemption is untested. The pull says pastGate leaves freshGreen off, but no test would fail if mergePull ignored that and set freshGreen true for the owner. Add a test (core mergePull with freshGreen and the owner break-glass, or a landsim step) that shows the owner can still land a stale green.
- The person who is refused gets the bare code checks_required, with nothing that says the check is of an older base or what to do. Word it for a person ("its check ran on an older main: re-run the check, then merge") on the page, and make sure the terminal door shows the same wording. Add a test on the wording.
Also: with require_checks off in production, every merge after another landing now needs a full re-check. That works against the 10x-landed-per-hour direction, so say in the pull how the re-check is made cheap, or link the #3316 work that does it.
No web UI changed; the preview pages are unaffected and nothing was added to README. Asks 1 and 3 remaining is accepted as separate work.
A green check of an older base is now refused with its own reason, check_stale, worded for a person. A test now shows the owner's break-glass still lands a stale green. Gate, tsc and the stale-green, landsim, api-hints, landing-doors and cli-ship suites pass here; the forge runs the full check on this push.
What changed
- Wording:
CHECK_STALE_REFUSAL("Its check ran on an older main: re-run the check, then merge. Nothing was merged.") lives insrc/checks/stale.ts. These doors show it:
- Web page: the merge flash message.
- REST API: the check_stale code, now with a message.
- MCP merge tool: it passes the REST message through.
- Terminal: errorText in the TUI.
- Fleet receipts: the fleet verbs' word map.
- Agent hint: check_stale has its own entry in respond.ts.
- Where it applies:
mergePull(src/core/pulls.ts) returnscheck_stalewhenever the head's check is green but ran on an older base. That holds where checks are required and where they are not. A missing, red or running check still returnschecks_required. - Break-glass test:
test/merge-stale-green.test.tsshows thatmergePullrefuses a stale green withcheck_stale, and that the same pull lands with{ pastGate: true }. - Wording test: the same file asserts the API message,
mergeFailureand the terminal'serrorTextall equal the one sentence.
Existing tests I changed
Three assertions expected checks_required for a stale green: two in test/merge-stale-green.test.ts (REST and the queue-less merge) and one in test/stale-green.test.ts. They now expect check_stale; the old code name was the thing being replaced. The landsim refusal key became land: check_stale. I also rewrapped three comment lines past 100 columns.
Not done
- The cost of re-checking: I did not make the re-check cheaper. With
require_checksoff, a merge after another landing still needs a fresh check, as you noted. That belongs to the #3316 work, which I have not linked or read. I did not touch the merge queue'sexpectpath: a gated landing is still not held by a stale green. pull_slices.ts: its separate gate (src/actions/pull_slices.ts:103) still answers a stale green with the barechecks_requiredunderrequire_checks. I left it because its wording is outside this change; say if you want it moved tocheck_staletoo.
To try it, push to a pull so its check goes green, push a commit to main, then press merge on the pull. The page, the terminal and POST …/pulls/N/merge each say to re-run the check.
The failed check was the "before/after looks" rule. This pull changes src/web/pages/pull.ts, but no commit message named the page of app.looks that shows it. I added an empty commit whose message has the line Looks: /preview-admin/sample/pulls/3, the pull page already listed in forge.json. bun scripts/gate.ts now prints nothing, and I pushed.
I did not change any code or tests. I did not run bun x tsc --noEmit or any tests, since nothing but a commit message changed.
The forge will take the before/after pictures of that page on the preview.
Read in full. A green check of an older base now holds a person's merge with its own check_stale code, whether or not the repo requires checks. The queue's expect path and the owner's break-glass (pastGate) are exempt, and a test covers each. The refusal has one sentence, shared by the page, API, MCP, terminal and fleet receipts, and a test pins it. The landsim case fails without the fix. No security, escaping or auth regressions; nothing added to src/web beyond a flash string, and no README or dependency change.
Left as follow-ups, not blocking: the cost of the re-check belongs to #3316, and pull_slices.ts still answers a stale green with the bare checks_required.
A person's landing of a pull whose green check was of an older base was allowed when the repo doesn't require checks. That is now refused, and the simulator has a case that fails without the fix. Asks 1 and 3 are only partly done; details below.
Which of the three it was (ask 1). I could not read the landing record from here. The API shows the check on #12511 (
e25a18f7) passed on base18eaf385and reportsrequired:false.e25a18f7's parent on main isad943ed4, which already held the index. So the pull was green on a base that was not the one it landed on, and the repo was not requiring checks. That makes it the "landing gate ran against an older base" case, through the person's-merge path. The staleness test (checksHold) only applies whenrequire_checksis on. The queue path lands only the tree it gated, so it is not implicated by what I can see. I did not see the landing record, so this is inferred, not confirmed.What changed
src/core/pulls.ts(landPull): a green whose recorded base is no longer the base tip now holds the landing withchecks_required, whether or not the repo requires checks. The queue's gated landings (expect) are exempt, as before.src/actions/pulls.ts(mergePull): sets the newfreshGreengate flag. The owner's break-glass (pastGate) leaves it off, so that still works.test/support/landsim.tsandtest/landsim.test.ts(ask 2): awriteedit and arequireChecksoption on the scenario. A stub rule stands in forfeature-orphans: oncenotes/INDEX.mdexists, every note must be named in it. A newruleHoldsOnMaininvariant fails when a landing leaves main breaking that rule. The new caseruleAfterCheck(#12656) checks and approves a pull, adds the index to main, then has a person land it. On the old code it fails withcheckedIsLanded/repo-squashandruleHoldsOnMain. With the fix it passes, with no landing andland: checks_requiredas the refusal.landsim.test.tspasses (20 tests), as do 13 landing and stale-check suites.gate.tsandtsc --noEmitare clean.fast.tsnamed 2,661 of 3,232 test files, so I ran the landing-related ones by hand.What I chose not to do
To try it:
bun test test/landsim.test.ts. Or turn offrequire_checkson a repo, check a pull, push to main, then merge the pull; the merge now says its check is of an older base.🤖 Generated with Claude Code
Closes #12656