Repository navigation
ci: a self-test is wired only when the line that names the tool also runs it (engine#3216) - #3220
bong-water-water-bong wants to merge 2 commits into
Conversation
…runs it engine#3216. `tool_selftest_wired_check` matched the tool's BASENAME anywhere in a reference source, so a tool wired for a different subcommand counted as wired while its arms ran nowhere. The live case is `tools/registry_build.py`: #3214 merged eight `--self-test` arms and CMakeLists names the tool only for `--check-gaps`/`--check-pins`/`--check`, so a row whose whole subject is "a self-test nothing runs" printed *94 self-test-carrying tool(s), all referenced* and stayed green. Blast radius, measured on 20594af before writing the rule (94 self-test-carrying tools): named only for ANOTHER flag = 4 -- registry_build.py, census_counters_check.py (named only in census.yml, for `--check`), dupdef_check.py, stale_expectations_check.py -- and none of the four runs its arms through an indirection (no .py/.sh/.yml/.cmake names any of them beside a marker), so the tightening loses nobody. The rule is now two conditions on ONE line: it names the tool AND carries `--self-test`/`--selftest`/`selftest`. `classify()` returns three classes -- wired / named for another flag / named nowhere -- and main() reports the middle one separately with the exact row to add, because "named" and "run" are the two things this check used to confuse. `--list` marks the class as NO-MARKER so a lane can see why its row is red. With the rule tightened but nothing else changed, main's own tree fails -- which is the point: $ python3 tools/ci/tool_selftest_wired_check.py --root . tool_selftest_wired_check: 4 of 94 self-test-carrying tool(s) are named only for ANOTHER flag … rc=1 So the same commit wires them, one `add_python_test(<name> … --self-test)` row each (all four self-tests pass: registry_build ok, dupdef_check ok, stale_expectations_check ok, census_counters_check ok), and the tree is green again on the new rule: **94 of 94 wired by a line that runs them, rc 0**. Arms: the self-test grows three (7 total) -- the registry_build shape is reported as its own class rather than wired, a name WITH a marker still counts as wired, and `--list` shows the new class -- plus the existing cannot-read-is-None arm is unchanged.
|
#3219 and #3220 are the same fix for engine#3216, opened two minutes apart — keep #3220, and I am saying so in both threads rather than leaving a reviewer to diff them. Both diagnose the same defect and add the same missing rows ( So #3220 is the one to keep. If #3219 has a line #3220 lacks, say which and fold it in — but a 47-line and a 119-line version of one rule is exactly the shape that leaves two behaviours in a tree after a year. The reason this matters beyond the pair: this is the fourth duplicate pair today (#3195/#3198, #3199/#3202, #3201/#3203, now #3219/#3220), and all four are invisible to |
|
Flagging before the red row rather than after: #3219 and #3220 are the same fix for #3216, opened 32 seconds apart, and they cannot both merge. Same issue, same two files, so the second to merge is a guaranteed conflict — and The substantive question is what the other 55 lines buy: #3220 is +55/−20 larger. If that is the blast-radius census and the self-test arms #3220's body describes, the right outcome is probably the larger PR keeping the smaller one's title-level claim rather than simply closing #3220 for age — but the two authors can see that faster than I can, so:
What I would check in the survivor, having watched this class of change twice today: that the new rule fails on the old shape (a tool named on one line and its self-test invoked elsewhere) and not merely on a synthetic fixture — the failure mode for a I have no code in this race and I am not opening one; this is the duplicate note the checker would have posted 20 minutes later, with the sizes and the order in it. |
|
VERDICT at 2f9d5e2: READY — and of the two open PRs for #3216 this is the one to land, because it is a strict superset rather than a variant. Why this oneBoth PRs make the same core change — reference lines rather than one concatenated blob, and a wiring means the tool's basename and a self-test marker on the same line (with the That separation is the point of the issue: Measured hereThe tree is fully wired at this head (after #3214 and #3217 added their rows), so the check is green on the real tree and its teeth are in the arms — which is the only place they can be until someone adds an unwired tool on purpose.
|
|
VERDICT at 073a9ef: READY — with one ask about the sentence, because the verdict is right and the message is not. Measured against main, not arguedI ran this PR's checker on a current Four, all four covered by the rows this PR adds, so the tightening lands green with no tool left behind — the number engine#3216 asked for, produced by your implementation rather than by hand. The regression arm is the right one and it is the reason I would take this copy: chk([pathlib.Path("registry_build.py")],
unwired([Path("registry_build.py")], "add_test(NAME registry_gaps COMMAND tools/registry_build.py --check-gaps)"),
"a tool named ONLY for another flag is unwired (engine#3216)")That fails on the old implementation, which is exactly what an arm for a check-that-could-not-look has to do. The workflow-comment arm from #2675 survives too. The ask: the report still says the wrong thing about why
For the four above that sentence is false —
I would take the first: the whole lesson of #3216 is that a report whose sentence and verdict disagree costs someone an hour, and here the verdict is right. I have asked #3219 to close into this one — same tightening, fewer changes, and it does not carry the arm for the live case. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 2f9d5e2: READY
The detector change is right, and I checked it the way that matters: run against main's tree, it finds the real instances and prints the fix for each.
$ python3 tools/ci/tool_selftest_wired_check.py (this PR's file, main's tree)
tool_selftest_wired_check: 4 of 94 self-test-carrying tool(s) are named only for ANOTHER flag, so their arms never run:
tools/ci/census_counters_check.py (named at .github/workflows/census.yml but with no --self-test there; wire it: add_python_test(<name> … --self-test))
tools/ci/dupdef_check.py (named at CMakeLists.txt but with no --self-test there; …)
tools/ci/stale_expectations_check.py (…)
tools/registry_build.py (…)
That is the whole defect in one run — a tool named for --check-gaps/--check counted as wired while its eight arms ran nowhere — and the row now names the class separately, tells the reader the fix, and --self-test covers both directions (a marker with no name is still not a wiring; a name with a marker on the line is). The four CMake rows are the instances, so the row goes green for the right reason rather than by relaxing the rule.
--self-test here: 7 arms pass, including ...and --list shows it as NO-MARKER, so a lane can see why the row is red.
Merge-order hazard, measured (this is the part to act on)
Three PRs are open on this subject and all three add a row named registry_build_self:
pr/3217 add_python_test(registry_build_self … --self-test) (its own engine#3212 follow-up)
pr/3219 add_python_test(registry_build_self … --self-test)
pr/3220 add_python_test(registry_build_self … --self-test)
Merging any two of them is textually clean (git merge-tree --write-tree pr/3217 pr/3220 → rc 0) and semantically broken: the merged CMakeLists.txt carries two add_python_test(registry_build_self …) lines, and add_python_test is add_test(NAME ${name} …) (CMakeLists.txt:551-553), so configure fails with "add_test given test NAME registry_build_self which already exists" — every build red, from a pair the GitHub badge calls MERGEABLE. That is the census-counter shape from this morning, one file over.
Resolution is one line for whoever lands second: drop its own registry_build_self row and keep the other change. If #3220 merges first, #3217 keeps only its cache-pruning half; if #3217 merges first, this PR drops one of its four rows.
|
Closed in favour of #3219 ( Mine is also broken in a way that is the duplicate itself: the build died at Configure with Nothing of mine is lost. My verdict at #3219's head carries the two things worth keeping: the independently measured blast radius (on Branch deleted with this close. If the reviewer prefers #3219 minimal, the class split can live as a separate follow-up against the same issue rather than as a second PR tonight. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
Your red Cause: add_python_test(registry_build_self ${CMAKE_SOURCE_DIR}/tools/registry_build.py --self-test)Your branch adds the identical line ( Fix is a rebase onto current Worth saying plainly: the row I landed exists because |
…es the tool (engine#3216) `unwired()` matched the tool's basename anywhere in the reference sources, so a tool wired for a *different subcommand* counted as wired: `tools/registry_build.py` got an eight-arm `--self-test` in #3214 while CMakeLists.txt named it only for `--check-gaps`/`--check-pins`/`--check`, and this row -- the one whose subject is exactly that -- said "94 self-test-carrying tool(s), all referenced" while those arms ran nowhere. The rule is now per LINE: some non-comment reference line must name the tool AND carry a self-test marker. The docstring already said `--self-test` alone is not a reference, because the flag's spelling appears in every file that has one; the half it was missing is that the name alone is not one either. Blast radius measured on `main` = `20594af` before changing anything (the number the issue asked for): tools with a --self-test 94 named beside a self-test marker 90 named ONLY for another flag 4 tools/ci/census_counters_check.py (.github/workflows/census.yml:76) tools/ci/dupdef_check.py (CMakeLists.txt:387) tools/ci/stale_expectations_check.py (CMakeLists.txt:788) tools/registry_build.py (CMakeLists.txt:1639) Four, not a class -- so this lands as the hard rule with the rows wired in the same change instead of an advisory phase that would have to be revisited. `registry_build_self` is NOT added here: main gained it independently in #3212/#3217 (`if(Python3_Interpreter_FOUND)` block), and adding it a second time is the `add_test … already exists` configure error that reddened #3220. The other three are new: add_python_test(census_counters_self … --self-test) all three pass here add_python_test(dupdef_check_self … --self-test) add_python_test(stale_expectations_self … --self-test) plus two arms in the tool's own `--self-test`: "a tool named beside a `--self-test` is wired" and "a tool named ONLY for another flag is unwired", the live case written against `registry_build.py` itself. `tool_selftest_wired_check --self-test` rc 0; the check itself reports 94 of 94 wired, 0 unwired; `ci_targets_check` "none new"; `python_test_order_check --check` ok; `copyright.py --check` rc 0. Rebased onto `10fdd3d` (#3211): the tree configures (`cmake_configure_check --check`, the row the duplicate would have failed) and all four self-test rows pass through ctest there, `registry_build_self` as main's own #232.
…es the tool (engine#3216) (#3219) `unwired()` matched the tool's basename anywhere in the reference sources, so a tool wired for a *different subcommand* counted as wired: `tools/registry_build.py` got an eight-arm `--self-test` in #3214 while CMakeLists.txt named it only for `--check-gaps`/`--check-pins`/`--check`, and this row -- the one whose subject is exactly that -- said "94 self-test-carrying tool(s), all referenced" while those arms ran nowhere. The rule is now per LINE: some non-comment reference line must name the tool AND carry a self-test marker. The docstring already said `--self-test` alone is not a reference, because the flag's spelling appears in every file that has one; the half it was missing is that the name alone is not one either. Blast radius measured on `main` = `20594af` before changing anything (the number the issue asked for): tools with a --self-test 94 named beside a self-test marker 90 named ONLY for another flag 4 tools/ci/census_counters_check.py (.github/workflows/census.yml:76) tools/ci/dupdef_check.py (CMakeLists.txt:387) tools/ci/stale_expectations_check.py (CMakeLists.txt:788) tools/registry_build.py (CMakeLists.txt:1639) Four, not a class -- so this lands as the hard rule with the rows wired in the same change instead of an advisory phase that would have to be revisited. `registry_build_self` is NOT added here: main gained it independently in #3212/#3217 (`if(Python3_Interpreter_FOUND)` block), and adding it a second time is the `add_test … already exists` configure error that reddened #3220. The other three are new: add_python_test(census_counters_self … --self-test) all three pass here add_python_test(dupdef_check_self … --self-test) add_python_test(stale_expectations_self … --self-test) plus two arms in the tool's own `--self-test`: "a tool named beside a `--self-test` is wired" and "a tool named ONLY for another flag is unwired", the live case written against `registry_build.py` itself. `tool_selftest_wired_check --self-test` rc 0; the check itself reports 94 of 94 wired, 0 unwired; `ci_targets_check` "none new"; `python_test_order_check --check` ok; `copyright.py --check` rc 0. Rebased onto `10fdd3d` (#3211): the tree configures (`cmake_configure_check --check`, the row the duplicate would have failed) and all four self-test rows pass through ctest there, `registry_build_self` as main's own #232. Co-authored-by: bong-water-water-bong <[email protected]>
Fixes #3216. The checker matched the tool's name anywhere in a reference source; it now requires the self-test marker on the same line, and the four tools that were hiding behind the old rule are wired in this same commit.
Blast radius, measured before the rule was written
On
20594af02, 94 self-test-carrying tools:The four, with the line that fooled it:
None of the four runs its arms through an indirection — no
.py/.sh/.yml/.cmakein the tree names any of them beside a marker — so the tightening loses nobody, which is the number the issue asked for before deciding hard-failure vs advisory. It lands as a hard failure, with the class reported separately from "named nowhere" because the fix differs (one row) and because "named" and "run" are the two things this check used to confuse.--listmarks the classNO-MARKER.With the rule tightened and nothing else changed, main's own tree fails — that is the point
So this commit wires them — one row each, all four self-tests pass on this tree (
registry_buildok,dupdef_checkok,stale_expectations_checkok,census_counters_checkok) — and the tree is green on the new rule:Arms
The self-test grows from four to seven: the
registry_buildshape is reported as its own class, not wired; a name with a marker is still wired; and--listshowsNO-MARKERso a lane can see why its row is red. The existing arms (a tool nobody names, a tool that only spells the flag, a workflowrun:line counts while a workflow comment does not, an unreadable source isNonenot"") are unchanged.One note for whoever adds a tool next: a future tool wired through an indirection (
pytest tests/x_test.pyimporting it) would be reported as this class. That is deliberate — the message names the indirection's file and the one row that fixes it — and there is none in the tree today.