Skip to content

Promote the HTML Block Code-Span Bound and Shared Opener Attribute Tail to Main - #3231

Merged
ptr727 merged 3 commits into
mainfrom
develop
Oct 19, 2026
Merged

ptr727 merged 3 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Oct 19, 2026

Copy link
Copy Markdown
Owner
  • End a Code Span at an HTML Block Line in pr_review.py #3229 ends an inline code span in pr_review.py at a line opening a GFM HTML block, as GitHub renders it. So a stray backtick no longer pairs across </details> or <details>, and the digest no longer prints those wrappers raw. A trusted author's attestation marker on a line of its own between two stray ticks now attests, which is the maintainer's "follow GitHub" decision, and the dead span mask in front of attestation() is gone.
  • Share One Attribute Tail Across the Details and Summary Opener Readers in pr_review.py #3230 gives the <details> and <summary> opener readers one attribute tail, attributes(). An opener quoted in code as <details [^>]*> is no tag to any of them, and a quoted value holding a > is read whole. The readers spanning lines take a line break where HTML does.

Neither change edits a skill, so this machine's installed Skills are unchanged at release.

Closes #3214
Closes #3212

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 19, 2026 08:38
## Summary

`CODE_SPAN` in `scripts/pr_review.py` ended an inline code span only at
a blank line. GitHub also ends a paragraph at a line opening an HTML
block, so a stray backtick before `</details>` paired with the first
tick of the next entry's summary, and `unwrap` printed the wrappers
between them raw. Implements #3214.

- `HTML_BLOCK_START` holds the GFM block starts that may interrupt a
paragraph (types 1 to 6), and `CODE_SPAN` does not continue onto such a
line. Type 6 reuses `tag_opener`, which gains a `closer` flag and moves
above its first use.
- `attestation()` drops its span mask. The marker is anchored to a line
of its own, which a span can no longer reach, so the mask changed
nothing. The maintainer chose to follow GitHub's rendering here: a
trusted author's marker on its own line between two stray ticks is a
real HTML comment, so it now attests.
- Two tests encoded a span crossing such a line and now read it as
GitHub renders it. The `stated_total` test now pins the offset alignment
the opener mask provides.

## Verification

- The constructed case from #3214 fails with the fix reverted and passes
with it. Each block-start alternative and the case-insensitive group
were mutation-checked against the new rows.
- `python3 -m unittest discover -s tests`: OK. ruff, ruff format, mypy,
`repo_gate.py`, the prose gate (whole tree and `--diff origin/develop`),
and `build_dist.py --check` are clean.
- Local strict review: two rounds. Round one's introduced findings were
fixed in 3a33b75, and round two raised none.

## Follow-ups filed

- #3227: a span still pairs across a list item, heading, blockquote, or
thematic break. This was already true before this change.
- #3228: the HTML block name list here and `INTERRUPTING_TAGS` in
`prose_lint.py` disagree on `source` and `search`.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
…s in pr_review.py (#3230)

## Summary

`scripts/pr_review.py` ended each `<details>` or `<summary>` opener's
name through one primitive, `tag_opener`, but each reader spelled the
attribute tail after it on its own. One of them, `[^>]*>`, read an
opener quoted in code as `<details [^>]*>` as a tag that ate the text
after it up to the next `>`. Implements #3212.

- `attributes(spanning, lone_space)` is the one tail. `SUMMARY`,
`DETAILS_OPENER`, and `DETAILS_TAG` move onto it beside `TAGS` and
`HTML_TAG`, which already used `ATTRIBUTES`.
- A quoted value may hold a `>`, and anything that is not an attribute
ends the tag unread.
- `spanning` readers (`SUMMARY`, `DETAILS_TAG`) take a line break
between attributes and inside a quoted value, as HTML does. The others
read one line.
- `lone_space=False` keeps `SUMMARY`'s refusal of the `<summary >` a
code span masked to a space leaves.
- `HTML_SPACE` names the HTML whitespace class that `tag_opener`,
`attributes`, and the HTML block start each spelled out.
- A table test pins, at every tail reader, an attributed, a quoted-`>`,
and a self-closed opener as read, and `<details [^>]*>` as not read.
Multi-line rows cover the two spanning readers.

## Verification

- The table test fails 10 subtests against the pre-change readers. Six
targeted mutations of the new primitive each fail the suite.
- `python3 -m unittest discover -s tests`: OK. ruff, ruff format, mypy,
`repo_gate.py`, the prose gate (whole tree, and the diff with
`sentence-length`), and `build_dist.py --check` are clean.

## Local review findings still open

The local strict review ran two rounds, and the edit budget is spent.
One finding remains:

- **introduced:** the letter-only lead on an attribute name, which
`SUMMARY` needs so a masked span cannot supply a name, also narrows
`TAGS` and `HTML_TAG`. So `unwrap` now leaves `<details :open>` or
`<summary _id="a">` raw where it stripped them before. Fixed in
8dad7fb, which keeps the letter-only lead to `lone_space=False` and
gives the other readers CommonMark's `[A-Za-z_:]` lead. Its own local
pass raised nothing.

🤖 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 19, 2026 16:37
@coderabbitai

coderabbitai Bot commented Oct 19, 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: 7cbd6d8c-ee33-4183-aa7c-bbd61512b59e
  • 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 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.57%. Comparing base (83e291c) to head (f1e5727).
⚠️ Report is 402 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3231      +/-   ##
==========================================
+ Coverage   65.52%   65.57%   +0.05%     
==========================================
  Files          17       17              
  Lines        9771     9782      +11     
==========================================
+ Hits         6402     6415      +13     
+ Misses       3369     3367       -2     
Flag Coverage Δ
python-3.13 65.57% <100.00%> (+0.05%) ⬆️

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.

🟡 Changes recommended

Unresolved findings remain for blockquote-aware HTML boundaries, complete tag validation, and the attestation docstring.

2 open issues
What changed in this PR

This PR aligns HTML block handling and shared tag-attribute parsing with GitHub behavior, with updated regression tests.

Changes:

  • Prevents code spans from crossing recognized HTML blocks.
  • Shares attribute-tail parsing for <details> and <summary>.
  • Updates attestation and parser test coverage.
File Summary
tests/​test_pr_review.py Adds regression coverage for parsing, code spans, totals, and attestations.
scripts/​pr_review.py Implements shared parsing, HTML block boundaries, and attestation behavior.

Review effort: Lite

Comment thread scripts/pr_review.py Resolved
Comment thread scripts/pr_review.py Resolved
#3232)

## Summary

This answers Copilot's P2 on promotion #3231. Once #3229 removed the
span mask in front of `attestation()`, a trusted marker on a line of its
own between two stray ticks attests, as GitHub renders it. The docstring
still said a marker "in a span" vouches for nothing. It now says a
marker quoted inline or in a code block vouches for nothing, and that a
tick on each side of the marker's own line opens no span, so the marker
still counts.

## Verification

- The change is docstring-only. ruff, ruff format, the `pr_review`
suite, and the prose gate with `sentence-length` are clean, and the
pre-commit gate passed at commit.
- The local strict review checked each claim against `ATTESTATION`,
`strip_fences`, and the `TestAttestationReadings` rows, and raised no
findings.

🤖 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

Self-closing HTML block openers are not yet recognized as span boundaries.

No open issues 🎉

2 resolved since last review

Review effort: Lite

@ptr727

ptr727 commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

Copilot's round on f1e5727 says "Needs a closer look" with the headline "Self-closing HTML block openers are not yet recognized as span boundaries". It names no line and no case, and it opened no thread. Checked against the code on this head and against GitHub's renderer (gh api markdown -f mode=gfm), with each line placed between a stray tick above and below:

Line CODE_SPAN on this head GitHub
<details/> span ends no <code>
<hr/> span ends no <code>
<hr /> span ends no <code>
<p/> span ends no <code>
<pre/> span continues one <code>
<br/> span continues one <code>

tag_opener's boundary admits />, so a self-closed block name ends the span. <pre/> is not a type-1 start and br is not a block name, so the span continues across both, as GitHub renders it. The headline is disproved, and nothing here is left to fix.

@ptr727
ptr727 merged commit 4861da5 into main Oct 19, 2026
14 checks passed
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.

End a Code Span at an HTML Block Line in pr_review.py Share One Attribute Tail Across the Details and Summary Opener Readers in pr_review.py

2 participants