Skip to content

Lex Heredoc Bodies Apart and Skip Code Spans When Numbering Inline Comments - #3427

Merged
ptr727 merged 5 commits into
developfrom
prose-gate-heredoc-and-code-span
Oct 24, 2026
Merged

ptr727 merged 5 commits into
developfrom
prose-gate-heredoc-and-code-span

Conversation

@ptr727

@ptr727 ptr727 commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Takes each run-block heredoc body from the shell-state-aware Bash lexer on the de-indented script, then lexes each body on its own, so an apostrophe in its prose cannot open a string that outlives it. The hyphenated delimiter <<END-OF-TEXT and an indented EOF line inside a body now work as a side effect. Numbers an inline Markdown comment on lines with code spans blanked, so a span holding the comment's text is never where the comment is found. Raises the gate's size ceiling from 1800 to 1840 lines (the gate is 1839, 39 over the old ceiling), for the maintainer to decide.

Closes on promotion: #3413
Closes on promotion: #3414

Pre-existing findings, filed:

Introduced findings from the final local review, deferred to filed issues:

This change writes comment lines, so it carries the comments label.

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 24, 2026 09:22
…mments

A run block's heredoc body is lexed as its own span, so an apostrophe in its prose cannot open a string that hides later comments. An inline Markdown comment search now advances past each code span, so a span holding the comment's text is never where the comment is found. The size ceiling moves from 1800 to 1840 lines for the added splitter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 24, 2026
Copilot AI lite review requested due to automatic review settings October 24, 2026 16:44
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

Run configuration
  • 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

Two unresolved moderate findings in .github/actions/prose-gate/prose_lint.py affect heredoc detection and inline comment discovery.

2 open issues
What changed in this PR

This pull request improves prose-gate parsing for heredocs in YAML run: blocks and Markdown inline code spans, preserving accurate comment detection and line numbers.

Changes:

  • Splits heredoc bodies into independently lexed spans with preserved line offsets.
  • Advances inline-comment searches past code spans.
  • Adds regression tests and raises the splitter size ceiling from 1800 to 1850 lines.
File Summary
tests/​test_prose_lint.py Adds regression coverage for heredoc apostrophes, comment numbering, inline code spans, line offsets, and the updated size ceiling.
.github/​actions/​prose-gate/​prose_lint.py Implements heredoc splitting and code-span-aware inline comment positioning. Two unresolved moderate findings remain: single-quoted strings can be misidentified as heredoc contexts, and a repeated one-word code span can cause a subsequent HTML comment to be missed.

Review effort: Lite

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.81%. Comparing base (9f19b2a) to head (2511b62).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3427   +/-   ##
========================================
  Coverage    80.81%   80.81%           
========================================
  Files           23       23           
  Lines         8859     8863    +4     
========================================
+ Hits          7159     7163    +4     
  Misses        1700     1700           
Flag Coverage Δ
python-3.13 80.81% <ø> (+<0.01%) ⬆️

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 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

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

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

The implementation has unresolved moderate-severity heredoc parsing issues that can hide later comments.

No open issues 🎉

2 resolved since last review

Review effort: Lite

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Headline 'unresolved moderate heredoc parsing issues' disposition: the covering table is carried from 7aa574c and its two threads are answered (one fixed in 7db26c6, one declined with a reproduction). The remaining heredoc shapes (hyphenated delimiter, two heredocs on one opener line, loose terminator indentation, a heredoc opened inside a double-quoted command substitution) are listed in the description as known gaps that leave behavior no worse than before this change.

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

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

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

Heredoc splitting currently also applies to non-shell run steps, creating a moderate parsing risk that must be addressed before approval.

1 open issue

Review effort: Lite

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Maintainer decisions, recorded by the orchestrating session: the size ceiling bump to 1840 is accepted, and the two introduced edge cases are deferred to #3429 and #3430 rather than fixed here.

@ptr727
ptr727 merged commit 06d0031 into develop Oct 24, 2026
14 checks passed
@ptr727
ptr727 deleted the prose-gate-heredoc-and-code-span branch October 24, 2026 18:12
ptr727 added a commit that referenced this pull request Oct 24, 2026
…xes to Main (#3434)

## Summary

Promotes the pull requests merged into develop since release 2.0.1158.

- [#3422](#3422):
`drive-pr` and `backlog-burndown` have every draft of a pull request
body go in a file named for its repository and branch. Two lanes sharing
one `pr-body.md` had published each other's drafts.
- [#3423](#3423): in
`pr_review.py`, an earlier partial round outranks a head round reading
`unknown`, printing `coverage=PARTIAL` and exiting 42.
- [#3427](#3427): the
prose gate takes run-block heredoc bodies from its patched Bash lexer's
heredoc tokens and lexes each alone, so an apostrophe in a body no
longer hides later comments. Inline Markdown comments are numbered with
code spans masked. The gate's size ceiling moves from 1800 to 1840
lines, as the maintainer decided on that pull request. Two edge cases
are deferred to #3429 and #3430, and a pre-existing one is filed as
#3428.
- [#3431](#3431): deletes
`spec/carried_text.py` and reads carried Markdown regions through
markdown-it-py in the new `spec/fidelity_text.py`. `carry.py`,
`build_dist.py`, and `canonical_review.py` carry PEP 723 metadata, and
every caller runs them as `uv run --no-project --script`. The full audit
sweep is identical before and after. The `validate.py` remainder is
#3426, and a pre-existing include-marker gap is #3432.
- [#3433](#3433):
`pr-review-conduct` and `scripts/README.md` say exactly when the
earlier-partial path exits 42, following #3423.

Closes #3412
Closes #3413
Closes #3414
Closes #3425

## Constituent coverage

Each change this promotion carries had coverage on its own pull request
into develop, at its merged head:

| Pull request | Merged head | Coverage |
| --- | --- | --- |
| [#3422](#3422) |
`b645b429` | attested local pass, and a Copilot table naming exactly the
changed files, `coverage=table` |
| [#3423](#3423) |
`3f893b65` | attested local pass, and a carried Copilot table,
`coverage=carried:table` |
| [#3427](#3427) |
`2511b62b` | attested local pass, and a carried Copilot table,
`coverage=carried:table` |
| [#3431](#3431) |
`92755285` | attested local pass, `coverage=local` |
| [#3433](#3433) |
`cceba3af` | attested local pass, `coverage=local` |

🤖 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

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