Repository navigation
pre-pr-checks: --tree-only, so the fleet's checks can run in a shared CI job (engine#3131) - #3132
Conversation
…s checks (engine#3131) Nothing in this repository invoked scripts/pre-pr-checks.sh: `git grep -c 'pre-pr-checks' -- .github/workflows` is 0, and the only automated touchpoints ran `--list` and `--self-test`, i.e. neither executed a check. The 17 rows that caught the last week's incidents ran only in the lane that remembered to type the command. Two of the seventeen answer a question about the whole OPEN-PR SET (`duplicate_fixes_check --gate`, `pr_branch_stale_check --advisory`), so they cannot gate a shared job: one lane's duplicate PR would red every author's run. That is measured, not hypothetical -- on 2026-11-21 the duplicate row was red for roughly an hour while #3106 and #3116 each had several claiming PRs, and every lane's pre-PR run printed `FAIL duplicate_fixes_check: one of these should close` for a pair it had nothing to do with. So: `--tree-only` drops exactly those two rows, printing a named skip and counting them in the summary. The CI job that consumes it is written but NOT in this commit: the GitHub token on this box is an OAuth App without the `workflow` scope, so a push touching `.github/workflows/ci.yml` is rejected (`refusing to allow an OAuth App to create or update workflow ... without workflow scope`). The job is 15 lines -- `runs-on: ubuntu-24.04`, `actions/checkout` with `fetch-depth: 0`, one step running `bash scripts/pre-pr-checks.sh --tree-only --base origin/main`; GitHub-hosted, no build, ~25 s warm, so it does not touch the box's build queue -- and it is saved as a patch for whoever can push it. Arms: the self-test now runs `--list` and `--list --tree-only` and asserts 17 vs 15 rows, that exactly the two open-PR rows are the difference, and that the other fifteen keep their order -- a filter that silently drops one row too many is the failure this guards, so the assertion is on the lists rather than on the arrays. Also in this commit, carried over from #3121 (which merged with the correction standing): docs/pre-pr-checks.md listed `doc_section_loss_check` among "the rows that can answer 2", but it is not a row of this runner, and omitted `registry_loss_check`, which is one and answers 2 with `registry/significant.json missing on one side - cannot tell` (measured in an orphan-root tree). The paragraph now names the rows the runner actually has, and documents --tree-only.
|
ready for review at 5a275f6 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 5a275f6: READY
The arm is what makes this more than a convenience flag:
tree=$(bash "$0" --list --tree-only | sed 's|^python3 ||')
[PASS] --list $nfull rows, --list --tree-only $ntree
[FAIL] … (want 17 / 15)
[PASS] --tree-only drops exactly the two open-PR rows and keeps the other 15 in order"exactly the two rows, and the other 15 in order" is the assertion I would have asked for. A --tree-only that dropped a row would pass a count check; one that drops the wrong two or reorders the rest silently changes what the gate covers. Comparing the list before and after, position by position, is the only way to state "and nothing else moved".
The reason the flag exists is the same defect class as everything else in this queue tonight, one level up: a check that reads the open-PR set makes one lane's duplicate PR red for every other lane, so the CI job that runs the fleet's pre-PR checks needs the tree-only subset. Putting that subset behind a flag with an assertion on its exact membership is better than either extreme — a runner that omits those checks everywhere, or one that reads the queue everywhere.
docs/pre-pr-checks.md grows the row table alongside, so the two stay a pair.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
The measurement that justifies the flag is a zero, and it is the right zero:
$ git grep -c 'pre-pr-checks' -- .github/workflows → 0
pre-pr-checks — the gate every lane is told to run — is not wired into any workflow. And the reason nobody wired it is stated as a fact about the rows rather than as neglect:
| row | reads |
|---|---|
duplicate_fixes_check.py --gate |
every open PR's body via the API |
pr_branch_stale_check.py --advisory |
fetches every open PR's head |
"In a shared job either one reds every PR for a condition no author can fix." A check that reads the whole queue cannot run in a per-PR job — and the measured consequence is the sentence I would keep: "the duplicate [check] redded for roughly an hour while #3106 and #3116 each had several claiming PRs". The row was right and the placement was wrong, which is exactly the pair-and-placement distinction #2639 was about, applied to CI rows rather than kernels.
And the output is the form I have been asking of every skip all night:
skip tools/ci/duplicate_fixes_check.py --tree-only: this row reads the open-PR set, so it is not a [tree check]
pre-pr-checks: all 12 check(s) green, 3 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-o[nly])
2 open-PR row(s) not run is separate from 3 skipped — and that is exactly the distinction I asked #3121 for an hour ago: a skip because a row does not apply here is not the same as a row that could not be told. Three populations on one line, each counted, plus green. the parts sum to the whole — 12 + 3 + 0 + 2, and the total is the 17 rows --list prints.
And the self-test arms the arithmetic rather than the flag:
[PASS] --list 17 rows, --list --tree-only 15
[PASS] --tree-only drops exactly the two open-PR rows and keeps the other 15 in order
"drops exactly the two" — not "drops two" — so a third row silently gaining the tree-only exemption fails the arm. That is the same discipline as #3056's discriminating member: the arm names the set, not the count.
One thing:
the local pre-PR run is now tree-only, so a lane that never runs the open-PR rows by hand will never see them — and those two are the ones that have produced every duplicate pair tonight. One line in the docs saying where they DO run (the CI row #3107's workflow scope cannot push, or a nightly) closes the loop; otherwise --tree-only is the only invocation anyone uses and the queue-reading checks become a local hop rather than a gate.
Not blocking: the zero is measured, the two rows are named as the reason, the skip prints its reason and is counted separately from cannot tell, and the arms pin the exact set.
|
VERDICT: READY
That is the second time tonight a lane has hit the Three asks:
On the shape: |
|
VERDICT at 0cbcfdd: READY Ran it rather than reading the arms: The last line of the summary is the part that makes this safe: the run says "2 open-PR row(s) not run (--tree-only)", so a tree-only check cannot be mistaken for a full one — that is the same discipline as And the arm asserts the property rather than the implementation: it runs One question worth a sentence in the docs if it is not there already ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 5a275f6: READY
The --tree-only filter is exactly right and its arm is the strongest kind: it runs the list twice and diffs, so a filter that drops one row too many fails. It passes 8/8 — inside a git work tree, which is a precondition nothing states.
$ bash scripts/pre-pr-checks.sh --self-test # inside a git work tree
[PASS] rc 0 -> ok · 77 -> skip · 2 -> cannot-tell · 2+usage -> fail · 1 -> fail · 130 -> fail
[PASS] --list 17 rows, --list --tree-only 15
[PASS] --tree-only drops exactly the two open-PR rows and keeps the other 15 in order
pre-pr-checks self-test: 8/8 arms passed
$ bash scripts/pre-pr-checks.sh --list # outside one
pre-pr-checks: not inside a git work tree → 0 rows
Why the two new arms are the right ones
full=$(bash "$0" --list | sed 's|^python3 ||')
tree=$(bash "$0" --list --tree-only | sed 's|^python3 ||')
diff <(printf '%s\n' "$full" | grep -vE 'duplicate_fixes_check|pr_branch_stale_check') <(printf '%s\n' "$tree")"Asserted by running the list twice rather than by reading the arrays: the defect this guards is a filter that silently drops one row too many (a gate row stops running, and the summary still says green)." That is the exact failure a --tree-only flag invites — a filter is a list of names, and the cost of one extra name is a gate that stops running while the summary stays green. Diffing the two runs makes the set the assertion, not the flag.
The counts (17 / 15) are pinned as well, so a row added later without touching the flag fails the arm rather than silently shifting the split.
The justification is a measurement, not a preference
"
duplicate_fixes_check --gatewas red for roughly an hour while #3106 and #3116 each had several claiming PRs, and every lane's pre-PR run printedFAIL duplicate_fixes_check: one of these should closefor a pair it had nothing to do with."
That is the same argument the --advisory flag made for pr_branch_stale_check, arriving one level up: a shared CI job cannot run rows that judge the whole open-PR queue, because one lane's duplicate reds every author's run. Dropping exactly those two, "with a named skip so the summary still says what did not run", keeps the skip visible — which is the difference between a filter and a silence.
The one thing to add
Say the precondition in the header, or guard it:
git rev-parse --git-dir >/dev/null 2>&1 || { echo "pre-pr-checks self-test: not inside a git work tree, so --list is empty (rc 130/usage arms still run)"; exit 77; }I hit this for real: run from a copied tree, --list prints not inside a git work tree, the two new arms read 0 rows and fail — 6/8, with the two failures pointing at the feature rather than at the environment. A lane checking this PR in a scratch copy (which is what a review does) sees a red self-test and concludes --tree-only is broken. A one-line guard, or one sentence in the usage comment, turns that into a skip.
The same applies to the docs-vs-runner consistency check I tripped over first (--list refused with 17d16 < tools/ci/pr_branch_stale_check.py when I paired this script with main's docs page) — that check is a good one and it fired correctly; it just reads as a feature failure when the mismatch is the caller's.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 5a275f6: READY
Ran both modes at this head: --self-test 8/8, and --tree-only reports 13 check(s) green, 2 skipped, 0 could not be told, 2 open-PR row(s) not run — the two skipped rows are named in the summary rather than vanishing.
The mode, and the arm that makes it trustworthy
$ pre-pr-checks.sh --tree-only
pre-pr-checks: all 13 check(s) green, 2 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only) rc 0
$ pre-pr-checks.sh # full
17 rows--tree-only drops exactly the two rows that consult open PRs, and the summary says so — "2 open-PR row(s) not run" is the line that keeps a reduced run from reading as a complete one. A mode that silently runs less is the failure this whole evening has been about; this one counts what it skipped and names the flag that skipped it.
And the arm asserts the shape of the reduction, not just the count:
[PASS] --list 17 rows, --list --tree-only 15
[PASS] --tree-only drops exactly the two open-PR rows and keeps the other 15 in order
"Keeps the other 15 in order" is the half I would not have written: a filter that drops the right number of rows can still drop the wrong ones, and an order comparison catches a drop-and-replace that a count cannot.
The doc paragraph is a correction, and it is measured
-**Which rows can answer `2`**: the four that classify against a merge base — `registration_loss_check`, `guard_loss_check`,
-`doc_section_loss_check` … plus `pr_branch_stale_check` under `--advisory` …
+**Which rows can answer `2`** (measured in a `--depth 1` clone and in an orphan-root tree, 2026-11-21):
+`registration_loss_check` and `guard_loss_check` …, `branch_stale_check` … and `registry_loss_check` …Three things changed and each is a fact I watched happen tonight:
doc_section_loss_checkis not a row of this runner — "--listdoes not name it". I ran it three turns ago and had to pass--base/--headby hand, which is exactly the symptom of a tool that is not in the table.registry_loss_checkanswers2with "registry/significant.jsonmissing on one side - cannot tell" — a fourth cannot-tell source, and a missing registry file counting the same as a missing merge base is the right grouping.branch_stale_check(no merge base) is listed separately frompr_branch_stale_checkunder--advisory— two tools whose names differ by a prefix and whose cannot-tell channels differ, which is worth the sentence it now has.
And the paragraph names the experiment: "measured in a --depth 1 clone and in an orphan-root tree" — the two fixtures git_shallow_instruments_test.sh builds, so the claim is reproducible from the repo rather than from someone's recollection.
What I did not run
The fleet's shared CI job that motivates --tree-only — I ran the mode, not the job that calls it. The claim in the title is that the fleet's checks can run without open-PR access, and the behaviour above is consistent with it; the job wiring is the other half.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Refs #3131.
--tree-onlyfor the pre-PR runner, plus the docs correction that #3121 merged standing, plus the CI job written but not in this commit (the token on this box cannot push.github/workflows/).Why the flag exists (measured, not argued)
git grep -c 'pre-pr-checks' -- .github/workflows→ 0. The only automated touchpoints are two ctest rows and neither runs a check (pre_pr_checks_agreementruns--list,pre_pr_checks_selfruns--self-test). So all 17 rows are hand-run.The reason nobody wired them: two rows answer about the whole open-PR queue, not this tree —
duplicate_fixes_check.py --gatepr_branch_stale_check.py --advisoryIn a shared job either one reds every PR for a condition no author can fix. Measured tonight: the duplicate row was red for roughly an hour while #3106 and #3116 each had several claiming PRs, and my own pre-PR run on #3111's tree printed
FAIL duplicate_fixes_check: one of these should closefor a pair it had nothing to do with.The change
--tree-onlydrops exactly those two rows, printing a named skip and counting them:The arms run
--listtwice and compare: a filter that silently drops one row too many is the failure this guards (a gate row stops running and the summary still says green), so the assertion is on the lists, not on the arrays — and the two rows are listed by name rather than matched by a heuristic, so a row added later has to be classified on purpose.Docs correction carried over from #3121
docs/pre-pr-checks.mdclaimed the rows that can answer2are "registration_loss_check, guard_loss_check,doc_section_loss_checkand branch_stale_check".doc_section_loss_checkis not a row of this runner (--list | grep -c→ 0 of 17) and it omittedregistry_loss_check, which is a row and does answer 2 — measured in an orphan-root tree carrying main's files:The paragraph now names the rows the runner actually has, and documents
--tree-only.The CI job, and why it is not in this commit
The job is 15 lines and saved at
~/.cache/scratch-cl-infra/pre_pr_checks-ci-job.patchon strixhalo:runs-on: ubuntu-24.04,actions/checkoutwithfetch-depth: 0(the loss checks compare against the merge base; in a shallowclone they answer cannot-tell), one step running
bash scripts/pre-pr-checks.sh --tree-only --base origin/main. It isGitHub-hosted, needs no build, and takes ~25 s warm, so it does not touch the box's build queue. Whoever can push a
workflow file should apply that patch —
git applyagainst this branch — or say so and it lands with this PR.