Skip to content

refactor(ci): simplify post-merge-demotion-alert and post-merge-test-mutation scripts - #14205

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14116

Summary

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

Simplified six of the ten listed scripts without changing behavior. The changes: a shared newest-run helper in the demotion report, a module-level records query in merge-path, guard lists in place of one-line if/continue blocks in handoff.bash, a readText helper and one file path per mutant in execute.mjs, a split ternary for survivor verdicts in assemble.mjs, and one shared render context and result binding in the mutation report's main. failing-checks.mjs, newer-green.bash, red-main.mjs and comment.mjs were reviewed and left unchanged because they were already minimal, and any edit that would shorten them meant moving code between files, which the issue puts out of scope.

Not verified

  • The node test suites (merge-path.test.mjs, report.test.mjs, execute.test.mjs, assemble/comment tests) and scripts/post-merge-demotion-alert.test.sh were not run, because this lane allows no interpreter. They are left to the PR's CI.
  • ci-status green on the PR: left to the PR's CI.
  • tidy skipped: the change is under .github/, a listed shared path for the tidy cutoffs.
  • No changelog fragment was added: the edited files are repository CI scripts under .github/, not a plugin, so no plugin release record applies.

Fix

  • .github/scripts/post-merge-demotion-alert/report.mjs: a newest helper (sorts a copy by created_at, newest first) now serves both lastGreen and the per-commit own-run lookup, replacing two copies of the same sort.
  • .github/scripts/post-merge-demotion-alert/merge-path.mjs: RECORDS_QUERY moved out of readRollup to module scope beside MERGED_QUERY, with the query text unchanged.
  • .github/scripts/post-merge-demotion-alert/handoff.bash: in retry_undelivered, the one-line if/continue and if/assign blocks became test || continue / call && moved=1 lists, with the same conditions and call order.
  • .github/scripts/post-merge-test-mutation/execute.mjs: a readText helper (returns null when the read fails) replaces the inline let/try/catch, and the mutant's file path is now joined once instead of twice.
  • .github/scripts/post-merge-test-mutation/assemble.mjs: the nested disposition/cause ternary is now an early return for a survivor that has no verdict, followed by the productive/none choice.
  • .github/scripts/post-merge-test-mutation/report.mjs: main builds the before/after/mode/pulls/repository context once for render and commentBody, and binds result once in place of the repeated !parsed.error && !parsed.stop checks.

Verification

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

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

The run reports:

  • check-changelog-fragments: passed (All 2 changelog fragment(s) under .changes/ are valid), before and after the review fixes.
  • check-changed-skills: passed (no changed skills under plugins/*/skills/).
  • check-affected: 9 passed, 7 skipped over 6 changed files, run before and after the review fixes.
  • fresh-context review subagent over the full diff, schemas and callers: found no behavior change reachable with real inputs. It named two theoretical differences, both outside what callers pass: a negative or non-numeric count in handoff.bash, which jq's .comments // 0 rules out, and a…
  • diff size: 6 files, under the 15-file and 400-changed-line limits in the acceptance criteria.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42508844041

Left out: the items under Not verified.

Related

#14116

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

Security review: PR #14205 (head f554bd6)

I found no security issues.

I read every hunk of all 6 changed files. None of them matches a TRUSTED PATHS glob. The workflows that run these scripts (post-merge-demotion-alert.yml, post-merge-test-mutation.yml) are trusted paths, but this diff doesn't change them. The PR touches no trust control: no trusted-trigger check, token request, kill switch, merge hold or plugin manifest. All of the changes are refactors that keep the same behavior:

  • handoff.bash: the if …; then continue; fi blocks became test || continue and call && moved=1. The conditions and call order are the same. The mark_undelivered … && moved=1 lists are exempt from errexit, just as if conditions were. The comment-id check ^[1-9][0-9]*$ and the marker regex are unchanged. The one difference is ((count > 0)) || continue versus the old ((count == 0)), and it only matters for a negative count. That value comes from jq's .comments // 0 and has no security impact.
  • merge-path.mjs: RECORDS_QUERY moved to module scope with the same text. The search still takes repo and the author-login filter (filers) is unchanged.
  • report.mjs (demotion alert): a newest helper replaced two copies of the same sort. The success, head_sha and RUN_SHA filters are unchanged.
  • execute.mjs: join(root, mutant.path) is now computed before the git ls-files --error-unmatch check, but it is only a string. Every read and write still happens after the tracked check and after applyProblem's glob check, so the guard against path traversal and untracked files works as before. readText returns null on a failed read, as the old try/catch did.
  • assemble.mjs: the nested ternary became an early return. It produces the same disposition and cause for every value of v.
  • report.mjs (mutation): parse returns exactly one of { error }, { stop } or { result } (lines 65, 75, 198-200). That makes if (result) the same check as !parsed.error && !parsed.stop, so the conditions for posting a comment are unchanged. The shared context object holds the same fields that were passed before.

The PR context file has no embedded instructions aimed at this lane. The instruction exception register wasn't needed: the diff deletes or softens no standing instruction.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of all 6 changed files, plus the code they call that the change depends on: parseResult/outcomeOf in the mutation report.mjs, triage.schema.json, the full execute() loop and the retry_undelivered function in handoff.bash. None of the refactors changes behavior for the inputs callers actually pass.

How each change was checked

  • post-merge-test-mutation/report.mjs: outcomeOf returns exactly one of {error}, {stop} or parseResult's {error}/{result}. So if (result) is equivalent to !parsed.error && !parsed.stop, and result is always an object, so it is always truthy. The later result.outcome access runs only after the error and stop returns, as before. The shared context object passes the same keys to render and commentBody.
  • post-merge-test-mutation/assemble.mjs: triage.schema.json requires disposition and limits it to an enum. The old v?.disposition ?? "unclassified" fallback could only differ for a verdict with no disposition, and schema validation rejects that before the map is built.
  • post-merge-test-mutation/execute.mjs: join(root, mutant.path) now runs before the ls-files check. GENERATE_SCHEMA validates path as a string first, so join cannot throw where it used to sit inside the try. readText keeps the same null-on-failure behavior.
  • post-merge-demotion-alert/handoff.bash: the guard lists keep the same conditions and the same call order. mark_undelivered … && moved=1 runs with errexit suppressed, the same as the old if condition, and it is never the last command in the loop body. ((count > 0)) || continue differs from ((count == 0)) only for a negative count, and jq's .comments // 0 cannot produce one. Both forms skip the issue when the count is empty or non-numeric.
  • post-merge-demotion-alert/report.mjs: newest sorts a copy and is called on freshly filtered arrays, so the result is the same as the old in-place sort.
  • post-merge-demotion-alert/merge-path.mjs: RECORDS_QUERY moved to module scope unchanged. It is a constant string with no interpolation.

Closing issue #14116 acceptance criteria

  • "Behavior is unchanged…": met, as checked above. No exported name, flag or file was renamed. The existing suites the PR lists (merge-path.test.mjs, report.test.mjs, execute.test.mjs, the assemble tests, scripts/post-merge-demotion-alert.test.sh) cover these paths. I did not run them. The PR says they were not run by its author either and leaves them to CI.
  • "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. 6 files, a small diff.
  • "ci-status is green": not checked by this lane. The PR leaves it to CI.

The verification results in the PR body (check-affected, changelog and skill checks) are the author's claims, and I have not confirmed them. No plugin manifests changed. Nothing in the PR context reads as an instruction to this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for f554bd6

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-14205-f554bd6b2f7387e7710b022a3a73ba774c639343, 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 5157977 Nov 8, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14116-42508844041-1 branch November 8, 2026 19:05
@github-actions

github-actions Bot commented Nov 8, 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/post-merge-demotion-alert/report.mjs 1 1 0 0 0 0
.github/scripts/post-merge-test-mutation/assemble.mjs 1 0 0 0 0 0
.github/scripts/post-merge-test-mutation/execute.mjs 1 1 0 0 0 0
.github/scripts/post-merge-test-mutation/report.mjs 2 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/post-merge-test-mutation/execute.mjs:143 other productive input-gap
.github/scripts/post-merge-demotion-alert/report.mjs:154 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 5157977b8bf68f750d503089997aa336102005f8; 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 .github: post-merge-demotion-alert, post-merge-test-mutation

0 participants