Skip to content

Add a File-Naming Audit Check and Check Secret-File Stem Casing - #3253

Merged
ptr727 merged 7 commits into
developfrom
feature/auto-3141
Oct 20, 2026
Merged

ptr727 merged 7 commits into
developfrom
feature/auto-3141

Conversation

@ptr727

@ptr727 ptr727 commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds the audit check #3141 asks for. It measures the file-naming rule that CODESTYLE.md "Script and Utility File Names" states.

  • file-naming, new in spec/audit.py. file_naming_findings reports, at drift, a .py stem that is not lowercase snake_case. It also reports a .sh, .ps1, .cmd, or .bat stem, or an extensionless executable's name, that is not lowercase-hyphenated, and an upper-case extension. Pester's .Tests.ps1 suffix is set aside. A snake_case launcher beside a .py of the same stem in its own directory keeps that stem. Two cases are reported for judgment rather than as a break: a launcher whose .py sits only in another directory, and an extensionless executable with no shebang or no readable text. The tree read now keeps each blob's mode. Only a non-conforming extensionless executable has its text read, for its shebang.
  • The former helper name is reported. hub-fetch-run.py is a break here. The check does not use CARRIED_PYTHON_HELPERS as an exemption, per the comment on Add a File-Naming Audit Check and Secret-Stem Casing #3141.
  • runtime-secrets stem casing. secret_stem_findings reports a file in a repo-scoped .secrets/ directory whose stem, the name before its first dot, is not lowercase snake_case. The directory's own README.md, .gitignore, and .gitkeep are not secret files.
  • Catalog and docs. spec/project-types.json gains the file-naming dimension (filenaming.scripts), and runtimesecrets.naming gains the stem rule. AUDIT.md section 4 gains the dimension and names both in the mechanized subset, and reports/_template.md gains its row.
  • Shared helpers. blob_field projects the tree read for every caller. capped_paths now also serves the python-directories finding's five-path cap.
  • Tests. --selftest covers each conforming and failing shape over constructed trees, and tests/test_audit.py covers the audit_repo call site, the modes reaching the check and the shebang read going to the audited branch.

The check reports three of the hub's own files under host-setup/agent-safety/claude/. That tree is worked only in an attended session, so #3251 tracks renaming them. #3252 tracks a way to record a tool-fixed name other than Pester's, which the check cannot know.

Closes on promotion: #3141

Local strict review: three passes recorded. The first raised 8 findings, and 6 were fixed. The fixes are the extensionless wrapper exemption, read errors left to surface as the run's ERROR, the secret-file wording, the tool-fixed exemption wording, the tree projection, and the shared cap. The hub's own names went to #3251. The 100644 shebang case was declined, since a file without the executable bit is not an executable. The second raised 2: the lowercase-extension wording was fixed, and the tool-fixed exemption record was deferred to #3252. The third raised none.

The fix push for Copilot's two findings (9665343) took three more passes. The first raised 3. Two were fixed: a docstring sentence was split, and an extensionless launcher beside its .py now goes to judgment, since it may be an installed command (431cb35). The third, a test pinning the failed shebang read as an ERROR, also landed in 431cb35. The second raised 2. The wrapper-exemption wording was fixed in 58e9a23. A .cmd, .bat, or .ps1 launcher beside its .py was declined, since CODESTYLE's wrapper exemption names fetch_report.ps1 as keeping the tool's stem. The third raised 2 after that push's edit budget was spent. Each now has an outcome:

  • introduced, fixed in the next push: the filenaming.scripts assert in spec/project-types.json listed the judgment cases without the extensionless executable whose text cannot be read, which the code, its docstring, and AUDIT.md all name.
  • introduced, declined: repo_tree_entries as a one-line shim over blob_field(repo_tree_blobs(...), 0), on the premise that repo_tree has no production caller. spec/fidelity_honesty.py:177 calls audit.repo_tree, and tests/test_audit.py covers the modes reaching the check.

The pass over that last push raised none.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Repository audits now check script filenames across supported languages and executable files.
    • Runtime secret filenames are validated for lowercase snake_case stems.
    • Audit results identify naming violations and cases requiring manual review.
    • File modes and unreadable files are handled more accurately during audits.
  • Documentation

    • Audit guidance now documents script naming rules, secret-file naming requirements, exceptions, and the file-naming reference.

ptr727 and others added 3 commits October 19, 2026 19:04
spec/audit.py now reports script file names that break CODESTYLE.md
"Script and Utility File Names", and secret-file stems under a
repo-scoped .secrets/ directory that are not lowercase snake_case, both
at drift. A file the per-extension patterns cannot decide is reported
for judgment instead of as a break. The tree read now keeps each blob's
mode, so an extensionless executable is found, and only one whose name
does not conform has its text read for a shebang.

The file-naming dimension and the extended runtimesecrets.naming check
are added to spec/project-types.json, AUDIT.md section 4, and the report
template.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Errors

An extensionless launcher beside a .py of the same stem now keeps that
stem, the same as a launcher with an extension. The shebang read no
longer turns a failed gh call into a judgment entry, so it surfaces as
the run's ERROR like every other read. One helper projects the tree's
blobs, and the python-directories finding uses the shared path cap.

The runtime-secrets text now names secret files rather than every file,
and the file-naming text says Pester's suffix is the one tool-fixed name
the mechanical check knows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The check already reports an upper-case extension as a break. AUDIT.md
and spec/project-types.json now say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 20, 2026 02:25
@ptr727

ptr727 commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 3ac4bf5598e2ba4667c2b0a29c1ff0b18cc14239, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 23cec034-be6b-4183-9f2b-cfd62d7b3a99
📥 Commits

Reviewing files that changed from the base of the PR and between 7b33c97 and 11e55eb.

📒 Files selected for processing: 5
  • AUDIT.md
  • reports/_template.md
  • spec/audit.py
  • spec/project-types.json
  • tests/test_audit.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The repository audit now checks script filenames and runtime-secret file stems. It reads blob modes to identify executable files and reports findings or cases that require manual judgment.

Changes: Repository naming audit

Layer / File(s) Summary
Declare naming rules
spec/project-types.json, AUDIT.md, reports/_template.md
The rules define script naming conventions, exceptions, and lowercase snake_case runtime-secret stems. The audit documentation and report template include the new checks.
Implement naming checks
spec/audit.py
The audit retrieves blob modes and checks supported script filenames, executable files, and secret-file stems. It includes exemptions, undecidable cases, and capped findings.
Run checks during audits
spec/audit.py, tests/test_audit.py
Repository audits invoke the checks with tree modes and a content reader. Tests cover naming results, executable and shebang handling, secret stems, and read failures.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 11e55

The naming audit appears ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 2 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies both primary changes: the new file-naming audit check and secret-file stem-casing validation.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 2 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Restrict secret matching to direct .secrets children and surface failed shebang reads instead of reporting judgment findings.

2 open issues
What changed in this PR

Adds automated audit checks for script filename conventions and runtime-secret stem casing, with catalog, documentation, report, and test updates.

Changes:

  • Adds file-naming and secret-stem detection.
  • Preserves executable modes and tests shebang handling.
  • Updates specifications, documentation, templates, and integration coverage.
File Summary
tests/​test_audit.py Tests audit integration, modes, and shebang handling.
spec/​project-types.json Registers the new audit dimensions.
spec/​audit.py Implements naming checks and tree-mode handling.
reports/​_template.md Adds the file-naming report row.
AUDIT.md Documents the new checks and scope.

Review effort: Lite

Comment thread spec/audit.py Resolved
Comment thread spec/audit.py Resolved
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.52174% with 60 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@7b33c97). Learn more about missing BASE report.

Files with missing lines Patch % Lines
spec/audit.py 56.52% 60 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #3253   +/-   ##
==========================================
  Coverage           ?   65.48%           
==========================================
  Files              ?       17           
  Lines              ?     9923           
  Branches           ?        0           
==========================================
  Hits               ?     6498           
  Misses             ?     3425           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 65.48% <56.52%> (?)

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.

ptr727 and others added 3 commits October 19, 2026 19:31
A secret file sits directly in .secrets/, as its **/.secrets/* ignore
rule reads it, so a file nested below the directory is no longer read as
one. The shebang read no longer accepts a 404, since the tree already
listed the path as a blob, so a failed read surfaces as the run's ERROR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An extensionless launcher beside a .py of the same stem may be an
installed command, which takes a hyphenated name, and the tree cannot
say which it is, so the check now reports it for judgment rather than
passing it. A test now covers a failed shebang read raising rather than
reading as undecided.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tated

The wrapper exemption now reads as covering a launcher with an
extension, matching the check, and AUDIT.md names each case it reports
for judgment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 58e9a232100d4b3d44b24ff5a2270e64e1d6395d, the content this pull request carries at that commit against develop, and it recorded 2 findings.

@ptr727

ptr727 commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 11e55eb8a893466f0daa7d163018ad99006a3ab3, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit 8577f22 into develop Oct 20, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/auto-3141 branch October 20, 2026 03:22
ptr727 added a commit that referenced this pull request Oct 20, 2026
…and File-Naming Check to Main (#3266)

## Summary

Promotes eight pull requests from develop. Three are `pr_review.py`
reader fixes from this round, one answers this promotion's first review,
and four are from other sessions.

- #3261: each heading, thematic-break, and fence shape in `pr_review.py`
has one primitive that every reader composes from. A no-break space
after a heading's hashes no longer opens a heading, and a tab-spaced
thematic break or setext underline closes its block.
- #3262: when `wait` returns `50` at once on an uncounted-verdict head
while a check has not concluded, it names a bounded `gh pr checks
--watch` to watch the checks with.
- #3264: `CODE_SPAN` reads code spans, raw inline HTML, and autolinks
left to right, as GitHub binds them, so a backtick inside an earlier
HTML comment, tag, or autolink opens no span. A line of only blockquote
markers now ends a paragraph.
- #3256: `pr_review.py wait` reads a superseded run's failed aggregator
as superseded rather than as a verdict on the head.
- #3258: a `driftNote` can exempt a tool-fixed script name from the
file-naming check.
- #3253: an audit check for file naming, including secret-file stem
casing.
- #3249: the Linux quick start names the no-sudo Debian case.
- #3267: splits the over-long and two-instruction sentences that this
promotion's first Copilot round found in #3249's paragraph.

Closes #3241
Closes #3246
Closes #3235
Closes #3252
Closes #3254
Closes #3141
Closes #2551

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants