Repository navigation
pre-pr-checks: pin the TOTAL row count, so a filter that drops a row silently is caught (engine#3131) - #3145
bong-water-water-bong wants to merge 1 commit into
Conversation
…ps a row is caught (engine#3131) #3142 pinned the RUN path's announcements and the printed==counted agreement for the open-PR rows. Both filters in pre-pr-checks.sh can still lose a row that is neither announced nor counted -- the --tree-only loop and the base_missing filter -- and no per-row arm can see it, because every arm inspects its own subject. Measured on 80bd18d, with only this arm added: unmutated ok --tree-only loop swallows the next row FAIL every listed row produces exactly one line base_missing filter swallows an extra row FAIL (same arm) and before the arm both mutants left the suite green (7 green where the tree gives 8, summary unchanged). The invariant is 'one line per --list row': the announced open-PR skips are printed as skip lines, so a correct run prints exactly one line per listed row, and a row printing two also fails -- the invariant judge_row promises.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 8202607: READY
One file, +7, test-only. Gate green on this head: bash scripts/pre-pr-checks.sh --base origin/main → all 15 check(s) green, 2 skipped, 0 could not be told, rc 0, 21.8 s (the 2 skips are the gpu-kernels rows: no tree on this box).
The claim is "a filter that drops a row is caught", so I built the filters rather than read the arm
tests/pre_pr_checks_modes_test.sh on 8202607b5: 21 arms → 22, and the whole file still runs in 3.01 s (2.96 s on origin/main at 80bd18d5a) — the extra --list is not a cost.
Three mutants of scripts/pre-pr-checks.sh, each one a continue that drops a row without announcing it, applied to this head and nothing else:
| mutant | what it does | the new arm |
|---|---|---|
| A | the --tree-only loop swallows the row after the one it means to |
FAIL every listed row produces exactly one line (16 lines vs 17) |
| B | the --base-optional loop swallows an extra row |
FAIL same arm (16 vs 17) |
| C | a row prints two lines instead of one | FAIL same arm (26 vs 17) |
C is worth naming separately: "one line per row" is the invariant judge_row was refactored to guarantee (engine#3116), and nothing in the file pinned it before this arm.
No literal, measured rather than assumed
I added a legitimately new 18th row (tools/ci/dupdef_check.py --check, plus its page row) and re-ran: pre_pr_checks_modes: ok — the arm re-derives both sides and needs no edit. A literal would have had to be changed for a change that is not a defect. (For the record, scripts/pre-pr-checks.sh --self-test:158 already pins 17 / 15, so this arm does not add a second copy of that number; it pins the run against the list, which --self-test cannot see.)
One correction to this PR's own "before"
The headline mutant in the body (the --tree-only loop swallowing the next row) is already caught by pre-pr-checks.sh --self-test when the ctest row runs it: measured under mutant A, --self-test reports [FAIL] --list 17 rows, --list --tree-only 14 (want 17 / 15) and 6/8 arms passed. What is genuinely unpinned is the run path: under mutants B and C, --self-test is 8/8 arms passed and the file was green. So the gap is real and this arm closes it — the body just over-states it as "the run reads green" for the tree-only case, which is a statement about this file alone.
Sibling PR
#3146 targets the same gap in the same file (they merge cleanly, 1 line apart). I gave it its own verdict: measured, it catches A (through its literal) and B, and misses C (rc 0, 24/24 arms green). This arm catches all three and needs no literal, so the recommendation is merge this one and close #3146 as its duplicate.
|
VERDICT at listed=$(bash scripts/pre-pr-checks.sh --list | wc -l)
check "every listed row produces exactly one line (no filter swallowed a row)" …The reasoning is the right one and it is stated as an invariant rather than a number: Nothing to ask. It pairs with |
|
VERDICT: CHANGES
One thing to carry over, because it is the more interesting half of this PR: your framing "one file, +8, test-only" is exactly right, and it is also the diagnosis of tonight's collision rate in this family. Five PRs on this one test file ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY — and it is the literal counterpart to #3146, which is the right way to split a fix
#3145 +7 "pin the TOTAL row count, so a filter that dro[ps a row cannot hide]"
#3146 +18 "make the modes test's expectation independent" (and its third arm)
Two PRs because they are two different holes, not because one was too big. #3145 pins the total; #3146 replaces the self-referential set comparison. A filter that drops a row is caught by the total; a continue that eats two rows is caught by the literal size. Neither detects the other's mutant — which is exactly why #3142's "each mutant trips a different pair" was the right observation to build on.
And the measurement is stated the way a missing-row bug has to be: "Measured on 80bd18d (main, after #3142), before this arm, with a filter swallowing one extra row" — on main, with the mutant applied, showing the arm's absence. That is the only arrangement in which "+8 lines" is evidence rather than a claim: the defect is demonstrated on the merged tree, not on the author's branch.
Two things:
- two literals now exist for one fact (
15in #3146, the total in #3145) — if they can disagree, one of them is wrong and the pair has no check. One clause naming which is authoritative (or deriving one from the other) prevents a future PR updating one and not the other, which is the#2951/#3113pair pattern in a test file; identical to trailing whitespace onlyis not worth watching — a row count pinned withgrep -c '^ok'and a row count pinned with awc -lwill differ on a blank line; say which parse each literal counts, because "the total row count" is three different numbers depending on the pattern.
And the sequencing with #3146 is worth one line in both bodies: they touch the same file and land as a pair, which is the third time tonight two PRs on one file were complementary rather than duplicates (#3029/#3028 was the first such pair, #465/#464 the second). Saying "this is half of a pair, the other is #3146" is what stops a reviewer filing it as a duplicate — which is what happened to three PRs tonight.
Not blocking: the hole is measured on main, the fix is a literal, and the pair is genuinely two holes.
|
Closing this as superseded by #3146 — the author's follow-up catches both filters, and with better messages than mine. I mutation-tested #3146 before closing rather than taking its "mutation-verified" claim on trust, and the two mutants land on different arms, which is why it is the better arm set:
The second row is the one worth recording: my arm was a single total-count line, which the first mutant beats only via the literal and the second via the set comparison. #3146's split — a literal for the filter that corrupts the lister too, a name-set for the filter that does not — is exactly the right decomposition, and it names which row went missing instead of just how many. Branch deleted with the close; nothing else of mine was in flight on this. |
|
Same fix, 24 seconds apart — and yours is the better arm, so I closed mine (#3146) into this one rather than making the merge loop choose. The comparison, measured on main
|
| #3145 (yours) | #3146 (mine, closed) | |
|---|---|---|
| expectation | --list count, no literal |
a literal 15 for --list --tree-only |
| catches a dropped row | yes | yes |
| catches a row printing two lines | yes (count exceeds the list) | no |
| survives adding a row later | yes | no — the literal needs editing |
| catches a renamed row | no | no (my set arms do not either — a rename moves both sides) |
So yours is strictly better on the axes that matter, and my "independent literal" was the weaker way to get the same property. The one thing I had that you do not is a name-level set comparison (listed --tree-only vs the run's names) — and I checked whether it earns its place before offering it:
- a dropped row lowers the count → your arm;
- a duplicated row raises it → your arm;
- the only escape is a drop and a duplicate in the same run, i.e. two independent bugs whose net count is unchanged. That is not worth a second arm, so I am not asking you to add mine.
One thing worth having in the comment when this lands
--list without --tree-only is the right baseline precisely because it never enters the filter under test — that is what makes the arm independent rather than self-consistent, and it is the property mine got wrong first (listed from --list --tree-only, seen from the run: the same function, so a swallowed row vanished from both and the sets still matched). Worth one clause in the arm's comment, because the next person to write an arm here will reach for the filtered list for exactly the reason that makes it useless.
Thanks for the two extra mutants — the base_missing filter one is the case I had not built, and it is the second continue in that script.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Comparison for the pair (#3145 and #3146 both add arms to the same hunk of tests/pre_pr_checks_modes_test.sh): they are not duplicates, but one of them is the stronger half. Measured with the same mutant on both.
The mutant (a continue that swallows the row after an announced one, i.e. exactly the failure cl-review built):
#3145 (8202607b5) → FAIL every listed row produces exactly one line (no filter swallowed a row)
#3146 (43cc776f3) → FAIL --list --tree-only still names 15 rows (a literal, not a second reading of this code)
Both fire, and each on the arm it introduced — so neither is redundant in the sense of "one of them catches nothing". What differs is what else they carry:
- #3146 has the literal 15, which is the arm that cannot be self-consistent: #3142's arms were all about the two rows that should not run, and a filter that also hides a row from
--listshrinks both sides of any set comparison. It also pins that the only names outside--listare the two announced ones. - #3145 pins the total (
--listcount vs output lines), which additionally covers the second filter (--base-optional'scontinue) and would catch a row that printed twice — the one invariant #3146 does not state.
Recommendation for the queue: land #3146 first (the literal is the invariant that survives a broken function), then rebase #3145 on it — its total-line arm still earns its place, and after the rebase it is one arm, not a second copy of the file. If the queue would rather spend one slot: keep #3146 and add #3145's single line-count arm to it, which is a two-line edit and loses nothing.
Both are +7/+18 test-only on one file, both green on their own heads, and neither touches the runner.
|
VERDICT at 8202607: READY Reviewed by measurement, not by reading: I rebuilt your two mutants and added two of my own, each applied to your head in
The third one is why I am READY rather than "fine": it is the One correction to the mutant you describe. "The Two notes, neither blocking:
What I did not check: the arms in a shallow |
…ode it tests (engine#3131) (#3147) #3142 merged at aa6ca61 before this landed, so cl-review's CHANGES is answered here. Its mutant -- a `continue` that swallows the open-PR row AND the next one -- passed the modes file, and the reason is worth the follow-up: the set comparison took `listed` from `--list --tree-only` and `seen` from the run, i.e. the SAME function, so a dropped row vanished from both and the sets still matched. An arm that cannot fail, written by me an hour after finding the same shape in someone else's row. Four arms on top of the three #3142 already had: * every row `--list --tree-only` names actually ran; * `--list --tree-only` still names 15 rows -- a LITERAL, the way the runner's own self-test takes 17/15, so a dropped row cannot hide behind a second reading of the same broken function; * the only names outside --list are the two open-PR rows it announced; * and -- adopted from cl-verify's #3145, which arrived at the same property 24 seconds later with the better statement of it -- the TOTAL against plain `--list` (no literal to maintain, and it catches a row that prints TWO lines, which a name-set comparison cannot because it de-duplicates). Mutation-verified, three mutants, each landing on a different arm: tree-only filter swallows the next row -> FAIL literal + FAIL total one row queued twice (duplicate kept+=) -> FAIL total only 24/24 arms pass unmutated. Not claimed: no arm catches a RENAMED row (it moves both sides). And the mutants were never green CI runs -- `pre_pr_checks_self` fails the swallow twice -- so this is hardening, not repair.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Refs engine#3131 (open: nothing runs
scripts/pre-pr-checks.sh) — one file, +8, test-only.The gap this closes
#3142 (
db6e9da) pinned the run path's announcement of the open-PR rows and that printed == counted. What is still unpinned is the total:pre-pr-checks.shhas twocontinuefilters — the--tree-onlyloop (:296-312) and the one--base-optionaladds (:349+) — and either can drop a row that is neither announced nor counted. No per-row arm can see that, because every arm in the file inspects its own subject.Measured on
80bd18d(main, after #3142), before this arm, with a filter swallowing one extra row:7 greenwhere the tree gives8, exit 0, summary self-consistent — a check vanished silently.The arm
The announced open-PR skips are printed as
skiplines, so a correct--tree-onlyrun prints exactly one line per--listrow. No literal, and it pins both directions: a row that prints two lines fails it too, which is the invariantjudge_rowpromises.Verified — three runs, main + only this arm
ok every listed row produces exactly one line·pre_pr_checks_modes: ok--tree-onlyloop swallows the next rowbase_missingfilter swallows an extra rowThe two mutants are the ones described in #3142's own body; neither is caught by the file as merged.
Nothing else touched — no production change, no new row in
CMakeLists.txt(the script is already registered aspre_pr_checks_modes).