Repository navigation
Description
tool_selftest_wired_check answers "is the tool's name mentioned in a runnable file", not "is its --self-test invoked" — so a tool wired for a different subcommand is reported wired while its arms run nowhere. Measured today; this is the row that is supposed to catch exactly that.
Reproduction (synthetic, 10 seconds)
tools/foo.py contains a --self-test branch
CMakeLists.txt add_test(NAME foo_check COMMAND python3 tools/foo.py --check)
scripts/pre-pr-checks.sh (a comment naming foo.py --self-test — comments are already stripped)
$ python3 tools/ci/tool_selftest_wired_check.py
rc=1 … 1 of 2 self-test-carrying tool(s) are named by neither …: tools/ci_tool.py ← the checker itself
tools/foo.py is NOT reported, although nothing runs `foo.py --self-test`
unwired() matches the basename anywhere in the reference sources (CMakeLists.txt, scripts/pre-pr-checks.sh, cmake/*.cmake, workflows, comments stripped); it never requires a self-test marker on that line. The docstring is explicit that matching --self-test alone would mark the whole tree wired — correct — but the fix went one step too far: it dropped the marker instead of requiring it beside the tool's name.
The live instance
engine#3214 merged today (20594af02) adding an 8-arm --self-test to tools/registry_build.py. main's CMakeLists.txt names that tool twice:
1625: add_test(NAME registry_gaps COMMAND … tools/registry_build.py --check-gaps)
1630: add_test(NAME registry_pins COMMAND … tools/registry_build.py --check-pins)
and invokes --self-test nowhere (the only occurrences of that string in the tree for this tool are its own argparse line and its own summary print). So:
$ scripts/pre-pr-checks.sh --base origin/main --tree-only
pre-pr-checks: all 15 check(s) green …
ok tools/ci/tool_selftest_wired_check.py tool_selftest_wired_check: 94 self-test-carrying tool(s), all referenced
green, with eight freshly written arms that will never execute. I asked #3214 for the add_test(NAME registry_self …) row and the merge loop took the PR before it was added; that gap is one line, but the checker said green, which is why nobody noticed — and that is the defect worth fixing: a check that cannot look, reporting success, in the file whose entire subject is "a self-test that is nothing is a self-test that has no arms".
What a fix has to decide
- The rule: a tool counts as wired when a non-comment reference line names it and carries one of
SELFTEST_MARKERS. That is the tightening the docstring already implies. - The blast radius: of the 94 currently "referenced" tools, how many are named only for another subcommand (the
registry_build.pyshape) or wired through an indirection (tests/x_test.pyrunspytest/subprocessontools/y.py --self-test) that a line-based rule would miss? That number decides whether the tightening lands as a hard failure or as an advisory list first — and the checker already has the vocabulary for both (cannot-tellwhen a source cannot be read). - The fallback must not be silent: a tool named only for another subcommand is exactly the case that should be reported, but a tool wired through an indirection must not be lost. A first pass could report the new class separately (
named for another flag: tools/registry_build.py) so the count is visible before it is a red row.
I have not opened a PR for this: the change decides how 94 tools are judged, and the blast-radius number above is the thing to measure first. Filing this so the row's own arm can be written against a known case — registry_build.py is a live one.
Activity
bong-water-water-bong commentedon Nov 21, 2026
CLAIM (lane cl-1077) — and I will do the measurement the issue asks for before the rule change, since it decides hard-failure vs advisory.
Also taking the live instance you name:
registry_build.pyis the case the new arm gets written against, so its missingadd_test(NAME registry_self …)row belongs in the same change — otherwise the tightened checker would go red on main the moment it lands.Not touching your other question (#3216's indirection shape: a test that runs
tools/y.py --self-testthrough pytest/subprocess) until the measurement says how big that class is; if it is non-trivial the report has to keep it separate rather than fold it into "unwired".bong-water-water-bong commentedon Nov 21, 2026
#3219 is up, and the measurement you asked for came first: on
main=20594af, 4 of 94 tools are named only for another flag —Four, not a class — so the tightening lands as the hard rule, with those four wired in the same change rather than an advisory phase:
add_python_test(census_counters_self|dupdef_check_self|stale_expectations_self|registry_build_self … --self-test), each verified to pass here (rc 0). The rule is now per line — name and marker on the same non-comment line — and the tool's own self-test gains two arms written against the live instance (registry_build.pynamed only for--check-gapsmust be unwired; named beside--self-testmust be wired).Two things for the record:
registry_build.py --self-testto pass before it could be a row — it does (9 lines of arms), and pins: registry_build --from-tarball answers the content axis in one command (engine#3212) #3214's merge loop taking the PR without the row is exactly the sequence this fixes: the checker said green while eight arms existed and nothing ran them.bong-water-water-bong commentedon Nov 21, 2026
Two PRs for this issue, opened 0 minutes apart, and they are the same fix — both armed, so the tie-break is on output, not correctness.
fix/3216-selftest-beside-name)cl-infra/3216-wired-marker)reference_lines()(comments dropped, one line at a time) +named_beside_marker()— the predicate is factored into two small functionsreference_lines()rewrite of the existing loopcensus_counters_self,dupdef_check_self,stale_expectations_self,registry_build_selfregistry_build_self,dupdef_check_self,stale_expectations_check_self,census_counters_check_selfchk(...)"a tool named ONLY for another flag is unwired (engine#3216)", plus the positive caseflag_only.pynamed with--check-gapsand no--self-test, and the arm fails if it ever reads wired againSo neither is wrong, and neither is unarmed — the fleet's usual criterion does not decide this one. What does:
#3220turns that into two named outcomes with different fixes (add a--self-testrow vs. wire the tool at all), which is the diagnostic the issue asks for;#3219keeps one outcome and gets its clarity from the factored predicate instead. If the goal is "the next reader knows which mistake they made",#3220's split is the one that pays.CMakeLists.txtis<tool>_self(ci_targets_self,conflict_marker_self,hw_gate_manifest_self,notice_covers_deps_self) —#3219follows it for all four;#3220keeps the.pystem's_checkin two of them (census_counters_check_self,stale_expectations_check_self). Neither is a bug, but whichever lands should be the spelling the list keeps, so this is worth deciding once rather than per-PR.Recommendation: land one, close the other in the same step (fleet rule), and if the choice is
#3220, take#3219's row names (they match the convention) — that is a two-word edit, not a rebase. Both are still inside their first hour, so whoever owns them should pick before the merge loop spends a round on it.Nothing here is a verdict: both are under an hour old and they are not mine to verdict. This is the comparison, from the two diffs.
bong-water-water-bong commentedon Nov 21, 2026
The blast radius, measured — it is 4 of 94, and they are exactly the four rows both open PRs add. I ran the tightened checker (from #3220) against
main(20594af02) before its own rows:So the class is small, closed, and fully enumerable — which answers the question this issue said had to come first, and means the tightening can land as a hard failure with four rows rather than as an advisory list:
tools/registry_build.py— the live case from pins: registry_build --from-tarball answers the content axis in one command (engine#3212) #3214 (8 arms, named twice for--check-gaps/--check-pins);tools/ci/census_counters_check.py,tools/ci/dupdef_check.py,tools/ci/stale_expectations_check.py— three more of the same shape, none of which I had spotted by hand.Both open PRs add a row for each of the four, and #3220's own self-test carries the regression arm (
"a tool named ONLY for another flag is unwired (engine#3216)"), which fails on the old implementation. Either PR closes this issue; my review of each is on its thread.One detail for whichever lands: the report's sentence is still the old one ("named by neither CMakeLists.txt nor scripts/pre-pr-checks.sh"), which is false for these four — they are named, just not beside a marker. The verdict is right and the sentence is not, and this row's whole subject is verdicts that overstate what they looked at.
bong-water-water-bong commentedon Nov 21, 2026
Two open PRs close this, same two files, and one is the other's superset — measured before both cost a build
Seventh instance of the shape today, so: the numbers, read from the diffs and the merged instrument rather than from the titles.
pr_branch_stale_checkfix/3216-selftest-beside-name)CMakeLists.txt(+8),tools/ci/tool_selftest_wired_check.py(+35/−12)−12cl-infra/3216-wired-marker)CMakeLists.txt(+11), same checker (+87/−32)−32Both make the same rule real — a self-test counts as wired only when the line that names the tool is the line that runs it — and both change the same checker plus the same CMake row. #3220 is the larger and already carries a verdict; #3219 is the smaller and has none.
Neither has a stale-base problem, which is worth saying because the instrument's "removes N line(s)" reads like one: both counts equal their own deletions (
−12,−32), so a rebase is mechanical for whichever survives. That is the same trap I nearly fell into on #3168 an hour ago — the tool counts a PR's intended deletions too.Not mine, and I am not picking: one of the two should land and the other closed with its branch deleted, because after the merge the survivor's checker change is the only one that can matter and the loser's is dead code. Every earlier pair today (#3048, #3049, #3060, #3087, #3116, #3171) resolved that way without spending two builds.
bong-water-water-bong commentedon Nov 21, 2026
Claiming this, and the blast radius you asked for first is 94 tools → 91 wired / 3 named-for-another-flag / 0 unwired under the tightened rule (name + marker on the same line):
census_counters_check.py—.github/workflows/census.yml:76,78(--check --root .)dupdef_check.py—CMakeLists.txt:387(--check)stale_expectations_check.py—CMakeLists.txt:788(--root …)So a hard-failing tightening reds three rows on day one ⇒ the fix reports the new class separately and counted, as you proposed.
I also measured the stricter form — the marker must appear after the tool's name on that line, so a marker belonging to another tool on the same line cannot vouch for it: identical 91/3/0 today, so the safer rule is free and that is what I am shipping.
And your live instance is already fixed:
CMakeLists.txt:1654now carriesadd_python_test(registry_build_self ${CMAKE_SOURCE_DIR}/tools/registry_build.py --self-test), added after you filed. The row exists; the checker's blindness is the remaining defect, which is exactly this issue. PR next.bong-water-water-bong commentedon Nov 21, 2026
Reopening this on the record rather than silently: #3219 closed it with the rule, and #3222 shows the shipped rule is one case short.
What #3219 landed (
6f124c746): a tool is wired when a reference line names it and carries a self-test marker on that line. That fixed the case this issue is about —registry_build.pyread as wired off its--check-gapsrows while eight arms ran nowhere — and all four instances (registry_build, dupdef, stale_expectations, census_counters) now have rows.What it does not do, measured on #3222's branch:
so a marker belonging to a different tool on the same line still vouches for the named one. And the shipped
unwired()still folds named for another flag into named by nothing, which is the distinction that made this defect invisible for a week — a lane reading the red row cannot tell which fix applies.#3222 is that refinement (positional rule + the three-way report, 6 self-test arms, blast radius 91/3/0 under both spellings) and needs a rebase onto
6f124c746plus this issue as its reference. Keeping it visible here so the remaining half is not lost because the first half landed.bong-water-water-bong commentedon Nov 21, 2026
One residual on the merged rule, measured while I was independently building the same fix (my #3222, closed as superseded by #3219). No action needed today; recording it so the next tightening does not have to re-measure.
The rule now requires the marker on the same line as the tool's name. It does not require the marker after the name, so a line that names two tools is vouched for by one marker:
I measured the stricter spelling (marker must appear after the name, so a marker cannot vouch for a tool named earlier on the same line) while deciding my version: over the same 94 self-test-carrying tools it gives identical results — 91 wired / 3 named-for-another-flag / 0 by nothing — so it is free on this tree, and no such line exists today, which is why this is a note rather than a PR.
Two things from the same pass that are worth having on the record:
census_counters_check.py,dupdef_check.py,stale_expectations_check.py— the three tool_selftest_wired_check: the marker has to sit on the line that names the tool (engine#3216) #3219 then wired. Two lanes arriving at the same three by different routes is the cheapest confirmation either measurement can get.--liststill distinguishes nothing for the middle class on the merged version: a tool named only for another flag is now simplyUNWIRED, so a lane reading--listcannot tell "wire it with one row" (the three that existed) from "this file is referenced by nobody" (the class the checker was built for). My closed branch marked itOTHERFLG; if the distinction is wanted later it is one label, but the merged behaviour is defensible — both are "nothing runs its arms".bong-water-water-bong commentedon Nov 21, 2026
Post-merge verification on
main(6f124c746) — the rule is live and it bites; one residual recorded.The four rows are there:
census_counters_self/dupdef_check_self/stale_expectations_selfatCMakeLists.txt:571-573,registry_build_selfat:1662. Full gate on main: 15 green / 2 skipped / 0 could-not-be-told (scripts/pre-pr-checks.sh --base origin/main --tree-only).Mutation, because "all referenced" is also what a check that cannot look prints. Built a root from main's own reference files (
CMakeLists.txt,scripts/pre-pr-checks.sh,cmake/,.github/) with the four*_selfrows removed and the four tools copied verbatim — the residual references are the real ones (CMakeLists.txt:387dupdef_check --check,:792stale_expectations_check --root,.github/workflows/census.yml:76,78census_counters_check --check):So main's green is the wiring, not the checker's blindness. For the record on the pair: the closed #3222 spelling reported the same mutant as
4 named only for another flagand exited 0 — which is why folding that class into the hard failure (what #3219 shipped) is the right shape, not a compromise.One residual, unchanged by #3219 and now unowned (#3220's and #3222's content, both closed): that failure sentence is false for exactly this class. Those four mutant tools are named in
CMakeLists.txt/census.yml, just not beside a marker, and the message says "named by neither" — sending the next lane to the wrong file. The docstring one-liner already has the right words ("named by no line that also carries a self-test marker"). Not opening a PR for it: the text is unreachable while the count is 0, so it should ride with the next real change totools/ci/tool_selftest_wired_check.py.Issue stays closed on that evidence.