Skip to content

refactor(instruction-placement): simplify remove-shims.sh - #14762

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14593-42645186850-1
Nov 9, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14593-42645186850-1

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14593

Summary

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

Simplified remove-shims.sh with no behavior change. The identical AGENTS.md find walk, written out twice, is now one agents_walk helper. The repeated '.'-or-subdir path branch, written out three times, is now dir_path. The awk line indexer, written out twice, is now index_file. The dir-row string counter became a 0/1 flag, and two single-use variables and a redundant empty-string test are gone. Outputs, exit codes, refusal messages, flags and trap/signal handling are unchanged; a fresh-context review of the diff found no input where old and new behave differently.

Not verified

  • remove-shims.test.sh not run directly: this lane runs only the named wrappers, and check-affected's summary does not say whether the suite was among its 13 passing checks; left to the PR's CI
  • tidy passes 4-5 (docs-hygiene and ai-slop on the changelog fragment) skipped: the fragment holds only the line the issue requires word for word
  • shellcheck/bash -n were not run separately; check-affected ran shellcheck, which passed after the fix

Fix

  • plugins/instruction-placement/skills/migrate/scripts/remove-shims.sh: replaced the duplicated find walk, '.'-path branches and awk indexer with three helpers (agents_walk, dir_path, index_file); made DIR_ROWS a flag; dropped the single-use cwd, indexed and REMOVED_COUNT variables and a redundant…
  • .changes/instruction-placement/work-resolve-issue-issue-14593-42645186850-1-399c3d42.md: patch fragment, '### Changed' / 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 359ba10:

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

The run reports:

  • check-changelog-fragments: all 2 fragments valid
  • check-changed-skills: migrate PASS, 0 errors (3 pre-existing size warnings on SKILL.md, which this change does not touch)
  • check-affected: first run failed shellcheck SC2094 (info) after the self variable in canary_line was folded into file; restored the separate self variable, and the re-run shows 13 passed, 6 skipped
  • fresh-context review subagent (old vs new script, plus remove-shims.test.sh): no behavior differences found; every message string the test asserts is unchanged
  • tidy-diff over the 16 changed hunks: no further edits (helpers each have 2+ callers; new comments state facts the code does not)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42645186850

Left out: the items under Not verified.

Related

#14593

Merge-Risk: max=MEDIUM demote=false head=9f754d7e2fa76b99984156a1c9e3a75701e4cea6 rubric=8.1.6 rater=claude-opus-5-5 checker=claude-opus-5-5

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

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review needs no new review of 9f754d7e2fa76b99984156a1c9e3a75701e4cea6: no file of this pull request changed since the review of 359ba10.

Security review: PR #14762, head 359ba10

I found no security issues. I read every hunk of both changed files: plugins/instruction-placement/skills/migrate/scripts/remove-shims.sh and the new changelog fragment under .changes/instruction-placement/.

Neither file matches a TRUSTED PATHS: glob. The change touches no trust control, merge hold, token scope, kill switch or plugin manifest. It removes no standing instruction: the refuse guards and their messages are unchanged, so the instruction-surface lens doesn't apply.

What I checked in remove-shims.sh:

  • agents_walk: this is the same find call as before, now in one helper. Both callers still capture its exit code (|| nested_rc=$? and || find_rc=$?), and a failed walk still refuses, so it still fails closed.
  • dir_path: it builds paths from $REPO and the plan's DIR rows exactly as the old inline branches did, with arguments still quoted. Nothing new reaches the path, so there is no new path-injection surface. The cd before the claude -p probe still goes to the same directory.
  • index_file: the awk program is unchanged. The file name still goes in through the F environment variable rather than being interpolated into the program text, so a file name can't inject awk code. Dropping the -n test is harmless because [[ -f "" ]] is false.
  • Canary-index presence check: KEY still reaches awk through ENVIRON. A shim directory missing from the index still refuses.
  • DIR_ROWS: this is now a 0/1 flag. ((DIR_ROWS)) still refuses on a plan with no DIR row.
  • Canary probe: the claude -p call, its --tools "" restriction and the probe text are unchanged.

The PR description states that the closing issue's body was omitted because its author is not trusted. I found no embedded directives in the PR context.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

claude-review needs no new review of 9f754d7e2fa76b99984156a1c9e3a75701e4cea6: no file of this pull request changed since the review of 359ba10.

Code review: refactor(instruction-placement): simplify remove-shims.sh

I read both changed files in full (the changelog fragment and remove-shims.sh), plus the whole head version of the script. No findings.

Behavior-preservation check (my own reading; I ran nothing)

  • agents_walk: it is the same find command as the two copies it replaces, and it returns find's exit status as its last command. Both callers still get || rc=$?, so a failed walk still refuses. It is defined after REPO is set and before its first use at line 189.
  • dir_path: it matches the three old "."-or-subdir branches (in canary_line, the index-presence check, and the canary cd). REPO already came from a command substitution, so dropping trailing newlines in $(dir_path …) changes nothing. KEY="$(dir_path …)/AGENTS.md" awk … is a valid prefix assignment, and the || refuse still applies to awk's exit status.
  • index_file: the awk program and the append target are byte-identical to the old copies. Dropping [[ -n "$file" ]] is safe because [[ -f "" ]] is false. The script runs set -uo pipefail with no errexit, and build_line_index's return value is never read. So the [[ -f … ]] && index_file … form, which can leave a status of 1, has no effect.
  • DIR_ROWS: changing it from a string counter to a 0/1 flag with ((DIR_ROWS)) || refuse gives the same result. Under set -u the variable is initialized to 0.
  • Zero-byte AGENTS.md refusal: it was rewritten from if to [[ … ]] || with the same condition and message.
  • Removed variables: REMOVED_COUNT, cwd and indexed were each used once, and nothing else in the plugin reads them (grep).

Closing issue #14593 acceptance criteria

  • Behavior unchanged: met, as far as I can tell from reading the code. remove-shims.test.sh is in the repository to catch a regression. The PR says the author did not run it directly; I did not run it either.
  • Diff edits only the listed file plus a fragment: met.
  • Within 400 lines / 15 files: met.
  • ci-status green: not something this lane can check.
  • Fragment body: met. It has bump: patch, ### Changed and "Internal simplification, no behavior change."

Rules and manifests

  • .claude/rules/skill-bodies-state-current-rules.md and cost-claims.md match the script's path. The new comments describe only the script's own behavior, with no volatile upstream specifics or prices, so neither rule is broken.
  • No plugin manifest changed.

Not verified

The author's own checks (check-affected and shellcheck passing, plus the fresh-context review) are author-claimed and I did not verify them.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 9f754d7

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-14762-9f754d7e2fa76b99984156a1c9e3a75701e4cea6, expires on 2026-12-09.

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 9, 2026
Merged via the queue into main with commit fabd094 Nov 9, 2026
46 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14593-42645186850-1 branch November 9, 2026 19:07
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-shims.sh instruction-placement plugin code

1 participant