Repository navigation
Let the Read Be the Check in the checks/ Gates That Probe First - #573
Conversation
The carried Operations and Failure Messages rule says to attempt the operation and turn its failure into a clean refusal, rather than predicting it with an existence test. Each of these gates read a file after an exists() or is_file() probe. Each now reads directly and catches FileNotFoundError, keeping the message the probe gave. The robots.txt read moves ahead of the origin lookup so its except clause can hold the missing-file refusal, and its comment moves with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The strict review found the template loop probing with exists() before its read, the same class this change removes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
A recorded local strict-review pass covers head |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #573 +/- ##
===========================================
- Coverage 67.12% 66.95% -0.17%
===========================================
Files 11 11
Lines 2494 2503 +9
===========================================
+ Hits 1674 1676 +2
- Misses 820 827 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
The review found no active approval-blocking issues; the gates preserve existing diagnostics and fallback behavior, with only a non-blocking regression-test nit remaining.
No open issues 🎉
What changed in this PR
This pull request updates four checks/ gates to use direct file reads as their existence checks while preserving existing diagnostics and fallback behavior.
Changes:
- Replaces
exists()andis_file()probes with direct reads andFileNotFoundErrorhandling. - Preserves missing-file messages and empty-file fallbacks.
- Moves the
robots.txtread before origin lookup in the URL parity gate. - Leaves one non-blocking regression-test nit for the missing excludes-file path.
This pull request is ready to be approved.
| File | Description |
|---|---|
checks/url_parity_gate.py |
Directly reads robots.txt and the generated home page with existing missing-file handling. |
checks/text_pii_gate.py |
Directly reads exclusion and allow-list files while retaining empty defaults. |
checks/media_redactions_gate.py |
Directly reads declared media files before hashing them. |
checks/env_docs_gate.py |
Directly reads the environment documentation and templates with missing-file handling. |
Review effort: Lite
|
The overview's regression-test nit on the missing excludes-file path is listed in the body under "Pre-existing findings, not filed". The gap predates this change, which keeps that path's behavior. |
Summary
Brings the
checks/gates in line with the carriedCODESTYLE.mdrule "Let the real operation be the check, not a prediction of it", for #546.Each site below read a file after an
exists()oris_file()probe. Each one now reads directly and catchesFileNotFoundError, and keeps the message the probe gave:checks/env_docs_gate.py: the environment doc, and each env template, which the local review found as the same class in the same filechecks/media_redactions_gate.py: each declared filechecks/text_pii_gate.py: the archive excludes and the allow list, where an absent file still means emptychecks/url_parity_gate.py:robots.txtand the home pageThe
robots.txtread moves ahead of the origin lookup so itsexceptclause can hold the missing-file refusal. Its unchanged comment moves with it, which is why this pull request carries thecommentslabel. Every printed line and returned message stays the same.mainalready resolves the origin throughcollect_refsbeforecheck_robotsruns.The issue closes from the promotion pull request.
Local review
Two recorded local strict-review passes. The first raised 3 findings, the second 1.
exists()probe.GOVERNANCE.md"Trust Boundaries and Hardening Effort": catching onlyFileNotFoundErrorlets a directory or not-a-directory path, whichis_file()used to read as missing, fail with a traceback that names the path. Every input is this repository's own content or its own build output, and that failure is loud, not silent or destructive.Pre-existing findings, not filed
checks/url_parity_gate.py:124,style: the local prose gate'ssentence-lengthrule flags the moved comment, whose text this change did not write. The CI-pinned prose gate carries no such rule.checks/tests/test_text_pii_gate.pyTree,test-coverage: the tree always writes.github/prose-gate-excludes, so the absent-excludes path inexcluded_prefixeshas no test. That gap predates this change, which keeps the path's behavior. Raised in the hosted review's overview on019e7588.Verification
python3 -m unittest discover -s checks/tests: 200 tests, OK.url_parity_gate.pypasses against a freshhugobuild.ruff checkandruff format --checkonchecks/: clean.🤖 Generated with Claude Code