Skip to content

refactor(ci): move the lane-token revoke and pinned PyYAML install into lib scripts - #15970

Merged
kyle-sexton merged 2 commits into
mainfrom
refactor/lane-token-pyyaml-lib-scripts
Nov 13, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
refactor/lane-token-pyyaml-lib-scripts

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #15963

session: Simplify E2 A

Summary

Moves two shell bodies that were written out by hand in several workflows into .github/scripts/lib/ (restructuring pass #15695). The "Revoke the lane token" body had 13 copies in 6 workflows. The "Install the pinned YAML reader" body had 4 copies in 3 workflows.

Fix

  • New .github/scripts/lib/revoke-lane-token.sh (mode 100755, #!/usr/bin/env bash). It reads GH_TOKEN and GITHUB_API_URL and sends the same curl DELETE to installation/token, with the auth header on stdin so the token never shows in a process listing. A 204 prints "the lane token is revoked"; any other status prints the existing ::warning:: line. It always exits 0.

  • New .github/scripts/lib/install-pinned-pyyaml.sh (mode 100755). It reads the pyyaml== block from the requirements-ci.txt two directories up (.base/.github/requirements-ci.txt when called from .base) into $RUNNER_TEMP/pyyaml-requirements.txt, then runs the same pip install --only-binary=:all: --require-hashes. On failure it prints ::warning:: with its one argument and exits 1.

  • Every step keeps its name, if:, continue-on-error and env::

    • the 13 revoke steps in intake-triage.yml (2), pr-merge.yml (2), work-unblock.yml (3), maintenance-measure-skill-edit.yml (2), maintenance-tidy-code-upkeep.yml (2) and upstream-apply-changelog.yml (2) now run bash .base/.github/scripts/lib/revoke-lane-token.sh;
    • the 4 YAML-reader steps in pr-merge.yml (2), pr-feedback-dispatch.yml and pr-unblock-dispatch.yml now run bash .base/.github/scripts/lib/install-pinned-pyyaml.sh '<their own warning text>'.

    Every one of those jobs checks main out to .base in full before it can hold a lane token.

  • hill-climb-workflow.test.mjs:68 matches revoke-lane-token.sh instead of DELETE.

The one output change: the 6 revoke copies that only warned (the measure-skill-edit, tidy-code-upkeep and upstream-apply-changelog steps) now also print "the lane token is revoked" on success.

Left as they are, per the issue:

  • the write runner's github-script revoke and request-lane-token's internal revoke;
  • pr-require-checks.yml's full-requirements install, which shares the step name "Install the pinned YAML reader" but installs the whole requirements file.

Verification

  • Both scripts pass shellcheck with the repo's .shellcheckrc and shfmt -d.
  • I ran both scripts locally against stubs; every case behaved as intended:
    • revoke with a stubbed curl answering 204 prints "the lane token is revoked" and exits 0;
    • revoke with a 401 prints the warning and exits 0;
    • the PyYAML install with a stubbed python3 writes a requirements block byte-identical (cmp) to the old inline awk output on the real file and passes the same pip flags;
    • the PyYAML install with a failing python3 prints the given warning and exits 1.
  • actionlint on the 8 workflows: clean. node scripts/check-artifact-retention.mjs: 152 upload steps match.
  • Local test suites:
    • node --test --test-concurrency=4 on the 79 node test files that name these workflows, the step names or scripts/lib/: 6637/6637 pass.
    • The 80 shell test files that name them: all pass.
    • test_merge_holds_sync.py, which scrapes the scripts these workflows load: 21 passed.
  • Left to CI: the full .github suite (ci-status).

Related

Part of restructuring pass #15695 (child R2-1). Blocks #15964 and #15966.

🤖 Generated with Claude Code

…to lib scripts

Add .github/scripts/lib/revoke-lane-token.sh (the DELETE
installation/token call with its stdin-only auth header, a success line
on 204 and a warning otherwise, always exit 0) and
.github/scripts/lib/install-pinned-pyyaml.sh (the `pyyaml==` block of
the requirements-ci.txt next to it, the same hashed pip install, and the
caller's warning text with exit 1 on failure).

The 13 "Revoke the lane token" steps in intake-triage, pr-merge,
work-unblock, maintenance-measure-skill-edit, maintenance-tidy-code-upkeep
and upstream-apply-changelog, and the 4 "Install the pinned YAML reader"
steps in pr-merge, pr-feedback-dispatch and pr-unblock-dispatch, now run
those scripts from .base, keeping each step's name, if:,
continue-on-error and env:. The hill-climb workflow test matches the
script name instead of DELETE.

Closes #15963

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 13, 2026 14:51
@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-13T14:52:55.040663Z c359578 Draft marked ready
ℹ️ 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

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #15970 (incremental, c359578 → efc6f20)

I found no security issues in this push. I read every hunk of the one file it changes, scripts/lane-lib-scripts.test.sh.

What changed. The push adds scripts/lane-lib-scripts.test.sh, a behaviour test for the two lib scripts this PR introduced: revoke-lane-token.sh and install-pinned-pyyaml.sh.

  • It stands in for the network with stub curl and python3 binaries in a mktemp -d directory, which a trap removes on exit.
  • It runs each script under env -i with the stubs first on PATH.
  • The only "token" it uses is the literal string GH_TOKEN=t, and the API URL is a placeholder (https://api.example). No real credential, secret or network endpoint is involved.
  • It copies install-pinned-pyyaml.sh and requirements-ci.txt into a temp tree so the script resolves its requirements file as it would under .base. It also asserts that pip still gets --only-binary=:all: --require-hashes, which checks the pin rather than loosening it.

Trust controls. The test changes no workflow, token request, trusted-actor list, kill switch or merge-hold script. It only exercises the scripts the previous review already checked. Nothing is widened.

PR text. The PR context holds no embedded instructions to this lane.

Scope. Every other file is unchanged since c359578, which this lane reviewed with no findings. This was a blocking-only review: only CRITICAL and IMPORTANT findings would be posted.

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 c359578b64be6144400f710c7f69c72f2965cdb3; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review: PR #15970, incremental (c359578 → efc6f20)

Scope. This is an incremental, blocking-only review, because this lane already reviewed an earlier head. One file changed since then: the new scripts/lane-lib-scripts.test.sh. I read its whole hunk in .claude-lane/incremental.diff. To check its assertions, I also read the two scripts it tests, .github/scripts/lib/revoke-lane-token.sh and .github/scripts/lib/install-pinned-pyyaml.sh.

Prior finding resolved. This lane's earlier finding was that no test ran either new script (discussion_r4564811444). It is resolved, and this push adds the test that finding asked for.

What the new test checks:

  • revoke-lane-token.sh: it runs the script under env -i with a stub curl that answers 204, then 401. It checks the exact success line, the exact ::warning:: line, and exit 0 both times.
  • install-pinned-pyyaml.sh: it runs the script from a copied tree laid out as .base is, so the ../../requirements-ci.txt lookup through BASH_SOURCE is exercised for real. It checks four things:
    • the temp requirements file holds the pyyaml== block;
    • that block starts with pyyaml==;
    • the exact pip arguments;
    • a failing python3 stub prints ::warning::<arg> and exits 1.

What I checked in the test itself:

  • The stub-writing printf formats expand to valid scripts.
  • ok, fail and test_harness::report exist in scripts/lib/test-harness.sh.
  • The temp directory is removed by an EXIT trap, as the pr-require-checks.yml rule for tests that run mktemp requires.
  • The # test-scope: header has the same form as other scripts/*.test.sh files.

With this test in place, the closing issue's criterion "Behavior is unchanged except the one success log line the terse revoke copies gain" now has a test that can fail.

Unverified. The owner says that two deliberate breakages each fail 3 of the 5 checks: ../requirements-ci.txt, and a non-204 exit 1. That is the owner's claim; I could not run the test.

Other checks.

  • No plugin manifests changed.
  • No PR-context, settled-thread or prior-finding text tried to direct this lane.
  • Spend: none.

No new findings.

Verifier dropped 0 of 0 candidates.

scripts/lane-lib-scripts.test.sh runs revoke-lane-token.sh with a stub
curl answering 204 and 401 (the success line and the warning, exit 0
both times) and install-pinned-pyyaml.sh from a copied .base-shaped tree
with a stub python3 (exactly the pyyaml== block of the requirements
file two directories up, the hashed binary-only pip flags, and on a
failed install the caller's warning and exit 1). Moving the requirements
path or making the revoke exit non-zero fails it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 5b1a599 Nov 13, 2026
62 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/lane-token-pyyaml-lib-scripts branch November 13, 2026 15:25
@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 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/lib/install-pinned-pyyaml.sh 3 1 0 0 0 0
.github/scripts/lib/revoke-lane-token.sh 3 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/lib/install-pinned-pyyaml.sh:9 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 lane-token revoke and the pinned PyYAML install into two lib scripts

1 participant