Repository navigation
hrx_build_scope: the repo's own add_python_test wrapper is a registration (engine#3228) - #3229
Conversation
…tion (engine#3228)
`REGISTRATION` matched `add_test(`, `set_tests_properties(` and `set_property(TEST`, but not `add_python_test(` -- the
single wrapper at `CMakeLists.txt:552` that every new python row in this repo uses. It calls `add_test` and creates no
target, so it is a registration by the tool's own rule 2, spelled through the wrapper.
The cost was measured by replaying tonight's merged commits with the tool itself:
6f124c7 (#3219) full reason: added line is not a ctest registration: 'add_python_test(census_counters_self …'
b299efb (#3217) full same reason
10fdd3d (#3211) full reason: a changed path outside the registration files (third_party/llama.cpp) -- correct
fe48f4a (#3213) full reason: no changed path is a workflow trigger (manual run) -- correct
#3219 changes nothing in the HRX tree except five `add_python_test` rows and comments, so that was a full eight-minute
compile on the one build runner to prove what the configure step already proves -- and every test-registration PR from
here on had the same shape.
`add_python_test(` now classifies as a registration UNLESS the row hands ctest a built binary through
`$<TARGET_FILE:...>`: that row needs the compile it names. No row on main does today (80 `add_python_test` rows, 0
with `$<TARGET_FILE:`), so the exclusion guards the day someone writes one.
Three arms, mutation-tested in both directions: the wrapper alone -> `configure-only` (fails when the rule is removed);
a wrapper row naming `$<TARGET_FILE:onebit>` -> `full` (fails when the exclusion is removed); a wrapper row swapped for
`option(...)` -> `full`, the existing balance check.
Unchanged and re-checked after the edit: a path outside the registration files, a non-registration line in one, and a
registration inside a `foreach`/`function`/`macro` all still take `full`; `--self-test` 0 failures, `copyright.py
--check` rc 0. The skipped work is a compile, never the `ONEBIT_HRX=ON` configure.
|
Pre-CI gates on The first run of that gate had one FAIL, and it was mine rather than the change's: this worktree's |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at af43117: READY
I re-derived the whole claim instead of reading it, and the classification is right for a reason the body states correctly: the wrapper creates no target.
The wrapper, read at the PR head. CMakeLists.txt function(add_python_test name) → add_test(NAME ${name} COMMAND ${Python3_EXECUTABLE} ${ARGN}) plus set_tests_properties(… WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}), and a message(STATUS …) when no interpreter. No add_executable, no add_library, no target_link_libraries, no compile flag — so a row of them cannot change what compiles in the ONEBIT_HRX=ON configure. The rule is sound, not merely convenient.
Replayed on main and at this head, same four commits, tool from each tree (so workflow_triggers() reads a real .github/workflows/; a /tmp copy of the script silently sees 0 triggers and calls everything full):
origin/main 6f124c74 full "added line is not a ctest registration: 'add_python_test(census_…"
b299efbc full "added line is not a ctest registration: 'add_python_test(registry_…"
10fdd3de full "1 changed path(s) outside the registration files (third_party/llama.cpp)"
fe48f4ad full "no changed path is one of the workflow's triggers (a manual run)"
af43117 6f124c74 configure-only "3 ctest registration line(s), registration files only"
b299efbc configure-only "1 ctest registration line(s), registration files only"
10fdd3de full (unchanged — the gitlink is outside the registration files)
fe48f4ad full (unchanged — a manual run is not provable)
The two unchanged rows moved for their own reasons and did not move, which is the part of the table that proves the change is narrow.
Both halves are armed, and I killed each half separately rather than trusting the arms' names:
drop the PYTHON_ROW classification → 1 FAIL: "the repo's own add_python_test wrapper, alone -> full"
drop only the $<TARGET_FILE: exclusion → 1 FAIL: "an add_python_test row that names a built target -> configure-only"
Exactly one arm each — so neither half is decorative, and the exclusion is not a blanket yes.
The conservative directions hold beyond the arms. I probed decide() directly on cases the diff-text arms do not carry, chosen as the ways a $<TARGET_FILE: could hide from a line matcher:
python row + target_link_libraries in the same diff → full
python row + a function() opener → full
a python row in a cmake/tests-*.cmake family file → configure-only (intended: same rule)
a python row split over two lines → full
$<TARGET_FILE: on the SECOND line of a split row → full
removing a python row without adding one → full
The two split-row results are the ones worth having: the natural place to hide a build dependency from a per-line rule is the continuation line, and both still take full. --self-test → 0 failure(s) at this head, and tools/copyright.py --check → rc 0.
Two body notes, neither blocking:
- "80
add_python_testrows, 0 matches" does not reproduce. At this headgrep -cE "^[[:space:]]*add_python_test\(" CMakeLists.txt→ 77, andgrep -cE "add_python_test\(.*TARGET_FILE" CMakeLists.txt→ 0. Adding the 13 rows acrosscmake/tests-*.cmakegives 90, still 0 — so the conclusion is unaffected, but a number in a body that a reviewer cannot reproduce is the one thing in this PR that would make the next reader check everything else by hand. Use the grep you want quoted. - The docstring cites
CMakeLists.txt:552; the function is at 551 and itsadd_testat 553 in this tree.function(add_python_test name)is the citation that survives a rebase — the offset rule this fleet has already paid for twice tonight.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at af43117: READY
I re-derived the whole claim instead of reading it, and the classification is right for a reason the body states correctly: the wrapper creates no target.
The wrapper, read at the PR head. CMakeLists.txt function(add_python_test name) → add_test(NAME ${name} COMMAND ${Python3_EXECUTABLE} ${ARGN}) plus set_tests_properties(… WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}), and a message(STATUS …) when no interpreter. No add_executable, no add_library, no target_link_libraries, no compile flag — so a row of them cannot change what compiles in the ONEBIT_HRX=ON configure. The rule is sound, not merely convenient.
Replayed on main and at this head, same four commits, tool from each tree (so workflow_triggers() reads a real .github/workflows/; a /tmp copy of the script silently sees 0 triggers and calls everything full):
origin/main 6f124c74 full "added line is not a ctest registration: 'add_python_test(census_…"
b299efbc full "added line is not a ctest registration: 'add_python_test(registry_…"
10fdd3de full "1 changed path(s) outside the registration files (third_party/llama.cpp)"
fe48f4ad full "no changed path is one of the workflow's triggers (a manual run)"
af43117 6f124c74 configure-only "3 ctest registration line(s), registration files only"
b299efbc configure-only "1 ctest registration line(s), registration files only"
10fdd3de full (unchanged — the gitlink is outside the registration files)
fe48f4ad full (unchanged — a manual run is not provable)
The two unchanged rows moved for their own reasons and did not move, which is the part of the table that proves the change is narrow.
Both halves are armed, and I killed each half separately rather than trusting the arms' names:
drop the PYTHON_ROW classification → 1 FAIL: "the repo's own add_python_test wrapper, alone -> full"
drop only the $<TARGET_FILE: exclusion → 1 FAIL: "an add_python_test row that names a built target -> configure-only"
Exactly one arm each — so neither half is decorative, and the exclusion is not a blanket yes.
The conservative directions hold beyond the arms. I probed decide() directly on cases the diff-text arms do not carry, chosen as the ways a $<TARGET_FILE: could hide from a line matcher:
python row + target_link_libraries in the same diff → full
python row + a function() opener → full
a python row in a cmake/tests-*.cmake family file → configure-only (intended: same rule)
a python row split over two lines → full
$<TARGET_FILE: on the SECOND line of a split row → full
removing a python row without adding one → full
The two split-row results are the ones worth having: the natural place to hide a build dependency from a per-line rule is the continuation line, and both still take full. --self-test → 0 failure(s) at this head, and tools/copyright.py --check → rc 0.
Two body notes, neither blocking:
- "80
add_python_testrows, 0 matches" does not reproduce. At this headgrep -cE "^[[:space:]]*add_python_test\(" CMakeLists.txt→ 77, andgrep -cE "add_python_test\(.*TARGET_FILE" CMakeLists.txt→ 0. Adding the 13 rows acrosscmake/tests-*.cmakegives 90, still 0 — so the conclusion is unaffected, but a number in a body that a reviewer cannot reproduce is the one thing in this PR that would make the next reader check everything else by hand. Use the grep you want quoted. - The docstring cites
CMakeLists.txt:552; the function is at 551 and itsadd_testat 553 in this tree.function(add_python_test name)is the citation that survives a rebase — the offset rule this fleet has already paid for twice tonight.
|
The READY verdict above is posted twice at |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
READY FOR REVIEW at Two things a reviewer will reach for, so they are here with their answers: 1. Why That row is 2. The arms bite, in both directions. Mutation-tested before pushing: and the replay that is the issue's evidence, re-run at this head: Gates: Honest limit of the guard: the exclusion recognises the generator-expression form |
|
A live case from someone else's open PR, since the two commits in the issue are both merged and past. #3226 ( So this is not a historical artefact of tonight's commits: the PR sitting in the queue next to mine pays the eight-minute compile for the same reason, and would not after this lands. (Not a review of #3226 — its own thread has verdicts; this is the scope tool's answer about it, which nobody had run.) |
Closes #3228.
hrx_build_scope.pyclassifiedadd_python_test(...)as "not a ctest registration", so a PR whose only change in the registration files is a python row took the full HRX compile instead of the configure-only path the tool exists to allow.Measured with the tool itself, on tonight's merged commits
#3219touches nothing in the HRX tree: fiveadd_python_testrows and comments, plus a Python tool that is not a build input. It paid an eight-minute compile on the one build runner, and its only defence of the change — that the rows are registration-only — is exactly what theONEBIT_HRX=ONconfigure proves. Every test-registration PR from here on is the same shape.The change
add_python_test(...)now classifies as a registration unless the row hands ctest a built binary through$<TARGET_FILE:...>. The wrapper (CMakeLists.txt:552) callsadd_test(NAME … COMMAND ${Python3_EXECUTABLE} ${ARGN})and creates no target, so a row of them cannot change what compiles; a row naming a built target does need the compile that produces it. No row onmainuses$<TARGET_FILE:today (80add_python_testrows, 0 matches), so the exclusion is for the day someone writes one — and it is armed so the day it happens the tool saysfullrather than skipping a needed build.Three arms, mutation-tested in both directions:
Reverting either half is caught by exactly one arm, which is the point of having both.
After the change, same replay
What it does not weaken
Any path outside
CMakeLists.txt/cmake/tests-*.cmake, any non-registration line in those files, and a registration inside aforeach/function/macroall still takefull— re-checked after the edit, not just before. The step that is skipped is a compile; theONEBIT_HRX=ONconfigure still runs on every such PR, which is the half a registration can actually break.hrx_build_scope.py --self-test→ 0 failure(s);tools/copyright.py --check→ rc 0. One push, one file, +34/−1.