Skip to content

refactor(pr-unblock): simplify six pr-unblock scripts with behavior unchanged - #14289

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14138-42534347571-1
Nov 9, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14138

Summary

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

I went through the nine listed pr-unblock scripts and pulled each repeated piece of logic into one helper inside its own file. Outputs, exit codes, printed text, gh argument lists, flags and exports are all unchanged, and no import was added. retry-fetch.mjs is unchanged because work-resolve-issue/retry-fetch.test.mjs requires it to stay byte-equal with its copies in apply-patch/ and work-resolve-issue/, which are outside this chunk. sync-shared-copies.sh and request-budget.mjs are also unchanged: they had nothing to simplify that would not change their behavior.

Not verified

  • Unit tests (node --test for the .mjs tests, report-escalation.test.sh and the babysit Python tests that import verify-cap.mjs) were not run: this lane runs no interpreter. Left to the PR's CI.
  • ci-status green is a PR check, left to the PR's CI.
  • retry-fetch.mjs left unchanged: work-resolve-issue/retry-fetch.test.mjs requires it to stay byte-equal with the copies in apply-patch/ and work-resolve-issue/, and editing those copies is outside this chunk.
  • sync-shared-copies.sh and request-budget.mjs reviewed and left unchanged: neither had a simplification that keeps behavior identical and improves readability.
  • tidy skipped: the change touches .github/, a listed shared path, so the tidy entry does not run on it.
  • shellcheck and the node/bash test suites were not run here as separate steps. check-affected's output does not name which 10 checks passed, so CI's lint and test jobs are the confirmation.

Fix

  • .github/scripts/pr-unblock/report-escalation.sh: three new helpers: need_head_and_repo for the HEAD_SHA/GITHUB_REPOSITORY checks that two modes ran, set_context for the activity-to-status-context mapping that appeared three times, and post_status for the commit-status POST shared by clear mode and…
  • .github/scripts/pr-unblock/verify-cap.mjs: a failureOf helper for the child-failure message built in both fetchCarry and verifyReader, and an unread() helper for the read-failed answer returned in two places.
  • .github/scripts/pr-unblock/review-dependency.mjs: an appFirstLines helper shared by rounds and countRounds, a labelNames helper for the label list built twice, and a lookup table in place of the nested ternary that picks the skip-reason output.
  • .github/scripts/pr-unblock/thread-scope.mjs: an isPlainPath helper for the PLAIN_PATH/BAD_SEGMENT pair that prPathAllowed, namedInScope and inThreadScope each repeated.
  • .github/scripts/pr-unblock/resolve-threads.mjs: judgeThread drops the intermediate lane array and checks the lanes App comments in one some call.
  • .github/scripts/pr-unblock/refine-event-dispatch.mjs: a userId helper for the two positive-id parses. An invalid sender is now undefined instead of null; the sender is only compared against that value, so behavior is unchanged.

Verification

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

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

The run reports:

  • check-changelog-fragments: all 1 fragment valid. No plugin changed, so no fragment is owed.
  • check-changed-skills: no changed skills to gate.
  • check-affected: 10 passed, 6 skipped over the 6 changed files; run again after the review fix, same result.
  • fresh-context review subagent over the full diff: no runtime behavior change found. One finding confirmed and fixed: context_of called inside $(...) would trip SC2311 under .shellcheckrc's check-set-e-suppressed, so it became set_context, which assigns directly, and post_status now takes the…
  • diff --numstat HEAD: 6 files, 53 added and 47 removed lines, all among the listed files.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42534347571

Left out: the items under Not verified.

Related

#14138

Merge-Risk: unrated reason=pending

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14289 (refactor(pr-unblock): simplify six pr-unblock scripts)

I found no security issues. I read every hunk of all 6 changed files. Two of them are on the trusted-path list (report-escalation.sh, thread-scope.mjs); for those I read the whole change and what it gates. I checked each refactor against the code it replaced, looking for any change in what passes a gate.

  • refine-event-dispatch.mjs, the sender gate. userId() uses the same regex as before: /^[1-9][0-9]*$/ on value ?? "". An invalid or missing sender now comes out as undefined instead of null, and the guard compares against undefined, so a bad sender still makes the run skip. appSenderId was already undefined when invalid, and it still is where it is used again at L89. A missing APP_SENDER_ID cannot match a valid sender, because sender === undefined is checked first. Who passes the gate (the lanes App or a listed human) is unchanged.
  • thread-scope.mjs, the edit-scope filter. isPlainPath is PLAIN_PATH.test && !BAD_SEGMENT.test. In prPathAllowed and namedInScope it replaces the same two conjuncts. In inThreadScope, isProtectedPath || !isPlainPath is logically the same as the old isProtectedPath || BAD_SEGMENT || !PLAIN_PATH. The protected, instruction and control-path exclusions are untouched, so nothing new gets into scope.
  • resolve-threads.mjs. Folding the lane array into a single some call checks the same predicate (authorId === appId && !isResolvingAnswer). The thread verdicts are unchanged.
  • report-escalation.sh.
    • need_head_and_repo runs the same SHA and owner/repo regexes in the same places: before the status read in clear mode, and before the case in the main path.
    • set_context maps activities to status contexts exactly as the three inline copies did. In clear mode, ACTIVITY is still checked against the routes table before it is used.
    • post_status builds the same gh api arguments. args is now local, and the graphql pager at L311 still sets its own args. Nothing new reaches the status description or URL.
  • review-dependency.mjs. appFirstLines keeps the user.id === appId author filter, so other authors' round markers are still ignored. The lookup table that replaces the nested ternary is keyed by the internal result.decision, which no attacker controls. The labelNames helper is a pure extraction.
  • verify-cap.mjs. failureOf and unread() are pure extractions. failureOf is declared after fetchCarry, but it is only called at runtime, so declaration order does not matter. The read-failed answer still sets readFailed: true, so a failed read still fails closed.

Trust controls: this PR does not touch the trusted-trigger check, the lane token scope, the kill switch, the merge-hold scripts or any manifest. I found no widening.

Embedded text: the PR context contains no directives aimed at this review.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

No findings: this simplification does not change behavior. I read every hunk of all 6 changed files, plus the whole head copy of report-escalation.sh, to check the new helpers in their context. This review is complete and is not blocking-only, since no earlier head was reviewed.

What I checked in each file:

  • report-escalation.sh:
    • need_head_and_repo runs before the ACTIVITY check in clear mode and right after the PR_NUMBER check in the main path, the same order as before. die still exits the script from inside the function, because the function is not run in a subshell.
    • set_context sets the same global context that the later lane-stopped comment body reads.
    • post_status:
      • Its local args is safe: both callers exit right after it, and the thread-page loop at line 312 builds its own global args.
      • [[ -z ]] || args+= gives the same result as the old [[ -n ]] && args+=.
      • A failed gh api call still ends the script under set -e, because the function is called as a plain command.
  • verify-cap.mjs: failureOf is a module-level const that fetchCarry uses only when it runs, never while the module loads. The existing oneLine already works the same way. unread() returns a new object on every call, as the old inline objects did.
  • review-dependency.mjs: the decision values are proceed, skip, escalate and pin, and every skip result sets skipReason. So the lookup table gives the same output as the old nested ternary, with proceed mapping to "". appFirstLines and labelNames keep the old filter and map order.
  • thread-scope.mjs: isPlainPath swaps the order of the PLAIN_PATH and BAD_SEGMENT checks inside inThreadScope. Neither regex has the g flag, so the order has no effect, and isProtectedPath still runs first.
  • resolve-threads.mjs: inlining the lane filter into one some call gives the same result.
  • refine-event-dispatch.mjs: an invalid sender is now undefined instead of null. The early-return check was updated to match, and nothing else reads sender.

Closing issue #14138, acceptance criteria:

  • "Behavior is unchanged": met, as checked above. Each changed file has a test file beside it in the repository (for example report-escalation.test.sh and verify-cap.test.mjs) that would fail if behavior broke. I did not run those tests.
  • "The diff edits only the listed files": met. All 6 files are on the issue's list.
  • "Within 400 changed lines and 15 hand-edited files": met. The diff adds 53 lines and removes 47, across 6 files.
  • "ci-status is green": the PR's CI decides this; I did not verify it. The author says they did not run the test suites or shellcheck, and leaves both to CI; that is the author's claim, which I did not check.

No .claude/rules/ path-scoped rule matches the changed files, and the diff touches no plugin manifest. Neither the PR context nor the prior-findings file contains embedded instructions aimed at the lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 5cfec6ca4663f7c00bb2b4328a53aab12cc0a155. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 5cfec6c

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-14289-5cfec6ca4663f7c00bb2b4328a53aab12cc0a155, expires on 2026-12-09.

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 9, 2026
Merged via the queue into main with commit 1cb526b Nov 9, 2026
66 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14138-42534347571-1 branch November 9, 2026 01:35
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 1cb526bed4a7992a12c5b08fddd0d458bc111db4; 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 pr-unblock .github script (6 of 6)

0 participants