Skip to content

refactor(source-control): simplify pull-request scripts without behavior change - #15224

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14947-42935569288-1
Nov 11, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14947

Summary

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

Simplified four of the eleven listed pull-request scripts without changing outputs, messages, exit codes or flags. fetch-annotations.sh and fetch-failed-logs.sh gain a die() helper in place of repeated printf-and-exit blocks, shift once at the bottom of their argument loops, test gh api failures inline with || die 2 ... (exit $?), and resolve the repository in three lines. fetch-annotations.sh also replaces the four-way conclusion or chain with jq IN() (a form the plugin already uses), and fetch-failed-logs.sh builds MARKER_RE from the --errors-only and --notices flags instead of a four-branch if. parse-branch-issue.sh folds the branch fallback into two guards and gives usable_pattern() a single note-and-return path, and parse-ready-skip.sh reads PRE_READY_STEPS directly instead of copying it into STEPS. The other seven files are unchanged: check-body-sections.sh, pr-worktree.sh, pre-ready-steps.sh and prep-warnings.sh are already minimal; check-ready-holds.sh and feedback-thread.sh are tight security gates where any rewrite risks changing what they accept; prep_warnings.py had no simplification that kept its output identical (for example, print(*lines, sep="\n") prints a blank line when there are no findings).

Not verified

  • The skill's *.test.sh suites (fetch-annotations, fetch-failed-logs, parse-ready-skip, parse-branch-issue, pre-ready-steps) were not run: this lane runs no interpreter or test runner, and check-changed-skills skips script tests here. Left to the PR's CI
  • ci-status green on the PR is a CI check, left to the PR's CI
  • tidy pass 5: ai-slop:audit read the fragment against its rubric only. Its detect.sh and digest-guard.sh are not on this lane's Bash allowlist, so the deterministic detector did not run on the fragment
  • Tidy proposal not applied, because it is outside the changed lines: fetch-failed-logs.sh per-job mode repeats the group and suspicious-pattern greps that grep_group_markers and grep_suspicious do for the full run
  • Seven listed files left unchanged (check-body-sections.sh, check-ready-holds.sh, feedback-thread.sh, pr-worktree.sh, pre-ready-steps.sh, prep-warnings.sh, prep_warnings.py): no simplification found that keeps behavior identical and is worth the risk in these gates
  • Changes left uncommitted in the working tree, per the lane's instruction that the runner turns them into a patch

Fix

  • plugins/source-control/skills/pull-request/scripts/fetch-annotations.sh: die() helper; single-shift argument loop; inline gh failure exits that still report gh's exit code; jq IN() for the --failed conclusions; here-strings for the small per-record id and name reads; the large API payloads stay…
  • plugins/source-control/skills/pull-request/scripts/fetch-failed-logs.sh: die() helper; single-shift argument loop with one-line flag cases; MARKER_RE built from the flag values; prerequisite, repository and unzip failures through die (the EXIT trap still keeps the scratch directory on exit 4)
  • plugins/source-control/skills/pull-request/scripts/parse-branch-issue.sh: branch fallback as two guards; usable_pattern() collects one reason and prints the same note text once
  • plugins/source-control/skills/pull-request/scripts/parse-ready-skip.sh: uses PRE_READY_STEPS directly instead of the STEPS copy
  • .changes/source-control/work-resolve-issue-issue-14947-42935569288-1-7582c2b3.md: patch fragment, ### Changed, "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 07a8278:

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

The run reports:

  • check-changelog-fragments: all 11 fragments valid (run before and after tidy)
  • check-changed-skills: pull-request PASS, 0 errors, 4 warnings, none of them from this change (run before and after tidy)
  • check-affected: 13 passed, 6 skipped over 5 changed files (run before and after tidy)
  • fresh-context review subagent over the whole diff: no behavior change or bug found. It flagged one narrow difference: here-strings over the large paginated gh payloads in fetch-annotations.sh could need a temp file that the old pipe did not. Both of those were reverted to pipes, and the checks were…
  • every die() message checked against the old printf text and exit code (fetch-annotations.test.sh and fetch-failed-logs.test.sh assert the exit codes and the --help banner, and the banner header is untouched)
  • tidy-diff over the 33 changed hunks: no further edits; one proposal outside the listed lines (fetch-failed-logs.sh per-job mode could reuse grep_group_markers and grep_suspicious)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42935569288

Left out: the items under Not verified.

Related

#14947

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

Security review: PR #15224 (head 07a8278)

No security issues found. I read every hunk of all 5 changed files.

This PR is a refactor of four local helper scripts in the pull-request skill, plus a changelog fragment. None of the changed files match the trusted paths, and none is a trust control: no trusted-actor check, token scope, kill switch, merge hold, manifest or standing instruction is touched.

What I checked:

  • parse-branch-issue.sh usable_pattern(). This function guards a repo-controlled regex before it is used. The new version still rejects the same three cases, in the same order:

    • a length or complexity limit from pattern_limit
    • a backreference (\\[1-9])
    • an invalid ERE (=~ returning 2)

    It still prints the same note text, and the note still leaves the pattern text out. A pattern that was rejected before is still rejected, so nothing new gets through.

  • fetch-annotations.sh / fetch-failed-logs.sh:

    • gh api failures still exit 2. The new || die 2 "... (exit $?)" reads the failed assignment's status.
    • User arguments are still quoted with %q in error messages.
    • --job and --max-bytes still shift twice in total, and the --max-bytes numeric check is unchanged.
    • The unzip failure still exits 4 through the existing EXIT trap.
    • MARKER_RE is built only from fixed literals, so no user input reaches the regex.
    • The jq IN(...) filter selects the same four conclusions as before.
  • parse-ready-skip.sh. It now reads PRE_READY_STEPS directly. The check that every --skip item is one of the known steps is unchanged.

  • PR context. No embedded instructions aimed at this review.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15224 (refactor(source-control): simplify pull-request scripts without behavior change)

I read every hunk of all 5 changed files, so this is a complete review. No findings.

Behavior-equivalence checks

I traced each rewrite by hand. I ran nothing: this lane has no shell. Throughout, "matches" means same output, same message text and same exit code.

fetch-annotations.sh

  • New die helper: the messages and exit codes (1, 2, 5) match the old printf text.
  • Argument loop: it now shifts once at the bottom. Each case still consumes one argument, and --) break stops before that shift.
    • The leftover -- is harmless. No code after the loop reads "$@", and arguments after -- were ignored before too.
  • Inline API failures: X=$(gh api …) || die 2 "… (exit $?)" still reports gh's own exit code. There is no pipe, and the script does not use set -e, only set -uo pipefail.
  • jq IN(...) filter: it matches the old four-way or chain, and a null conclusion is still excluded. IN() is already used in other jq filters in this plugin, so it adds no new jq version requirement.
  • Here-strings: the small per-record reads now use here-strings and are equivalent. The large payloads still go through pipes.

fetch-failed-logs.sh

  • --job and --max-bytes: each still consumes two arguments (one shift in the case, one at the bottom).
  • --audit: SHOW_GROUPS=1 TIMING=1 SUSPICIOUS=1 on one line sets all three variables.
  • MARKER_RE: it matches the old four-branch if for all four flag combinations (default, errors-only, notices, both).
    • \[ survives inside double quotes.
    • A ((…)) && … line that evaluates false does not stop the script, since set -e is not on.
  • unzip failure: die 4 still reaches the cleanup trap with exit code 4, so the scratch directory is kept as before.

parse-branch-issue.sh

  • usable_pattern: the elif chain prints the same note text for each of the three reasons. The status check (($? != 2)) reads the status of the [[ =~ ]] test.
    • reason is set to an empty string first, so set -u is satisfied.
  • Branch fallback: the two guards behave like the old blocks.

parse-ready-skip.sh

  • STEPS was a local copy used only on the two replaced lines. read-pre-ready.sh defines its own STEPS and is not affected.

Closing issue #14947 acceptance criteria

  • Behavior unchanged: met, as far as reading the code shows. The skill's existing *.test.sh suites cover these scripts' exit codes and messages, though I did not run them.
  • Only listed files plus a fragment: met.
  • Within 400 lines and 15 files: met.
  • Fragment: met. bump: patch, a ### Changed section, and the exact required line.
  • ci-status green: left to CI; I cannot confirm it.

Other checks

  • Path-scoped rules: skill-bodies-state-current-rules.md and cost-claims.md match these files. Nothing in the change breaks them.
  • Paved paths: the standards index has no paved-path row, so there is nothing to check.
  • Plugin manifests: none changed.
  • Author's verification: the PR body reports check-changelog-fragments, check-changed-skills and check-affected passing. That is the author's claim; I have not confirmed it.
  • Embedded instructions: none found in the PR context.
  • Cost: none. The change spends no billable resource.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 07a8278

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-15224-07a8278a46a1627520803c3a5816ee99f6c28f91, expires on 2026-12-11.

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 11, 2026
Merged via the queue into main with commit d174a2a Nov 11, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14947-42935569288-1 branch November 11, 2026 03:05
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit d174a2ab7f1a48f6c10b91022e658c2dc976dc74; 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 pull-request source-control plugin code (1 of 2)

0 participants