Skip to content

Promote the Block-Shape Primitives, Left-to-Right Code Span Reading, and File-Naming Check to Main - #3266

Merged
ptr727 merged 8 commits into
mainfrom
develop
Oct 20, 2026
Merged

ptr727 merged 8 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

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.

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

🤖 Generated with Claude Code

ptr727 and others added 7 commits October 19, 2026 18:47
Name the no-sudo Debian case in the Linux quick start of
host-setup/README.md: the one root step (through `su -l root -c`) that
installs `sudo curl ca-certificates tar` and adds the account to the
`sudo` group, then logging out and back in. The doc route only,
`bootstrap.sh` detection is not in scope.

Closes on promotion: #2551

Local strict review: three passes recorded. The last raised one grammar
note on the opening clause of the new paragraph, left to this pull
request's review per the spent edit budget.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
## 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 #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](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## 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.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…py wait (#3256)

## Summary

`scripts/pr_review.py wait` read a failed check from a superseded
workflow run as a verdict on the head and exited `44`. The usual cause
is a closed and reopened pull request. GitHub cancels the first run,
whose aggregator then fails over the cancelled jobs, while the reopen's
run on the same head is still going and has not yet posted its own
aggregator.

- The rollup query now reads each check suite's `status` and its
workflow run's `databaseId`.
- `check_nodes` marks a check `superseded` when its name appears only in
an older suite of a workflow whose newest suite has not completed. It
records the newest run's id as `newer_run`.
- `check_shape` reads a superseded check as not stuck. It no longer
takes exit `44`, and a held wait still polls on it as settling.
- The digest prints `CHECK SUPERSEDED` for a superseded check that did
not pass, naming the newer run.
- Once the newer run completes, a check name it never posted stands as
the merge gate reads it.

Tests build the case from the issue: the first run's failed aggregator,
plus a second run of the same workflow still in progress. Reverting the
fix brings exit `44` back and the wait test fails. A held-wait case and
a case for a passed superseded check pin the other paths.

## Local review findings

The local pass's edit budget ran out on the first push. These two
findings were listed then and are now fixed:

- `introduced`, **fixed in d1f3038**: the newer run was found only
through check runs it had already posted, so a read could still return
`44` while the newer run waited on a concurrency slot. The head commit's
own `checkSuites` now count too.
- `introduced`, **fixed in d1f3038, wording again in 5410b07**: the
exit-44 help sentence could be read as the older run being the one still
running.

Later passes also had the change supersede only a finished check, state
the exception in `scripts/README.md`, and drop a dead clause.

Listed open after 255964b, when that push's edit budget was spent, and
now fixed:

- `introduced`, **fixed in c96856a**:
`test_a_superseded_check_that_passed_prints_no_superseded_line` never
asserted that the green check was marked `superseded`. If the marking
had stopped firing for that shape, the test would still have passed. The
pass over c96856a found nothing.

Closes on promotion: #3254

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Pull request checks now recognize when an older workflow run has been
superseded by a newer unfinished run.
- Failures from superseded runs are reported for visibility but do not
block merging.
  - Newly queued workflow runs are recognized even before checks appear.

- **Bug Fixes**
  - Completed failures remain blocking when no newer run is active.
  - Unfinished checks from older runs continue to be handled correctly.
- Exit status `44` is now limited to required checks that are stuck
while merging is blocked.

- **Documentation**
- Clarified how superseded checks and blocked merge outcomes are
reported.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…Check (#3258)

## Summary

The `file-naming` audit check knew one tool-fixed name, Pester's
`.Tests.ps1` suffix. Any other name a tool or platform fixes was
reported at drift on every run, with no way to clear it. A driftNote
naming `(filenaming.scripts)` did not help, since the note-freshness
check asked the auditor to delete it once the check passed, and it never
passed.

- A registry driftNote naming `(filenaming.scripts)` now exempts each
path it names as a code span, such as `` `tools/Install.ps1` ``. Only
those paths are exempt, so a break on any other path still reports.
- A named path the check no longer reports is a stale exemption, whether
it was renamed, deleted, made conforming, or was never a script. A note
naming no path is reported as exempting nothing.
- `driftnote_findings` skips the id through `DETECTION_SUPPRESSION_IDS`,
the way it already skips `python.directories.declared`. A `None` value
there means the suppression holds on every repository, and
`is_suppression_id` reads it.
- `notes_naming` and `quote_note` replace the lookup and the
note-quoting expression the suppression checks each repeated.
- The `filenaming.scripts` assert in `spec/project-types.json` and the
file-naming and driftNote wording in `AUDIT.md` now describe the
exemption.

Selftest cases built on constructed names cover a named path exempt with
an unnamed break still reported, an undecided path exempted, a stale
path (conforming and missing), a note naming no path, an id outside its
parenthesized form, and the note skipped by `driftnote_findings`.
Mutating out each of the exemption filter, the stale report, the no-path
report, and the freshness skip fails the selftest. `tests/test_audit.py`
asserts the new break message.

## Local review findings

The first local pass raised a stale expected message in
`tests/test_audit.py`, two duplicated expressions, guards the validated
registry made redundant, a misplaced constant, and new sentences over
the length limit. All are fixed in the second commit, and the second
pass found nothing. The three long sentences still at `AUDIT.md` line
206 predate this change.

Closes on promotion: #3252

🤖 Generated with [Claude Code](https://claude.com/claude-code)
## Summary

Gives each block shape in `scripts/pr_review.py` one spelling, and has
the other sites compose from it (#3241).

- `ATX_HEADING` and `THEMATIC_BREAK` hold the heading and thematic-break
shapes. `fence_opener` holds a fence's opening line, and `FENCE` passes
it capturing runs so its closer can repeat the opener's mark.
- `FENCE`, `INTERRUPTS_PARAGRAPH`, `MARKDOWN_HEADING`, `HEADING`, and
`coverage_statements`' block-closing test all compose from those
primitives. `LINE_END` moves up so `FENCE`'s closer can use it.
- A fuzz run over 300,000 constructed strings found `FENCE`'s matches
and `INTERRUPTS_PARAGRAPH`'s truthiness unchanged.

## Behavior that changes, each case checked against GitHub's renderer

- A no-break space after a heading's hashes no longer opens a heading.
Python's `\s` took one in `MARKDOWN_HEADING`, `HEADING`, and the
coverage closing test.
- A thematic break or setext underline spaced by tabs now closes its
block in `coverage_statements`. Before, it was read as paragraph text,
and an indented marker under it was read as stated coverage.
- A bare `#` line is now a heading, which GitHub renders as an empty
`<h1>`. The local review traced each call site: it ends a headline,
reports `heading: #` as unvetted, and stops a `<summary>` fold. Each of
those matches what GitHub renders.

Each case is pinned by a test, and each new assertion fails with the fix
reverted.

## Filed along the way

- #3259: `str.splitlines` splits a body where GitHub does not, so a
vertical tab or a form feed after a heading's hashes never reaches these
readers as one line.
- #3260: the heading readers' leading `\s*` takes a no-break space and
any indentation.

Refs #3241

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
## Summary

`pr_review.py wait` returns exit `50` within a second on every call on a
head whose round opens on an uncounted non-clean verdict, since nothing
reads an answer to that headline (#3246). So once the headline is
answered, `wait` cannot be used to wait for checks still running on that
head.

- Where a check on that head has not concluded, `wait` now prints a note
after the `50` status. The note names a bounded `timeout 1800 gh pr
checks <n> --repo <owner>/<repo> --watch` to watch the checks with, then
`status`.
- The gate is `checks_settling`, which leaves out a stuck check and
reads no branch rules. The local review ruled out `held_checks_open`,
which is about whether a held wait polls on: it fired on a DIRTY,
BEHIND, or UNKNOWN merge and on an empty rollup, and it printed an
unrelated rules-read note.
- No new exit code. The `scripts/README.md` exit-`50` paragraph says the
same.

Tests cover a running check, which names the watch and fails with the
change reverted. They also cover every check passed, a stuck check, and
no checks, each naming no watch, and both `held_checks_open` and a
`mergeStateStatus != "CLEAN"` gate fail them.

Refs #3246

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…w.py (#3264)

## Summary

GitHub binds a code span, raw inline HTML, and an autolink by which one
opens first (#3235). So a backtick inside an earlier HTML comment, tag
attribute value, processing instruction, declaration, CDATA section, or
URI or email autolink is literal and opens no span. `CODE_SPAN` paired
that backtick with a later one, so a live tag between them read as
quoted, and `unwrap` printed it raw.

- `CODE_SPAN` is now a `CodeSpans` reader. One alternation pattern reads
a span first, keeping its backtick run as group 1, then `INLINE_HTML`,
each match consuming its own text. `sub`, `finditer`, and `search`
report only spans, so every caller keeps the interface it used.
- `INLINE_HTML` follows the grammar GitHub's renderer showed for each
construct:
- a comment is `<!-->`, `<!--->`, or text not ending in `-` closed by
`-->`
  - a declaration takes an uppercase name and then whitespace
- an unquoted attribute value excludes a backtick, and a tag name
excludes a colon
- a tag's whitespace carries at most one line break inside the paragraph
  - a backslash before `<` escapes it
- `PARAGRAPH_BREAK` and `IN_PARAGRAPH` give the span and the multi-line
HTML readers one paragraph bound. That bound now also ends at a line
holding only blockquote markers, which GitHub ends a paragraph at,
quoted or not. Spans no longer pair across such a line either.
- Every opener and every near-miss in the tests was rendered on GitHub.
Over 200,000 constructed strings without a `<`, the reader's output
matches the old regex exactly.

## Decided in the local review

- **Declined: one attribute grammar for both readers.** `attributes()`
stays the lenient tail its tag readers share, and `TAG_ATTRIBUTE` is
CommonMark's stricter inline grammar, which is what decides span
binding. Merging them would make one of the two wrong. The
`attributes()` docstring now names the split.
- **Out of the threat model: quadratic cost on unclosed openers.**
Thousands of unclosed `<!--`, `<?`, or `<![CDATA[` openers in one
paragraph cost quadratic time. Reviewer bodies are not adversarial
input, and a constructed 196 KB bot-shaped body read in 9 ms.
- **Deferred to #3240: a sibling ordered list item.** A sibling item
numbered other than 1 still does not end a paragraph here, for spans as
before and now for an unclosed HTML opener too. That needs the container
tracking #3240 holds, and the case is commented there.
- **Filed as #3263:** a backtick inside a link destination or title, the
remaining opener-first construct.

## Local review findings listed open after the first push, now fixed

- `introduced`, **fixed in 8a7bd39**: the `attributes()` docstring said
the tail serves "every reader here looking for a named tag", but
`HTML_TAG` is built on it too and reads any tag name. Copilot raised the
same point.

Copilot also found that the HTML guard read `\\<` as an escaped `<`.
That is fixed in 8a7bd39 too, and the span opener's matching
approximation, which predates this PR, is filed as #3265.

Refs #3235

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 20, 2026 14:56
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 112e2d1e-4152-4068-8b3f-29cd5642b030
  • 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.

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.59322% with 93 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.49%. Comparing base (36251ed) to head (918e42c).
⚠️ Report is 405 commits behind head on main.

Files with missing lines Patch % Lines
spec/audit.py 49.45% 93 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3266      +/-   ##
==========================================
- Coverage   65.60%   65.49%   -0.11%     
==========================================
  Files          17       17              
  Lines        9790    10011     +221     
==========================================
+ Hits         6423     6557     +134     
- Misses       3367     3454      +87     
Flag Coverage Δ
python-3.13 65.49% <60.59%> (-0.11%) ⬇️

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.

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.

🔵 Needs a closer look

Address the extensionless-executable audit bug and split the overlong setup-documentation sentences.

No open issues 🎉

What changed in this PR

Promotes parser, workflow-check, audit, documentation, and host-setup improvements to main.

Changes:

  • Centralizes Markdown parsing and improves check-state handling.
  • Adds file-naming and secret-stem audit checks with exemptions.
  • Updates tests, specifications, reports, and setup documentation.
File Summary
tests/​test_pr_review.py Parser and workflow-state regression coverage.
tests/​test_audit.py Audit integration and naming-check coverage.
spec/​project-types.json Declares new audit dimensions and rules.
spec/​audit.py Implements naming, secret-stem, and superseded-check support. [P1] Extensionless executables can be skipped before undecidable files are reported.
scripts/​README.md Documents updated wait behavior.
scripts/​pr_review.py Updates Markdown parsing and check handling.
reports/​_template.md Adds the file-naming report row.
host-setup/​README.md Documents no-sudo Debian setup. [P2] New prose exceeds the repository’s sentence-length convention.
AUDIT.md Documents naming rules and drift-note exemptions.

Review effort: Lite

## Summary

Copilot's round on promotion #3266 found two sentences over the 25-word
bound in the no-sudo Debian paragraph that #3249 added to
`host-setup/README.md`. Each is now two sentences, and what they say is
unchanged.

`prose_lint.py --check sentence-length` reports both on the promoted
diff and none after this change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

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.

🔵 Needs a closer look

Two moderate unresolved findings remain in scripts/pr_review.py and spec/audit.py.

No open issues 🎉

Review effort: Lite

@ptr727

ptr727 commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

Answering both headlines on this promotion: 2cb39cb3 ("Address the extensionless-executable audit bug and split the overlong setup-documentation sentences") and 918e42c6 ("Two moderate unresolved findings remain in scripts/pr_review.py and spec/audit.py"). Neither round opened a thread, listed a finding, or collapsed a block. Only the first round's file table gave any detail.

No further change follows on this head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants