Skip to content

refactor(repo-hygiene): simplify clean resolve-clean-action and scan scripts - #15172

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14720

Summary

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

resolve-clean-action.sh: the reset-or-sweep choice for fleet phrases was written out twice. It now lives in one fleet_tier helper. The second-token lookup is a single ${2:-} call, and the final fallback block is one flat if/elif instead of a nested if. scan.sh: the format_size and emit_path_line helpers are folded into emit_tier's loop. That drops format_size's existence branch, which could never run because the loop already skips a missing path, and the separate empty-line check, which [[ -e ]] already covers. The awk-failure '?' fallback stays, because an earlier pass that removed it was rejected as reachable (CHANGELOG.md:1176). Output, exit codes and flags are unchanged.

Not verified

  • resolve-clean-action.test.sh and scan.test.sh were not run directly here (this lane's Bash runs only the named wrappers); check-affected's output does not say whether its 13 passing checks include them. Left to the PR's CI.
  • scan.sh: if a candidate path is deleted between the loop's [[ -e ]] check and du (a microsecond race), the old code printed 'Size: -' and the new code prints 'Size: ' (empty). Under every other input the output is identical.
  • tidy: passes 1 to 3 ran and made no further edits. Pass 4 (docs-hygiene writing rules) was skipped on the changelog fragment, whose wording the issue dictates verbatim. Pass 5 (ai-slop) was a manual read only, because detect.sh is not a wrapper this lane may run; it found no tells.

Fix

  • plugins/repo-hygiene/skills/clean/scripts/resolve-clean-action.sh: new fleet_tier helper replaces two copies of the tree-batch/all-batch choice; second_action set with one resolve_token "${2:-}" call; nested fallback if collapsed into if/elif
  • plugins/repo-hygiene/skills/clean/scripts/scan.sh: format_size and emit_path_line inlined into emit_tier's loop (unreachable '-' size branch and redundant empty-line check dropped, '?' awk fallback kept); header contract comment now reads Size: <human size>
  • .changes/repo-hygiene/work-resolve-issue-issue-14720-42884754877-1-1667a5b9.md: patch fragment, ### Changed / Internal simplification, no behavior change.

Verification

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

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

The run reports:

Left out: the items under Not verified.

Related

#14720

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

Security review: PR #15172 (head ec5c7220)

No security issues found. I read every hunk of all 3 changed files, plus the head versions of both scripts.

None of the changed files match a trusted path. The diff touches no plugin manifest, no trust control and no instruction surface. It removes no guardrail from a skill or agent body.

plugins/repo-hygiene/skills/clean/scripts/resolve-clean-action.sh: the refactor keeps behaviour the same.

  • fleet_tier contains the same has_reset_intent choice that both removed copies made. A reset phrase still goes to the destructive tree-batch, and any other fleet phrase goes to the selective all-batch.
  • resolve_token "${2:-}" returns empty for an empty argument because the *) branch prints nothing (L84). The $# -ge 2 check on L167 still controls the note path. No new input reaches a more destructive tier.
  • Flattening the fallback into an if/elif keeps the same order: the fleet phrase is checked first, then the phrase case.

plugins/repo-hygiene/skills/clean/scripts/scan.sh: the scan is still read-only, and the protected-path filter is still applied.

  • The inlined loop still skips missing paths and still skips any path for which clean_path_is_protected "$REPO_ROOT" "$abs" succeeds (L45-L46). This happens before anything is printed or added to the total.
  • The script runs with set -u only, not set -e (L14), so the && continue form cannot end the loop early.
  • Paths are still quoted in each du call.
  • The PR describes one difference: if a path disappears between the existence check and the du call, the size is now printed empty. That is a cosmetic output change with no security impact.

.changes/repo-hygiene/…1667a5b9.md: a changelog fragment only, with no security relevance.

The PR description holds no instructions aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of all 3 changed files, plus resolve-clean-action.sh and scan.sh in full at head. The pull request has no earlier review heads, so this was a full review, not a blocking-only one.

resolve-clean-action.sh

  • fleet_tier gives the same tree-batch/all-batch choice the two inline copies made.
  • second_action="$(resolve_token "${2:-}")" is safe under set -u. With no second argument, resolve_token "" prints nothing, and the only reader of second_action (line 167) already requires $# -ge 2.
  • The flattened if … && is_fleet_phrase / elif [[ -z "$canonical" ]] takes the same branches as the old nested if.

scan.sh

  • In the inlined emit_tier loop, [[ -e "" ]] is false, so dropping the separate empty-line check changes nothing.
  • clean_path_is_protected … && continue behaves as the old if guard did: the script runs set -u only, with no errexit.
  • The du -sh … | awk … || printf '?' expression and the TOTAL_BYTES accumulation are kept word for word.
  • Nothing else in the repository calls format_size or emit_path_line; a repo-wide grep found them only in the CHANGELOG.
  • The one output difference is the author-noted race: a path deleted between [[ -e ]] and du now prints an empty Size: where it used to print -. The old code already had a window between its two -e checks, so this is not a meaningful regression.

Closing issue #14720, acceptance criteria

  • Behavior unchanged: met, by my reading of the code. I did not run the tests; that the existing tests pass is the author's claim and is unverified. The PR does not add tests specific to this refactor, but the existing resolve-clean-action.test.sh and scan.test.sh cover these scripts.
  • Edits only the listed files plus a changelog fragment: met.
  • Within 400 changed lines and 15 hand-edited files: met (about 70 lines, 2 files plus the fragment).
  • ci-status green: left to CI.
  • Fragment: met. It has bump: patch, ### Changed, and "Internal simplification, no behavior change."

No plugin manifest changed, so there are no manifest lines. The PR context contains no embedded instructions.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for ec5c722

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-15172-ec5c7220bf2009597c690c78aa51fdd15a038899, 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 75c6985 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14720-42884754877-1 branch November 10, 2026 22:00
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 75c6985b49ed3958ffe5f82a56ba0b23acd84892; 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 clean repo-hygiene plugin code (5 of 5)

0 participants