Repository navigation
ci: a tools/*.py that declares a self-test and no runner names is now a failing row (engine#1901) - #1911
Conversation
… a failing row (engine#1901) The #1824 sweep is specific to tests/*.sh, so the same defect in tools/*.py was invisible -- and a tool that ships a --self-test is claiming it can be verified without its real inputs, so an unregistered one is an arm nobody runs. The predicate is the point: 'registered' means a RUNNER (CMakeLists.txt, cmake/, .github/workflows/), not a mention in another tool's source. That is the 2-vs-5 difference -- measured 2 with the wide corpus, 5 with the runner-only one, and 5 is honest because tools/mtp_head_ref.py is only cited by two other tools. - tests_referenced_check.py gains the second sweep, with the corpus and the reasoning in its docstring, plus three self-test arms (a tool arm no runner names, a citation is not a runner, a registered one is clean). - The five (batched_repeat, logprob_agree, mtp_head_ref [--selftest], spec_decode_acceptance, whisper_encoder_baseline) are registered as rows, not excused: all pass device-free in 58-277 ms. My first version used the raw ${Python3_EXECUTABLE} form above find_package(Python3) and the repository's own ordering guard named all five lines; ctest then showed tool_selftest_mtp_head_ref BAD_COMMAND because that file is the one of the five without an exec bit. They are add_python_test rows now, after the find_package. Red/green: delete one registration -> the sweep fails naming that tool; restored -> 73 scripts + 21 tool self-tests registered, 0 failures. Under ctest: 9/9 passed in 2.13 s.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at cdd2b65: READY
Checked at cdd2b65. tests_referenced_check --self-test gives 0 failures. --check at this head gives rc 0 ("… 21 tool self-test(s) are registered").
Ground truth on current main (extracted tree): the tools/**/*.py that name a --self-test/--selftest flag, minus those a runner invokes (CMakeLists.txt, cmake/*.cmake, .github/workflows/*.yml) and minus those exercised through their own registered tests/*_test.* (gsm8k_eval, mtp_depth_pool, q4nx_diff, seal_manifest, split_ceiling). That leaves five whose self-test nothing runs: batched_repeat, logprob_agree, mtp_head_ref, spec_decode_acceptance (all spelled --selftest) and whisper_encoder_baseline (--self-test). Each of the four #1901 PRs, run against that tree:
| PR | flags on main |
registers |
|---|---|---|
| #1908 | whisper_encoder_baseline only |
whisper_encoder_baseline |
| #1910 | batched_repeat, logprob_agree, mtp_head_ref, whisper_encoder_baseline, + template_bom |
the same |
| #1911 | all five | all five; each --selftest/--self-test passes when run directly |
| #1912 | whisper_encoder_baseline only |
whisper_encoder_baseline |
All four conflict-or-overlap on Fixes #1901 (#1908, #1910 and #1911 conflict pairwise; #1912 adds a second checker), so one should land.
This is the one I'd land. It is the only one that catches both spellings. Its "a runner, not a mention" predicate is what separates the five from the tools tools/ merely imports, and it registers exactly the five, each of which passes. Close #1908, #1910 and #1912 in its favour. Then #1906's CONTRIBUTING bullet needs a clause for this gate.
VERDICT at
|
|
Duplicate of #1910 — please take that one and close this. Four PRs landed on engine#1901 within the same hour (this one, #1910, #1911, I compared all four on the two things that decide it — does the rule catch the right set and are the tools it names actually run:
The two false positives are worth knowing whichever PR merges, because both made the rule noisy on its first run and both were caught by running
#1911 registers Nothing wrong with the code here — same rule, same shape — this is purely "one of four, and the fourth is the most complete". |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at cdd2b65
This is the version of #1901 to merge, and it wins on three things the siblings do not have:
- the predicate is defined against a runner, not a mention — "counts
tools/**/*.pythat declare one and are named by no RUNNER (CMakeLists/cmake/workflows — a citation in another tool's source is not a runner: that is the 5-vs-2 difference)". That parenthetical is the whole correctness of the check: a self-test cited in another tool's comment or help text is not executed by anything, and a predicate that counts mentions would report two tools when the answer is five. - the five are measured, not excused — "all five run device-free and fast (58-277 ms measured), so they are rows rather than allow-list excuses". 58 ms is the tightest and it is still a row; that measurement is what forecloses the obvious objection to registering them all.
- it uses
add_python_test(engine#1864's helper) and says why it had to — "my first version used the raw${Python3_EXECUTABLE}form above thefind_packageand the repository's own ordering guard caught it by name —tools/mtp_head_ref.pyis the one of the five without an exec bit, and it became BAD_COMMAND under ctest." That is the ordering defect (#1864) reproduced by a live author, caught by the repository's own guard, on exactly the tool that would have failed silently. It is the best evidence yet that the guard earns its place.
Consolidation: #1910 and #1912 fix the same #1901. #1910 is a twin of this in the same file (tools/ci/tests_referenced_check.py), and #1912 adds a separate tool that asks the same audit question one directory over — a second home for one question, which is how the two answers drift apart. Merge this, close both.
|
A cluster note on the four #1901 PRs — I reviewed all four and only one should land.
All four pass their own My recommendation, and the reason: land one implementation inside Between the three in-file versions I have no strong preference: #1910's |
|
Coordination: four PRs And a coverage gap all four share, with numbers from the tree: A matcher that only knows |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at cdd2b65 — correct rule, but it is one of three variants in this file; land whichever fills the rule best and close the others (see the cluster note above).
|
VERDICT: READY at Cluster: #1908, #1910, #1911, #1912 are all None is an ancestor of another. The three that touch What I would doKeep one of the in-place extensions and close the other two with pointers. The rule being added — a Of the three, #1911 carries the clearest statement of the defect ("the #1824 sweep is specific to #1912 stays defensible only if the rule is genuinely different in kind rather than in directory — in which case say why, because that is the whole argument for a second tool. |
Correction to my READY, measured rather than read: this registers 4 of the 6, one of them redundantlyI checked Six tools declare a self-test and have no ctest row on This PR registers
Details on #1901. The detector's rule is the part to fix before either lands: keyed on What I still want kept from this PR: the |
…the full notice (engine#2018)
CI went red on "Copyright notice on every file", and my PR body had claimed it would not: a `.txt` has no comment style of
its own, so being in EXEMPT is what gives it one, and the notice it then wants is the FULL Apache block rather than the two
SPDX lines I wrote. Two corrections, both mine:
tools/copyright.py "unreferenced_py_tests.txt" beside add_test_gaps.txt and unreferenced_tests.txt, same
reason -- a `#`-comment data file
tools/ci/unreferenced_py_tests.txt the full licence header, then the prose that explains the baseline
Verified by running the checkers against a git-archive extract: `tools/copyright.py --check` rc=0 (it failed with
"no comment style known" before the exemption and "missing copyright notice" with only the SPDX lines), and
`tools/ci/tests_referenced_check.py --check` still rc=0 with the two-entry baseline.
Second time tonight I asserted a copyright.py behaviour without checking it -- the first was `unreferenced_tests.txt` in
#1911, where the same two-line-header assumption cost a red build. The rule to keep: run the repo's own check on the
extract before pushing, not after.
… correcting the issue's count) (#2088) * tests: the sweep covers tests/*_test.py too, as a set baseline (engine#2018) #1824's row covers tests/*.sh and #1911's covers tools/*.py that declare a self-test; tests/*_test.py was outside both, so a python test whose runner was never added reads as green for ever -- the same defect, in the file kind most new tests are written in. Landing shape follows the repo's own precedent for existing debt (tools/ci/add_test_gaps.txt, engine#1595): a SET baseline (tools/ci/unreferenced_py_tests.txt) rather than 35 allow-list entries with invented reasons. The check FAILS on a name that is not in the baseline and REPORTS a baseline line whose file is registered now, so the list can only shrink. The corpus for this rule is RUNNERS (CMakeLists.txt, cmake/, .github/workflows), not "any mention": a test importing another test is a citation, which is the distinction #1911 established for tools. A file another test imports is therefore not counted -- that is what separates a test from a helper without guessing. CORRECTION to #2018's headline, found while building this: the issue says "6 of 20 sampled tests/*_test.py have no runner" and the true figure is **2 of 42**. The first version of this rule scanned RUNNERS, which holds one FILE (CMakeLists.txt) and two directories, and tested is_dir() on all three -- so every add_python_test(...) registration in CMakeLists.txt was invisible and 35 of 42 looked unregistered. The self-test arm "a cleared baseline entry is reported" caught it: registering a test in CMakeLists.txt did not clear its line. Two independent hand checks confirm the remaining two (tests/hyperloom_benchmark_test.py, tests/moe_expert_chunks_accum_test.py: zero mentions in CMakeLists.txt, cmake/*.cmake and the workflows). Verified on a git-archive extract of main in ~/.cache/scratch-pkg (not /tmp; it is tmpfs): clean tree + 2-entry baseline -> rc=0, "40 python test(s) are registered" a NEW unregistered tests/*_test.py -> rc=1 naming it a test imported by a sibling test -> not counted a baseline line whose test is registered -> reported as no longer needed, rc=0 a baseline line dropped for a real gap -> rc=1 --self-test -> 17 arms, 0 failures (two new) * tests: exempt the new baseline from the copyright check, which needs the full notice (engine#2018) CI went red on "Copyright notice on every file", and my PR body had claimed it would not: a `.txt` has no comment style of its own, so being in EXEMPT is what gives it one, and the notice it then wants is the FULL Apache block rather than the two SPDX lines I wrote. Two corrections, both mine: tools/copyright.py "unreferenced_py_tests.txt" beside add_test_gaps.txt and unreferenced_tests.txt, same reason -- a `#`-comment data file tools/ci/unreferenced_py_tests.txt the full licence header, then the prose that explains the baseline Verified by running the checkers against a git-archive extract: `tools/copyright.py --check` rc=0 (it failed with "no comment style known" before the exemption and "missing copyright notice" with only the SPDX lines), and `tools/ci/tests_referenced_check.py --check` still rc=0 with the two-entry baseline. Second time tonight I asserted a copyright.py behaviour without checking it -- the first was `unreferenced_tests.txt` in #1911, where the same two-line-header assumption cost a red build. The rule to keep: run the repo's own check on the extract before pushing, not after.
…ot just written (Refs #1503, #1911, #2018) Reviewing #2018/#1911 caught this PR in its own trap: tools/npu_pack_components.py declares --selftest and nothing ran it, which is exactly the pattern #1911 added a sweep for. Registered as ctest 'npu_pack_components' beside the existing tools/*.py --self-test precedent (device_holders). Pure python, no pack, no device, no network.
…ot just written (Refs #1503, #1911, #2018) Reviewing #2018/#1911 caught this PR in its own trap: tools/npu_pack_components.py declares --selftest and nothing ran it, which is exactly the pattern #1911 added a sweep for. Registered as ctest 'npu_pack_components' beside the existing tools/*.py --self-test precedent (device_holders). Pure python, no pack, no device, no network.
…ries (Refs #1503) (#1886) * tools: list a pack's components, including the sibling vision directories (Refs #1503) Qwen3.5_4B/9B are not one flat pack: the root holds the text component and the vision graph ships as a sibling directory, in one of two forms -- compiled (dd_metastate_Llm_Vision_Vision_node_conv3d.fconst) in partitioned/, or ONNX (vision.onnx + .onnx.data + vision_strategy.yaml) in partitioned_patch1_sdgemm_leftover/. The engine has no notion of these directories yet, so a loader that reads only the root runs text-only and nothing says so. This makes the discovery rule checkable before the loader learns it: a directory is a component when it holds a compiled metastate set or an ONNX graph, the pack root is always 'text', and variant selection stays the caller's decision -- the tool lists every component with its form rather than picking one. Verified on the real pack (~/scratch-packs/qwen35_4b: text compiled 1872.1 MiB, partitioned compiled 360.1 MiB, patch1 onnx 84.7 MiB) and by --selftest, which needs no pack: three components across both forms, a directory with no graph ignored, an empty directory refused. Refs #1503 * tests: register the pack-component selftest, so the rule is run and not just written (Refs #1503, #1911, #2018) Reviewing #2018/#1911 caught this PR in its own trap: tools/npu_pack_components.py declares --selftest and nothing ran it, which is exactly the pattern #1911 added a sweep for. Registered as ctest 'npu_pack_components' beside the existing tools/*.py --self-test precedent (device_holders). Pure python, no pack, no device, no network.
Fixes #1901. The #1824 sweep is specific to
tests/*.sh, so the same defect intools/*.pywas invisible — and a tool that ships a--self-testis claiming itcan be verified without its real inputs, so an unregistered one is an arm that is maintained beside the logic and never executed.
The predicate is the disagreement in the issue, and it is worth settling
"Registered" means a runner —
CMakeLists.txt,cmake/,.github/workflows/— not a mention anywhere intools/:The 5 is the honest number:
tools/mtp_head_ref.pyis only cited by two other tools (mtp_head_pb16i_exact.py,mtp_acceptance.cpp), and a citation never runsanything. That distinction is written into the docstring so the next reader does not re-derive it.
What the change is
tools/ci/tests_referenced_check.pygains the second sweep (unregistered_selftest_tools), reported and failed like the first, with three new--self-testarms:a tool arm no runner names is drift; a citation in another tool's source is not a runner; a registered one is clean.
batched_repeat68 ms,logprob_agree65 ms,mtp_head_ref200 ms,spec_decode_acceptance58 ms,whisper_encoder_baseline277 ms. Notemtp_head_refspells its flag--selftest; the sweep accepts both.Red and green
Through ctest, after a real configure: 9/9 passed in 2.13 s (
tool_selftest_*×5,tests_referenced×2,python_test_order_check×2).My first version was wrong, and the repository caught it
I wrote the five as raw
add_test(… ${Python3_EXECUTABLE} …)lines placed abovefind_package(Python3), andtests/python_test_order_check.pynamed all five:ctest then agreed in the way that guard exists for:
tool_selftest_mtp_head_ref→ BAD_COMMAND, because that file is the one of the five without an exec bit, sowith an empty interpreter ctest handed the
.pyto the kernel as a program. They areadd_python_testrows now, after thefind_package. Keeping this in thecommit message and here because it is the second time tonight a guard in this repo caught my own change — the first was the flat fixture in #1778 — and both times
the guard was cheaper than the review would have been.