Skip to content

Blank Quotations After a Heredoc Label on Its Opening Line in Paste-Safe - #4390

Merged
ptr727 merged 4 commits into
developfrom
burndown/paste-safe-heredoc-quotes
Nov 24, 2026
Merged

ptr727 merged 4 commits into
developfrom
burndown/paste-safe-heredoc-quotes

Conversation

@ptr727

@ptr727 ptr727 commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

shell_literals in prose_lint.py kept the rest of a heredoc's opening line, after its label, as code, and did not blank the quotations there. So paste-safe reported a placeholder that is already quoted when it sits after a heredoc on the same line, as in cat <<'END' | tee "<file>". No edit the message suggests could clear that report.

  • The rest of the opening line is now read as any other command is. shell_literals reads that part of the line through itself, blanking its quotations, escapes, and comments. That is the same recursion shell_char_kinds already applies to the same span, so the two readings of the line now agree.
  • Both walkers take the split from one helper. heredoc_rest says where a heredoc token's opening line resumes past its label and where that line ends. The two walkers each computed that themselves, and their readings drifting apart on that line is what Blank Quotations After a Heredoc Label on Its Opening Line in Paste-Safe #4383 was.
  • The twin still reports. The unquoted cat <<'END' | tee <file> is still a finding, and a second heredoc on the same opening line is read the same way.

Verification

  • A constructed fence with the quoted placeholder reported on develop and passes on this branch. Its unquoted twin reports on both.
  • New test test_a_quotation_after_a_heredoc_label_is_literal covers a double-quoted, a single-quoted, and an unquoted placeholder after the label, a comment after it, and two heredocs on one opener.
  • tests/test_prose_lint.py: 762 tests pass. ruff format --check, ruff check, and mypy are clean. A whole-tree prose gate run reports nothing.

Introduced findings from the local passes

  • tests/test_prose_lint.py test_a_second_shell_after_a_heredoc_label_is_read, introduced (test gap), fixed in c990c18. This change removes the plain paste-safe report that cat <<'END' | sudo sh -c 'cat > <file>' raised beside its in-shell report. The test checked only that the in-shell report was present. It now asserts that the single in-shell finding is all that line raises.

Closes on promotion: #4383

🤖 Generated with Claude Code

ptr727 and others added 3 commits November 23, 2026 19:47
`shell_literals` kept the rest of a heredoc's opening line, after its
label, as code without blanking its quotations. So `paste-safe` reported
a quoted placeholder there, which no edit could clear. It now reads that
part of the line through itself, as `shell_char_kinds` already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`shell_literals` and `shell_char_kinds` each computed where a heredoc's
opening line resumes past its label. The two drifting on that split is
what #4383 was, so both now take it from `heredoc_rest`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every `HEREDOC` match holds a line break after the opening line, so the
token's first line break is always found.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 24, 2026 03:56
@ptr727

ptr727 commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

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

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 477c4d1 and c990c18.

Files selected for processing: 2

  • .github/actions/prose-gate/prose_lint.py
  • tests/test_prose_lint.py
  • 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

The first shell no longer reports the quoted string a heredoc's opening
line hands `sh -c`, so the test now asserts that one finding is all
that line raises.

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.

🟡 Changes recommended

A moderate test gap remains because the adjacent second-shell case does not verify that the duplicate outer paste-safe finding is absent, allowing a regression to pass.

1 open issue
What changed in this PR

This pull request fixes paste-safe handling for shell commands that continue after a heredoc label on the opening line, treating quoted placeholders as literals while preserving findings for unquoted placeholders.

Changes:

  • Adds a shared heredoc_rest helper for heredoc boundary detection.
  • Recursively processes post-label command text for quotes, escapes, and comments.
  • Adds regression coverage for quoted, unquoted, commented, and multiple-heredoc cases.
File Description
tests/​test_prose_lint.py Adds regression tests covering quoted and unquoted placeholders, comments, and multiple heredocs on an opening line.
.github/​actions/​prose-gate/​prose_lint.py Centralizes heredoc boundary parsing and recursively processes the remaining opening-line command text.

Review effort: Lite

Comment thread tests/test_prose_lint.py Resolved
@ptr727

ptr727 commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

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

@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.39%. Comparing base (477c4d1) to head (c990c18).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4390   +/-   ##
========================================
  Coverage    79.39%   79.39%           
========================================
  Files           46       46           
  Lines        16070    16070           
========================================
  Hits         12758    12758           
  Misses        3312     3312           
Flag Coverage Δ
python-3.13 79.39% <ø> (ø)

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 Nov 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

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 6cb4990 into develop Nov 24, 2026
14 checks passed
@ptr727
ptr727 deleted the burndown/paste-safe-heredoc-quotes branch November 24, 2026 04:20
ptr727 added a commit that referenced this pull request Nov 24, 2026
…lts, Secret Sync Fields, and Audit Account Fixes (#4428)

Promotes the 28 pull requests that landed on develop since the last
promotion (#4388), from the away-mode backlog burndown run.

- #4391: Drop the false XML comment suppression claim from the .NET
conventions.
- #4390: Blank quotations after a heredoc label on its opening line in
the paste-safe rule.
- #4392: Carry attention lists, cut lists, and opt-in billing in the
`backlog_metrics.py` JSON.
- #4393: Gate `configure.sh apply`'s interaction limit on a committed
bot verification record.
- #4394: Make the gh and node report note say a one-line vendor source
is configured.
- #4395: Add ShellCheck and shfmt lint tasks to the VS Code task
snippets.
- #4396: Count a CodeRabbit clean pass on the head in the digest's
`other_reviewed`.
- #4401: Date the line-ending intentRefs by the skill and trim advisory
restatements.
- #4399: Share one any-level heading region primitive between
`heading_body` and `extract_anchored`.
- #4398: Name the hub pull requests a standup lands through, and add
HACS first-run guidance.
- #4404: Add a PowerShell section to CODESTYLE.md and narrow the shell
rule.
- #4405: Close AUDIT.md section 10's convergence loop and fix three
skill pointers.
- #4409: Route CODESTYLE.md's General section to the language skills
(part of #1153, which stays open).
- #4410: Detect a C# test project by its own text rather than its file
name.
- #4411: Drop the unruled "working gate is not drift" sentence from
CODESTYLE.md.
- #4412: Track the newest upstream line of each pinned host tool.
- #4413: Correct AUDIT.md section 0's account of what the audit checks.
- #4416: Add a required coverage shield class to the README audit.
- #4414: Tie drive-pr's merge to its authorization and align the pass
moments.
- #4417: Pass over a second SIGTERM in `pr_review.py` so an interrupt
prints one line.
- #4418: Point the report-path placeholder at AUDIT.md section 8.
- #4419: Correct the audit account copies outside AUDIT.md section 0.
- #4422: Drop the archived DevKitCIoT from the rollout checklists.
- #4423: Report a stale `pullRequestCheck: false` and correct AUDIT.md
section 6.
- #4424: Add a `prune` subcommand to retire orphaned canonical review
passes.
- #4425: Drop the archived DevKitCIoT from the reusable-workflows
checklists and fix a normalization docstring.
- #4427: Store secret sync metadata in item fields, not 1Password tags.
- #4426: Declare and apply the Actions workflow token defaults through
`configure.sh` (the `configure.sh` part of #1783, which stays open).

## Owed by the maintainer

- #4412: A live run of the new host-tool line tracker. Scheduled runs
start only once this reaches `main`, and a `workflow_dispatch` would
prove it sooner.
- #4426: A fleet `configure.sh apply` for the workflow token defaults,
after the per-repository read the 2026-11-01 answer requires. Please
also confirm the new `--lower-workflow-token` option, which a `write`
repository needs for the apply to lower its default.
- #4427: Run `python3 scripts/secrets_sync.py selftest`, then the
cleanup script in that pull request's body (`move_sync_tags.py`, dry run
first, then `--apply`). Until that runs, every un-migrated secret item
refuses to sync.
- #4393: The pilot's first interaction limit is set by hand in its
settings and its bots verified there. The verification record is
committed afterwards through a hub pull request, and only then does
`apply` set the limit fleet-wide.
- A fleet resync is owed, because carried text changed: AGENTS.md,
GOVERNANCE.md, CODESTYLE.md, and several skills.

Fixes #4387
Fixes #4383
Fixes #4284
Fixes #1095
Fixes #4299
Fixes #4370
Fixes #4364
Fixes #4173
Fixes #4064
Fixes #3536
Fixes #3929
Fixes #3808
Fixes #3812
Fixes #3810
Fixes #4320
Fixes #4232
Fixes #1748
Fixes #1607
Fixes #1270
Fixes #1170
Fixes #3692
Fixes #4415
Fixes #3908
Fixes #1648
Fixes #4276

🤖 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