Repository navigation
tests: the sweep also asks whether a tool's self-test ever runs (#1901) - #1908
bong-water-water-bong wants to merge 1 commit into
Conversation
…ne#1901) #1824's row covers tests/*.sh, so a tools/*.py that advertises a self-test and is registered nowhere is invisible to it -- the same defect one directory over. A tool that ships --self-test is claiming it can be verified without its real inputs; if nothing runs it, the claim is unbacked and the arm rots in the same commits as the logic. NARROW on purpose: a blanket rule over tools/*.py flags 16 of 60 sampled files, most of which are hand-invoked by design, and a row that fails on those is a row someone disables. The rule is the promise the file makes itself: declares a self-test => must be referenced. Measured on this tree: exactly ONE such file (tools/whisper_encoder_baseline.py), whose self-test needs no pack, no network and no device and passes by hand -- so it is registered as a row (add_python_test, the helper #1891 introduced) rather than allow-listed. KNOWN LIMITATION, recorded in the code: a mention or an import satisfies the rule without the self-test executing. tools/mtp_head_pb16i_exact.py imports mtp_head_ref, and neither runs mtp_head_ref.py --self-test. Tightening the rule to require "--self-test" on the same line as the basename was tried and is WRONG the other way: tools/seal_manifest.py advertises a self-test but is exercised through its subcommands by tests/seal_manifest_test.sh, so the strict form flags a tool that genuinely runs. Both directions measured before choosing this one. Verified on a git-archive extract of main (no worktree: / is under this lane's build gate): before registering: rc=1 naming whisper_encoder_baseline.py and nothing else after registering: all 84 required script(s) are referenced (1 deliberately not a row: anchor_rerun.sh) rc=0 ci_targets_check unchanged: 9 baseline, none new rc=0 --self-test: 15 arms, 0 failures (three new: tool-with-self-test unreferenced -> drift, registered -> clean, hand-invoked tool with no self-test -> not drift, which is the arm that keeps this from becoming blanket).
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 6bbbec4: CHANGES
Checked at 6bbbec4. --self-test passes and --check at this head gives rc 0.
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 rule keys on the literal "--self-test" (tests_referenced_check.py:129), so the four tools spelled --selftest are invisible to it. On top of that, a mention anywhere satisfies it, a limitation its own comment states (:113-117). It finds one of the five. #1911 finds all five. I'd close this in its favour.
|
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". |
|
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 6bbbec4 — 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. |
|
VERDICT: READY at What it addsThat is the right narrowing, and the reason is in the body: "the #1824 sweep asked whether every Verified: it bites, with a remedy in the messageThree properties: a count in the green line (so a scan that found nothing cannot pass), the single deliberate exception named rather than absorbed into a number, and a failure message that gives both remedies. That is the same shape The note about my earlier recommendationI recommended landing |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Consolidation: #1901 now has four PRs, and #1911 is the one to merge — close this.
The set: #1910 and #1911 (both extend tools/ci/tests_referenced_check.py), #1912 (a new parallel tool), and this one (extends the #1824 sweep). Four implementations of one audit question.
#1911 is the strongest on the two things that decide correctness:
- the predicate: a tool is unregistered when no RUNNER names it — "CMakeLists/cmake/workflows — a citation in another tool's source is not a runner: that is the 5-vs-2 difference". A predicate that counts mentions reports two tools when the answer is five;
- the measured cost: all five run device-free at 58-277 ms, so they are rows rather than allow-list excuses — which forecloses the obvious objection to registering them.
So merge #1911 and close the other three. What this PR says well and should survive: "it asks the same question of a tool that promises it can be verified" — that framing (a --self-test is a claim, and an unrun claim is unbacked) is the clearest reason the audit exists.
|
Closing as superseded — and by a better implementation than this one. What landed on Three things in it are better than my attempt, and I want them on the record rather than buried in a closed PR:
What this PR still had that main does not: nothing that matters — the one For anyone reading the history: my #1824 row and this change are the same sweep, and the two-lane path to it (mine narrow, theirs precise) is why the final rule has both a stated limitation and a registered corpus. |
Fixes #1901. The #1824 sweep asked whether everytests/*.shcan be run by something; this asks the same question of a tool that promises it can be verified, and stops there.The rule, and why it is narrow
A blanket rule over
tools/*.pywould flag 16 of 60 sampled files — most tools here are invoked by hand by design, and a row that fails on them is a row someone disables within a week. The property that is not negotiable is the one the file states about itself: declares a--self-test⇒ something must run it.On this tree that is exactly one file,
tools/whisper_encoder_baseline.py. Its self-test needs no pack, no network and no device and passes by hand, so it becomes a row (add_python_test, the helper #1891 introduced) rather than an allow-list entry — an allow-list line would have been the weaker answer here, since the tool is genuinely cheap to run.The limitation, measured in both directions before choosing
A mention or an import satisfies the rule without the self-test ever executing:
tools/mtp_head_pb16i_exact.pyimportsmtp_head_ref, and nothing runsmtp_head_ref.py --self-test. So I tried the strict form first — reference counts only if the mentioning file passes--self-testto it — and it is wrong the other way:tools/seal_manifest.pyadvertises a self-test but is exercised through its subcommands bytests/seal_manifest_test.sh, so the strict rule flags a tool that genuinely runs. A row with false positives is worse than a row with one known false negative, so the loose rule stays and the import-only case is written down in the code as the known gap. Both directions are commented where the rule lives, so the next person does not have to re-derive that trade-off.Verified on a
git archiveextract of main (no worktree —/is under this lane's build gate)Three of those arms are new and they are the argument for the rule's shape: tool with a self-test and no runner → drift, registered → clean, and hand-invoked tool with no self-test → not drift, which is the arm that keeps this from silently becoming the blanket version.