Skip to content

refactor(pr-unblock): fold duplicated dispatch, hold, job-listing and base-config steps into helpers - #14242

Merged
kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14132-42514680466-1
Nov 8, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14132-42514680466-1

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14132

Summary

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

Simplified three of the four listed pr-unblock scripts with behavior unchanged; nothing outside them changed. In dispatch.mjs, code that was written out twice now lives in one helper each: the eligibility check behind isCandidate and isPending, the prHold arguments, the in-flight-run skip, the dispatch-and-validate step shared by dispatchConflicting and dispatchSharedCopies (an optional label keeps the sync-shared-copies log text byte-identical), the HTTP error object, the repository URL prefix, the job listing that must fit one page, the SHA regex, and the four resolve-config loaders (fromBase and basePath). dispatcher-current.sh now has one leave line for the blob read instead of two, and earlier-fail-notes.mjs builds its read-only countedBy client once per call instead of once per run. escalation-routes.mjs was reviewed and left unchanged: it is already minimal, and apply-patch.mjs copies it and merge-holds.test.mjs lists it as an enforcement file.

Not verified

  • Node test suites (dispatch.test.mjs, count-requests.test.mjs, dispatch-limits.test.mjs, earlier-fail-notes.test.mjs, workflow-gates.test.mjs) and dispatcher-current.test.sh were not run: this lane can run only its wrapper scripts. They are left to the PR's CI.
  • shellcheck and eslint were not run by hand. check-affected marks the ci-workflows linters as CI only, so they are left to the PR's CI.
  • tidy skipped: every changed file is under .github/, a listed shared path, so the tidy-diff pass does not apply.
  • ci-status green: a PR CI check, left to the PR's CI.
  • The long header comment of dispatch.mjs was left as it is: it documents cross-file behavior that the sub-epic's later restructuring pass may change.

Fix

  • .github/scripts/pr-unblock/dispatch.mjs: moved duplicated logic into these helpers: inState, handleOptions, holdReads, inFlightRun, sendDispatch, httpError, repoUrl, latestJobs, SHA, basePath, fromBase. dispatchAll reuses the parsed appSenderId instead of testing the regex a second time. Every…
  • .github/scripts/pr-unblock/dispatcher-current.sh: the blob read and its SHA check share one || leave with the same message.
  • .github/scripts/pr-unblock/earlier-fail-notes.mjs: the read-only github client for countedBy is built once per earlierFailNotes call instead of once per FAILed run.

Verification

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

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

The run reports:

  • check-changelog-fragments: passed. The change touches no plugin, so no fragment is needed.
  • check-changed-skills: passed. No skill files changed.
  • check-affected: 10 passed, 6 skipped over 3 changed files.
  • fresh-context review subagent over git-read diff HEAD against the HEAD versions: found no behavior change. It checked that log strings are byte-identical, failure counting and the dispatched array are unchanged, API call order is unchanged, error object properties are unchanged, the bash `a…
  • read resolve-config.mjs limitsFromBase, adoptionFromBase, ownedBranchesFromBase and tidyCutoffsFromBase: none uses this, so calling them through resolver\[reader\] in fromBase changes nothing.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42514680466

Left out: the items under Not verified.

Related

#14132

Merge-Risk: max=MEDIUM demote=false head=fc89a39ca9e256cac5c022d908ea3d68422338e2 rubric=8.1.2 rater=claude-opus-5-5 checker=claude-opus-5-5

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

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of the 3 changed files: .github/scripts/pr-unblock/dispatch.mjs, .github/scripts/pr-unblock/dispatcher-current.sh and .github/scripts/pr-unblock/earlier-fail-notes.mjs. earlier-fail-notes.mjs matches a trusted-path glob, so I read its whole change and the countedBy call it feeds. The client is still read-only, and it is now built once per call with the same closure over actions. Nothing changes there that matters for security.

Behavior-unchanged check (issue #14132, first acceptance criterion). I went through each refactor and compared it with the base:

  • inState: isCandidate and isPending keep the same conjuncts. Only the order of pure boolean checks in isPending moved.
  • holdReads + spread into prHold: the same keys and values reach prHold in both dispatchers.
  • inFlightRun: the log text is the same. In dispatchSharedCopies the skip still sits inside the same try.
  • sendDispatch:
    • The log strings are byte-identical, including the ${activity} label for shared copies.
    • An invalid id or a thrown dispatch still adds one to failed.
    • The push into dispatched now happens after the log line rather than before it. Nothing observes that order.
  • httpError, repoUrl, SHA, latestJobs:
    • The error message and its status/rateLimited properties are unchanged.
    • The URLs are the same.
    • latestJobs is an async function, so the incomplete-page check still rejects instead of throwing synchronously into testedRun.
  • fromBase / basePath: the same import path and the same BASE_PATH || ".base" fallback.
  • dispatchAll: appSenderId is already parsed with the same regex at line 874 (permalink). That makes appSenderId !== undefined the same test as the old one, and the value passed is the same.
  • dispatcher-current.sh: blob=$(gh …) && [[ … ]] || leave exits with gh's status when the read fails, and with the regex result otherwise. It reaches leave with the same message in both failure cases, as the two old lines did.

Other acceptance criteria.

  • Listed files only: met. The diff touches only listed files. escalation-routes.mjs was left unchanged, and the PR explains why.
  • Size: met. The diff is well under 400 changed lines and 15 files.
  • Tests: existing test suites could catch a regression (dispatch.test.mjs, earlier-fail-notes.test.mjs, dispatcher-current.test.sh). I did not run them. The PR says the authoring lane did not run them either and leaves them to CI.
  • ci-status green: I could not check this from this lane.

The verification in the PR body (the fresh-context subagent review and the check-affected results) is the author's claim; I did not check it.

There are no plugin manifest changes, no closing-issue text addressed to this lane, and no prior findings. No hold applies.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14242 at fc89a39

No security issues found. I read every hunk of all 3 changed files. This is a refactor that keeps behaviour the same, and I found nothing that widens a trust control, a token's scope, or what untrusted text reaches a lane.

What I checked:

  • .github/scripts/pr-unblock/earlier-fail-notes.mjs (trusted path; I read the whole change and what it gates). The read-only github client passed to countedBy is now built once per call instead of once per run. It captures only actions and still rejects every method except GET. The gate's verdict-counting reader is unchanged, so nothing new gets counted.
  • .github/scripts/pr-unblock/dispatcher-current.sh. The new line is blob=$(gh api …) && [[ $blob =~ ^[0-9a-f]{40}$ ]] || leave …, and bash reads a && b || c as before: a failed read or a blob that isn't a SHA still calls leave. The script runs with set -uo pipefail and no -e (line 19), so errexit doesn't change this. The comparison of the dispatcher file against the tip's blob (line 50) is untouched.
  • .github/scripts/pr-unblock/dispatch.mjs:
    • sendDispatch still counts both a thrown dispatch and a run id that fails RUN_ID as failed. Only a valid id reaches dispatched, so the record the broker and gate check is unchanged.
    • holdReads passes prHold the same labels, head, timeline reader and review reader. The caller-specific holdLabels, gateLabel, activity and appId are spread after it, so neither merge-hold path is narrowed.
    • inState keeps every eligibility condition: not a draft, not cross-repository, not a Dependabot head, base matches, mergeable state matches.
    • The new if (appSenderId !== undefined) check in dispatchAll is equivalent to the old regex. appSenderId is set from that same regex or left undefined (dispatch.mjs#L874).
    • fromBase imports the same resolve-config.mjs URL and calls one of four fixed export names on the same BASE_PATH. No input from the pull request picks the reader.
    • repoUrl, httpError, latestJobs and SHA give the same URLs, error properties (status, rateLimited), single-page job check and SHA validation as the code they replace.

The PR context contains no embedded instructions aimed at the lane.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for fc89a39

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-14242-fc89a39ca9e256cac5c022d908ea3d68422338e2, expires on 2026-12-08.

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 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 8, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 8, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit 17572ce Nov 8, 2026
66 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-14132-42514680466-1 branch November 8, 2026 22:29
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 (3 of 6)

1 participant