Skip to content

refactor(code-tidying): simplify remove-comments scripts without behavior change - #15162

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14433

Summary

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

Reviewed all 14 listed files through /simplify's four checks and simplified the five that had duplication: detect.sh merges its three value-taking options into one branch (same error text via $1), re-anchors targets in place, factors the twice-written keep-or-exclude step into cr_keep_target, prints a finding with one printf, and merges the two line-skip branches (dropping a prev_shapes reset that nothing reads while prev_ct is empty); comment-shapes.sh folds three locals into one and reuses its own eb boundary in the origin-note regexes; settings.sh drops a status temporary. The changed-code-files.sh wrapper now points to change-shape.sh for the grant rationale like its siblings instead of restating it, and added-lines.sh points there too. The other nine files (thin exec wrappers, open-pr-count.sh, upkeep-setting.sh) were already minimal; open-pr-count.sh's api-budget line was left as is because switching it to SCRIPT_DIR would change which path it sources when the script is invoked without a directory component.

Not verified

  • Shell test suites (detect.test.sh, settings.test.sh, open-pr-count.test.sh and the plugin's scripts/*.test.sh) were not executed here: this lane runs no interpreter; left to the PR's CI
  • tidy passes 4-5 (docs-hygiene writing rules, ai-slop fix) skipped on the changelog fragment: its text is fixed verbatim by the issue's acceptance criteria
  • Changes left uncommitted in the working tree per the lane's instructions; the runner turns them into the patch
  • ci-status green is a PR check left to the PR's CI

Fix

  • plugins/code-tidying/skills/remove-comments/scripts/detect.sh: merged --paths-file/--exclude-from/--added-since parsing, in-place target anchoring, cr_keep_target helper, single-printf emit_finding, merged skip branches, one-line pre-pass loops
  • plugins/code-tidying/skills/remove-comments/scripts/lib/comment-shapes.sh: one local declaration in cr_detect_shapes_text; origin-note regexes reuse ${eb}
  • plugins/code-tidying/skills/remove-comments/scripts/settings.sh: read_layer tests $? directly instead of through a status variable
  • plugins/code-tidying/skills/remove-comments/scripts/changed-code-files.sh: header comment shortened to the sibling wrappers' pointer to change-shape.sh
  • plugins/code-tidying/skills/remove-comments/scripts/added-lines.sh: header comment points to change-shape.sh for the rationale
  • .changes/code-tidying/work-resolve-issue-issue-14433-42883564370-1-1c8081d5.md: patch fragment, ### Changed, Internal simplification, no behavior change.

Verification

The runner ran each check from the base copy against 9b0670f:

  • 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 (run before and after tidy)
  • check-changed-skills: remove-comments PASS, 0 errors, 2 pre-existing size warnings (run before and after tidy)
  • check-affected: 13 passed, 6 skipped over 6 changed files (run before and after tidy)
  • grep of plugins/code-tidying tests and evals: no test asserts on the edited wrapper comments or option-parsing lines; detect.test.sh's --exclude-from assertions (excluded-count note, exit 2 on missing file or missing value) match the unchanged messages and exits
  • fresh-context review subagent over the full diff: no findings; traced each hunk (option messages, TARGETS indices, cr_keep_target, prev_shapes reads, printf args, $? after local-declared assignment, eb scope and value) as behavior-identical
  • tidy-diff over the 17 changed hunks: passes 1-3 found nothing to change; 3 of 18 turns used
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42883564370

Left out: the items under Not verified.

Related

#14433

Merge-Risk: max=MEDIUM demote=false head=9b0670fe824f3fc04f923ba7d4bd55679eb4a53e rubric=8.3.5 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 9b0670fe824f3fc04f923ba7d4bd55679eb4a53e: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15162

I found no security issues.

I read every hunk in all 6 changed files. The change is a refactor of the code-tidying remove-comments scripts plus a changelog fragment:

  • detect.sh
    • Merges the parsing of the --paths-file, --exclude-from and --added-since options into one branch. The value check still runs before the value is used, and the error still exits 2.
    • Anchors targets in place. Indexed assignment of a quoted command substitution adds no injection surface.
    • Factors the keep-or-exclude step into cr_keep_target. Exclusion still runs on both directory and file targets.
    • Combines the finding output into one printf with a constant format string. All values go through %s arguments, so there is no format-string injection.
    • Merges the two line-skip branches.
  • lib/comment-shapes.sh
    • Folds three local declarations into one.
    • The origin-note regexes now reuse the function's own ${eb} boundary. This is detection logic, not a trust boundary.
  • settings.sh: tests $? directly instead of through a status variable. It still reads the reader's exit code from the same command substitution.
  • changed-code-files.sh and added-lines.sh: header comments only. The removed text explained why the allowed-tools grant names ${CLAUDE_SKILL_DIR}. It was rationale, not a standing instruction: the grant itself is not in this diff and is unchanged.
  • Changelog fragment: a patch-bump note.

What the review covered:

  • Trusted paths: no changed file matches a TRUSTED PATHS glob.
  • Trust controls: no trust control, merge hold, token scope, kill switch or workflow is touched.
  • Plugin manifests: no plugin manifest (plugin.json or marketplace.json) is changed.
  • Untrusted input: no untrusted input reaches a credentialed context through these local scripts.
  • Instruction text: the PR context has no embedded instructions aimed at this lane.
  • Prior reviews: this is the lane's first review of the PR (blocking only: no).

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of all 6 changed files. I checked each one against the code at head to see whether behavior stays the same. I ran no tests. The shell test results and the CI status in the PR body are the author's claims, and I have not verified them.

detect.sh

  • Option parsing: --paths-file, --exclude-from and --added-since now share one branch. The error text uses $1, so each message is the same as before, and each still exits 2.
  • Target anchoring: targets are now anchored in place with ${!TARGETS[@]}. A length check guards this step, so set -u is still safe.
  • cr_keep_target: it gives the same results as the two old copies: non-code files are skipped, and the excluded count and the EXPANDED list are both global. No other file defines or uses either name.
  • emit_finding: it now uses one printf with the same format. The excerpt is still passed as an argument, not as the format string, so the output is byte-identical.
  • Merged skip branches: the conditions run in the same order (in_scope first, then cr_line_skipped). Dropping the prev_shapes="" reset is safe: prev_shapes is read only at detect.sh:325, inside the -n "$prev_ct" guard at detect.sh:319. Both skip paths still clear prev_ct.

lib/comment-shapes.sh

  • ${eb} is declared in the same function (comment-shapes.sh:182) with the same text as the regex piece it replaces, ([^[:alnum:]]|$). The capture-group count is unchanged.
  • Folding the three local declarations into one keeps the same defaults.

settings.sh

  • local is declared on an earlier line, so $? right after value="$(...)" is still the reader's exit status. status is not used anywhere else in read_layer.

Wrapper comments

  • The new changed-code-files.sh header matches the other six sibling wrappers word for word.
  • The added-lines.sh pointer now names change-shape.sh, which is the file that actually holds the citation.

Closing issue #14433

  • Behavior unchanged: met. detect.test.sh and settings.test.sh exist and cover these paths, but I did not run them.
  • Only listed files and a changelog fragment are edited: met.
  • Under 400 changed lines and 15 files: met (about 120 lines, 5 hand-edited files).
  • The fragment has bump: patch, a ### Changed heading and the required line: met.
  • ci-status green: left to CI.

No text in the PR context asks the lane to change its review.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 9b0670f

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-15162-9b0670fe824f3fc04f923ba7d4bd55679eb4a53e, 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
Merged via the queue into main with commit e7e9557 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14433-42883564370-1 branch November 10, 2026 20:55
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit e7e955714290ed20c71ada02fe35e6d3cd0e9470; 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 remove-comments, tidy-diff and tidy code-tidying plugin code

0 participants