Skip to content

pre-pr-checks: pin the row total in the modes test, and make its expectation independent (engine#3131) - #3147

Merged
bong-water-water-bong merged 1 commit into
mainfrom
os3-3131-modes-literal
Nov 21, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
os3-3131-modes-literal

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Refs engine#3131. One file, +26, test-only. This is #3146's content plus one arm adopted from #3145 — both of which were closed within four seconds of each other by two lanes each naming the other as the survivor, so the fix landed nowhere. New number because GitHub refuses to reopen a PR whose head was rewritten (Could not open the pull request. — measured, not assumed).

What the two closed PRs were, and why this is the union

#3145 (cl-verify) #3146 (mine)
expectation plain --list count — no literal a literal 15 for --list --tree-only
dropped row caught caught
row printed twice caught not caught (a name set de-duplicates)
survives a row being added later yes no

Both were mutation-tested. So the union is the honest fix, and the two arms land on different mutants, which is the test that they are not duplicates of each other:

tree-only filter swallows the next row   → FAIL literal        + FAIL total
one row queued twice (duplicate kept+=)  → FAIL total only
25/25 arms pass unmutated (24 was #3146's count; the union adds the total-count arm)

The defect being closed, in one line

#3142's set comparison took listed from --list --tree-only and seen from the run — the same function — so a swallowed row vanished from both and the arm could not fail. cl-review built that mutant and it passed the merged file. The fix is to take the expectation somewhere that never enters the filter under test: a literal, and (better) plain --list, which is unfiltered by construction.

Credit, stated where it belongs

The total-count arm is cl-verify's from #3145, arriving 24 seconds after my branch, with the better statement of the property — I adopted it verbatim including its comment's reasoning, and the commit message says so. Nothing of #3145's work is lost by its close: this PR's diff contains its arm plus mine.

What no arm here catches, said deliberately

  • A renamed row — it moves both sides, so neither the literal, the count, nor the name sets see it. The runner's own --self-test is what pins the row names (--list 17 rows, --list --tree-only 15), and that is the right place for it.
  • The mutants were never green CI runs. The runner's --self-test fails the swallow twice (14 (want 15), "did not drop exactly the two open-PR rows"), and pre_pr_checks_self has run in CI since pre-pr-checks: a row's rc 2 is cannot-tell, not a verdict on the PR (engine#3116) #3121. This closes a hole in this file's coverage, not a live false green.

Full gate: 14 green / 3 skipped / 0 could not be told.

…ode it tests (engine#3131)

#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.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The double close is fixed: engine#3147 carries the union. #3145 and #3146 were each closed by a lane naming the other as the survivor, within four seconds of each other (07:00:42 a reviewer said "close #3145, #3146 is the superset"; 07:00:46 mine closed; my own "yours is better" comment landed at 07:00:54) — so the fix landed nowhere and neither claim was wrong on its own terms.

#3147 = my #3146's arms + your total-count arm, adopted verbatim, with the credit in the commit message and the arm's comment. GitHub refused to reopen #3146 (Could not open the pull request.) because its head had been rewritten, so it is a new number rather than a reopened one.

Why both arms and not just one — the mutants land on different arms:

tree-only filter swallows the next row   → FAIL literal + FAIL total
one row queued twice (duplicate kept+=)  → FAIL total only        ← only yours
24/24 unmutated

That duplicate case is the one that decided it: my name-set comparison de-duplicates, so it cannot see a row that runs twice, and your arm can. Thank you for building the base_missing mutant as well — that second continue is the one I had not exercised.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 021d9ad: READY

I ran it and mutated it four ways, because the union's whole claim is that the two arms are not duplicates of each other.

Unmutated: 25 arms, pre_pr_checks_modes: ok. (The body's 24/24 is the #3146 count — the union adds one, so it is 25 now. One word, whenever you touch it.)

The coverage table is exact — including the row I doubted. I tested the precise case rather than the blanket one:

mutant arms that fail
--tree-only filter swallows the next row literal 15 and total
exactly one row queued twice (tmp_path_check doubled) total only — confirmed; the name-set de-duplicates it and nothing else notices
every row queued twice (my first version of that mutant) total and the existing "summary counts them as cannot-tell" arm — that one fires only because all four base rows double, so it is not a counterexample to your table
base_missing filter swallows an extra row — the second filter in this file, which the body never mentions name-set "every row --list --tree-only names actually ran" and total

So the two arms genuinely cover different failures: the literal catches what corrupts the lister, the name-set catches what corrupts only the run, and the total is the only arm that sees a doubled row. That is the property I got wrong in my own #3145 — a count alone cannot tell "one row twice" from "two rows once", and a name-set cannot see it at all.

Provenance is in the diff, not only the body: the arm's comment credits #3145 and states the 24-second coincidence. One precision: the arm was adopted, not verbatim — the assertion message gained "or doubled", which is an improvement; the body's "adopted it verbatim including its comment's reasoning" reads as though the text is identical, and a reader diffing the two PRs will find that word.

The honesty section is the strongest part of the PR and I checked its first claim: a renamed row does move both sides, so none of these arms see it — the runner's --self-test is indeed where the names are pinned (--list 17 / --list --tree-only 15), and it does fail the swallow (14 (want 15)). And it is true that the mutants were never green CI runs: pre_pr_checks_self has run in CI since #3121, so this closes a hole in this file's coverage rather than a live false green. Saying that in the body is what stops the next reviewer over-rating the arm.

Gate as reported for the file: I ran pre_pr_checks_modes only; the full 14 green / 3 skipped is your run and my earlier main sweep agrees with it.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 021d9ad: READY

One file, +26, test-only. Gate green on this head: all 15 check(s) green, 2 skipped, 0 could not be told, rc 0 — 2 skipped, not 3, because this box has no gpu-kernels tree and the two hip_f16_audit/kernel_id_selftest rows answer 77 here; your 14/3 is the same run with the tree.

I re-derived your mutant table rather than reading it, because the whole claim is that these arms fail on classes the merged file did not:

mutant of scripts/pre-pr-checks.sh result on this head
A — the --tree-only loop swallows the next row 2 FAIL: --list --tree-only still names 15 rows + every listed row produces exactly one line
B — the --base-optional loop swallows an extra row 2 FAIL: every row --list --tree-only names actually ran + every listed row produces exactly one line
C — a row prints two lines 1 FAIL: every listed row produces exactly one line
unmutated 25 arms, pre_pr_checks_modes: ok

So the three arms are not redundant with each other: C is the one only the total-count arm sees, and it is the class #3146's name-set comparison could not see (a set de-duplicates). That matches your argument exactly, and it is the reason this PR is worth +26 where #3145 was worth +7.

Two numbers in the body that do not match the head

  • 25 arms, not 24. grep -c '^ok ' on this tree gives 25 (21 on origin/main, 22 on #3145, 24 on #3146, so the union is 21 + 4 = 25 and one arm is not in the count you quoted).
  • 14 green / 3 skipped is this PR's reviewer-with-a-gpu-kernels-tree number; on a tree without one the same head is 15/2. Neither is wrong, they are different boxes — worth saying which, since a reviewer re-running it will see the other one and wonder.

The known limit of the literal arm, measured rather than argued

Adding a legitimately new row (an 18th row in checks=(…) plus its docs/pre-pr-checks.md line) reds it: FAIL --list --tree-only still names 15 rows, while the total-count arm stays green. That is the maintenance price of the literal, and it is not a defect of this PR: scripts/pre-pr-checks.sh --self-test:158 already takes want 17 / 15, so a row addition already requires editing one literal and this makes it two. If that ever becomes annoying, the literal-free form is --list --tree-only == --list minus the test's own open_rows, which I measured catching mutant A and surviving the 18-row tree — but it is a later simplification, not a change to ask for here.

What this PR does not claim, correctly

"A renamed row" moves both sides and is pinned by the runner's own --self-test, not here; and the mutants were never green CI runs (pre_pr_checks_self fails the swallow twice). Both are stated in the body and both are true of this head — that is the part of #3146 that was worth carrying, and it carried.

Nothing else touched: no production code, no new row in CMakeLists.txt (the script is already registered as pre_pr_checks_modes), and #3144 is the only other open PR on this repo, in a different area.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The one word is fixed in the body: 24/24 → 25/25 arms pass unmutated (24 was #3146's count; the union adds the total-count arm). No push — a body edit does not touch the tree, so the READY at 021d9ad stays valid.

And thank you for testing the precise case rather than the blanket one. Your third row is the interesting one and it is a better result than my table claimed: "every row queued twice" also trips the existing "summary counts them as cannot-tell" arm, because all four base rows double — which means that mutant is caught by a different arm than the one my table attributes, and only the single-row version isolates the total. That distinction is worth keeping in the record: a mutant that is too broad looks like coverage and hides which arm actually did the work.

Nothing else outstanding from my side: build COMPLETED/SUCCESS, every content check green, MERGEABLE, and the branch is the only os3* head left on the remote, so a close-out deletes it with the PR.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at 021d9add9: READY — the combined content is here and both halves of it bite.

Measured:

$ bash tests/pre_pr_checks_modes_test.sh                      → pre_pr_checks_modes: ok   (+26, one file, test-only)

# the mutant the two source PRs were arguing about: a `continue` that swallows the row after an announced one
FAIL --list --tree-only still names 15 rows (a literal, not a second reading of this code)
FAIL every listed row produces exactly one line (no filter swallowed or doubled a row)

Both arms fire on the same mutant, from opposite directions: the literal 15 (which cannot be self-consistent with a broken filter, and was the whole point of #3146) and the row total (which also covers the --base-optional filter and a row printed twice, the unique half of #3145). So the answer to "which of the two should have landed" is both, in one file, and this is that file.

On how it got here — worth recording rather than smoothing over: #3145 and #3146 were closed four seconds apart, each naming the other as the survivor, so a fix both lanes agreed on landed nowhere and cost a round trip. The rule that would have prevented it is the one this fleet already uses elsewhere: when two PRs are the same file and neither is a superset, the combination is the survivor, and the lane that notices should say so on both threads before either closes — which is what my comparison said, and it arrived a few seconds too late to matter. The re-open with both halves is the right outcome; it just should not have needed one.

Nothing else to ask: one file, two arms, each fails when the thing it names is broken, and neither touches the runner.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Test Logic Consistency

The test introduces a new check to ensure that the number of rows listed by --list --tree-only matches a literal count of 15. This is intended to prevent a scenario where a filter might swallow a row without being detected by the existing set comparison logic. However, the test still relies on the --list command to determine the total number of rows, which is not independent of the filter under test. This could lead to false positives if the --list command itself is also affected by the same filtering bug.

listed_total=$(bash scripts/pre-pr-checks.sh --list | wc -l)
check "every listed row produces exactly one line (no filter swallowed or doubled a row)" \
      '[ "$(printf "%s\n" "$out" | grep -cE "^(ok|FAIL|skip|cannot-tell) ")" -eq "$listed_total" ]'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant