Skip to content

Guard the tools that guard this repo: fail CI on a name nothing binds - #1395

Merged
andrewboudreau merged 1 commit into
mainfrom
ci/python-names
Aug 11, 2026
Merged

Guard the tools that guard this repo: fail CI on a name nothing binds#1395
andrewboudreau merged 1 commit into
mainfrom
ci/python-names

Conversation

@andrewboudreau

Copy link
Copy Markdown
Collaborator

Guards the tools that guard this repo

#1392 fixed a NameError that had blocked PR validation outright. The module was
bound as AP and read as asm_policy, on a branch only reachable when a file graded
NO-REPRO — so the first PR to contain a declared draft got a traceback instead of a
verdict, and the worker discarded the results it had already computed.

A gate's failure branch is the one path a green CI run never exercises. No ROM
build will ever catch a defect there — these tools are not compiled into the ROM — and
only static analysis reaches that code without running it. This is the job that stops
it happening twice. It finds the #1367 defect in under a second across all 186 tracked
Python files.

Narrow on purpose — this is the part worth arguing with

The gate fails on unresolvable names and unparseable files, and nothing else.
The tree has zero of those, so this lands green and every future red is a real
regression.

It also has 32 style findings — unused imports, unused locals, f-strings without
placeholders. Gating on those meant one of two bad outcomes: landing this red, or a
32-file cleanup commit in the same PR that buries the actual signal. A gate that lands
red gets switched off, and then it catches nothing at all.

So the style findings are counted on every run, listed under --advisories, and not
gated. Ratcheting them downward the way langmode-ratchet.yml does is a fair
follow-up — it needs a banked baseline, and this deliberately does not.

pyflakes is pinned to 3.0.1. A floating version can add a check, and this job
turning red on a PR that touched no Python would be indistinguishable from a real
regression — exactly the confusion a stale ratchet caused earlier this week.

Verified

  • The One banner rule instead of three, and let the PR gate fail a file that won't build #1367 defect, reconstructed verbatim, is caught:
    repro.py:5: undefined name 'asm_policy' → exit 1.
  • An unparseable file is caught, and reported separately from the name check.
  • 186 tracked files: 0 unresolvable, 0 unparseable, 32 advisory.
  • 7 tests pass under python -m unittest tools.test_check_python_names, which is how
    the workflow runs them — stdlib only, so the runner needs no dependency beyond the
    pinned pyflakes.
  • Adds no src/ or config/ change, so the ROM build is untouched.

The gate caught its own author on the way in: the first draft imported
pyflakes.reporter without using it and pushed the advisory count 32 → 33.

Run it locally

python tools/check_python_names.py               # every tracked *.py
python tools/check_python_names.py --advisories  # also list the style findings

🤖 Generated with Claude Code

https://claude.ai/code/session_01XxDmkQ47fWa3GB6mj8xEQe

#1392 fixed a NameError in tools/pr_linkcheck.py that had blocked PR validation
outright: the module was bound as `AP` and read as `asm_policy`, on a branch only
reachable when a file graded NO-REPRO. The first PR to contain a declared draft got a
traceback instead of a verdict, and the worker discarded the results it had already
computed. This is the gate that stops it happening twice.

A gate's failure branch is the one path a green CI run never exercises. No ROM build
will ever catch a defect there -- these tools are not compiled into the ROM -- and
only static analysis reaches that code without running it. pyflakes finds this one in
under a second across all 186 tracked files.

NARROW ON PURPOSE, and this is the part worth arguing with. The gate fails on
unresolvable names and unparseable files, and on nothing else. The tree has ZERO of
those, so it lands green and every future red is a real regression.

It also has 32 style findings -- unused imports, unused locals, f-strings without
placeholders. Gating on those would have meant one of two bad outcomes: landing this
red, or a 32-file cleanup commit in the same PR that buries the actual signal. A gate
that lands red gets switched off, and then it catches nothing at all. So the style
findings are counted on every run, printed with --advisories, and not gated.
Ratcheting them downward the way langmode-ratchet.yml does is a fair follow-up; it
needs a banked baseline, and this deliberately does not.

pyflakes is pinned to 3.0.1. A floating version can add a check, and this job turning
red on a PR that touched no Python would be indistinguishable from a real regression
-- which is exactly the confusion a stale ratchet caused earlier this week.

VERIFIED

  the #1367 defect, reconstructed verbatim, is caught:
      repro.py:5: undefined name 'asm_policy'   (exit 1)
  an unparseable file is caught, separately from the name check
  184 -> 186 tracked files, 0 unresolvable, 0 unparseable, 32 advisory
  7 tests pass under `python -m unittest tools.test_check_python_names`, which is how
  the workflow runs them -- stdlib only, so the runner needs no dependency beyond the
  pinned pyflakes

The gate caught its own author on the way in: the first draft imported
pyflakes.reporter without using it, and the advisory count went 32 -> 33.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxDmkQ47fWa3GB6mj8xEQe
@tangos-validator

tangos-validator Bot commented Aug 11, 2026

Copy link
Copy Markdown

✅ PR validation — Passed

noverify: no source/build-data changes in this PR

Each changed src/*.c|*.cpp is compiled and its relocated bytes compared to the binary data on a private build box. Passing requires every changed file to reproduce the ROM byte-for-byte with correct relocation targets — this catches WRONG-DEST relocations and non-reproducing near-misses that ledger-scoped linkcheck skips.

@andrewboudreau
andrewboudreau merged commit cc9f293 into main Aug 11, 2026
3 checks passed
@andrewboudreau
andrewboudreau deleted the ci/python-names branch August 11, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant