Skip to content

refactor(lib): simplify the .github scripts lib helpers without changing behavior - #14235

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14109-42514638935-1
Nov 8, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14109

Summary

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

Reviewed the 11 listed .github/scripts/lib files for reuse, simplification, efficiency and altitude, and simplified 8 of them. All outputs, exit codes, exports and JSON key orders stay the same. The main changes: handoff-evidence.sh's jq program folds its three identical job-then-step facts (posted, stale, credit-stop) into one job_step function plus a fact dispatcher; act-turns.mjs pulls the permission-denial list out of an inline IIFE and names its repeated serializer; workflow-text.mjs shares one name: value block parser between job outputs and step inputs. upsert-comment.mjs, stop-reason.mjs and gate-expression.mjs were already minimal and are unchanged.

Not verified

  • The node test suites covering these files (callers.test.mjs's handoff-evidence.sh and act-turns tests, admit.test.mjs, report-outcome.test.mjs, write-issue.test.mjs, the credential-legs tests) and a jq run of the edited settle program could not run in this lane, which has no node or jq access; they…
  • tidy: not run, because the change is under .github/, a listed shared path
  • ci-status green on the PR: a PR check, left to the PR's CI

Fix

  • .github/scripts/lib/act-turns.mjs: the denied list is built before the diag literal instead of in an IIFE (key order unchanged), permission_denials is read once, a serialize helper replaces two copies of JSON.stringify(…, null, 2) + newline, and runStep names the act-turns.json path once
  • .github/scripts/lib/admission-comment.mjs: sayWhy's three branches (POST, PATCH when the body differs, nothing when it matches) are one if/else-if
  • .github/scripts/lib/admission-record.mjs: admittedAt's person filter uses the existing personSender flag, and the same-second sort tie-break is a boolean difference (record before person, as before)
  • .github/scripts/lib/done-evidence.mjs: doneEvidence converts the reason to a string once
  • .github/scripts/lib/handoff-evidence.sh: the jq posted, stale and credit_stop functions, identical apart from job and step name, become one job_step($n; $s); a fact($f; $c) function replaces the inline if-chain in the output line
  • .github/scripts/lib/lane-outcome.mjs: readRecord converts its input to a string once
  • .github/scripts/lib/model-credential.mjs: truthy moves to module scope so runs reuses it instead of restating the check; the stray blank line at end of file is gone
  • .github/scripts/lib/workflow-text.mjs: a fields(block, indent) helper replaces the two copies of the name: value loop in outputs and step

Verification

The runner ran each check from the base copy against 73e16b8:

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

The run reports:

  • check-changelog-fragments: all 1 changelog fragment under .changes/ valid (no fragment needed: .github/ is not a plugin)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 10 passed, 6 skipped over 8 changed files
  • git-read diff --numstat HEAD: 8 files, 52 added and 60 removed lines, all within the listed files
  • fresh-context review subagent over the whole diff: no behavior change found; two nits about call order and String() call count matter only for an impure redact or an object whose toString changes between calls, and neither occurs in this code
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42514638935

Left out: the items under Not verified.

Related

#14109

Merge-Risk: max=HIGH demote=true head=73e16b8fec919d6295851d00dbbe8b430f129b01 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-security-review reviewed 73e16b8fec919d6295851d00dbbe8b430f129b01: read 8 of 8 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14235

No security issues found. I read every hunk of all 8 changed files. Each change is a refactor, and I found nothing that changes behavior on a security-relevant path.

Five changed files match trusted-path globs: admission-comment.mjs, admission-record.mjs, done-evidence.mjs, lane-outcome.mjs, stop-reason.mjs-adjacent lib helpers. I read the whole change in each and what it gates:

  • .github/scripts/lib/admission-record.mjs (admission gate): the new filter !personSender || one.actorId === sender matches the old sender == null || sender === appId || one.actorId === sender exactly. personSender is defined at head as sender != null && sender !== appId (L91). The sender check that throws for an unlisted human (L88-L90) is unchanged. The new sort tie-break (a.kind === "person") - (b.kind === "person") gives -1, 0 or 1 in the same cases as before: a record sorts before a person in the same second. The set of admissions that admit an issue is no wider.
  • .github/scripts/lib/admission-comment.mjs: the POST / PATCH / no-op branches are equivalent. When own is undefined the old code also reached POST, because body is always a string. The comment is still matched by bot login and marker.
  • .github/scripts/lib/done-evidence.mjs, .github/scripts/lib/lane-outcome.mjs: the reason or text is converted to a string once and then reused. The regexes, the 3-item caps and the MAX_LENGTH slice bounds are unchanged.
  • .github/scripts/lib/handoff-evidence.sh: the jq function job_step($n; $s) reproduces posted, stale and credit_stop with the same job suffixes (/ report, / run, / run) and the same step names. The fact dispatcher keeps the same branch order and still falls back to handed_off. Nothing new is interpolated into the shell. The program is still one single-quoted literal, and $f and $c are jq variables.
  • .github/scripts/lib/act-turns.mjs: the denied-call output keeps the same caps (20 entries, 100 and 300 characters, 8192 bytes), still applies redact before it truncates, and still enforces the overall CAP loop. The rmSync of a planted act-turns.json before writing still runs. Only the path is now named once.
  • .github/scripts/lib/model-credential.mjs, .github/scripts/lib/workflow-text.mjs: the truthy helper is hoisted unchanged. fields() builds ^ {N}([\w-]+): (.*)$ from a fixed numeric indent of 6 or 10, the same patterns as before, so no outside input reaches the RegExp.

Not applicable to this PR:

  • Trust controls: none is widened. The PR touches no trusted-trigger, token, kill-switch or merge-hold code.
  • Instruction surfaces: none is deleted.
  • Plugin manifests: none is changed.
  • Embedded text: none was found in the PR context.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14235 (refactor of the lib helpers under .github/scripts/)

I read every hunk of all 8 changed files and checked each edit against the head file around it. I found nothing to block or flag. Every change keeps the old behavior:

  • act-turns.mjs: The denied list is now built before the diag literal instead of inside an inline function, and the key order in diag is unchanged. A serialize helper replaces two copies of the same code. runStep now names its output path once. The only ordering change is that redact runs on the denials before the stderr entries, which matters only if redact is impure, and it isn't.
  • admission-comment.mjs: The three cases (POST when there is no comment, PATCH when the body differs, nothing when it matches) are the same.
  • admission-record.mjs: The filter !personSender || one.actorId === sender matches the old test, since personSender is defined as sender != null && sender !== appId (admission-record.mjs:91). The new sort tie-break (a.kind === "person") - (b.kind === "person") gives -1, 0 or 1 exactly as before for the only two kinds, record and person.
  • done-evidence.mjs and lane-outcome.mjs: The input is turned into a string once instead of twice. The results are the same, including for null input, which still returns early in readRecord.
  • handoff-evidence.sh: The new job_step($n; $s) matches the three functions it replaces (posted, stale, credit_stop), with the same job name and step name for each. fact($f; $c) routes each fact the way the old inline if-chain did, and the fallback is still handed_off. No jq builtin uses these names.
  • model-credential.mjs: truthy now lives at module scope. Nothing else at module scope uses that name, and the uses inside evaluate resolve to the same function.
  • workflow-text.mjs: fields(block, indent) builds the same patterns as before (^ {6}… for outputs and ^ {10}… for step inputs), and an empty block still gives an empty map.

Closing issue #14109, acceptance criteria:

  • Behavior unchanged, with the same exports and no renamed files: met, from my reading. Existing tests cover these modules, for example callers.test.mjs, admit.test.mjs, report-outcome.test.mjs, write-issue.test.mjs and the credential-legs.test.mjs suites. The PR says they were not run in the authoring lane. I could not run them either (this lane has no shell), so whether they pass is left to CI.
  • Only the listed files are edited: met. All 8 changed files are on the issue's list.
  • Within 400 changed lines and 15 files: met (the PR reports 52 lines added and 60 removed, across 8 files).
  • ci-status green: I can't see it from this lane, so it is left to the PR's checks.

No plugin manifest changed and nothing new is spent. No prior findings or settled threads apply to this PR.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 73e16b8fec919d6295851d00dbbe8b430f129b01. 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 73e16b8fec919d6295851d00dbbe8b430f129b01, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 73e16b8

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-14235-73e16b8fec919d6295851d00dbbe8b430f129b01, 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
Merged via the queue into main with commit 2c53b69 Nov 8, 2026
67 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14109-42514638935-1 branch November 8, 2026 21:10
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 2c53b69d8aa41ff2562c9c8a8b93a85b92ad2cf3; 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 lib .github script

0 participants