Skip to content

refactor(repo-fleet-hygiene): simplify audit-fleet.sh part 1 of 2 - #15169

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14711

Summary

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

Simplified the functions that start in lines 1-1852 of audit-fleet.sh (range 1 of 2 of the 3704-line file) without changing behavior. classify_worktrees now builds its '<path> (<branch>)' label once, appends list separators with ${var:+, }, and calls under_configured_root once instead of twice in its conforming/wrong-layout split. A new physical_path_key helper replaces the repeated path_key "$(physical_path ...)" nesting, and use_fallback_worktree_root replaces two copies of the fallback-root assignment. to_native_path reads the upper-case drive letter from a table instead of forking printf|tr, and directory_has_non_git_entries uses ${child##*/} instead of forking basename. Out of scope and left alone: record_bare_live_tree, whose loop could use array_contains but which the test file extracts and evals on its own without that helper; graphql_query_admitted's tr lowercasing, because lower() is ASCII-only while BSD tr lowercases some non-ASCII characters, so swapping them could change which queries are admitted; and line 3317's long-form path_key call, which sits in a function starting in range 2.

Not verified

  • Commit: the lane's system prompt says to leave every change uncommitted in the working tree for the runner to turn into a patch, so nothing was committed
  • audit-fleet.test.sh and shellcheck were not run directly here, because the lane allows no interpreter or arbitrary command; left to the PR's CI
  • ci-status green: a PR CI check, left to the PR's CI
  • tidy pass 5 (ai-slop): only the rubric layer ran; the deterministic detect.sh layer and its findings file were skipped because the lane's Bash allowlist does not include that script
  • cant-fail-scan: not applicable, because it scans test files and this change touches none

Fix

  • plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh: wt_label computed once in classify_worktrees; ${var:+, } separator appends; merged the two under_configured_root branches; new physical_path_key and use_fallback_worktree_root helpers used at their call sites in range 1; tr fork…
  • .changes/repo-fleet-hygiene/work-resolve-issue-issue-14711-42884720412-1-314e373c.md: patch fragment created with new-changelog-fragment, body '### Changed' and '- Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: All 9 changelog fragment(s) under .changes/ are valid (before and after tidy)
  • check-changed-skills: CHECK-SKILL audit PASS, 0 errors, 3 pre-existing size warnings on the audit SKILL.md, which this change does not touch (before and after tidy)
  • check-affected: 13 passed, 6 skipped over 2 changed files (before and after tidy)
  • git-read diff --numstat HEAD: 46 added, 44 removed in audit-fleet.sh; every changed function starts before line 1852
  • fresh-context review subagent over the whole diff: no behavior-changing defects found; it confirmed the sed-extracted test functions still work in isolation, that no new name collides with an existing one, and that the parameter expansions match the old command output for every input the code can…
  • tidy-diff over 27 hunk rows: passes 1-5 made no further edits and raised no proposals
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42884720412

Left out: the items under Not verified.

Related

#14711

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

Security review: PR #15169 (head a52d70f)

I found no security issues.

I read every hunk of both changed files:

  • plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh: a refactor of a read-only audit collector that runs locally.
  • .changes/repo-fleet-hygiene/work-resolve-issue-issue-14711-42884720412-1-314e373c.md: a changelog fragment.

Neither file matches a trusted-path glob. Neither touches a trust control, a merge hold, a plugin manifest, a workflow or a standing instruction.

What I checked in audit-fleet.sh:

  • Upper-case drive letter: to_native_path now reads it from a fixed table (WINDOWS_DRIVE_LETTERS_UPPER) at the same index, instead of running printf | tr. This gives the same output for all 26 drive letters, and no input reaches a command.
  • basename: directory_has_non_git_entries now uses ${child##*/} instead of calling basename. The glob results there never end in a slash, so the name comes out the same. It still skips ., .. and .git.
  • Merged branch: classify_worktrees now calls under_configured_root once, then sorts the result into conforming or wrong-layout. The outcome is the same as the old two-branch chain, and the emitted findings are unchanged.
  • Helpers: wt_label, the ${var:+, } separators, physical_path_key and use_fallback_worktree_root are plain extractions. Every variable expansion stays quoted, and there is no new eval, no new external command and no new place where untrusted data is interpolated.

PR context: it contains no instructions aimed at this lane. The closing issue's body was left out by the wrapper because its author is not on the allowed-author list. Nothing in the diff depends on that body.

This was a full review of the head, not a blocking-only one; there were no prior findings. I ran no hunters and needed no verifier, because there were no candidates.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of both changed files: audit-fleet.sh and the new changelog fragment. I checked each change against the acceptance criteria in #14711. The bar was the same behavior, edits only in range 1 of 2, and a patch fragment with the required body.

Behavior checks, done by reading the code (nothing was run here):

  • to_native_path: ${WINDOWS_DRIVE_LETTERS_UPPER:i:1} gives the same letter that printf | tr '[:lower:]' '[:upper:]' gave, for all 26 ASCII drive letters, and it still avoids ${var^}, so bash 3.2 still works.
  • physical_path_key is exactly path_key "$(physical_path "$1")". It sits at line 884, before the source-guard at line 1264. So under_configured_root and classify_worktrees still resolve it when audit-fleet.test.sh sources the script.
  • classify_worktrees:
    • wt_label is built after wt_path and wt_branch are set, and neither changes later in the loop body.
    • ${var:+, } appends the same separators as the removed if blocks.
    • The merged under_configured_root branch puts each worktree in the same bucket as before: conforming, wrong layout, or outside the root.
  • use_fallback_worktree_root makes the same three assignments, and its exit status is 0. So try_read_worktree_root ... || use_fallback_worktree_root runs the same flow as the old if ! block. It is defined and called only after the guard, and the test file does not extract any function that calls it.
  • directory_has_non_git_entries: ${child##*/} matches basename for glob results, which never end in /. The test that extracts this function with sed (audit-fleet.test.sh lines 2531–2552) still gets a self-contained function.

Acceptance criteria:

  • Scope: only the listed file and one fragment are edited, and every changed function starts before line 1852.
  • Size: about 90 lines changed, well under the 400-line limit.
  • Fragment: bump: patch, with the required ### Changed body.
  • Tests: the existing classify_worktrees and directory_has_non_git_entries tests in audit-fleet.test.sh cover the changed paths.

Not verified here: CI status, and the shellcheck and test-suite results the author lists. Those are claimed by the author, and I could not run them.

No plugin manifest changed. Nothing in the PR text tries to steer the review.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for a52d70f

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-15169-a52d70f5954d860d7428f85c25039e4f6a2cd64d, 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 a961eff Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14711-42884720412-1 branch November 10, 2026 21:02
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 57%; mutation score 57%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh 4 3 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh:1058 other productive no-assertion
plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh:150 other productive input-gap
plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh:885 other productive input-gap

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit a961effc43aa22544db5aeb360b60b5b5f4cffcd; 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 audit-fleet.sh repo-fleet-hygiene plugin code (part 1 of 2)

0 participants