Skip to content

ci: ratchet that every workflow-invoked gate script declares a test - #1915

Merged
zackees merged 1 commit into
mainfrom
agent/gate-test-coverage
Nov 5, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/gate-test-coverage

Conversation

@zackees

@zackees zackees commented Nov 5, 2026

Copy link
Copy Markdown
Member

Why

ci/local_suites.py + ci/test_local_suites.py guard one direction: a
ci/test_*.py that is wired into no entry point fails. Nothing guarded the
other direction — a gate script that a workflow runs with --fail could
have 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.py sat unguarded until
#1911 and ci/find_direct_subprocess.py until #1913 — both had two live
contract bugs
each (<no reason given> accepted a bare allowlist marker; a
char 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 ci modules are invoked from
.github/workflows/*.yml (both python ci/<mod>.py and python -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_backend and
validate_boards are only mentioned as a path / lane-name string today, never
exercised — 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 --check CLI
    (--root, --registry, --budget).
  • ci/gate_script_tests.toml — [scripts.<stem>].tests per gate, plus
    untested = [...] for the eight open gaps.
  • ci/test_gate_script_coverage.py — 16 tests: synthetic-fixture cases for every
    failure face (unregistered gate, entry nobody invokes, missing declared test,
    test that never mentions its subject, stale untested entry, budget
    overrun, -m spelling, 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 untested entry keeps its slot after a test lands; or the
untested list grows past the pinned budget. So it can only shrink.

Registered in both entry points (ci/local_suites.py DRIFT_UNITTEST_MODULES

Real output

  • python -m unittest ci.test_gate_script_coverage → 16 tests, OK
  • hosted self-test set: 127 → 143 tests, OK (Ran 143 tests in 4.494s)
  • python -m ci.gate_script_coverage --budget 8 on this checkout →
    Every workflow-invoked gate script is accounted for
  • RED, each face in the real repo (then reverted):
    • adding python ci/bench_uv_run.py to ci-minimal.yml →
      bench_uv_run: invoked by ci-minimal.yml but absent from the registry
    • that script plus a 9th untested entry →
      9 gate modules have no test, budget is 8
    • pointing check_glibc_floor at another test →
      check_glibc_floor: declared test ci/test_wheel_check.py never mentions it
  • ruff 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 untested entry,
and the budget only ever goes down.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees
zackees added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 0ce6f13 Nov 5, 2026
31 checks passed
@zackees
zackees deleted the agent/gate-test-coverage branch November 5, 2026 12:43
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant