Skip to content

refactor(ci): move the mutation legs' repeated setup steps into scripts - #15956

Merged
kyle-sexton merged 1 commit into
mainfrom
refactor/15951-mutation-leg-setup-scripts
Nov 13, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
refactor/15951-mutation-leg-setup-scripts

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Closes #15951

session: Simplify E2 B

Summary

The post-merge mutation lane's two repeated pre-model leg steps now each live in one script under .github/scripts/post-merge-test-mutation/. "Set the diff target" repeated across six legs, and "Stage the plugin and the prompt" across three legs per stage. The two dead credit-marker rm -rf lines are also gone. This is part of restructuring pass #15695. Behavior is unchanged.

Fix

  • New set-diff-target.sh (mode 100755, #!/usr/bin/env bash): holds the "Set the diff target" body verbatim, its # shellcheck disable=SC2016 reason included. It reads BEFORE and AFTER from the environment.
  • New stage-plugin-prompt.sh <generate|triage> (mode 100755): holds the staging body, with <stage>.prompt.md and <stage>.schema.json picked by the argument. Any other argument, or none, exits 2. It reads HEAD_SHA, DIFF_TARGET, PROMPT_FILE, SCHEMA_FILE and MODEL from the environment.
  • The twelve steps: each keeps its name, id, if: and env:. Its run: is now one line, bash .base/.github/scripts/post-merge-test-mutation/set-diff-target.sh or … stage-plugin-prompt.sh generate|triage. The command still runs from the workspace root against main's checkout and still comes before the model step. No new token, permission or composite action.
  • Credit-stop marker steps: dropped rm -rf "${RUNNER_TEMP:?}/key-credit-stop" from the key legs of generate and triage. No earlier step of those jobs names the directory, and runner.temp starts empty in each job. Each step keeps its mkdir -p and echo.
  • Shell flags: the workflow's defaults.run.shell: bash runs steps as bash -eo pipefail, and a script called with bash inherits neither flag. So both scripts start with set -eo pipefail, and without -u, which the steps never had.
  • Lint adaptations: each script carries a file-level # shellcheck disable=SC2154 with its reason, as pr-verify/chunk-diff.sh does, because the step env sets those variables. [ ] became [[ ]] (SC2292). shfmt split the one-line { …; exit 1; } groups. None of these changes behavior.

Verification

  • Old against new, in scratch repos: a throwaway harness, not committed, ran the old step bodies taken from HEAD's workflow under bash -eo pipefail, then the new scripts, in identical scratch repos. It compared stdout, stderr, the exit code, GITHUB_OUTPUT, the prompt and schema files, the settings file and .git/info/exclude. Every case was identical:

    • diff target with a previous head (range, rc 0);
    • diff target with no previous head (commit, warning, rc 0);
    • diff target for a head not on main (error, rc 1);
    • staging for generate and for triage (rc 0);
    • staging with an empty model (error, rc 1).

    stage-plugin-prompt.sh bogus and a call with no argument both exit 2.

  • Lints: shellcheck --rcfile .shellcheckrc and shfmt -d with the repo's .editorconfig are clean on both scripts. scripts/check-affected.sh passed 11 checks and skipped 5 over the 3 changed files.

  • Tests: all 6 local test files that name this workflow pass under scripts/run-test-file.sh, including credential-legs.test.mjs and callers.test.mjs. Both compare the legs with one another, and all twelve steps changed alike.

  • Other checks: local actionlint reports no errors beyond the cache-mode key it does not know. check-artifact-retention.mjs reports 152 upload steps matching.

  • Left to CI: the full .github suite runs in ci-status, under the one-suite-per-machine rule.

Follow-ups

  • No committed test runs the two new scripts. The leg-equality tests stay green even if both scripts break the same way, as the review thread on set-diff-target.sh notes. A small *.test.sh that runs both scripts in a scratch repo would close the gap. It would check GITHUB_OUTPUT, the settings file and the exit codes for range, commit and not-on-main, plus the argument check. This issue's file list leaves out a new test, so it is a follow-up for the restructuring pass (Restructure and dedupe workflow files (final group, host sessions) #15695).

Related

🤖 Generated with Claude Code

The post-merge mutation lane's six model legs each carried the same
19-line "Set the diff target" body, and each stage's three legs the
same 16-line "Stage the plugin and the prompt" body. Both now live once,
in .github/scripts/post-merge-test-mutation/set-diff-target.sh and
stage-plugin-prompt.sh (generate or triage; any other argument exits 2),
and each of the twelve steps calls its script from main's checkout with
its name, id, if: and env: unchanged. The scripts set -eo pipefail, as
the workflow's `shell: bash` step shell did.

Drop the two dead `rm -rf` lines before the key's credit-stop marker:
no earlier step of those jobs writes the directory, and each job starts
with an empty runner.temp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T12:41:28.812738Z f8bbe98 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: no security issues found

I read every hunk of the 3 changed files. .github/workflows/post-merge-test-mutation.yml is a trusted path, so I read its whole change and the jobs it touches.

What changed. The "Set the diff target" step body repeated across six legs. The "Stage the plugin and the prompt" step body repeated across three legs per stage. Both moved into two new scripts: set-diff-target.sh and stage-plugin-prompt.sh <generate|triage>. The rm -rf "${RUNNER_TEMP:?}/key-credit-stop" line was removed from two credit-stop marker steps.

What I checked:

  • Where the scripts come from. Each run: calls bash .base/.github/scripts/post-merge-test-mutation/.... .base is main's checkout at the event commit: ref: ${{ github.sha }}, path: .base, persist-credentials: false (workflow L262-L267). That is the same trusted tree the old inline bodies already read their prompt and schema files from. The pushed head checked out at the workspace root is never run. The trigger is workflow_run on branches: [main]. The prep job also requires event == 'push', head_branch == 'main' and a same-repository head (L42-L69). No outside input reaches the scripts.
  • Same behavior. Both scripts match the old bodies line for line, apart from [ ] → [[ ]], the reformatting into multi-line groups, and $stage choosing the prompt and schema file. $stage can only be generate or triage: the case statement exits 2 on any other value, so the argument cannot reach a path outside those files. Both scripts start with set -eo pipefail, which matches the workflow's shell: bash default, so they still stop on the first error. The step names, ids, if: conditions, env: blocks and permissions: are unchanged. The checks that the head is on main, that the staged plugin holds no symbolic links, that the plugin copy is read-only and that the tree is clean all stay in place.
  • Credit-stop marker rm -rf removal. These jobs run on ubuntu-24.04 hosted runners, where RUNNER_TEMP starts empty in each job. No earlier step in those jobs writes key-credit-stop, so dropping the cleanup changes neither the marker's content nor the credit-stop path.
  • Trust controls. Nothing here widens who is trusted, a token's scope, the kill switch, a merge hold, or the untrusted text a lane sees. The change adds no new token, permission, action or trigger.
  • Instruction surfaces. None of the changed files is a standing instruction file, and no plugin manifest changed.

No prior findings and no settled threads apply: this is the first review, so it was not limited to blocking findings. The PR context contains no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on f8bbe9899ebeeda0d4e165bd8cce542bca6845ab; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: refactor(ci): move the mutation legs' repeated setup steps into scripts

I read the whole diff (3 files), the PR context and closing issue #15951, and the step context in post-merge-test-mutation.yml at head.

Behavior. I compared each script with the inline bodies it replaces. They match line for line. The only changes are [ ] → [[ ]], groups split by shfmt, and the generate/triage file names now picked by $stage.

  • Shell flags: steps ran under defaults.run.shell: bash, which is bash -eo pipefail. Both scripts now set set -eo pipefail, so that holds.
  • Working directory: still the workspace root, where the pushed head is checked out.
  • Script source: each script is read from .base. That is main at github.sha, the same commit whose workflow file runs (ref: ${{ github.sha }}, post-merge-test-mutation.yml#L262-L267). So the script version always matches the workflow version, and no code from the pushed head runs.
  • Credit-stop marker: dropping the rm -rf is safe. runner.temp starts empty in each job.

Closing issue criteria (#15951):

  • Logic exists once and all twelve steps call it: met. I counted six set-diff-target.sh calls and six stage-plugin-prompt.sh calls (three generate, three triage).
  • No marker step removes the directory: met, both lines are gone.
  • Step names, id, if:, env:, jobs, triggers and permissions unchanged: met as far as the diff shows. Only run: bodies changed.
  • Behavior unchanged: met by my read, but no test could fail if it broke (inline comment).
  • Edits only the listed files; within 400 lines and 15 files: met.
  • shellcheck/shfmt clean and ci-status green: the author says so, but I did not check it. I had no shell, and CI owns those.

The author's old-vs-new harness and lint runs are author-claimed and unverified. The harness was not committed.

Note, not counted. The workflow file is in the gate class at pr-pipeline.yaml#L1952. The logic it ran inline (the on-main ancestry check and the read-only plugin staging) now lives in .github/scripts/post-merge-test-mutation/*.sh, and no trusted-path glob covers that folder. Other scripts in that folder are already uncovered, so this follows an existing pattern. Whether the folder should be listed is a call for the security lane or a maintainer.

Spend: none changed. No model, turn, schedule or runner changes.

No manifest, userConfig, paved-path or .claude/rules items apply to these files. The PR context had no embedded instructions.

Verifier dropped 0 of 1 candidates. No verifier subagent ran: there was one candidate, and I checked it myself.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit b69d520 Nov 13, 2026
72 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/15951-mutation-leg-setup-scripts branch November 13, 2026 13:10
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

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

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/post-merge-test-mutation/set-diff-target.sh 0 4 0 0 0 0
.github/scripts/post-merge-test-mutation/stage-plugin-prompt.sh 0 3 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/post-merge-test-mutation/set-diff-target.sh:19 LCR unclassified none
.github/scripts/post-merge-test-mutation/set-diff-target.sh:26 other unclassified none
.github/scripts/post-merge-test-mutation/set-diff-target.sh:29 SBR unclassified none
.github/scripts/post-merge-test-mutation/set-diff-target.sh:33 ROR unclassified none
.github/scripts/post-merge-test-mutation/stage-plugin-prompt.sh:22 ROR unclassified none
.github/scripts/post-merge-test-mutation/stage-plugin-prompt.sh:28 ROR unclassified none
.github/scripts/post-merge-test-mutation/stage-plugin-prompt.sh:35 SBR unclassified none

The run's summary has the full report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move the post-merge mutation legs repeated setup steps into scripts

1 participant