Skip to content

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

Closed
kyle-sexton wants to merge 3 commits into
mainfrom
feat/13410-shape-fences-replacement
Closed

kyle-sexton wants to merge 3 commits into
mainfrom
feat/13410-shape-fences-replacement

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

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

Replacement

Replaces #13415 (lanes App PR whose pr-unblock reached its 4-round cap on d3e3819, leaving a failing address-feedback status that clears only on a new head). This branch is origin/main with #13415's head merged, no other change.

melodic-automation-lanes Bot and others added 3 commits November 5, 2026 01:31
Lane-Activity: work-resolve-issue/resolve-issue
Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM6z4ku1
Lane-Thread: PRRT_kwDOTCGFQM6z4k38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T02:58:46.681470Z 5ac5ba9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 5ac5ba97b9d7566a92eaf392439f928ff5054ede: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #13432 (head 5ac5ba9)

No security issues found. I read every hunk of all 6 changed files. None of them matches a trusted-path glob. The PR changes no trust control, plugin manifest, workflow or token scope.

Where untrusted input goes: plugins/planning/scripts/check-plan-citations.sh. The new shape-fence parser takes text from a PLAN.md, which may be author-controlled, and passes it to git and to bash arithmetic. I traced each field to where it is used:

  • Path: always passed quoted. It reaches git cat-file -t "$commit:$path" (L258) and a :(top,literal)$path pathspec after -- (L265). Both only read objects already in the repository. Neither can run a command, read outside the git object store, or be taken as an option.
  • Symbol: passed after -e to both git grep -F and grep -F, so a leading - cannot be read as an option. The test file adds a --dry-run case for this.
  • Line number: the only field that reaches arithmetic ((( 10#$line > count ))). It has to match ^L[1-9][0-9]*$ in awk (L149), and bash checks it again as digits before the arithmetic runs.
    • An info string holding any control byte, including the \037 field separator, is marked malformed. Its path, symbol and line are left empty and the control bytes are replaced with ? (L135-L139). So a crafted fence cannot shift a value into the line field, where arithmetic would run a command substitution.
    • The new shapeus.md test checks this with a $(touch …) payload.
  • Output: the label is printed only on a line starting shape=, and awk input is line-based, so a label cannot contain a newline. It cannot fake the final citations=… status=ok line.
  • cut -s -f3: this change keeps the new US-separated shape rows out of the path list. Tabs in the info string are turned into spaces before the row is built.

Documentation and instruction files (SKILL.md, plan-template.md, plan-md-anatomy.md, the changelog fragment): they only add guidance. They delete, narrow or soften no standing rule, so the instruction-surface check finds nothing. I did not consult the instruction exception register, because no rule was removed.

PR context: the description has no embedded instructions aimed at this review.

This is the lane's first review of this PR (blocking only: no). No earlier findings apply.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed 5ac5ba97b9d7566a92eaf392439f928ff5054ede: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #13432, shape fences checked by the citation gate

I found no blocking or advisory issues. I read every hunk of all 6 changed files, plus the whole of check-plan-citations.sh and the test harness in check-plan-citations.test.sh.

What I checked

  • Two row types in one stream. Citation rows (C) are split by TAB and shape rows (S) by the US byte (\037), and the two never get mixed up:
    • Adding -s to cut -s -f3 (line 222) keeps shape rows out of the path rows.
    • The grading awk skips any row whose first field is not C.
    • The shape loop skips any row whose tag is not S.
    • The awk turns runs of spaces and tabs into single spaces before it writes a shape row, so a shape row never carries a TAB.
  • Control bytes and arithmetic. If the info string holds a control byte, the row is marked malformed and each such byte becomes ?. The L<n> value is checked as digits before (( 10#$line > count )) runs. Together these block the field-shift-into-arithmetic case, and the shapeus.md test covers it.
  • How each reason is graded (check-plan-citations.sh lines 256-289):
    • A missing path, a tree with L<n>, a submodule, or a file with no symbol each map to the reason the docs give.
    • The symbol search uses git grep -q -w -F -e with a :(top,literal) pathspec. Exit 1 maps to shape-missing-symbol and any other error exits 2.
    • shape-line only warns, and a warning alone leaves the exit code at 0.
  • Outermost fences only. Only an opening fence (!in_fence) creates a shape row. The 4-backtick outer fence in plan-md-anatomy.md and the markdown ```` example in plan-template.md both keep their inner `shape` fences unchecked.
  • Closing issue feat(planning): shape fences anchored by path plus symbol, checked by the citation gate #13410, "Done when":
    • The tests cover shape-missing-path, shape-missing-symbol, shape-past-end, the shape-line warning, a directory anchor, a symbol starting with -, and a quoted example that is not checked. They also cover shape-not-a-file and shape-malformed.
    • The template names the three allowed forms and says types and signatures belong in ## Design.
    • The PR body carries Refs: #6917.
  • Changelog fragment: bump: minor matches a new capability. No plugin manifest changed, so the manifest checks do not apply.
  • Path-scoped rules: .claude/rules/skill-bodies-state-current-rules.md and cost-claims.md apply to the changed skill files. Neither is broken: the files restate no volatile upstream specifics and make no cost claims.
  • Paved paths: the standards index has no paved-path row, so there is nothing to report.

Notes (not counted as findings)

  • One task in feat(planning): shape fences anchored by path plus symbol, checked by the citation gate #13410 says "Step 4.7 names the new reasons". The SKILL.md Step 4.7 text names only shape-line and links to the full list in plan-template.md "Shape fences". The PR says this was a deliberate trim, and the issue's "Done when" list does not include this task, so I'm not flagging it. A person may still want to confirm that the link is enough.
  • Nothing here was run by me: this lane has no shell. Whether check-plan-citations.test.sh passes and whether shellcheck is clean are author-claimed and unverified. The PR's own "Not verified" list says neither was run, so both are left to CI. I traced the new test cases against the script by hand, and they match the expected exit codes and output patterns.

No embedded instructions were found in the PR context. The prior-findings file shows no earlier review, so this was a full review, not a blocking-only one.

@kyle-sexton

Copy link
Copy Markdown
Member Author

Superseded by #13415. R106: a replacement of a pr-verify-FAILed PR must change the diff, and this one did not (same change digest), so the gate refused it with verify:earlier-fail. #13415 takes the existing remedy instead: a main merge gives it a fresh head with its PASS digest unchanged.

@kyle-sexton kyle-sexton closed this Nov 5, 2026
@github-actions
github-actions Bot deleted the feat/13410-shape-fences-replacement branch November 6, 2026 13:23
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