Skip to content

Compose pr_review.py's Block Shapes From One Primitive Each - #3261

Merged
ptr727 merged 3 commits into
developfrom
feature/block-shape-primitives
Oct 20, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/block-shape-primitives

Conversation

@ptr727

@ptr727 ptr727 commented Oct 20, 2026

Copy link
Copy Markdown
Owner

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

Refs #3241

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 20, 2026 06:47
The ATX heading, the thematic break, and the fence opener each get one
spelling, and FENCE, INTERRUPTS_PARAGRAPH, MARKDOWN_HEADING, and
coverage_statements' block-closing test compose from them. The closing
test took a vertical tab after a heading's hashes and refused a
thematic break or setext underline spaced by tabs, and MARKDOWN_HEADING
read only a heading carrying text after its hashes. Each now reads the
shape the way GitHub renders it, with those cases pinned.

Refs #3241

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HEADING spelled the heading shape out with Python's \s after the hashes,
so a no-break space there opened a section where GitHub renders text.
The reachable no-break-space case is pinned at the regex and through
coverage_statements.

Refs #3241

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 20, 2026 13:55
@ptr727 ptr727 added enhancement New feature or request script A defect in hub tooling labels Oct 20, 2026
@ptr727

ptr727 commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head f1d1d821b98a9c34f7f297ad8c7d8708d45da30f, 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

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: f03dbe1a-0f9c-4a04-bb7f-04af46c71933
  • 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.

🟢 Approval recommended

The remaining comment is documentation-only, and the supplied readiness assessments approve the changes.

No open issues 🎉

What changed in this PR

This PR consolidates Markdown block-shape regexes into reusable primitives and adds GitHub-compatible regression coverage.

Changes:

  • Composes heading, thematic-break, fence, and line-ending patterns.
  • Updates block readers to use shared primitives.
  • Adds tests for tabs, no-break spaces, bare headings, and fence behavior.
File Summary
tests/​test_pr_review.py Adds regression tests for whitespace-sensitive Markdown parsing.
scripts/​pr_review.py Defines and composes shared block-shape primitives. Includes a P2 (moderate) docstring wording comment.

Review effort: Lite

@ptr727

ptr727 commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

Answering the round on f1d1d821: its file table names "a P2 (moderate) docstring wording comment" in scripts/pr_review.py, but the review posted no inline comment, opened no thread, and collapsed no suppressed block, so the comment text is not on the pull request to act on. The one docstring this diff adds is fence_opener's. Each of its claims matches the pattern it returns: a backtick info string excludes a backtick, a tilde info string takes anything, and FENCE passes capturing runs so its closer can repeat the mark. A local strict review covering this head also read that docstring and raised nothing on it. No change follows.

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@8228473). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #3261   +/-   ##
==========================================
  Coverage           ?   65.40%           
==========================================
  Files              ?       17           
  Lines              ?     9991           
  Branches           ?        0           
==========================================
  Hits               ?     6535           
  Misses             ?     3456           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 65.40% <100.00%> (?)

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
ptr727 merged commit 26d6765 into develop Oct 20, 2026
14 checks passed
@ptr727
ptr727 deleted the feature/block-shape-primitives branch October 20, 2026 14:11
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

enhancement New feature or request script A defect in hub tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants