Repository navigation
fix(gates): run every program a gate calls under a bound - #297
Merged
Merged
Conversation
CI Results
All checks passed. |
stxkxs
force-pushed
the
claude/gates-bounded-calls
branch
from
November 27, 2026 09:20
c25b124 to
33a217b
Compare
A gate that lets subprocess.TimeoutExpired escape ends through the traceback with status 1, the status every gate gives a finding, so a slow renderer or a stalled clone read as a defect in this repository. Three calls had no bound at all: the kustomize builds in check-alert-severity-routes and check-burn-rate-budgets, and git ls-files in check-workflow-id-masking. gatelib.run runs a program under a timeout and exits CANNOT_RUN, naming the call and its bound, when the program runs it out or cannot start. Every gate now runs programs through it: 13 call sites across 12 gates. check-image-verification and check-image-vulnerabilities keep their own calls, which already handle the expiry. validate-dashboards exits CANNOT_RUN rather than 1 when grafana.com stays unreachable after every retry, through an entry() a test reaches. test_gatelib covers the helper's outcomes and reads every script's syntax tree: a subprocess call outside a try that handles TimeoutExpired, or one with no timeout, fails it, as does a urlopen with no timeout. Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
…red code to its source The reader in test_gatelib took a subprocess call as bounded only inside a try whose handler names TimeoutExpired. A handler naming a class it derives from catches it too, SubprocessError, Exception or everything, and the vendored masking gate's git ls-files is bounded in exactly that way. The reader now accepts those, and refuses a handler for anything else. The files scripts/vendored.json records are landing-zone's bytes, and the gate reading the record fails a copy that differs from it. Four calls in their self-tests still let an expiry escape: check-workflow-id-masking.py lines 2002, 2449 and 2457, and mask-aws-ids.py line 357. Those are fixed in landing-zone and re-vendored, so the reader holds the files this repository writes and reads the exemption from the record itself. Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
stxkxs
force-pushed
the
claude/gates-bounded-calls
branch
from
November 27, 2026 09:35
33a217b to
d678139
Compare
CI Results
All checks passed. |
1 similar comment
CI Results
All checks passed. |
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.
When a gate lets
subprocess.TimeoutExpiredescape, it ends through the traceback with status 1, the status every gate gives a finding. So a slow renderer or a stalled clone read as a defect in this repository. Two calls had no bound at all: the kustomize builds incheck-alert-severity-routes.pyandcheck-burn-rate-budgets.py. This PR puts every program a gate runs under a bound, makes a bound that runs out read as could-not-run, and adds a test that keeps it that way.What changed
gatelib.run. It runs a program under a timeout. When the program runs its bound out, or cannot start, it exitsCANNOT_RUN, naming the call and its bound.check-image-verification.pyandcheck-image-vulnerabilities.pykeep their own calls, which already handle the expiry.validate-dashboards.pyexitsCANNOT_RUNrather than 1 when grafana.com stays unreachable after every retry. It does this through anentry()a test reaches.scripts/tests/test_gatelib.pycovers the helper's outcomes and reads every script's syntax tree. It fails:trythat catches the expiry;urlopenwith no timeout.A handler counts if it names
TimeoutExpired, a class that derives it (SubprocessError,Exception), or no class at all. A handler for anything else doesn't count.The vendored files are left to landing-zone. The files
scripts/vendored.jsonrecords are landing-zone's bytes, and the gate reading the record fails a copy that differs. So the reader reads the exemption from that record.check-workflow-id-masking.pylines 2002, 2449 and 2457, andmask-aws-ids.pyline 357.git ls-filesis already bounded and handled upstream. This branch's earlier edit to that file is dropped, and its bytes are landing-zone's.Checks run on this branch
At this head (
c25b124, rebased onto68320f3), under Python 3.15.2 with the lock installed--require-hashes:COVERAGE_REQUIRED=1 coverage run --rcfile=.coveragerc scripts/tests/run.py: 1497 tests across 42 modules pass, and all 23 per-file floors hold.scripts/tests/controls.py: 25 controls complete a proof.scripts/tests/empty-corpus.py: all 36 probed gates refuse an empty corpus.check-workflow-id-masking.pyon this tree: OK. Its three vendored files are the bytes their record names.I didn't re-run the reverify harness at this head; CI runs it.
Generated by Claude Code