Repository navigation
ci: ratchet that every workflow-invoked gate script declares a test - #1915
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ci/local_suites.py+ci/test_local_suites.pyguard one direction: aci/test_*.pythat is wired into no entry point fails. Nothing guarded theother direction — a gate script that a workflow runs with
--failcouldhave no test at all, so the policy it enforces could be loosened (or silently
stop covering its input) and every job would stay green.
That is not hypothetical.
ci/check_python_complexity.pysat unguarded until#1911 and
ci/find_direct_subprocess.pyuntil #1913 — both had two livecontract bugs each (
<no reason given>accepted a bare allowlist marker; achar literal opened a phantom string and hid a real spawn). The class is
unbounded, so this PR replaces "remember to add a test" with a ratchet.
What
Measured inventory, not a guess: 26
cimodules are invoked from.github/workflows/*.yml(bothpython ci/<mod>.pyandpython -m ci.<mod>spellings). 18 have a covering test; 8 have none:
audit_ignored_tests,build_backend,build_qemu_linux_runtime,cancel_superseded,check_dylint_allowlists,check_fbuild_path_baseline,check_flash_offsets,validate_boards.Two of those were false positives in a plain-text sweep:
build_backendandvalidate_boardsare only mentioned as a path / lane-name string today, neverexercised — so the registry records them as untested rather than counting a
mention as coverage.
ci/gate_script_coverage.py— pure discovery + validation:invoked_modules()(both invocation spellings,test_*stems excluded),load_registry(),violations(root, registry, budget), and a--checkCLI(
--root,--registry,--budget).ci/gate_script_tests.toml—[scripts.<stem>].testsper gate, plusuntested = [...]for the eight open gaps.ci/test_gate_script_coverage.py— 16 tests: synthetic-fixture cases for everyfailure face (unregistered gate, entry nobody invokes, missing declared test,
test that never mentions its subject, stale
untestedentry, budgetoverrun,
-mspelling,test_*exclusion, schema mismatch, CLI exit code),then the real repository asserted against the same rules with
MAX_UNTESTED = 8.The ratchet fails when: a workflow invokes an undeclared module; a declared
entry is invoked by nobody; a declared test path is missing or never mentions
its subject; an
untestedentry keeps its slot after a test lands; or theuntestedlist grows past the pinned budget. So it can only shrink.Registered in both entry points (
ci/local_suites.pyDRIFT_UNITTEST_MODULESci-workflow-drift.ymlunittest step), per the ci(release): Authenticode-sign Windows release binaries via Azure Artifact Signing #1855 rule.Real output
python -m unittest ci.test_gate_script_coverage→ 16 tests, OKRan 143 tests in 4.494s)python -m ci.gate_script_coverage --budget 8on this checkout →Every workflow-invoked gate script is accounted forpython ci/bench_uv_run.pytoci-minimal.yml→bench_uv_run: invoked by ci-minimal.yml but absent from the registryuntestedentry →9 gate modules have no test, budget is 8check_glibc_floorat another test →check_glibc_floor: declared test ci/test_wheel_check.py never mentions itruff check(C901/RUF100 @10) clean on all changed files;ci/check_python_complexity.py→All checks passed!; drift YAML parses.No Rust changed, so no clippy/dylint surface.
Not in this PR
Backfilling tests for the eight listed gates is deliberately separate work —
this PR only makes the gap visible and prevents it from growing. Closing them is
tracked by the registry itself: each backfill must delete its
untestedentry,and the budget only ever goes down.