Skip to content

refactor(work-unblock): simplify the second half of label-unblocked.mjs - #14291

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14153

Summary

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

This simplifies the functions that start in the second half of .github/scripts/work-unblock/label-unblocked.mjs (from line 1353 of the 2705 lines on main) and leaves their behavior unchanged. The four per-run job scans (stoppedMint, stoppedUntrusted, stoppedStale, cancelledBeforeWork) now share one someRunJobs loop and reuse the existing endedAt and byBot helpers. Repeated inline expressions are now named helpers in the same file: appPosted, fieldNamesOf, NAMES_ISSUE, firedOn and addedSince. main reads appId once and joins its back-to-back sweep branches into one if/else. The file is 37 lines shorter. Nothing moved between files, and no exported name, flag, printed line or API call order changed.

Not verified

  • node --test for .github/scripts/work-unblock/label-unblocked.test.mjs was not run here, because this lane has no interpreter; it is left to the PR's CI
  • ci-status green is a PR check, left to the PR's CI
  • Tidy was skipped: the change is under the shared path .github/, which the tidy cutoffs exclude
  • No changelog fragment was added: the change is an internal refactor of a .github script with no behavior change and no plugin release, and check-changelog-fragments passes without one

Fix

  • .github/scripts/work-unblock/label-unblocked.mjs: in the range-2 functions, the four run-job scans now share someRunJobs; endedAt and byBot replace their inline copies; appPosted, fieldNamesOf, NAMES_ISSUE, firedOn and addedSince replace repeated expressions; refireRefusal builds its issue path…

Verification

The runner ran each check from the base copy against 6422b3a:

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

The run reports:

Left out: the items under Not verified.

Related

#14153

Merge-Risk: max=HIGH demote=true head=6422b3aa6a70cebf4f9442c3aaf9789415b00541 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 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14291 (refactor of label-unblocked.mjs)

No security issues found.

The change is a refactor of .github/scripts/work-unblock/label-unblocked.mjs, and that file does not match any trusted-path glob. It does touch trust-related logic: who added a label, byBot actor matching, the untrusted-provenance stop, and which holds are read. So I checked that each replaced expression does the same thing as the code it replaces:

  • byBot(bot) (defined at L786) is (actor) => actor?.login === bot. That is the same as the inline lambdas it replaces in refireRefusal's untrustedHold, in isTrustedClose and in closeDoneParent's splitLeftOpen. The App's identity check does not get any wider.
  • endedAt (defined at L1674) matches the inline step?.name === X && step.conclusion === "success" checks in stoppedUntrusted and stoppedStale exactly. The untrusted-provenance stop is detected the same way as before, so a run that stopped on it still never re-fires.
  • someRunJobs keeps the RUN_ID filter and returns on the first match, as before. In cancelledBeforeWork, the cancelled filter now runs before RUN_ID instead of in one combined filter, which selects the same runs.
  • appPosted still requires comment.user?.login === bot and a body that starts with the marker. Only the App's own comments count, as before.
  • addedSince: humanSince still counts only labels added by listed humans (humans.has(event.actor?.id)). Another labeler still cannot buy restarts.
  • fieldNamesOf has the same fieldFirst call and arguments, so holds set on the Work status field are still applied.
  • NAMES_ISSUE has no g flag, so .test() keeps no state between calls and behaves like the inline regex.
  • appId is read once, from logins (L2571), before anything uses it. The if (!sweep) … else merge is equivalent to the two back-to-back ifs it replaces.

No merge hold, trusted-trigger check, token scope or kill switch is changed. No untrusted text gets a new route into a lane. No plugin manifests and no instruction surfaces are touched.

The PR text holds no embedded instructions aimed at the review.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14291 (refactor of label-unblocked.mjs, part 2 of 2)

I read every hunk of the one changed file (.github/scripts/work-unblock/label-unblocked.mjs) and checked each new helper against what it replaces at head. No findings.

What I checked:

  • someRunJobs: it keeps the old loop's order and its RUN_ID filter, reads each run's jobs one at a time, and returns on the first match. cancelledBeforeWork still filters to cancelled runs before the RUN_ID check, so the set of runs and the order are unchanged.
  • endedAt (L1674): it is the same step?.name === name && step.conclusion === conclusion test that stoppedUntrusted and stoppedStale used to write out inline.
  • byBot (L786): it is (actor) => actor?.login === bot, the same as the inline isApp lambdas it replaces.
  • NAMES_ISSUE: the regex has no g flag, so reusing it in .test() keeps no lastIndex state between calls.
  • fieldNamesOf, appPosted, firedOn, addedSince: each is the same expression it replaces. The two module-level consts are only called at runtime, so there is no temporal-dead-zone risk. firedOn closes over refireRefusal's markers parameter.
  • main: appId = logins.get(bot) is read after logins is set (L2571) and has no side effects. sweep is a const (L2549), so merging if (!sweep) / if (sweep) into one if/else is equivalent.

Closing issue #14153, acceptance criteria:

  • Behavior unchanged: met by inspection (above). No exported name, flag or printed line changed.
  • Edits only the listed file: met.
  • Within 400 changed lines: met (68 added, 105 removed).
  • Only functions that start in range 2 are changed: met. Every hunk is at or after line 1508, past the stated boundary at line 1353.
  • ci-status is green: I can't check this in this lane; it is left to CI.

Not verified by me: I did not run node --test or any other command, because this lane has no shell. The verification results in the PR body were reported by the author and I did not confirm them.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 6422b3a

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-14291-6422b3aa6a70cebf4f9442c3aaf9789415b00541, 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 22e8b92 Nov 9, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14153-42536267521-1 branch November 9, 2026 01:55
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/work-unblock/label-unblocked.mjs 5 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/work-unblock/label-unblocked.mjs:1512 other productive input-gap
.github/scripts/work-unblock/label-unblocked.mjs:1801 other productive input-gap

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 22e8b92f1f608d64c4cbc42747a6ad56f771e1bd; 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 label-unblocked.mjs .github script (part 2 of 2)

0 participants