Skip to content

Let the Read Be the Check in the checks/ Gates That Probe First - #573

Merged
ptr727 merged 2 commits into
developfrom
chore/checks-read-is-the-check
Oct 30, 2026
Merged

ptr727 merged 2 commits into
developfrom
chore/checks-read-is-the-check

Conversation

@ptr727

@ptr727 ptr727 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Brings the checks/ gates in line with the carried CODESTYLE.md rule "Let the real operation be the check, not a prediction of it", for #546.

Each site below read a file after an exists() or is_file() probe. Each one now reads directly and catches FileNotFoundError, 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 file
  • checks/media_redactions_gate.py: each declared file
  • checks/text_pii_gate.py: the archive excludes and the allow list, where an absent file still means empty
  • checks/url_parity_gate.py: robots.txt and the home page

The robots.txt read moves ahead of the origin lookup so its except clause can hold the missing-file refusal. Its unchanged comment moves with it, which is why this pull request carries the comments label. Every printed line and returned message stays the same. main already resolves the origin through collect_refs before check_robots runs.

The issue closes from the promotion pull request.

Local review

Two recorded local strict-review passes. The first raised 3 findings, the second 1.

  • Fixed: the env template loop's exists() probe.
  • Declined under GOVERNANCE.md "Trust Boundaries and Hardening Effort": catching only FileNotFoundError lets a directory or not-a-directory path, which is_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's sentence-length rule 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.py Tree, test-coverage: the tree always writes .github/prose-gate-excludes, so the absent-excludes path in excluded_prefixes has no test. That gap predates this change, which keeps the path's behavior. Raised in the hosted review's overview on 019e7588.

Verification

  • python3 -m unittest discover -s checks/tests: 200 tests, OK.
  • The env docs, media redactions, and text PII gates pass on the tree, and url_parity_gate.py passes against a fresh hugo build.
  • Each missing-file branch, exercised in process against an empty directory, prints the same message as before.
  • ruff check and ruff format --check on checks/: clean.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 30, 2026 07:59
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>
Copilot AI lite review requested due to automatic review settings October 30, 2026 15:05
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 30, 2026
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 69610956-afd3-4774-a142-b2e01c9aeb88
  • 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

Comment @coderabbitai help to get the list of available commands.

@ptr727

ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 019e75884ffe2cae00c8a105e457ba7d8b48d6c9, the content this pull request carries at that commit against develop, and it recorded 1 finding.

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 28.00000% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.95%. Comparing base (3b107de) to head (019e758).

Files with missing lines Patch % Lines
checks/env_docs_gate.py 0.00% 6 Missing ⚠️
checks/url_parity_gate.py 0.00% 6 Missing ⚠️
checks/media_redactions_gate.py 0.00% 5 Missing ⚠️
checks/text_pii_gate.py 87.50% 1 Missing ⚠️
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     
Flag Coverage Δ
python-3.13 66.95% <28.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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() and is_file() probes with direct reads and FileNotFoundError handling.
  • Preserves missing-file messages and empty-file fallbacks.
  • Moves the robots.txt read 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

@ptr727

ptr727 commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

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.

@ptr727
ptr727 merged commit bea0be0 into develop Oct 30, 2026
13 checks passed
@ptr727
ptr727 deleted the chore/checks-read-is-the-check branch October 30, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants