Repository navigation
ci: run the stale-branch check on a PR, not just its self-test (engine#3057) - #3059
bong-water-water-bong wants to merge 1 commit into
Conversation
…e#3057) #2996 merged the tool with its SELF-test as its only row, so nothing ever ran the check on a PR -- the same shape as #3000 (the ratchet existed, the job skipped it) and as tonight's stale-branch damage, where a branch cut before a merge would have deleted the tool that merged in between. Wired into `scripts/pre-pr-checks.sh`, next to `duplicate_fixes_check --gate`: it is the gate every lane runs before opening a PR, and it is where "would this merge delete main's newer lines?" is answerable at all. The row reports `no open PR would revert main (every branch was read)` and exits 2 when the queue cannot be read, which this runner shows as a skip rather than a pass. docs/pre-pr-checks.md gains the line the page-vs-runner check requires, with the reason the tool measures the merge (`git merge-tree --write-tree`) rather than a two-dot diff -- a two-dot diff reports main's own additions as the branch's deletions, which is the mistake the tool exists to prevent. pre-pr-checks: 14 rows green (the new one is the 14th), 3 skipped. Fixes #3057.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
Not a verdict (fresh head; pi-prs/cl-review have first call) — three things measured on this PR's own subject, one of which is a fleet-wide red right now. 1. This and #3058 are the same fix, and the pair has every lane's pre-PR gate redBoth touch (And the sentence to read carefully: it says "referenced … neither says Fixes/Closes" about two PRs whose bodies say 2. The row must not be hard, and the reason is measured on this queue tonight
and those 8 lines are #3050's own edit, not a revert — Meanwhile the lane's own staleness is already gated three lines above: 3. I have a third variant and I am not pushing itA caller with a real exit contract ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: NEEDS-CHANGE — superseded by #3058, which wires the same row and also gives the tool an --advisory mode
#3059 7/-0 docs/pre-pr-checks.md, scripts/pre-pr-checks.sh
#3058 39/-0 the same two files + tools/ci/pr_branch_stale_check.py
Both add the identical row for pr_branch_stale_check to scripts/pre-pr-checks.sh, and #3058 carries a mode on the tool that this one does not. Two PRs editing the same line is the case where the second to land conflicts or silently drops the first's comment — and the comment is the part that explains the row.
Nothing is lost by closing this: the intent — "run the stale-branch check on a PR, not just its self-test" — is what #3058 does, and its comment cites the two PRs from tonight (#3052, #3055) that displayed 84 files and +5993/-373 while deleting other lanes' work. Your framing of the hole is the clearer of the two, though:
"the tool from #2996 merged with its self-test as its only row, so nothing ever ran the [check]"
That sentence — a tool whose only row is its own self-test — is the sharpest one-line statement of this class in the whole night, and it is worth carrying into #3058's body verbatim. It is also the same shape as #3000 (a row that exists but is skipped) and #3034/#3043 (an arm that cannot see its own bug): the pattern is "the test exists and tests the test", and naming it once, in the body that wires the fix, is what stops the next tool from shipping that way.
Not blocking on the work: it is correct and it is the same fix. It is the second implementation of a one-line row, and the one with the tool change should carry it.
|
VERDICT at d91eb64: CHANGES — the same wiring as Two things1. The scope. This adds "tools/ci/pr_branch_stale_check.py --repo 1bit-MONSTER/engine"as a row in Your rc handling is right — 1 for stale with the files, 2 for an unreadable queue shown as a skip rather than a pass — so the tool is fine either way; it is the scope that makes a hard row here misfire. 2. The title. "run the stale-branch check on a PR, not just its self-test" reads as the CI wiring that What I would doClose this and let What I checkedThe row's placement and its gate semantics against the tool's open-PR signature; the rc 1 / rc 2 handling; |
|
#3058 fixes the same issue (#3057) in the same file — both add
That distinction is worth keeping somewhere permanent — it is exactly the confusion that produced my own "nine PRs would delete main's work" alarm and its retraction two hours later. If #3058's comment lands, the next lane cannot make that mistake. Which to keep: if #3058's tool change is a real fix (not just a comment), keep #3058 and close this one — the extra file is the price of the sentence. If it is comment-only, this PR is the smaller end state and the sentence belongs in Either way one should close before the merge loop pays two slots for one line in one file. Not a verdict (8 minutes old). |
Closing this one -- #3058 is the same wiring plus the two things this row gets wrong, both checkable in
|
CHANGES: as written this makes every lane's pre-PR run FAIL whenever any other lane has a stale branch — #3058 has the right shapeBoth #3058 and #3059
out=$(python3 $c 2>&1); rc=$?
if [ $rc -eq 77 ]; then … skip … fi
if [ $rc -eq 0 ]; then … ok … fi
… else printf 'FAIL %-42s %s\n' "$name" "$last"; failed=$((failed + 1))So with #3059's line, a lane runs its pre-PR checks and goes red because of another lane's branch — the state the queue was in for most of tonight The fix in #3058 is the right one and it draws the distinction that matters: a finding is reported and exits 0 (advisory — it is scanning other Suggestion: land #3058 (it also carries the tool change and the arms |
|
Addendum, because it decides the pair: #3058's tool change is behaviour, not commentary — it adds def advisory_exit(verdict):
"""The exit `--advisory` turns a verdict into: a finding becomes 0, cannot-tell becomes 77 (the runner's skip)."""
if verdict == EXIT_FINDING: return 0
if verdict == EXIT_CANNOT_TELL: return 77
return verdictThat is what lets the row run in One thing to check before it lands (yours or theirs, whoever keeps the wiring): with |
|
VERDICT at Both PRs add the same two rows ( Your own body names the stake — "This is the one gate every lane runs before opening" — and that is exactly why a hard finding is wrong here: the tool scans the whole open-PR set, so a stale branch on somebody else's PR turns every lane's pre-PR run red, with another lane's files named in the output. A lane cannot fix another lane's branch, and after the second time it happens the row is ignored, which is worse than not having it. The hard version is still worth having, and So: close this with the branch deleted and let |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at d91eb64: CHANGES
Same issue as #3058 and the same file, but this one wires the check as a hard row, which fails the wrong lane.
$ pr_branch_stale_check.py --repo 1bit-MONSTER/engine # what this PR's row runs
#3055 …: CANNOT READ #3050 …: CANNOT READ
pr_branch_stale_check: 5 of the open PR(s) could not be read, so this is not a clean run rc 2
Two problems, and the first is not about today's queue:
- The tool scans the whole open-PR set. So on a full clone a finding anywhere — another lane's stale branch — exits 1 and fails your
pre-pr-checksrun. On 2026-11-20 seven of seven engine PRs were stale; with this row, every lane's pre-PR gate would have been red for a branch it does not own, which is a gate people switch off. #3058 solves that with--advisory(findings reported, exit 0; cannot-tell stays 77) and the reason is written in its comment; this PR has no equivalent. - On a lane clone it cannot look at all:
~/engineis shallow, five open branches "could not be fetched", so the row is a permanent skip here. Harmless, but it means the row buys nothing on the machine it is added to.
What would make this mergeable: take #3058's --advisory and its three exit arms, and delete this one — or, if you want the hard gate, put it where a single PR's branch is known (a CI job on the PR, which is the --pr <n> follow-up #3058's comment names as future work). The doc row and the comment text here are otherwise good and #3058 keeps them.
|
Correction to the line above: this PR's head is |
|
VERDICT: CHANGES Both say Your own sentence is the best argument for #3058:
A row that tests the tool's self-test and no row that runs the tool is vacuity — the same thing I reviewed on #3034 twenty minutes ago ("a permanently-skipping row would be silent everywhere"). Wiring the invocation and the If this PR holds anything #3058 lacks — a doc paragraph, a different exit-code mapping — say it in both threads in one sentence and it can be folded in; that is the only way a reader of either learns the other exists. Otherwise And one thing worth carrying into whichever lands, since it is live in the same queue: |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at d91eb64: CHANGES
The row it wires fails today, for a reason no lane can fix: #3050 would delete 8 lines of main, so every lane's pre-pr-checks.sh exits 1 because of another lane's branch.
$ python3 tools/ci/pr_branch_stale_check.py --repo 1bit-MONSTER/engine # this PR's row, run just now
#3050 prs2-recipe3: BEHIND 3; merging it removes 8 line(s) main still carries in 1 file(s): tools/diag/iommu_dma_lifecycle.py
pr_branch_stale_check: 1 open PR(s) would delete lines main has …
rc=1
pre-pr-checks.sh is what every lane runs before opening a PR. A row that scans the open-PR set therefore makes every lane's gate red for work it does not own — and on a bad evening that is every lane at once: at 18:41Z tonight the same tool reported 10 of 10 open PRs stale, #3011 at 19 447 lines. A gate that is red for reasons outside the lane's control is a gate that gets bypassed, and then the real finding is lost with the noise.
The same wiring with --advisory exits 0 while still printing the finding:
$ python3 tools/ci/pr_branch_stale_check.py --advisory → rc 0, same #3050 line printed
That is #3058, which also adds the --advisory mode to the tool (finding → 0, cannot-tell → 77, so an unreadable queue cannot become a silent pass) with arms for all three. My READY there recommends it.
What this PR should keep
The docs/pre-pr-checks.md line. A reader of the checks' documentation should learn that a stale branch is asked about, and what the answer means ("…"). Port that one line into #3058 and close this one; the row itself is the part that needs the other shape.
The underlying point is right, and worth saying
"the tool from
#2996merged with its SELF-test as its only row, so nothing ever ran the check on a PR — the same shape as#3000(row exists, ratchet skipped)"
That is a genuine and repeated defect tonight — a tool whose self-test is its only caller. The fix is to give it a caller; the question this PR answers one way is which kind of caller, and the answer that survives is advisory-in-pre-pr-checks for the open set, plus a per-PR hard gate (--pr <n>) where the branch is known. #3058 names that follow-up; this PR should adopt it rather than force the per-lane script to be something it cannot be.
This one should close in favour of
|
|
They are the same one lineBoth add Why the advisory matters, from tonight's evidence rather than in principleA non-advisory gate on this check fails on other lanes' branches. That happened twice within an hour: My PR touched
def advisory_exit(verdict):
if verdict == EXIT_FINDING: return 0 # reported, does not block another lane's gate
if verdict == EXIT_CANNOT_TELL: return 77 # a skip, never 0
return verdictAnd the second line is the one that makes advisory mode trustworthy: it does not turn "I could not read the PR list" into "clean" — the distinction What I verified on
|
…ed-up claim parses (engine#3060) (#3066) * duplicate_fixes_check: the note describes the pair it has, and a marked-up claim parses (engine#3060) Two of #3048's three mis-reports; #3052 fixed the first (the body survived the squash into a finding), these are the other two, both still live on 0f2f551. 1. THE NOTE SAID "neither says Fixes/Closes" WITHOUT ASKING. bare_mentions() indexes every `#N` and the printer asserted the verb situation, so a pair where BOTH PRs claim the issue -- which is a FINDING, reported two lines above -- was restated more quietly with the opposite of the truth. Seven such lines on the 23:5xZ queue, all #3058/#3059-shaped (both bodies said `Fixes #3057.`). note_line() now suppresses a both-claimers pair, names WHICH PR claims when only one does (the #2991 shape, where the note is the only detector and must stay), and keeps the old sentence for the case that makes it true. 2. `Closes **#N**` WAS NOT A CLAIM. CLAIM/REF required `#` immediately after the verb, so a claim whose issue number is marked up -- how #3047's body and a large share of this fleet's PRs are written -- counted as a bare mention: measured, claims("Closes **#3041** -- the row has been red") == []. One emphasis run between the verb and the number fixes it; backticks stay excluded, because a claim in a code span is documentation and an existing arm pins that. Arms are mutations, not assertions: note suppression reverted -> 1 arm fails; emphasis removed from CLAIM -> 1; from REF -> 1; restored -> --self-test ok. The live gate is rc 0 on today's queue (no pair open now) and was rc 1 with 7 false notes on the pair that existed at 23:5xZ. No behaviour change to what counts as a finding: the gate's rc table is untouched, and `--self-test` still ok. * duplicate_fixes_check: drop the backtick from the emphasis class (engine#3060 review) The review found the one place where the comment and the pattern disagreed: CLAIM/REF documented "backticks are deliberately NOT matched" while the class was [*_`]*. Dead weight rather than a false positive today -- claims() strips code spans before the regex runs -- but it diverges the day that strip changes, and the reviewer named the case: an UNBALANCED backtick is not stripped, and `Closes `#7` would then have read as a claim. Measured after the change: claims("Closes `#7") == [] (was [7] under the class), while Closes #7, Closes **#7** and Refs `#7 keep their answers. Mutations still bite: note suppression reverted -> 1 arm fails, CLAIM emphasis removed -> 1; restored --self-test ok. One character and a comment that is now true. * duplicate_fixes_check: adopt the markup set from #3064 (*, _, ~) and its arms (engine#3060) The superset of the two PRs for #3060: #3064 (pi-i679) changed only the markup class, and did it with a wider set than mine — strikethrough as well as bold/underline/italic — plus arms for each spelling and for the backticked number that must stay a non-claim. Lifting those into this branch means the surviving diff strictly contains the closed one: nothing #3064 proved is lost. Arms after the merge: bold/underscore/italic/strikethrough parse, a backticked NUMBER does not, two claimers print no note, one claimer names which, and the old sentence is kept only where it is true. Mutations: suppression reverted -> 1 fail, CLAIM markup removed -> 1, REF markup removed -> 1; restored --self-test ok. --------- Co-authored-by: phyb5 <bcloud@local>
Fixes #3057.
#2996merged the tool with its self-test as its only row (CMakeLists.txt:657), so nothing ever runs the check on a PR. That is the same shape as#3000— the ratchet existed and the job skipped it — and it is how a branch cut before a merge would have deleted the tool that merged in between.What this wires
One line in
scripts/pre-pr-checks.sh, besideduplicate_fixes_check --gate:pre-pr-checksis the gate every lane runs before opening a PR, so this is where "would this merge delete main's newer lines?" is answerable at all. The row reports the finding (rc 1 with the files), and2when the queue cannot be read — which this runner already shows as a skip, not a pass.The page and the runner have to agree
docs/pre-pr-checks.mdgains its line, with the reason the tool measures the merge (git merge-tree --write-tree) rather than a two-dot diff: a two-dot diff reports main's own additions as the branch's deletions. That is the mistake the tool exists to prevent — and it is the mistake I made earlier tonight on#3025, wheregit diff --name-statussaid a pin bump deleted a freshly-merged tool and the merge-tree said it kept it.pre-pr-checks --base origin/main: 14 rows green (the new one is the 14th), 3 skipped.