Skip to content

refactor(guardrails): simplify range 5 of block-root-delete-target.sh - #15260

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14480-42958876131-1
Nov 11, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14480

Summary

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

Simplified the functions that start in range 5 of 5 (lines 6651-8313 of 8313) of plugins/guardrails/hooks/block-root-delete-target.sh, with no behavior change. rdt_ps_param_to repeated rdt_ps_pick_to exactly (same token normalization, exact-then-unique-prefix match), so the one call site in rdt_ps_ri_check now calls rdt_ps_pick_to with the same parameter list and the duplicate is gone. rdt_ps_ri_check's __raw copy became one case on ${__v,,}. The rdt_ps_rest wrapper and rdt_ps_statement's length-guard branches now pass the array slice directly, which is safe because __w is non-empty there and the slice expands to zero words exactly when the old else-branch ran. The empty-operand if-blocks in rdt_ps_cmd_rd and rdt_ps_ri_check are now one-line || guards, never the last command of a function, so no return status changes. Considered and left alone: the cross-function command-basename normalization (rdt_ps_statement, rdt_ps_decoded, rdt_ps_list_judge, rdt_ps_cmd_line), which is deduping for the restructuring pass, and rdt_ps_robocopy_check's guard, since rdt_robocopy_scan with no operands is not shown to be a no-op.

Not verified

  • The guardrails hook test suites were not run: this lane can run only its named wrappers, not bash test scripts. Left to the PR's CI (ci-status).
  • ci-status green on the PR: a CI check, left to the PR's CI.
  • shellcheck and shfmt on the touched shell file were not run separately; the lane cannot invoke them directly beyond check-affected. Left to the PR's CI.
  • Tidy: the hook script's 10 hunks were dropped from tidy because the script is wired as a hook command (plugins/guardrails/hooks/hooks.json:113), which puts it on tidy's GLOBAL HARD list (hard_exclusions unset, so enforce); passes 1-3 had no rows. Passes 4 and 5 ran on the fragment and made no edit,…
  • The changes are left uncommitted in the working tree as this lane's instructions require; the runner turns them into the patch.

Fix

  • plugins/guardrails/hooks/block-root-delete-target.sh: removed rdt_ps_param_to (its one caller uses rdt_ps_pick_to with the same list) and rdt_ps_rest (rdt_ps_statement calls rdt_ps_ri_check "${__w[]:__i}" directly); rdt_ps_ri_check drops __raw in favor of a case on ${__v,,} for -rf/-fr; rd/rmdir…
  • .changes/guardrails/work-resolve-issue-issue-14480-42958876131-1-8360438f.md: new patch fragment from new-changelog-fragment, body '### Changed' and '- Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against e243e7b:

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

The run reports:

  • range measured on the current file: 8313 lines, range 5 of 5 is lines 6651-8313 (same floor((k-1)N/5)+1..floor(kN/5) split part 4 used); every edited function starts in it (rdt_ps_param_to 6897, rdt_ps_cmd_rd 7051, rdt_ps_ri_check 7206, rdt_ps_rest 7298, rdt_ps_statement 7859, numbered before the…
  • Grep over the repository (excluding .lane/) for rdt_ps_param_to, rdt_ps_rest and rdt_ps_ri_check: only the hook file references them, so no other file calls a removed name
  • check-changelog-fragments: all 19 fragments valid (run before and after tidy)
  • check-changed-skills: no changed skills, nothing to gate (run before and after tidy)
  • check-affected: 13 passed, 6 skipped over 2 changed files (run before and after tidy)
  • fresh-context review subagent, given the hunks and the file: all 6 hunks SAFE, each traced (rdt_ps_pick_to matches param_to's normalization and result; -rf/-fr case equals the __raw test for a word starting with '-'; || guards never end a function; __w non-empty so the slice is set -u safe and…
  • diff size: 2 files, one area (plugins/guardrails plus .changes/guardrails), about 80 changed lines, under the 400-line and 15-file limits
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42958876131

Left out: the items under Not verified.

Related

#14480

Merge-Risk: max=HIGH demote=true head=e243e7bfc4d5d9a1ba59492091aa6a42a1114835 rubric=8.4.1 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-review reviewed e243e7bfc4d5d9a1ba59492091aa6a42a1114835: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings. I read every hunk in both changed files.

This is a behavior-neutral refactor of plugins/guardrails/hooks/block-root-delete-target.sh, and I traced each hunk against the code at head:

  • rdt_ps_param_to → rdt_ps_pick_to. rdt_ps_pick_to (L7391) normalizes the token the same way as the removed function: strip one leading -, drop everything from the first :, lowercase. It returns an exact match first, otherwise a unique prefix, otherwise empty. The name list passed at the call site is the same 23 names in the same order. No file outside .claude-lane/ still references rdt_ps_param_to, rdt_ps_rest or rdt_ps_ri_args.
  • -rf/-fr detection. The old __raw test (strip one -, cut at :, lowercase, compare to rf/fr) matches exactly the words case "${__v,,}" in -rf | -fr | -rf:* | -fr:* matches. This holds for every word starting with -, which is the only branch it runs in. --rf was refused before and is refused now.
  • rdt_ps_rest removal and the cmd branch in rdt_ps_statement. __w is non-empty there because of the guard at L7814. So "${__w[@]:__i}" is safe under set -u and gives zero words exactly when the old else-branch ran. The other cases in the same case already passed this slice directly. Called with no arguments, rdt_ps_cmd_from skips its loop and returns 0, and rdt_ps_statement returns 0 regardless. rdt_ps_cmd_rd gets the same arguments as before.
  • || rdt_block guards. In both rdt_ps_cmd_rd and rdt_ps_ri_check the guard is never the last command in the function, so no return status changes.

Closing issue #14480 acceptance criteria:

  • Behavior unchanged: met by the trace above. I did not run the hook test suites (this lane has no shell). The author's verification list is author-claimed and unverified.
  • Diff edits only the listed file plus a changelog fragment: met.
  • Within the 400-line / 15-file limits: met (about 80 changed lines, one hand-edited file).
  • Every edited function starts in range 5 (lines 6651–8313 of the base file): met. The earliest is rdt_ps_param_to at base L6897.
  • Fragment is bump: patch, with body ### Changed / "Internal simplification, no behavior change.": met.
  • ci-status green: left to CI, not verified here.

No plugin manifest changed and no embedded instructions were found in the PR context. This was a full review, not blocking only.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15260, no security issues found

I read every change in both changed files. plugins/guardrails/hooks/block-root-delete-target.sh is a guard hook: it blocks recursive deletes in the PowerShell lane. The diff touches its block logic, so I checked each hunk against the base code to see whether any refusal was narrowed. None was.

  • rdt_ps_param_to replaced by rdt_ps_pick_to. The replacement lives at block-root-delete-target.sh:7391-7408. It does the same thing as the removed function:

    • it strips one leading - and anything from the first :, then lowercases;
    • an exact match wins; otherwise it accepts a unique prefix and returns empty when none or several match.

    The call site at L7180-7183 passes the same 23 parameter names, so recurse, path/literalpath and the value-taking parameters bind exactly as before.

  • -rf / -fr detection. The old test stripped one dash and the : suffix, lowercased, then compared to rf/fr. The new case "${__v,,}" in -rf | -fr | -rf:* | -fr:*) at L7184-7187 gives the same answer for every word, because the branch only runs for words starting with - (L7179). I checked --rf, -RF:x and -rf:a:b: both versions agree on each.

  • Empty-operand guards. These are now one-line || guards (L7061, L7064, L7251, L7253). Each still calls rdt_block under the same condition, and none is the last command of its function, so no return status changes.

  • rdt_ps_rest removed and slices passed directly (L7830-7835).

    • __w is non-empty at that point (L7814, L7822), so "${__w[@]:__i}" is safe under set -u (L845). The surrounding branches (L7841-7847) already use the same pattern.
    • cmd now calls rdt_ps_cmd_from even with no operands. With zero words its loop never runs (L7146), so this is a no-op.
    • rd/rmdir still runs both rdt_ps_ri_check and rdt_ps_cmd_rd.
  • Changelog fragment. The .changes/guardrails/... fragment is prose only and has no security impact.

Other checks:

  • Instruction-surface lens: the hook's refusals are kept as they were, so no protected guardrail is removed or narrowed.
  • Trust controls: none touched.
  • Manifests: no plugin manifest changed.
  • PR context: the closing issue's text was withheld by the wrapper. The PR description has no embedded directives aimed at the review.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for e243e7b

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-15260-e243e7bfc4d5d9a1ba59492091aa6a42a1114835, expires on 2026-12-11.

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 11, 2026
Merged via the queue into main with commit 3699b9a Nov 11, 2026
72 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14480-42958876131-1 branch November 11, 2026 05:30
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 3699b9a37f3db61c615db1c6eb9b3929cfe0bfc4; 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 block-root-delete-target.sh guardrails plugin code (part 5 of 5)

0 participants