From 59fead71610d4919fab22104cf40cad7502ebdb1 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Fri, 13 Nov 2026 18:02:58 -0400 Subject: [PATCH] pre-pr-checks: the runner refuses to run when the page and its own list disagree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The page and this list drifted apart **twice in one night**, and both times a lane found it by happening to compare two lists by hand: 1. the page said the runner "runs the first **six**", after `notice_covers_deps.py` made it seven — a count sentence contradicting the table three lines below it (engine#2380); 2. the table's **order** disagreed with this array at three positions, while this file's own comment claims *"in the order docs/pre-pr-checks.md lists them"* (same PR). A defect that has happened twice and is invisible to both editors is a job for a check, not for a resolution to compare more carefully. `--list` (and therefore every run) now compares the two lists before doing anything: ``` $ PRE_PR_CHECKS_PAGE=… bash scripts/pre-pr-checks.sh --list # after swapping two rows in the page pre-pr-checks: the page and this runner disagree about WHICH checks run, or their order: 5d4 < tools/ci/tmp_path_check.py 6a6 > tools/ci/tmp_path_check.py runner: scripts/pre-pr-checks.sh page: docs/pre-pr-checks.md (set PRE_PR_CHECKS_PAGE to point elsewhere) $ echo $? 2 ``` Three arms, each run without a pipe (so the code is the script's, not `tail`'s — that mistake cost me a wrong claim earlier tonight): | arm | exit | |---|---| | clean tree (page and runner agree) | **0** | | two rows swapped in the page | **2**, naming the position | | the `notice_covers_deps` row deleted from the page | **2**, naming the missing check | Notes on the shape: the comparison reads the *rows of the first table* (`| command | red means |` … up to the blank line), so the "two more, for the moments they are for" table is out of scope and `conflict_triage.py`/`check_pins.py` stay out of the runner's list by design. A missing page **warns instead of failing** — the runner is a host-side tool and must still run in a tree without docs; the message says the agreement is unchecked rather than pretending it passed. --- scripts/pre-pr-checks.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/pre-pr-checks.sh b/scripts/pre-pr-checks.sh index dddc502f3..fe7686484 100755 --- a/scripts/pre-pr-checks.sh +++ b/scripts/pre-pr-checks.sh @@ -77,6 +77,25 @@ checks=( "tools/ci/registration_loss_check.py --check --base $base" ) +# The page and this list drift apart, and it has happened twice in one night: the page said the runner "runs the first six" +# after a seventh was added (its count sentence contradicting its own table three lines down), and the table's order disagreed +# with this array at three positions while THIS file's comment above claims the order is the page's. Both were found by hand, by +# a lane that happened to compare two lists. So the comparison is now part of the run: whoever edits one list and not the other +# gets a refusal naming the difference, instead of a page that describes a tool it no longer matches. +page="${PRE_PR_CHECKS_PAGE:-docs/pre-pr-checks.md}" +if [ -f "$page" ]; then + want=$(sed -n '/^checks=(/,/^)/p' "$0" | sed -n 's/^[[:space:]]*"\([a-zA-Z0-9_\/\.]*\).*/\1/p') + have=$(sed -n '/^| command | red means |/,/^$/p' "$page" | sed -n 's/^| `python3 \([a-zA-Z0-9_\/\.]*\).*/\1/p') + if [ "$want" != "$have" ]; then + echo "pre-pr-checks: the page and this runner disagree about WHICH checks run, or their order:" >&2 + diff <(printf '%s\n' "$want") <(printf '%s\n' "$have") | sed 's/^/ /' >&2 + echo " runner: $0 page: $page (set PRE_PR_CHECKS_PAGE to point elsewhere)" >&2 + exit 2 + fi +else + echo "pre-pr-checks: no $page to cross-check against; the page/runner agreement is unchecked" >&2 +fi + if [ "$list_only" = 1 ]; then for c in "${checks[@]}"; do echo "python3 $c"; done exit 0