Skip to content

Promote the markdown-it Shared Reader, Heredoc Lexing, and Exit-42 Fixes to Main - #3434

Merged
ptr727 merged 5 commits into
mainfrom
develop
Oct 24, 2026
Merged

ptr727 merged 5 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Summary

Promotes the pull requests merged into develop since release 2.0.1158.

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 b645b429 attested local pass, and a Copilot table naming exactly the changed files, coverage=table
#3423 3f893b65 attested local pass, and a carried Copilot table, coverage=carried:table
#3427 2511b62b attested local pass, and a carried Copilot table, coverage=carried:table
#3431 92755285 attested local pass, coverage=local
#3433 cceba3af attested local pass, coverage=local

🤖 Generated with Claude Code

ptr727 and others added 5 commits October 24, 2026 09:26
## Summary

Two concurrent lanes drafted their pull request bodies into one shared
`pr-body.md`, and a `gh pr edit --body-file` published one lane's draft
onto the other lane's pull request. That happened twice in one round.

- `drive-pr` "The Drive Loop" step 2 now says every draft of a pull
request's body, the opening one and each later rewrite, goes in a file
named for its repository and branch.
- `backlog-burndown` "Dispatching a Worker" has the brief tell each
worker to draft its body, and each rewrite of it, in a file named for
its branch.
- The generated mirrors under `.claude-plugin/fleet-skills/` and
`.github/skills/` are regenerated.

## Local review

Two `local-strict-review` passes at the Opus tier. Round 1 raised five
findings (two sentence-length violations, placement at creation only, a
branch name not unique across repositories, a broken "it" antecedent),
all `introduced` and all fixed in b645b42. Round 2 raised none.

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

---------

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

`coverage()` in `scripts/pr_review.py` now lets a partial stated on an
earlier round outrank a head reading of `unknown`. A head whose only
readings are unbelievable, beside an earlier partial, prints
`coverage=PARTIAL` and exits 42 instead of printing UNKNOWN and exiting
0. A head stating `full` alone still wins, and `unknown` with no partial
on record is unchanged.

Tests in `tests/test_pr_review.py` pair an unknown head round with an
earlier partial round (fails before the fix), pin a full head beside an
earlier partial, and pin the accepted fail-closed outcome for a head
carrying both a full and an unknown round. The `status` help text names
the new case.

Local strict review, two edit rounds spent. Remaining `introduced`
findings and their outcomes:

- The `status=COVERAGE_IS_PARTIAL` line says the covering review "read
fewer files than the pull request changed", which contradicts the carry
reason in its brackets. The no-statement carry path already had this.
Deferred to a filed issue (#3424).
- `.agents/skills/pr-review-conduct/SKILL.md` says only a stated partial
is an exit 42. This is outside this lane's claimed files. Deferred to a
filed issue (#3425).

Closes on promotion: #3412

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

---------

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

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:
- #3428: a second heredoc on one opener line (`<<A 3<<B`) is still read
as code.

Introduced findings from the final local review, deferred to filed
issues:
- #3429: two identical inline comments in one paragraph plus a stray
backtick can be numbered on one line.
- #3430: the heredoc split also runs for a non-shell `run:` step, so a
shift by a name plus a multi-line string can misread comments.

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

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

---------

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

The follow-up #3416 named: the audit, `scripts/carry.py`,
`scripts/build_dist.py`, and `scripts/canonical_review.py` now split a
document at headings and code blocks markdown-it-py reads, and
`spec/carried_text.py`, the last hand-written fence reader they shared,
is gone.

## What Changes

### One Reader, Now a Parser

- `spec/fidelity_text.py` replaces `spec/carried_text.py`. It parses
block structure only, CommonMark plus tables. `headings()` reads
top-level ATX headings, `code_blocks()` and `code_lines()` read fenced
and indented code at any depth, and `sections()` is the one place a
level-two region's extent is decided. `section_span()`,
`extract_section()`, `strip_sections()`, and
`canonical_review.split_markdown()` all slice from it.
- `normalize()` and the two workflow-YAML masks it applies,
`_ACTION_PIN` and `_JOB_NEEDS`, move into the same module unchanged. The
audit, `spec/audit_markdown.py`, and `scripts/carry.py` all call
`normalize()`, so one shared home is what the masks need.
- **The audit:** `spec/audit.py` and `spec/audit_markdown.py` import
from the new module. `_atx_headings()` and `unfenced_text()` read
through it too, so presence checks and region extraction split a
document alike.
- **`scripts/carry.py`:** `h2_headings()` and `section_span()` call the
shared reader. `fence_step()` is gone.
- **`scripts/canonical_review.py`:** `split_markdown()` cuts regions at
the shared reader's level-two headings.
- **`scripts/build_dist.py`:** include markers and heading bodies read
code lines and headings from the shared reader. A body leaving a fence
open is a fence the parser reads as unclosed. `_MAX_INDENT` stays only
for a marker line itself.

### Running Them

- `scripts/carry.py`, `scripts/build_dist.py`, and
`scripts/canonical_review.py` each declare `markdown-it-py>=4` in a PEP
723 block, in `spec/audit.py`'s form.
- Every caller now runs them as `uv run --no-project --script`:
- the validate action and `canonical-review-sweep.yml`, which now sets
up uv rather than Python;
- `host-setup/menu.sh` and `host-setup/menu.ps1`, whose plain-Python
helpers had no caller left and are removed;
- `RESYNC.md`, `STANDUP.md`, `OPERATIONS.md`, `scripts/README.md`,
`docs/token-efficiency-plan.md`, and the `local-strict-review` and
`skill-lifecycle` skills, regenerated;
  - each script's own usage text and the commands its messages print.
- **Two plain-`python3` importers stay safe.**
`scripts/skills_install.py` imports `build_dist`, and
`scripts/handoff.py` imports `carry`. Both modules import the shared
reader lazily, on the path that reads a region, so neither importer
loads markdown-it-py.

### Tests

- `tests/test_build_dist.py`'s check that importing `build_dist` loads
no `carried_text` now imports `skills_install` in a fresh interpreter
and checks that neither `fidelity_text` nor `markdown_it` loads. That is
the invariant the plain-`python3` install path relies on.
`tests/test_carry.py` gains the same check for `handoff`.
- The two per-line cache tests are gone, since nothing reads per line
any more. The test that the accessor adds `spec/` to `sys.path` once
stays.
- `test_an_indented_heading_is_a_boundary_as_it_is_to_the_audit`
asserted the old reader's quirk, a four-space `## ` line read as a
heading. It now asserts what the parser reads: three spaces open a
heading, and four open an indented code block.
- `tests/test_fidelity_text.py` covers the shared reader on constructed
documents, a quoted or listed heading and a fence ending a file with no
final newline among them. `tests/import_probe.py` holds the import probe
both laziness tests share.
- CI already installs `tests/requirements.txt`, which carries
`markdown-it-py`, before the suite runs.

## Behavior

- The full audit sweep, every cataloged repository plus the fleet
membership check, ran at develop 9f19b2a before the change and on this
branch after it, both against the same hub `main`. The two outputs match
line for line apart from the run stamp.

- `uv run --no-project --script scripts/canonical_review.py list` and
`status` print byte-identical output before and after, so every review
unit key and digest is unchanged.
- `uv run --no-project --script scripts/build_dist.py --check` reports
the generated trees current, and a no-flag run rewrote nothing beyond
the two edited skills' mirrors.
- A probe compared the old and new region readers over every local
Markdown file, heading boundaries, `extract_section`, and
`strip_sections` alike. The fleet's own documents read identically. The
only differences are in vendored third-party documents and are the
parser being right where the line reader was not: a fence indented four
spaces inside a list item, a fence whose closer is indented differently
from its opener, and a `## ` inside an HTML comment block.

## Local Review

`local-strict-review` passes ran at the `frontier` tier over the whole
branch diff, each recorded before the next commit and attested after
each push. The fixes they drove before the pull request opened:

- A fence left open at a file with no final newline read as closed, so
`build_dist.py` stopped refusing that include body. The last content
line now counts.
- A heading quoted in a blockquote or nested in a list item opened a
region. Only top-level headings do now, which no tracked document's
split depends on.
- The rule for where a region ends was written three times. `sections()`
now holds it.
- `build_dist.py` rebuilt a code-line set the shared reader already
returns.
- The `code_blocks()` docstring claimed every region copier refuses an
open fence. Only the include fill does, and it now says so. The
`heading_body()` docstring names where an include body ends differently
from a fidelity region.
- `scripts/README.md`, `host-setup/README.md`, and the menu comments
still described plain-Python paths.
- The shared import probe moved out of a test module into
`tests/import_probe.py`.

### After the Pull Request Opened

The third pass, after the edit budget for the opening push was spent,
and Copilot's round on that head raised the first two points below.
Later passes raised the rest, and the last pass, on the current head,
raised nothing:

- An include body holding a fence its blockquote or list item ends, with
no closing line, is refused, which the old stepper did not do. Filling
one was tried and reverted. An end marker indented to a list item's
content continues that item past the blank line the fill writes, so the
fence swallows the marker on the next scan. Refusing is the loud
outcome, no tracked source holds such a fence, and tests pin the list
item and blockquote cases. The docstrings now give that reason.
- The `audit_markdown.py` heading docstrings read as if only fenced
headings are skipped. `_atx_headings()` now states that it reads
top-level `#` headings only, and the readers built on it point there.
- "which the fidelity checks read with too" read awkwardly in three
docstrings, and now says "also use".
- The laziness tests imported `build_dist` and `carry` directly. They
now import `skills_install` and `handoff`, the real plain-`python3`
importers.
- `_unindented()`'s docstring said a line indented past three spaces is
code or a paragraph's continuation, which is false in a list item. It
now says the bound is held on the line's own indentation in every
container.
- `heading_body()`'s docstring, and the `skill-lifecycle` skill, said a
body ends at the next heading at its level or above. They now say a
top-level `#` heading, since the shared reader reads a setext heading
and one in a blockquote or list item as content.

## Pre-Existing Findings, Filed

- #3432: `scripts/build_dist.py` skips an include marker indented past
three spaces without refusing it, so the region stays empty and
`--check` exits 0. Class: pre-existing correctness defect.

## Pre-Existing Findings, Not Filed

- `--check sentence-length` reports sentences this branch touched only
to rename a command or a path:
`.agents/skills/skill-lifecycle/SKILL.md:18` and `:19` and their
generated copies, `OPERATIONS.md:40`, `RESYNC.md:77`,
`host-setup/README.md:119`, `host-setup/menu.ps1:252`,
`host-setup/menu.sh:394` and `:449`, `scripts/README.md:7`, `:381`, and
`:385`, `scripts/build_dist.py:313` and the comment it moved into
`heading_body()`, and `scripts/carry.py:420`. Class: style, on prose
this change did not write.

## Deferred

- #3426 covers `spec/validate.py`'s own Markdown readers and the
`references()` against `_LINK_DEF` split in `spec/audit_markdown.py`.
`repo-config/configure.sh` runs `spec/resolve_description.py`, which
imports `validate`, under a probed Python 3.7+, and reading link targets
from tokens changes what the carried-link check sees. Each needs its own
comparison, so this change stops at deleting `carried_text.py`.

## Verification

Each command below ran in the worktree on this branch.

- `uv run --no-project --with-requirements tests/requirements.txt python
-m unittest discover -s tests` at the final head -> `Ran 2872 tests ...
OK (skipped=7)`
- `uv run --no-project --script spec/audit.py`, before and after ->
identical apart from the run stamp, rerun after the review fixes that
touched region code. One downstream repository's own `main` moved
between runs, which only its header line shows.
- `uv run --no-project --script scripts/build_dist.py --check` ->
`Generated skill distributions are current.`
- `uv run --no-project --script scripts/canonical_review.py list` and
`status`, before and after -> byte-identical
- `uvx ruff@latest format --check .` and `uvx ruff@latest check .` ->
clean
- `uvx mypy@latest` -> `Success: no issues found in 76 source files`
- `python3 scripts/repo_gate.py` -> `composite-actions`, `eol`,
`eol-coverage`, and `sha-pin` report 0 issues
- `uvx --from actionlint-py actionlint
.github/workflows/canonical-review-sweep.yml` -> clean
- `npx markdownlint-cli2` over the changed Markdown -> `0 issues`
- `shellcheck host-setup/menu.sh` -> clean, and `host-setup/menu.ps1`
parses with no errors under pwsh
- `python3 spec/validate.py` -> `Spec validation OK`
- The prose gate over the diff reports only `comment-added` lines, which
is why this pull request carries the `comments` label. Most are comments
that moved with the code they describe.

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

---------

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

After #3423, `pr_review.py` lets an earlier partial round outrank a head
round reading `UNKNOWN`, printing `coverage=PARTIAL` and exiting 42.
`pr-review-conduct` and `scripts/README.md` still said only a stated
partial exits 42.

- `pr-review-conduct` Merge Gate item 2 and `scripts/README.md` (the
exit-code table and the `coverage=` paragraph) now say when the
earlier-partial path gives exit 42.
- The generated mirrors are regenerated.

Closes on promotion: #3425

## Introduced findings

- Fixed in 3900f40 and cceba3a. The first push listed `introduced`,
`.agents/skills/pr-review-conduct/SKILL.md:49-50`,
`scripts/README.md:206`, `scripts/README.md:227`: the earlier-partial
condition read "no head round states full". That excluded a head with
one full and one `UNKNOWN` round, which exits 42, and covered a head
with no round at all, which exits 0 in `status`. The wording now names a
head round reading `UNKNOWN`, and a head with non-refusal rounds none
stating coverage. The last local pass checked every head state against
`coverage()` and `report_verdict()` and found nothing.
- Fixed in cceba3a, `pre-existing` but adjacent: "A round covering the
head that states full coverage satisfies this item" now adds "where no
other head round reads `UNKNOWN` or partial".

## Pre-existing findings, not filed

- `pre-existing`, `scripts/README.md:227`: seven sentences on this
paragraph line run past 25 words. Develop's copy of the line has eight,
and none of the seven was written by this change.
- `pre-existing`, `.agents/skills/pr-review-conduct/SKILL.md:54`: the
`coverage=carried:table` sentence runs to 28 words, word for word as on
develop. The rewrap touched its line.

🤖 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 24, 2026 19:42
@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.

🔵 Needs a closer look

Numeric heredoc delimiters are not preserved by the prose-gate lexer, leaving a comment-detection regression unresolved.

No open issues 🎉

What changed in this PR

Promotes the shared Markdown reader, heredoc-aware prose lexing, pull-request coverage fixes, and related documentation, workflow, test, and generated skill updates from develop to main.

A remaining review issue affects .github/actions/prose-gate/prose_lint.py: numeric heredoc delimiters such as <<123 are not recognized, so apostrophes in those bodies can still hide later comments. The heredoc pattern should preserve word-character initial delimiters while allowing hyphens afterward.

Changes:

  • Replaces the handwritten carried-text reader with a shared markdown-it-py reader.
  • Improves heredoc isolation and Markdown code-span handling in prose analysis.
  • Updates review coverage semantics, uv execution paths, documentation, CI, tests, and generated skill distributions.
File Summary
tests/​test_prose_lint.py Adds heredoc and inline-comment regression coverage and updates the size ceiling.
tests/​test_pr_review.py Tests earlier partial coverage precedence across head-review combinations.
tests/​test_fidelity_text.py Tests parsed headings, code blocks, and section spans.
tests/​test_carry.py Verifies lazy Markdown-reader imports through handoff.py.
tests/​test_canonical_review.py Updates canonical-review command expectations for uv.
tests/​test_build_dist.py Tests shared-reader behavior, open fences, and lazy imports.
tests/​import_probe.py Adds subprocess-based import-laziness checks.
STANDUP.md Updates carry commands to use uv.
spec/​fidelity_text.py Adds the shared markdown-it-py Markdown reader.
spec/​carried_text.py Removes the superseded handwritten reader.
spec/​audit.py Switches audit region operations to the shared reader.
spec/​audit_markdown.py Uses shared parsed headings and code-block boundaries.
scripts/​README.md Documents uv usage and updated coverage semantics.
scripts/​pr_review.py Lets earlier partial coverage outrank unknown head readings.
scripts/​carry.py Uses the shared reader and inline script metadata.
scripts/​canonical_review.py Uses shared Markdown sections and uv command documentation.
scripts/​build_dist.py Uses parsed code blocks and the shared reader for includes.
RESYNC.md Updates carry procedure commands.
OPERATIONS.md Updates verification commands and shared-reader documentation.
host-setup/​README.md Documents uv as the lazy hub-tool prerequisite.
host-setup/​menu.sh Runs hub scripts through uv.
host-setup/​menu.ps1 Runs hub scripts through uv on Windows.
docs/​token-efficiency-plan.md Updates skill regeneration instructions.
.github/​workflows/​canonical-review-sweep.yml Sets up uv and runs canonical-review commands through it.
.github/​skills/​skill-lifecycle/​SKILL.md Documents parsed heading boundaries and uv commands.
.github/​skills/​pr-review-conduct/​SKILL.md Documents the expanded partial-coverage exit condition.
.github/​skills/​local-strict-review/​SKILL.md Updates canonical-review command examples.
.github/​skills/​drive-pr/​SKILL.md Requires repository- and branch-specific PR-body drafts.
.github/​skills/​backlog-burndown/​SKILL.md Requires branch-specific worker PR-body drafts.
.github/​actions/​validate/​action.yml Runs distribution and canonical-review checks through uv.
.github/​actions/​prose-gate/​prose_lint.py Splits heredoc bodies and masks code spans; numeric heredoc delimiters remain unrecognized.
.claude-plugin/​fleet-skills/​skills/​skill-lifecycle/​SKILL.md Regenerated Claude skill distribution.
.claude-plugin/​fleet-skills/​skills/​pr-review-conduct/​SKILL.md Regenerated Claude skill distribution.
.claude-plugin/​fleet-skills/​skills/​local-strict-review/​SKILL.md Regenerated Claude skill distribution.
.claude-plugin/​fleet-skills/​skills/​drive-pr/​SKILL.md Regenerated Claude skill distribution.
.claude-plugin/​fleet-skills/​skills/​backlog-burndown/​SKILL.md Regenerated Claude skill distribution.
.claude-plugin/​fleet-skills/​.source-digests/​skill-lifecycle Updates the generated skill digest.
.claude-plugin/​fleet-skills/​.source-digests/​pr-review-conduct Updates the generated skill digest.
.claude-plugin/​fleet-skills/​.source-digests/​local-strict-review Updates the generated skill digest.
.claude-plugin/​fleet-skills/​.source-digests/​drive-pr Updates the generated skill digest.
.claude-plugin/​fleet-skills/​.source-digests/​backlog-burndown Updates the generated skill digest.
.agents/​skills/​skill-lifecycle/​SKILL.md Updates the canonical skill source.
.agents/​skills/​pr-review-conduct/​SKILL.md Updates the canonical review-conduct skill source.
.agents/​skills/​local-strict-review/​SKILL.md Updates the canonical review skill source.
.agents/​skills/​drive-pr/​SKILL.md Updates the canonical PR-driving skill source.
.agents/​skills/​backlog-burndown/​SKILL.md Updates the canonical backlog skill source.

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.76%. Comparing base (9f19b2a) to head (4c77db2).
⚠️ Report is 417 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3434      +/-   ##
==========================================
- Coverage   80.81%   80.76%   -0.05%     
==========================================
  Files          23       23              
  Lines        8859     8839      -20     
==========================================
- Hits         7159     7139      -20     
  Misses       1700     1700              
Flag Coverage Δ
python-3.13 80.76% <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.

@ptr727

ptr727 commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Deferred to #3435, as pre-existing, on the headline "Numeric heredoc delimiters are not preserved by the prose-gate lexer, leaving a comment-detection regression unresolved." It is not a regression this promotion introduces. main already carries HEREDOC with the letter-first delimiter ([A-Za-z_]\w*), and #3427 kept that first character while widening the rest to [\w-]*, so <<123 went unread before this promotion as well. #3435 carries a constructed reproduction, verified against the develop gate, and the fix it needs.

@ptr727
ptr727 merged commit 56ea2d4 into main Oct 24, 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

2 participants