Skip to content

refactor(source-control): simplify the readiness gate and PR comment fetch scripts - #14909

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14828

Summary

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

Simplified babysit-readiness-gate.sh and fetch-all-pr-comments.sh without changing behavior. In the gate: the five value flags share one case arm, the self-login list is built with one jq call instead of two, the two body extractions share a bodies_where helper, the Python counter call builds its source arguments once, and the two blocked verdicts share one printf. In the fetch script: owner/repo resolve with ${VAR:-$(...)}, the repeated array-unwrap filter moved into fetch_surface, and each surface appends to one buffer that feeds the merge, replacing three per-surface variables. The --help header blocks, every printed message, exit code and flag are unchanged. convert-bump-to-fragment.sh was reviewed and left unchanged because no cleanup made it shorter or clearer. plugins/source-control/scripts/fleet-discovery.sh was left unchanged because it is a synced copy of plugins/repo-fleet-hygiene/scripts/fleet-discovery.sh (scripts/cross-plugin-source-registry.txt), so editing it alone would fail the drift check, and the issue limits the diff to the listed files.

Not verified

  • babysit-readiness-gate.test.sh and fetch-all-pr-comments.test.sh were not executed: this lane runs only the named wrappers, so the suites are left to the PR's CI
  • plugins/source-control/scripts/fleet-discovery.sh not simplified: it is a synced copy of the canonical plugins/repo-fleet-hygiene/scripts/fleet-discovery.sh, and a fix there falls outside this issue's listed files and area
  • tidy recorded as skipped: pass 5 (ai-slop:audit) could not run its deterministic detector (detect.sh) because the lane's Bash runs only the named wrappers; only the rubric read ran on the changelog fragment
  • ci-status green is a PR check left to the PR's CI

Fix

  • plugins/source-control/scripts/babysit-readiness-gate.sh: merged the five value-flag case arms into one; inlined the single-use have() check; built SELF_JSON with one jq -nR '\[inputs\]' instead of jq -R . | jq -s .; replaced the two near-identical body-extraction jq pipelines with a…
  • plugins/source-control/scripts/fetch-all-pr-comments.sh: OWNER/REPO now resolve with ${FETCH_COMMENTS_*:-$(gh repo view ...)}; fetch_surface now applies the shared if type == "array" then .\[\] else . end unwrap and appends each non-empty surface to ALL_JSON, which removes the…
  • .changes/source-control/work-resolve-issue-issue-14828-42724599063-1-b92d290e.md: new patch fragment, ### Changed / - Internal simplification, no behavior change.

Verification

The runner ran each check from the base copy against 9d560d4:

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

The run reports:

  • check-changelog-fragments: all 20 fragments under .changes/ 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 3 changed files (run before and after tidy)
  • read babysit-readiness-gate.test.sh and fetch-all-pr-comments.test.sh: the source-text asserts (grep -owE, export PYTHONUTF8=1, unproven prereq-missing 4, no bare exit 3/4) still hold; the gh/jq/grep/cat stubs still match the new invocations, including the jq stub that fails on -s, which…
  • git-read diff --unified=0 HEAD: the first hunks start at line 163 (gate) and line 114 (fetch), after both --help header blocks, so the --help text is unchanged
  • fresh-context review subagent over the whole diff: no behavior difference found and no new shellcheck issue
  • tidy-diff over the 24 changed hunks: no further edits (passes 1-4 found nothing; pass 5 read the fragment against the rubric and found no tell)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42724599063

Left out: the items under Not verified.

Related

#14828

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

Security review: PR #14909 (head 9d560d4)

No security issues found. I read every hunk of all 3 changed files. None of them matches a TRUSTED PATHS glob. The babysit-prs trusted globs cover plugins/source-control/skills/babysit-prs/scripts/*.py, not plugins/source-control/scripts/*.sh. The PR touches no plugin manifest, no trust control and no instruction surface.

I checked the refactor against the base for any change in fail-closed behavior or in how authors are classified. I found none.

plugins/source-control/scripts/babysit-readiness-gate.sh

  • Flag parsing: the five value flags now share one require_value arm. The inner *) branch sets REPO_SLUG, and only --repo can reach it. Each flag still assigns the same variable.
  • SELF_JSON: jq -nR '[inputs]' gives the same array of strings as jq -R . | jq -s ., so self-identity resolution is unchanged.
  • bodies_where: the filter is a fixed literal ('| not' or '') joined into a single-quoted jq program. No outside input reaches the filter text. Comment bodies still pass only as data, through $COMMENTS and --argjson self. The self/non-self split matches the base exactly, and || bodies_unreadable still fails closed (exit 4).
  • Python counter call: the py_source array keeps the same arguments, quoted as before.
  • Verdict: under-decomposed is still checked before checklist-incomplete (now with elif), and both still exit 1 with the same message format.

plugins/source-control/scripts/fetch-all-pr-comments.sh

  • Owner/repo lookup: ${FETCH_COMMENTS_OWNER:-$(…)} treats an unset or empty variable the same way the old -n test did. The empty-owner/repo guard is unchanged.
  • fetch_surface: a failed fetch or a failed parse still exits 2 from the main shell, because the function is not called inside $( ). The shared array-unwrap prefix combined with each projection gives the same filter as before, including the reviews surface's select. An empty surface adds nothing, and an empty ALL_JSON still merges to [].

.changes/…b92d290e.md

A changelog fragment with no executable content.

Prior findings: none (earlier heads reviewed: 0; blocking only: no). PR context: no embedded directives to report.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 9d560d44a8b170f1fd5c7b76c7cfe93e7f022525: 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: the changelog fragment, babysit-readiness-gate.sh and fetch-all-pr-comments.sh. I checked each rewrite against the base version to see whether behavior changed.

babysit-readiness-gate.sh

  • Flags: the five value flags now share one case arm with an inner case. Only --repo can reach the inner *) arm, so each flag still sets the same variable, and require_value and shift 2 behave as before.
  • have removal: with have() inlined, the gate script calls have nowhere. The test asserts on the source text unproven prereq-missing 4, and that text still holds.
  • SELF_JSON: jq -nR '[inputs]' gives the same array as jq -R . | jq -s .. SELF_LOGINS is already guarded non-empty above it.
  • bodies_where: I expanded the helper's filter for both arguments. It becomes select((.author as $a | $self | index($a)) | not) and select((...) ), the same filters as the two original pipelines. The || bodies_unreadable handling on each capture is unchanged.
  • py_source: the array is always non-empty when expanded, so set -u is not a concern.
  • Verdict: the if/elif keeps the old order: under-decomposed wins over checklist-incomplete. The printed line and exit 1 are unchanged.

fetch-all-pr-comments.sh

  • Owner/repo: ${VAR:-$(...)} keeps the old empty-or-unset fallback, and the script runs without -e.
  • Array unwrap: moving it into fetch_surface makes the same jq programs, review-surface select included.
  • One buffer: collecting every surface in ALL_JSON keeps the empty-surface case: nothing is appended, and an empty input to jq -s still gives []. Exit 2 on a fetch or parse failure is still raised outside any $( ), so it still ends the script.
  • Tests: Case 13's jq stub, which fails on -s, still matches only the merge call. The surface projections use -c without -s.

Closing issue #14828

  • Behavior unchanged: I found no difference in output, exit code, message or flag.
  • Files and size: only listed files and a fragment are edited, well under 400 lines.
  • Fragment: it is bump: patch with body ### Changed / "Internal simplification, no behavior change.", as required.
  • Existing tests: babysit-readiness-gate.test.sh and fetch-all-pr-comments.test.sh cover the changed paths: flags, the jq prerequisite source assert, empty-subset merge, merge failure and malformed input.
  • Unverified: the PR says the test suites were not run, and ci-status green is left to CI. Both are author-claimed and unverified here; I could not run them.

Other checks

  • Path-scoped rules: no .claude/rules/ rule matches the changed files.
  • Manifests: no plugin manifest changed.
  • Embedded instructions: none in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 9d560d4

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-14909-9d560d44a8b170f1fd5c7b76c7cfe93e7f022525, 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 66dd8d4 Nov 10, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14828-42724599063-1 branch November 10, 2026 01:14
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 scripts source-control plugin code (1 of 3)

0 participants