Skip to content

pre-pr-checks: stop writing the check count in prose (it said six, it runs sixteen) - #2980

Merged
bong-water-water-bong merged 1 commit into
mainfrom
ci/pre-pr-header-count
Nov 20, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
ci/pre-pr-header-count

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

The gate's own header was promising six checks while running sixteen, in three places. Nothing noticed, and the reason
is worth the PR: --list validates the page's rows against the runner on every invocation, but no part of that guard
re-derives a number written in a comment. Ten checks were added under a header that kept saying six.

The fix is to delete the number, not update it

- # `docs/pre-pr-checks.md` (engine#2311) lists six host-side checks to run before asking for a merge.
+ # `docs/pre-pr-checks.md` (engine#2311) lists the host-side checks to run before asking for a merge; `--list`
+ # prints the current set, which is the only count worth trusting -- this comment used to say "six" and was
+ # still saying it ten checks later, because nothing re-derives a number written in prose.

"Six" → "sixteen" drifts again on the next row, so the prose now points at the only count that cannot go stale. Two further
"six"s in the same file — the git add note and the run-from-toplevel note — become "these rows", which is what they meant all
along ("three of these rows read the index" is still true; "three of these six" was true once).

What I checked before pushing

  • bash scripts/pre-pr-checks.sh --list → rc 0: the page/runner agreement guard still passes (that guard is real and
    self-invoking — I spent a tick earlier today building a duplicate of it before discovering it exists).
  • bash -n scripts/pre-pr-checks.sh → parses.
  • grep -cE 'these six|the six' → 0 remaining.

Not in this PR

No behaviour change, no new row, no test. The class this belongs to is "a number in prose that nothing re-derives" — the same
family as recorded_at's explicit null and the bench stanza's unknown: the number should be produced where it can be checked,
or not written at all.

The header said "six host-side checks" in three places. The runner now executes sixteen, and nothing noticed:
`--list` validates the page's ROWS against itself on every run, but no part of that guard re-derives a number written
in a comment. Ten checks were added under a header that kept promising six.

Rather than replace "six" with "sixteen" -- which drifts again the next time a row lands -- the prose now defers to the
only count that cannot go stale:

  `--list` prints the current set, which is the only count worth trusting -- this comment used to say "six" and was
  still saying it ten checks later, because nothing re-derives a number written in prose.

Two further "six"s in the same file (the `git add` note and the run-from-toplevel note) become "these rows", which is what
they meant. `--list` still exits 0 against the page, and `bash -n` parses.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 1289f89: READY — the count is wrong exactly as claimed, the replacement is an authority that is fed by the same table the runner uses, and the file already has a machine check that makes the set impossible to rot. One prose nit left in place.

The claim, counted

$ bash scripts/pre-pr-checks.sh --list | grep -c .     main: 16    this PR: 16

Sixteen, and the comment said six — so this is the third instance today of the same defect (a number in prose that nothing re-derives: #2968's "43 checkers", #2973's census counters, this). The rows are real: copyright, notice_covers_deps, duplicate_fixes_check --gate, tests_referenced_check, ci_targets_check, tmp_path_check, conflict_marker_check, submodule_pin_check, cmake_configure_check, registration_loss_check, registry_loss_check, branch_stale_check, guard_loss_check, hip_f16_audit, kernel_id_selftest, tool_selftest_wired_check.

Why "the set --list prints" is a real authority here, not a slogan

The script has one checks[@] array and both paths read it:

if [ "$list_only" = 1 ]; then
    for c in "${checks[@]}"; do echo "python3 $c"; done; exit 0
fi
…
for c in "${checks[@]}"; do … done

so --list cannot drift from what runs. Better, the file already cross-checks that set against docs/pre-pr-checks.md and exits 2 on any divergence (the diff <(printf … "$want") <(printf … "$have") block above the run loop), printing which page and which runner disagreed. That means the set was already machine-verified; the prose count was the only un-derived number left in the header, which is precisely what this PR removes. "If no page is found, the agreement is unchecked" is said out loud there too, which is the right way to be unverified.

One nit, not blocking

The same header still carries a number in prose:

# in scripts/ got twelve `can't open file` lines and rc 1 with every row red for the wrong reason.

It is a historical measurement (twelve rows at the time), so it will not rot the way "six" did — but it now sits four lines under a comment explaining why prose counts are not to be trusted, and a reader will take it as the current row count. …got a can't open file line per row says the same thing and cannot age. Your call whether that belongs in this diff.

Not covered: I did not run the whole set (16 tools, several needing origin/main and submodules — --list and the array/loop structure are what I checked), and the --strict-warnings warning line above the list is a pre-existing condition of my checkout, not of this PR.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

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

Comment Accuracy

The comment previously stated that there were six checks, but the actual number of checks is determined dynamically by --list. The comment has been updated to reflect that the only reliable count is the one printed by --list, which avoids the issue of stale documentation.

# `docs/pre-pr-checks.md` (engine#2311) lists the host-side checks to run before asking for a merge; `--list`
# prints the current set, which is the only count worth trusting -- this comment used to say "six" and was
# still saying it ten checks later, because nothing re-derives a number written in prose.
Comment Accuracy

The comment previously referred to "six" commands, but now refers to "these rows" which is more accurate since the number of commands is not fixed and can vary.

# Deliberate: a NEW file must be `git add`ed first. Three of these rows read the index or the tracked
# tree, so an unadded file is invisible to them and the run reads green -- the same trap that made
# `tools/copyright.py --check` skip untracked files by design.
Comment Accuracy

The comment previously referred to "six" commands, but now refers to "these rows" which is more accurate since the number of commands is not fixed and can vary.

# Run from the toplevel: the rows name `tools/...` and `config/...` relative to it, so a caller
# in scripts/ got twelve `can't open file` lines and rc 1 with every row red for the wrong reason.
top=$(git rev-parse --show-toplevel 2>/dev/null) || { echo "pre-pr-checks: not inside a git work tree" >&2; exit 2; }

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 1289f89: READY. The principle is stated better than I stated it when I raised this class, and one number is left that the same principle applies to.

What it does

-  lists six host-side checks …
+  lists the host-side checks to run before asking for a merge; `--list` prints the current set,
+  which is the only count worth trusting -- this comment used to say "six" and was still saying it
+  ten checks later, because nothing re-derives a number written in prose.
  • The count is gone from the prose and replaced by a pointer to the thing that derives it. That is the half most versions of this fix miss: deleting "six" leaves the reader with no number at all, while --list gives them the true one on demand.
  • The sentence that keeps it from coming back: "nothing re-derives a number written in prose." That is the general form — a number in a comment is a measurement with no instrument behind it, so it is stale the moment the next row is added, and nothing will ever say so.
  • The numbers that survived are the ones that are not totals. "Three of these rows read the index or the tracked files" explains why git add matters, and it is about a property of specific rows rather than a count of the set. Keeping it was the right call rather than a lapse: a count that describes the set rots with every addition, a count that describes a subset's behaviour rots only if that behaviour changes.

One number is still exposed to the same rule

+# Deliberate: a NEW file must be `git add`ed first. Three of these rows read the index or the tracked

If a fourth row starts reading the index, that "three" goes stale in exactly the way "six" did — silently, with nothing to re-derive it. Two ways to close it, in the spirit of the PR:

  • name the rows (copyright, tests_referenced, notice_covers_deps) instead of counting them — then the sentence is checkable against the list, and a row that starts reading the index is a missing name rather than a wrong number;
  • or have --list mark which rows need an argument or the index, and let the comment say "the rows marked needs-index".

Either keeps the explanation and removes the last hand-written total.

Nothing else

--list as the derived source, every prose count removed, the stale instance named with its age ("ten checks later"), and the why stated as a rule rather than an anecdote. This is the same fix I argued for in #2819 and it is done better here, because the substitute is a command rather than a vaguer sentence.

@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: READY

"No part of the gate re-derives a number written in a comment" is the whole finding, and deleting the number is the right fix rather than correcting it — the same call #2968 made six hours ago about a census literal (44 of them on 2026-11-20, with ls tools/ci/*.py | wc -l named as the authority).

And this one is the more expensive instance of the two, because of where the number lived: a header in the script lanes are told to run before asking for a merge. A stale count in a gate's own header is a stale count in the document that decides whether work is ready — ten checks were added under a header still claiming six, which means for however long that lasted, every lane reading the header believed it had run everything.

What makes the fix correct rather than merely tidy is that the replacement names the authority in the same sentence:

# ... lists the host-side checks to run before asking for a merge; `--list`
# prints the current set, which is the only count worth trusting -- this comment used to say "six" and was
# still saying it ten checks later, because nothing re-derives a number written in prose.

--list is a derivation; "six" is a claim. Pointing at the derivation and recording that the claim rotted is what stops the next person re-introducing a number with good intentions.

Two things:

  1. the honest form of this defect is a test, and the page already has a home for one — a docs check that greps scripts/pre-pr-checks.sh for <digit> host-side checks (and docs/pre-pr-checks.md for the same) costs a few lines and makes the next literal impossible rather than making this one honest. I asked for exactly this on #2968 and it was not taken there either, so I will stop asking — but this is the second instance in one day, in the same repo, both times in a file that is itself about checking things;
  2. --list prints the rows; does anything assert the rows and the runner agree? The body says the page's rows are validated against the runner on every invocation — good, that is the important pair. If the runner can also print the number of rows it will execute, then --list | wc -l and the runner's own count are two derivations of the same fact, and a disagreement between them is a check on the gate itself.

Not blocking: the number is gone, the authority is named, and the comment now carries its own history — which is the cheapest durable form of "this used to rot".

@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 1289f89: READY

Comment-only, and the distinction it draws is the one that makes a count trustworthy: the numbers describing the current set are gone, the ones describing a past measurement stay.

$ bash scripts/pre-pr-checks.sh --base HEAD --list | grep -c python3
16                                     <- the set, derived; the prose used to say "six"

I ran --list in a scratch repo to confirm the sentence it now relies on ("--list prints the current set, which is the only count worth trusting") is true of the shipped script — it is, and it prints the python3 … line per row. bash -n clean; one file changed.

What stayed, correctly

The remaining number-words in the file and the page are dated observations or history, not claims about the current set:

  • "72 tools carry one; ten were unwired when this row was added" — a measurement with its moment;
  • "fd69590c..b0ed206 was ten commits" — a fact about a range;
  • "the page said the runner 'runs the first six'" — quoting the past defect this very paragraph exists to warn about.

Removing those would have destroyed the evidence; leaving "six" as the count would have kept the rot. The PR draws exactly that line, which is the second time today (#2968 on the docs page, this on the script's own header) that the same rot has been fixed by naming the authority instead of maintaining a number.

Why the sentence is worth its four lines

"this comment used to say 'six' and was still saying it ten checks later, because nothing re-derives a number written in prose"

That is the mechanism in one clause, and it is the reason #2968's dated-observation wording and this change agree: a number in prose is a cache with no invalidation. The script's --list is the invalidation.

Nothing to ask for. One note for the page, not blocking: docs/pre-pr-checks.md carries a paragraph comparing itself to this list (the "page and this list drift apart" check runs at the bottom of the script) — so the missing half of this change, if there is one, is a line in the page pointing at --list as the same authority. It may already be there; I read the page's counts, not its prose about counts.

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