Guard the tools that guard this repo: fail CI on a name nothing binds - #1395
Merged
Conversation
#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
✅ PR validation — Passednoverify: no source/build-data changes in this PR Each changed |
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.
Guards the tools that guard this repo
#1392 fixed a
NameErrorthat had blocked PR validation outright. The module wasbound as
APand read asasm_policy, on a branch only reachable when a file gradedNO-REPRO— so the first PR to contain a declared draft got a traceback instead of averdict, 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 notgated. Ratcheting them downward the way
langmode-ratchet.ymldoes is a fairfollow-up — it needs a banked baseline, and this deliberately does not.
pyflakesis pinned to 3.0.1. A floating version can add a check, and this jobturning 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
repro.py:5: undefined name 'asm_policy'→ exit 1.python -m unittest tools.test_check_python_names, which is howthe workflow runs them — stdlib only, so the runner needs no dependency beyond the
pinned pyflakes.
src/orconfig/change, so the ROM build is untouched.The gate caught its own author on the way in: the first draft imported
pyflakes.reporterwithout using it and pushed the advisory count 32 → 33.Run it locally
🤖 Generated with Claude Code
https://claude.ai/code/session_01XxDmkQ47fWa3GB6mj8xEQe