Skip to content

fix: Simplify the shared fleet-discovery, scope-resolve and worktree-root-resolve scripts in both - #15488

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-15419-43136195953-1
Nov 12, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #15419

Summary

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

Simplified the three cross-plugin shell scripts without changing behavior. The canonical copies were edited and the same edits applied to each mirror, so every pair stays byte-identical. fleet-discovery.sh inlines a single-use local and collapses an if into a guard. It also condenses an 8-line comment that carried a ticket back-reference. scope-resolve.sh drops a redundant $# -gt 0 wrapper (looping over no arguments is already a no-op) and merges paired printf calls that write the same bytes. worktree-root-resolve.sh folds two duplicated success branches into one if/elif/else with a single assignment and return. Design choice: kept every function name, variable and flag, and kept the edits small and local, because the issue puts cross-file moves out of scope.

Not verified

  • Test suites (scope-resolve.test.sh, audit-fleet.test.sh, sync-fleet.test.sh, worktree-create.test.sh) were not executed here: this lane can run only the named wrappers. Left to the PR's CI.
  • ci-status green is a PR CI check; left to the PR's CI.
  • Tidy not run: the change spans 2 areas (plugins/repo-fleet-hygiene and plugins/source-control, with their .changes dirs), over the 1-area tidy cutoff.
  • Theoretical difference noted by review: WORKTREE_ROOT_VALUE/KEY_USED are exported, and git child processes started by legacy retire/promote now see them empty instead of set. Git ignores these variables and nothing reads them from the environment, so there is no observable change.

Fix

  • plugins/repo-fleet-hygiene/scripts/fleet-discovery.sh (canonical): fleet_finalize_skip_names uses a \[\[ \]\] || guard; should_skip_dir_name comment condensed from 8 to 4 lines (ticket back-reference dropped); fleet_discover_root passes "${child##*/}" straight to should_skip_dir_name and drops…
  • plugins/source-control/scripts/fleet-discovery.sh (mirror): same edits, byte-identical to the canonical copy (blob bb6b90bd).
  • plugins/repo-fleet-hygiene/scripts/scope-resolve.sh (canonical): removed the redundant if \[\[ "$#" -gt 0 \]\] wrapper around the named-path rung; merged the two printf calls in the ancestor and cwd rungs.
  • plugins/source-control/scripts/scope-resolve.sh (mirror): same edits, byte-identical (blob 62e23ecd).
  • plugins/source-control/scripts/worktree-root-resolve.sh (canonical): worktree_root_resolve's two duplicated success blocks became one if/elif/else, with the WORKTREE_ROOT_VALUE / WORKTREE_ROOT_KEY_USED assignments and return 0 stated once.
  • plugins/repo-fleet-hygiene/scripts/worktree-root-resolve.sh (mirror): same edits, byte-identical (blob 7edb76a9).
  • .changes/repo-fleet-hygiene/work-resolve-issue-issue-15419-43136195953-1-3b171683.md: patch fragment, ### Changed / Internal simplification, no behavior change.
  • .changes/source-control/work-resolve-issue-issue-15419-43136195953-1-63647379.md: patch fragment, ### Changed / Internal simplification, no behavior change.

Verification

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

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

The run reports:

  • check-changelog-fragments: all 7 fragments under .changes/ valid.
  • check-changed-skills: no changed skills, nothing to gate.
  • check-affected: 13 passed, 6 skipped (ruff no .py, typos not installed, three validate-plugins steps that run code from the checked tree, changed-skills), over 8 changed files.
  • git-read diff --unified=0: each mirror's post-change blob hash matches its canonical (fleet-discovery bb6b90bd, scope-resolve 62e23ecd, worktree-root-resolve 7edb76a9), so the pairs are byte-identical as scripts/cross-plugin-source-registry.txt requires.
  • git-read diff --stat: 62 changed lines across the three canonical copies (fleet-discovery 23, scope-resolve 24, worktree-root-resolve 15), within the 400-line limit.
  • Grep: no caller hook (audit-fleet.sh, worktree-discover.sh, sync-fleet.sh) reads or writes a bare name via dynamic scope; every name in audit-fleet.sh is function-local. worktree-root-legacy.sh never reads WORKTREE_ROOT_VALUE, WORKTREE_ROOT_KEY_USED or raw, so moving the assignments after…
  • Fresh-context review subagent over the whole diff and its callers: no confirmed findings. It flagged one comment ('unreachable today') as overclaiming, since a broken-symlink or FIFO .git can reach the arm; reworded in both copies.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43136195953

Left out: the items under Not verified.

Related

#15419

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

Code review: PR #15488, no findings

This PR simplifies three shell scripts that exist as byte-identical pairs in repo-fleet-hygiene and source-control, and adds two patch changelog fragments. I read every hunk of the 8 changed files. The second changelog fragment is a listed copy of the first, so files_read counts it once. Each script mirror's hunks match its canonical copy line for line, and the base and head blob ids also match (0b77a9a7..bb6b90bd, 45704470..62e23ecd, 740aac3a..7edb76a9).

Behavior-equivalence checks, by reading the code (I did not run the tests):

  • fleet-discovery.sh
    • fleet_finalize_skip_names: the new [[ … -gt 0 ]] || SKIP_NAMES=(…) guard is the old if -eq 0 with the test inverted, so it behaves the same.
    • Child loop: should_skip_dir_name "${child##*/}" && continue passes the same value as the old name local. A && list does not trigger errexit. Nothing else in the file reads name in fleet_discover_root (the other name uses are locals in validate_skip_name and should_skip_dir_name).
    • The shorter comment keeps the defense-in-depth rationale and still points to the audit-fleet.test.sh assertion.
  • scope-resolve.sh: with no arguments, for path in "$@" runs zero times and found stays 0. So dropping the $# -gt 0 wrapper changes nothing. Each merged printf writes the same bytes as the two calls it replaces.
  • worktree-root-resolve.sh
    • The if/elif/else gives the same values and return codes on every path.
    • raw is local to worktree_root_resolve, and worktree-root-legacy.sh never reads raw, WORKTREE_ROOT_VALUE or WORKTREE_ROOT_KEY_USED. So setting those two variables after retire/promote instead of before changes nothing visible.
    • The one difference: git child processes started by retire/promote now inherit those exported variables as empty, not set. The PR notes this, and git ignores them.

Closing issue #15419, acceptance criteria:

  • Behavior unchanged: met, by the reasoning above. The existing suites (scope-resolve.test.sh, audit-fleet.test.sh, worktree-create.test.sh) cover these paths; the author says they did not run them and left them to CI.
  • Mirrors byte-identical: met (matching hunks and blob ids). The registry check passing is the author's claim; I did not verify it.
  • Diff touches only the listed files and fragments: met.
  • Within 400 lines in the canonical copies: met (about 60 lines).
  • ci-status green: the PR's CI decides this; I did not verify it.
  • Fragments: met. Both are bump: patch with ### Changed and "Internal simplification, no behavior change."

No plugin.json or marketplace.json change, so there are no manifest checks. The PR context contains no embedded instructions aimed at this review.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15488

I found no security issues. I read every hunk of all 8 changed files. The two .changes/ fragments have identical content, so I read the first and the job counts its copy.

Scope. The PR simplifies three shell helpers that plugins/repo-fleet-hygiene and plugins/source-control share, with the same edits in each plugin's copy. It also adds two patch-bump changelog fragments. No changed file matches a trusted-path glob. The PR touches no workflow, plugin manifest, trust control, merge hold, token request or kill switch.

What I checked:

  • fleet-discovery.sh: the new [[ -gt 0 ]] || guard behaves the same as the old -eq 0 if-block. The skip check now gets "${child##*/}" directly instead of through the name local. It is still quoted, and should_skip_dir_name still skips ., .. and .git, so directory-walk filtering is unchanged. The comment edit only shortens the text; the rule it describes is unchanged.
  • scope-resolve.sh: looping over "$@" with no arguments does nothing, so dropping the $# -gt 0 wrapper changes nothing. The merged printf calls write the same bytes, and the values are still passed as %s arguments, never as the format string, so no format-string injection is introduced.
  • worktree-root-resolve.sh: I folded the new if/elif/else back into the old early returns and both give the same result. raw is function-local (plugins/source-control/scripts/worktree-root-resolve.sh:60). worktree-root-legacy.sh (worktree_root_legacy_promote at :68, worktree_root_legacy_retire at :90) never reads or writes raw. That means setting WORKTREE_ROOT_VALUE / WORKTREE_ROOT_KEY_USED after the retire/promote call returns the same values. The fallback still returns 1, unchanged.

Embedded text in the PR context: none that tries to direct this lane.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for d5d23f2

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-15488-d5d23f24f0d96ac13e2a264dd7c02c9d658c57f0, expires on 2026-12-12.

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 12, 2026
Merged via the queue into main with commit 8930f4c Nov 12, 2026
70 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15419-43136195953-1 branch November 12, 2026 02:18
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 8930f4caa3e1792ddc4c4a693b0085c3d3c41e0d; 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 shared fleet-discovery, scope-resolve and worktree-root-resolve scripts in both plugins

0 participants