Skip to content

refactor(planning): simplify the scripts and lib planning plugin code - #15001

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14674-42764480375-1
Nov 10, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14674-42764480375-1

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14674

Summary

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

Simplified five of the six listed planning scripts without changing their outputs, exit codes, flags or exported names. check-plan-outcome.sh reuses its commas helper and collapses report() and the closing status into single paths. check-round-codes.sh hoists the CR-strip and fence skip into one awk rule and extracts a question_id() function in place of two copies. goal-condition-length.sh drops if/fi blocks and restating comments. repin-digests.sh reads each pin's call line once instead of twice and parses it with bash regexes. lib/pin-digests.sh has a shorter section_digest comment. page-input.mjs was reviewed and left as is: its checks are already minimal, and the remaining candidates would change the exported parsePageInput/templateChoices contract. A fresh-context review found two edge cases where an earlier draft changed behavior (a leading-zero limit such as --limit 08 in goal-condition-length.sh, and a call line with invalid UTF-8 in repin-digests.sh). Both now match the original exactly: -gt is kept, and kind is parsed with an anchored regex that falls back to the whole line, as the old sed did.

Not verified

  • The planning test suites (check-plan-outcome.test.sh, check-round-codes.test.sh, goal-condition-length.test.sh, page-input.test.sh, repin-digests.test.sh, tests/repin.test.sh) were not run directly in this lane, which allows no interpreter; check-affected does not name the suites it ran. Left to…
  • ci-status green is a PR check, left to the PR's CI.
  • tidy pass 5 (ai-slop:audit fix on the changelog fragment) applied the rubric only: the lane runs only its named wrappers, so detect.sh did not run. The fragment is the two lines the issue requires and was left unchanged.
  • cant-fail-scan was not run: it scans tests, and this change edits none (the wrapper also takes no base-ref argument).
  • Line-number change: bash error messages from the edited scripts (for example the arithmetic error for --limit 08) now name different line numbers, because lines moved. Outputs, exit codes and messages are otherwise unchanged.
  • The working tree also lists untracked .bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile and .zshrc at the checkout root. This run did not create them; they appear to be sandbox mount stubs and are not part of this change.

Fix

  • plugins/planning/scripts/check-plan-outcome.sh: commas() moved above its first use and reused for id-without-row, row-without-tag and planned-breakage; report() reduced to one printf plus the failed flag; closing status line and exit computed once
  • plugins/planning/scripts/check-round-codes.sh: one awk rule strips CR and skips fenced lines for every record; new question_id() replaces the duplicated Q<N> extraction in the pass-1 and grading rules
  • plugins/planning/scripts/goal-condition-length.sh: if/fi guards turned into [[ ]] || die; restating comments trimmed; verdict printed from one echo with the same -gt comparison and exit 0/1
  • plugins/planning/scripts/repin-digests.sh: the call line is read once into call_text; pin label and kind come from bash regexes (label_re, kind_re) with the same match and fallback as the old sed/tr pipelines
  • plugins/planning/scripts/lib/pin-digests.sh: section_digest comment shortened, keeping the whole-line and exactly-once reasons
  • .changes/planning/work-resolve-issue-issue-14674-42764480375-1-3f8f4843.md: patch fragment, ### Changed, "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 25d5d74:

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

The run reports:

  • check-changelog-fragments: all 14 fragments under .changes/ valid
  • check-changed-skills: no changed skills under plugins/*/skills/, nothing to gate
  • check-affected: 13 passed, 6 skipped over 6 changed files (shellcheck passes after fixes for SC2154, SC1003, SC2287 and SC2001 raised by earlier drafts)
  • fresh-context review subagent: checked old vs new behavior of every edited line; reported two edge-case differences (goal-condition-length --limit 08, repin-digests kind on invalid UTF-8), both fixed to match the original; found check-plan-outcome.sh and check-round-codes.sh equivalent and…
  • grep of plugins/planning/tests/interview-defenses.test.sh: no digest pin covers any file under plugins/planning/scripts/, so no re-pin is needed
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42764480375

Left out: the items under Not verified.

Related

#14674

Merge-Risk: max=MEDIUM demote=false head=25d5d7405a9c15b01fdbe30add4b2a9f03565a99 rubric=8.3.3 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15001 (head 25d5d74)

Result: no security issues found. I read every hunk of all 6 changed files. None of them matches a trusted-path glob, and none touches a trust control, a merge hold, token scope, the kill switch, a plugin manifest or a workflow.

What I checked in each file:

  • plugins/planning/scripts/check-plan-outcome.sh: report() still sets failed=1 for any status other than pass. The script still exits 0 when nothing failed and 1 when something did, because failed only ever holds 0 or 1. Moving commas() above its first use doesn't change what any check returns.
  • plugins/planning/scripts/check-round-codes.sh: the CR strip and fence skip are now one rule that runs before the per-file rules. Each record used to hit exactly one of three rules that all did the same strip and skip first, so fence() still runs once per record, in the same order. In pass 1, add_code(question_id($0), 0) can now be called with "", but add_code returns early on an empty code (check-round-codes.sh:98), so grading is unchanged.
  • plugins/planning/scripts/goal-condition-length.sh: every die (exit 2) path is kept, including the guard for a crashed character counter. The verdict still exits 0 for ok and 1 for over, through the last [[ ]] test. The -gt comparison is unchanged.
  • plugins/planning/scripts/repin-digests.sh: label and kind are now parsed with anchored bash regexes, and each falls back to the whole line, as the old sed did. The values are only stored in arrays; they don't reach eval or a shell command, so no new injection surface.
  • plugins/planning/scripts/lib/pin-digests.sh: only a comment changed. The shortened text still gives both reasons for the design: whole-line heading matching, and each boundary occurring exactly once. The section_digest and pin_section code is unchanged, so no instruction-surface control is weakened.
  • .changes/...md: a changelog fragment only.

The PR description contains no embedded instructions aimed at this lane. This was a full review, not blocking only: the lane had reviewed no earlier head.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15001 (refactor(planning): simplify the scripts and lib planning plugin code)

No findings. I read every hunk of all 6 changed files and checked each edited line against the base behavior. Issue #14674 requires outputs, exit codes and flags to stay the same.

  • check-plan-outcome.sh: commas() now sits above its first use. Using it for planned-breakage gives the same result as the old ${invalid# } / ${invalid// /,} pair: one leading space is dropped and the other spaces become commas. That holds because breakage_invalid is one line from field. report() still sets failed=1 on any status that is not pass. exit "$failed" exits 0 or 1, the same as before.
  • check-round-codes.sh: before, all three awk rules (ledger, pass == 1, grading) began with the same CR strip and fence skip. That step is now one shared rule, placed after the FNR == 1 && NR > 1 && in_fence exit, so fence() state changes in the same order. add_code("") already returns early on an empty code, so calling it with question_id's "" on lines with no question adds nothing. The global c is only read inside the matched branch, and grade keeps its own local c.
  • goal-condition-length.sh: there is no set -e, so [[ … -gt … ]] && status=over cannot abort the script. The final [[ "$status" == ok ]] gives exit 0 or 1 as before. The deleted comments are outside the usage() sed range (/^# Mechanical/,/^# Output/), so the printed usage is unchanged.
  • repin-digests.sh: ${call_text//\\/} removes backslashes the same way tr -d '\\' did. label_re and kind_re are ERE versions of the old BRE seds, with the same greedy match up to the last quote. When nothing matches, both fall back to the whole line, as the old sed did. The script runs set -uo pipefail with no -e, so a failed [[ =~ ]] && … does not stop the loop.
  • lib/pin-digests.sh: only a comment changed.

Closing issue #14674 acceptance criteria

  • The diff touches only the listed files and a changelog fragment. It is well under 400 changed lines and 15 files.
  • The fragment has bump: patch, a ### Changed heading and the required line.
  • I checked "behavior unchanged" by reading the code; I ran nothing. The test suites the PR names exist for these scripts. The author says they were not run in their lane.
  • The ci-status green criterion is left to CI.

Unverified claims. The checks in the PR body (shellcheck, check-affected, the changelog-fragment check) are the author's claims. I did not run them.

No plugin manifest changed. No hold class applies.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 25d5d7405a9c15b01fdbe30add4b2a9f03565a99. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 25d5d7405a9c15b01fdbe30add4b2a9f03565a99, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 25d5d74

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-15001-25d5d7405a9c15b01fdbe30add4b2a9f03565a99, expires on 2026-12-10.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit bfe6334 Nov 10, 2026
75 of 76 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14674-42764480375-1 branch November 10, 2026 07:00
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit bfe6334bc2ab5d6503b6f96584ab28211171b6d3; later checks count it verified from this comment.

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.

Simplify the scripts and lib planning plugin code

0 participants