Skip to content

refactor(repo-fleet-hygiene): simplify sync-fleet.sh scope and plan code - #15175

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14715

Summary

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

sync-fleet.sh now has an add_scope helper that adds the config scope and the fallback scope to ROOTS/REPOS and tags each path with its rung. Before, each of the two places had four lines doing this by hand. A scope_empty predicate replaces the same three-part test written out twice. The plan loop's git-status and default-branch skips now capture $? inline instead of going through an rc variable, and report_skip builds its optional extra column in one expansion. Output, exit codes, array order and flags are unchanged. setup-config.sh is unchanged. Its only candidate, merging the two identical --max-depth range checks into one A && B || C line, failed shellcheck SC2015 and was reverted, and nothing else in the file was worth changing.

Not verified

  • sync-fleet.test.sh and setup-config.test.sh were not run: this lane runs no interpreter or test runner. Left to the PR's CI
  • ci-status green on the PR: a PR CI check, left to the PR's CI
  • ai-slop deterministic detector (detect.sh) was not run on the changelog fragment: the lane's Bash runs only the named wrappers. Only the rubric read ran
  • setup-config.sh has no edit: the one simplification (combined --max-depth validation) tripped shellcheck SC2015 and was reverted. The rest of the file is already minimal

Fix

  • plugins/repo-fleet-hygiene/skills/sync/scripts/sync-fleet.sh: added add_scope and scope_empty helpers and used them for the config and fallback scope rungs; inlined the plan loop's rc handling; one-expansion extra column in report_skip
  • .changes/repo-fleet-hygiene/work-resolve-issue-issue-14715-42884789939-1-4d641914.md: new patch fragment, '### Changed' / 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 5c32ab6:

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

The run reports:

  • check-changelog-fragments: all 12 fragments valid (run before and after tidy and review)
  • check-changed-skills: sync skill PASS, 0 errors (setup skill also PASS while its script was touched)
  • check-affected: 13 passed, 6 skipped, including shellcheck on sync-fleet.sh. An earlier run failed shellcheck SC2015 on the merged --max-depth check in setup-config.sh; that hunk was reverted and the check re-run green
  • fresh-context review subagent: read every hunk against the old code (set -u on empty arrays, $? capture, nameref collisions, $'\t' inside ${5:+...}, array order, default_branch failure vs empty output). It found every hunk equivalent and no other reader of the removed globals path and rc
  • tidy-diff over the 8 changed hunks: no further simplification, comment deletion or residue. The write-for-humans and ai-slop rubric read of the fragment found nothing to change
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42884789939

Left out: the items under Not verified.

Related

#14715

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

Security review: PR #15175 (head 5c32ab6)

No security issues found.

I read every hunk of both changed files. Neither matches a trusted-path glob.

  • .changes/repo-fleet-hygiene/…-4d641914.md is a new changelog fragment (patch bump, "Internal simplification"). It has no security surface.
  • plugins/repo-fleet-hygiene/skills/sync/scripts/sync-fleet.sh is a refactor with no behavior change. I checked each hunk for security relevance:
    • add_scope / scope_empty. The namerefs (local -n add_roots="$2" add_repos="$3") only ever get fixed array names (FLEET_CONFIG_ROOTS/FLEET_CONFIG_REPOS, fb_roots/fb_repos), never outside input. Paths still go into ROOTS/REPOS quoted, and each path still gets its rung tag. Scope resolution is unchanged.
    • Plan loop $? capture. The old code skipped when $branch was empty. The new code skips when default_branch exits non-zero. These are the same thing: default_branch already returns 1 for an empty ref, a ref starting with -, or a name that fails check-ref-format. So a branch name chosen by the remote still can't reach git fetch/switch/pull as an option, and an empty branch never gets into the plan.
    • report_skip extra column. ${5:+$'\t'"$5"} gives the same result as before and only feeds a printf argument, not the format string.

This PR changes no trust control, plugin manifest, workflow or standing instruction. The PR context file has no embedded directives aimed at the lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 5c32ab6a7e2bd9972a9a44d77e9efdcca2756692: 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 and found no correctness or maintainability problems. No plugin manifest changed, so there are no manifest lines.

How I checked that behavior is unchanged in sync-fleet.sh:

  • add_scope (L74-L79):
    • It ends with the same ROOTS/REPOS contents and order, and the same ROOT_RUNG/REPO_RUNG maps, at both call sites.
    • It still uses the ${arr[@]+...} guard, so set -u stays safe on empty arrays.
    • It uses a nameref (local -n). That needs no newer bash than before, because read_lines_into already uses one.
    • The removed global path has no other reader in the file.
  • scope_empty: it is the same three-part test as the two inline copies it replaces.
  • Plan loop (L288-L290):
    • Inside cmd || { ...; }, $? is the exit status of the command that failed, so the same git-exit value is recorded.
    • The old code skipped when branch was empty; the new code skips when default_branch fails. These are the same case: default_branch (L250-L262) only exits 0 after printing a non-empty ref, and every other path returns non-zero.
    • Nothing else reads rc; park_finish declares its own local rc.
  • report_skip: in the unquoted ${5:+$'\t'"$5"} the $'\t' is still expanded, so the result matches the old two-line form, including an empty extra when there is no 5th argument.

Closing issue #14715, acceptance criteria:

  • Behavior unchanged: met, by my reading above. sync-fleet.test.sh asserts the paths this touches (the ls-remote and dubious-or-unreadable skip lines with git-exit=, and rung=config/named/ghq/cwd/ancestor), so a regression there would fail a test.
  • Diff edits only the listed files plus a fragment: met.
  • Size limit of 400 lines and 15 files: met.
  • Fragment: met. It has bump: patch, a ### Changed heading, and the required line.
  • ci-status green: left to CI.

I did not run the tests or shellcheck myself (this lane has no shell). The PR's verification claims, including that shellcheck passed, are the author's and I have not confirmed them.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 5c32ab6

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-15175-5c32ab6a7e2bd9972a9a44d77e9efdcca2756692, 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 78b4b61 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14715-42884789939-1 branch November 10, 2026 22:05
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 78b4b61a93583b1efb995bfc0cff223e732a545a; 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 setup and sync repo-fleet-hygiene plugin code

0 participants