Skip to content

feat(planning): check shape fences anchored by path plus symbol in the citation gate - #13415

Merged
kyle-sexton merged 3 commits into
mainfrom
work-resolve-issue/issue-13410-41947434362-1
Nov 5, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
work-resolve-issue/issue-13410-41947434362-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #13410
Refs: #6917

Summary

Opened by the work-resolve-issue lane. The run's own summary:

A plan can now show code shape in a shape &lt;path&gt;\[#&lt;symbol&gt;\]\[ L&lt;n&gt;\] fence. check-plan-citations.sh checks each outermost one at the checked commit: it fails shape-missing-path, shape-missing-symbol (found with git grep -w -F -e), shape-past-end, shape-not-a-file and shape-malformed, and warns shape-line. It prints a shapes=&lt;n&gt; failed=&lt;n&gt; warned=&lt;n&gt; line before the unchanged closing line. The plan template and anatomy document the grammar, the three /visualization:visualize forms, and that types and signatures belong to ## Design; SKILL.md Step 2 prefers a shape fence and Step 4.7 names the check. Design choices made on evidence: the issue's four reasons are kept, plus shape-not-a-file (L<n> on a directory, or a submodule path) and shape-malformed (a fence that does not parse), so a bad anchor fails loudly and is never skipped; a directory anchor needs no symbol, and a symbol it carries is searched for in that directory; the symbol search uses a :(top,literal) pathspec so it reads the path from the repository root, as cat-file does. Refs: #6917 belongs in the PR body (issue done-when item).

Not verified

  • bash plugins/planning/scripts/check-plan-citations.test.sh was not executed: this lane's Bash runs only the named wrappers, so the suite is left to the PR's CI (cases were traced by hand in review)
  • shellcheck on check-plan-citations.sh not run here (no wrapper); left to the PR's CI lint
  • tidy pass 5 (ai-slop): the deterministic detector script could not run under this lane's Bash restriction; only the rubric read was applied to the changed markdown lines, with no findings. Tidy passes 1-3 found nothing to edit in the code lines
  • The PR body must carry Refs: #6917 (issue done-when); the lane writes the PR body

Fix

  • plugins/planning/scripts/check-plan-citations.sh: parse outermost shape fence info strings in the awk pass, grade each anchor (path, symbol via git grep -w -F -e, L<n> past end, line-lacks-symbol warning), print shape= lines and a shapes= summary, fail the run on a failing anchor; header…
  • plugins/planning/scripts/check-plan-citations.test.sh: src/shape.ts fixture plus cases for a passing anchor, shape-missing-path, shape-missing-symbol (absent symbol and file without symbol), shape-past-end, the shape-line warning, a directory anchor, a symbol starting with -, a malformed anchor,…
  • plugins/planning/skills/plan/context/plan-template.md: new 'Shape fences (per-phase)' section and contents entry: grammar, the three allowed forms named by skill, types and signatures stay in ## Design, the gate's reasons
  • plugins/planning/skills/plan/templates/plan-md-anatomy.md: skeleton outer fence lengthened to four backticks, a shape fence in the Phase 1 skeleton, and the longer-outer-fence rule
  • plugins/planning/skills/plan/SKILL.md: Step 2 prefers a phase shape fence over prose for which code changes; Step 4.7 names the shape anchor check
  • .changes/planning/work-resolve-issue-issue-13410-41947434362-1-8ae2c087.md: minor changelog fragment for planning

Verification

The runner ran each check from the base copy against 7cffd18:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 3 fragments valid
  • check-changed-skills: CHECK-SKILL plan PASS, 0 errors, 5 pre-existing size/description warnings
  • check-affected: 13 passed, 6 skipped over 6 changed files
  • fresh-context review subagent hand-traced every new test case and the existing ones against the script: no correctness problem found; its two doc precision notes (submodule case of shape-not-a-file, symbol on a directory anchor) were applied to plan-template.md
  • tidy-diff over the change's lines: write-for-agents trims applied (SKILL.md Step 4.7 now points at the template's reason list instead of repeating it; anatomy note tightened), changelog sentence split per write-for-humans
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41947434362

Left out: the items under Not verified.

Related

#13410

Lane-Activity: work-resolve-issue/resolve-issue

@github-actions github-actions Bot 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.

claude-review: 1 inline finding(s) on 7cffd18d5794e8bd215425daa744138104c8471c; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

claude-review needs no new review of fb022429750db2c2019aa870a280139639364a53: no file of this pull request changed since the review of d3e3819.

Code review (incremental, blocking only): PR #13415, 7cffd18d → d3e38190

This lane already reviewed an earlier head, so this pass reports only blocking findings. I read every hunk of both files in scope (check-plan-citations.sh and check-plan-citations.test.sh) and the script at head. I ran nothing. Everything below comes from reading the code.

What changed in this push

  • Script, awk pass. If the shape info string contains a control byte (\001–\037 or \177), the row is now marked malformed and each such byte in the label becomes ?. Before this, a raw US byte (\037) in a fence moved the fields bash reads back, so attacker text landed in $line. The [[ "$line" -gt "$count" ]] check then evaluated it as arithmetic, and an array subscript there runs $(...). Tabs are already turned into spaces earlier in the pass, and a newline can't appear in an awk record, so the new check covers every byte that could split a field.
  • Script, bash loop. $line must now match ^[1-9][0-9]*$ before any arithmetic, and the comparison uses (( 10#$line > count )). The awk pass already only lets L[1-9][0-9]* through, so this is a second guard. It is correct.
  • Tests.
    • New case shapedirline.md covers shape-not-a-file. The label check src/lib/ L1 is right, since the label is the normalized info string.
    • New case shapeus.md puts a raw \037 and a $(touch …) payload in a fence, then checks that shape-malformed is reported and that $TMP/pwned was not created. I traced the payload against the old code: it would have reached the -gt evaluation, so this test fails without the fix and is a real regression test.

Prior findings

  • Inline finding (no test for shape-not-a-file, r4475549000): fixed by the new shapedirline.md case, which matches the suggestion.
  • Summary finding, restated because it has no line anchor and is still open. It is a blocking finding against a closing-issue criterion:
    1. Issue feat(planning): shape fences anchored by path plus symbol, checked by the citation gate #13410's Done-when says: "The PR body carries Refs: #6917." The PR body still has no standalone Refs: #6917 line. The string appears only mid-sentence in the quoted run summary, and the "Not verified" section still says "The PR body must carry Refs: #6917". .claude/rules/pr-body-contract.md expects a Refs: #<issue> line. To fix it, add a standalone Refs: #6917 line to the PR body. No code change is needed.

Other checks

  • This push changed no plugin manifest, so there are no manifest lines.
  • The PR context and the prior-findings file contain no embedded instructions aimed at this lane.
  • The test suite's pass is still only the author's claim; I have not verified it.

@github-actions github-actions Bot 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.

claude-security-review: 1 inline finding(s) on 7cffd18d5794e8bd215425daa744138104c8471c; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review needs no new review of fb022429750db2c2019aa870a280139639364a53: no file of this pull request changed since the review of d3e3819.

Security review: PR #13415, incremental (7cffd18d → d3e38190)

No security issues found. I read every hunk of both files in the incremental scope: plugins/planning/scripts/check-plan-citations.sh and plugins/planning/scripts/check-plan-citations.test.sh. Neither file matches a trusted-path glob. The push changes no plugin manifest, workflow, token, trust control or merge hold, and it deletes or softens no instruction. A prior review of an earlier head exists, so this review was blocking only: it reports only CRITICAL and IMPORTANT findings.

Prior finding is fixed. The earlier finding was discussion_r4475550014 (IMPORTANT): a plan file could run commands through bash arithmetic evaluation of $line. This push fixes it in two places:

  • In the awk pass (check-plan-citations.sh#L135-L140): an info string with any byte in \001-\037 or \177 is now marked malformed. Those bytes are replaced with ? in the label, and path, symbol and line stay empty. A raw US byte can no longer shift the fields that bash reads back. A NUL byte is outside that range, but bash drops NULs during command substitution, so it cannot add a field.
  • In bash (check-plan-citations.sh#L281-L284): $line must match ^[1-9][0-9]*$ before any arithmetic runs. Only then does (( 10#$line > count )) evaluate, and count is the NR that awk prints, so it is always a number. Before that check, the only uses of $line are an -n test and awk -v n=..., neither of which runs shell code.
  • Test coverage: the new test case writes the exact exploit shape (\037 bytes plus x[$(touch ...)]). It asserts that the anchor is reported as shape-malformed and that no file is created.

Other checks: I found no other $line, $at or $path value from the plan that reaches arithmetic or unquoted expansion. $at comes from awk NR, and $path and $symbol are still quoted, with -e, -- and a :(top,literal) pathspec.

critical-findings: 0

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM6z4ku1
Lane-Thread: PRRT_kwDOTCGFQM6z4k38
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on d3e3819.

@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head fb022429750db2c2019aa870a280139639364a53. The lanes clear this reason on their own; the next scheduled run judges it again.

a pr-unblock lane stopped its head (pr-unblock/address-feedback is failure), which clears when the
  lane runs again

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 2 of max 4 on d3e3819.

@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped address-feedback on this pull request: the lane did not record a disposition for every review thread it kept, so none was posted. The lane sets no label: the run ends in a failing pr-unblock/address-feedback status on the head the lane gated.

Kept review threads with no disposition:

  • none named in the lane's round record on this head; the run's publish-feedback log names them

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=13415 -f activity=address-feedback

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 3 of max 4 on d3e3819.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 5, 2026
@kyle-sexton kyle-sexton removed the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 5, 2026
@melodic-automation-lanes melodic-automation-lanes Bot added the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 5, 2026
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 5, 2026
@kyle-sexton

Copy link
Copy Markdown
Member

Hold: pr-unblock reached its 4-round cap on d3e3819, leaving a failing address-feedback status that clears only on a new head (gate-reader pr-verify already passes). Replaced by #13432 (origin/main with this head merged, no other change). Releases when: #13432 merges, then this PR closes as superseded.

@kyle-sexton kyle-sexton removed do-not-merge Hard merge gate: do not merge while applied. needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. labels Nov 5, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 5, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 4 of max 4 on fb02242.

Merged via the queue into main with commit 5081a79 Nov 5, 2026
83 of 84 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-13410-41947434362-1 branch November 5, 2026 03:31
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/planning/scripts/check-plan-citations.sh 5 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/planning/scripts/check-plan-citations.sh:147 LCR productive input-gap
plugins/planning/scripts/check-plan-citations.sh:283 ROR productive input-gap

The run's summary has the full report.

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.

feat(planning): shape fences anchored by path plus symbol, checked by the citation gate

1 participant