Repository navigation
feat(concurrency-policy): admit the branched contract-only group and both fallback terms - #532
Conversation
…both fallback terms Two runs of one required workflow on one head SHA share a single concurrency group, and GitHub evicts a pending run in that group unconditionally, whatever cancel-in-progress says. A contract-only run evicted while pending starts no job, so its check suite never receives the required check run and the pull request stops reporting until someone re-runs that specific run. Phase 6b of the ci-perf program branches the group on the contract-only predicate, keying every contract-only run on github.run_id so it can neither be evicted nor evict anything. This component was the gate blocking that shape. The group grammar now admits two forms: the existing canonical expression, and the branched form whose predicate is byte-identical to the contract-only predicate the component already knew, whose contract branch carries github.run_id, and whose full branch falls back to exactly github.ref or github.run_id. Whitespace is tolerated only at the two operator joins and inside the expression delimiters, which is where the folded scalar the design writes differs from the same expression on one line; a probe against the pinned YAML parser confirmed the parser preserves a newline and the continuation indent at each join and nowhere else. The predicate, the contract branch and the fallback term are exact. The fallback term is a per-repository decision rather than drift: github.ref keeps push-side burst collapse and github.run_id gives none. The analyzer now reports it as an informational finding, concurrency-group-fallback, on both accepted forms, so a later fleet check can list which repositories keep push collapse without this component picking a side. Findings carry an explicit level, and the exit status and the JSON ok field are computed from the presence of any non-info finding, so an informational rule cannot mask a blocking one. Every previously accepted form stays accepted, including the contract-only cancel-in-progress text, which repositories not yet reshaped still carry. Rejected: a branched group whose predicate differs by one byte, a fallback term outside the two, and a contract branch without github.run_id. Tests: 31 pass, up from 25. The README documents both forms, what each fallback term means, and the ci-perf plan; the threat model records the widened objective and the two new controls. Refs melodic-software/github-iac#378 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019APkoJh8NVN773d82fBBSG
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @kyle-sexton's task in 4m 4s —— View job Code review complete
No blocking findings. What I checked
Note on verification: this sandbox's Bash tool required approval for |
|
Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
…checks.yml at the tag (#534) No related issue: melodic-software/github-iac#378 tracks the ci-perf program (Phase 6b-i, standards leg) ## Summary Phase 6b-i of the ci-perf program converges every consumer of `melodic-software/ci-workflows` onto one tag, v0.22.0 (`906ae7ef379ea4d2b8497f64475dce1d3d8715c4`). The Phase 6b design names standards-distributed components as one of the two structural obstructions to that convergence: three caller templates this repository distributes carry a ci-workflows pin, `managed-files-guard` reverts a consumer that edits one of them, and the synced `runner-policy` component approves ci-workflows reusables by exact `path@SHA`. So the pins have to move here, with their policy approvals, before any consumer's own pull request can claim it converged. This is the standards leg. It moves the three distributed pins and adds the three `runner-policy` contracts the converged callers need. It deliberately does not touch this repository's own workflows, which are a separate consumer pull request after this one merges. ## Fix **Three caller templates re-pinned to v0.22.0.** | Template | From | To | | --- | --- | --- | | `components/claude-lanes/claude-review.yml` | `0f8176e87e0be518f382664779655011bf95784a` (v0.17.2) | `906ae7ef379ea4d2b8497f64475dce1d3d8715c4` (v0.22.0) | | `components/claude-lanes/claude-security-review.yml` | `0f8176e87e0be518f382664779655011bf95784a` (v0.17.2) | `906ae7ef379ea4d2b8497f64475dce1d3d8715c4` (v0.22.0) | | `components/managed-files-guard/managed-files-guard.yml` | `3b2f4eab5b4bb58a150e400613350ede37742ee8` | `906ae7ef379ea4d2b8497f64475dce1d3d8715c4` (v0.22.0) | The guard's old pin was an unreleased `main` commit (ci-workflows#530, the close of the guard's fail-open on an unreadable diff), so its pin comment took the `pin-comment-convention` short-SHA fallback form and the re-pin cascade's ancestry fence held the file back from every release that did not contain it. v0.22.0 is the first release that does, so the comment takes the release-tag form now and `components/managed-files-guard/README.md` records the change. **Input contract findings, read at the tag through the contents API.** Nothing required a template change. - `checks.yml` is **byte-identical** between `b260ba091ca89bb3292eb53abea07ca8f0a51bf1` (v0.21.0) and the tag. - `.github/actions/managed-files-guard/action.yml` is **byte-identical** between `3b2f4eab5b4bb58a150e400613350ede37742ee8` and the tag. - `claude-review.yml` and `claude-security-review.yml` each differ from v0.17.2 by exactly **three `uses:` lines and nothing else**: two `anthropics/claude-code-action` pins (v1.0.198 to v1.0.215) and one `claude-lane-outcome` composite pin. Every `on.workflow_call` input and secret, every job permission, and every `runs-on` expression is unchanged in both. **Three `runner-policy` contracts added at the tag**, each a verbatim copy-forward of the terms already reviewed for that workflow path: - `claude-review.yml@906ae7ef379ea4d2b8497f64475dce1d3d8715c4`, from v0.17.2. - `claude-security-review.yml@906ae7ef379ea4d2b8497f64475dce1d3d8715c4`, from v0.17.2. - `checks.yml@906ae7ef379ea4d2b8497f64475dce1d3d8715c4`, from v0.21.0, the second SHA #531 shaped its trailing entry to make cheap. Nothing widens. No entry gains an input, a secret, a routing surface, or a caller permission, and the tests below assert that as equality against the predecessor rather than by restating the terms a second time. No selector allowlist entry is added: the lane caller components stopped pinning `select-runner.yml` in Phase 3b, so there is no selector reference to approve. No entry at all is added for `managed-files-guard`, which calls a composite action rather than a reusable workflow, and composite actions are not SHA-allowlisted. **The repin lane was used as the oracle, not as the pen.** `components/claude-lanes/repin-callers.sh apply v0.22.0 <sha> 2026-09-05` produced the rewrite form, which is what the committed pins carry. `repin-policy-lockstep.mjs` then **declined** the automatic copy-forward: ```text ::warning::claude-review.yml credentialReferences changed between revisions (from 0f8176e); claude-security-review.yml credentialReferences changed between revisions (from 0f8176e) ``` That is the documented human path, and the reason is the familiar one this repository has recorded twice before: both `claude-code-action` pins sit inside the steps that pass `claude_code_oauth_token`, and the credential-references surface records such a step in full, so an action pin bump on a credential-consuming step reads as a `credentialReferences` diff. Human review confirms the secret mapping itself is unchanged and still only `claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`. The contract entries are therefore written by hand and `components/runner-policy/README.md` carries the rollout record. **Scope.** The lane's `EXTRA_CALLER_FILES` also enumerate this repository's own `.github/workflows/claude-review.yml`, `sync.yml` and `standards-sync-stuck-automerge-alert.yml`, and the lockstep's `REPIN_TARGETS` would copy the two sync-family contracts forward with them. Those are reverted here and left to the standards consumer pull request that follows this one, for two reasons: the Phase 6b design's order of work separates the distributed-component bump and its sync from the per-repository re-pin, and bumping the `standards-sync.yml` reusable inside the very change whose merge triggers the sync would put an untested revision on the critical path of the fan-out this pull request has to land. ## Verification - `node --test components/runner-policy/runner-policy.test.mjs`: **294 pass / 0 fail before, 298 pass / 0 fail after.** - **Red first, verified.** With the whole change stashed, the four new tests fail and the rest pass. With only the pin bump applied and the policy change stashed, three tests that already existed fail as well: `every managed target of a claude lane caller admits that caller`, `claude lane caller components pass runner policy for a private self-hosted consumer`, and `a fleet-routed claude lane caller is rejected outright on a public consumer`. Those three audit the shipped component bytes against the real `policy.json`, so they are the load-bearing proof that the pin and the approval move together. - New: the `checks.yml` contract at the tag equals the v0.21.0 contract; a private fleet caller of `checks.yml` at the tag is admitted; both claude lane contracts at the tag equal their v0.17.2 predecessors; and the lane caller components all pin one ci-workflows revision. - That last test asserts convergence as a **property, with no SHA in the assertion**, on purpose. The daily `claude-lanes-repin` lane rewrites these components on every ci-workflows release and the lockstep maintains only the selector constants, so a test naming one revision would go red by construction on each of the lane's pull requests, which is the exact shape 6b is removing from ci-runner's pin metadata test. It is non-vacuous: pointing one lane caller back at the v0.17.2 SHA fails it and nothing else, that revision still being approved. - `node --test components/claude-lanes/repin-policy-lockstep.test.mjs`: 7 pass. - `bash harness/shell/run-tests.sh components/claude-lanes/repin-callers.test.sh`: pass. - `bash harness/shell/run-tests.sh components/pin-comment-convention/pin-comment-convention.test.sh`: pass, and `bash components/pin-comment-convention/scan-workflow-files.sh components/claude-lanes/*.yml components/managed-files-guard/*.yml` exits 0, which is what proves the guard's new comment form is convention-legal. - `actionlint` clean on both changed component workflows; `typos` clean on every changed file; `markdownlint-cli2` 0 issues on both changed READMEs; lefthook pre-commit green (editorconfig, typos, gitleaks, markdownlint, biome). - Three suites were run against a clean `origin/main` tree first to separate host noise from regressions, and each fails identically there: `claude-lanes.test.sh` case 32 and `managed-files-guard.test.sh` case 86 (both `actionlint` on a scratch tree outside a Git repository), and `distribution/sync-manifest.test.sh` with 7 failures both before and after. CI covers all three on Linux. ## Related - melodic-software/github-iac#378, the ci-perf program tracking issue. - #531 added the `checks.yml` contract at v0.21.0 and shaped its trailing entry so a second SHA is a copy of one self-contained object; this pull request answers its open question, and the answer is that the surface is byte-identical. - #532 taught `concurrency-policy` the branched contract-only group shape, the unconditional first gate of 6b-i. - melodic-software/ci-workflows#557 is the change v0.22.0 cuts: the bounded carry-forward wait and the branched concurrency group. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
No related issue: melodic-software/github-iac#378 tracks Phase 6b of the ci-perf program
Summary
Phase 6b of the ci-perf program branches the top-level concurrency group on the
contract-only predicate. Two runs of one required workflow on one head SHA share
a single concurrency group today, and GitHub cancels a pending run in that group
unconditionally when a newer run arrives, whatever
cancel-in-progresssays. Acontract-only run evicted while pending starts no job at all, so its check suite
never receives the required
ci-statuscheck run and the pull request stopsreporting until someone re-runs that specific run. That was observed on
dotfiles#647 and cost 2 hours 14 minutes of a silently blocked pull request.
components/concurrency-policyis the gate that shape has to pass. It matchesconcurrency.groupagainst one exact-token expression today, so every consumerpull request carrying the branched group would fail
concurrency-group-drift.The design records this grammar change as the first Phase 6b-i pull request and
as unconditional: nothing else in the phase can merge past it.
This is a producer-internal lint.
distribution/sync-manifest.ymlcarries noconcurrency-policyentry (grep -c -i concurrency distribution/sync-manifest.ymlreturns 0), so no sync follows this merge and no consumer receives a payload.
Fix
components/concurrency-policy/concurrency-policy.mjsThe contract-only predicate is lifted into its own constant,
CONTRACT_ONLY_PREDICATE_TEXT, andCONTRACT_ONLY_CANCEL_TEXTis derivedfrom it as
${{ !(<predicate>) }}. The existing test's inline literal stillguards that derivation byte for byte, so the two places the predicate can now
appear cannot drift apart.
concurrency.groupadmits a second form, the branched expression from thedesign:
One compiled pattern per admitted fallback term, built by escaping the
predicate and both
format(...)calls as literals. Whitespace is toleratedonly at the two operator joins and inside the
${{ }}delimiters. That isexactly and only where the folded spelling differs from the single-line one:
written as
group: >-with the continuation lines more-indented, the pinnedYAML parser preserves a newline plus the continuation indent at each join and
folds nothing else. That was verified with a probe against
yaml2.9.0 ratherthan inferred, and both spellings appear as fixtures in the tests. The
predicate, the contract branch and the fallback term are exact; there is no
other loosening.
FALLBACK_TERMSis exactlygithub.refandgithub.run_id. The canonicalform is unchanged and still carries
github.run_idby construction.New informational rule
concurrency-group-fallback. The fallback term is aper-repository decision rather than drift (
github.refkeeps push-side burstcollapse,
github.run_idgives none, and the design's table assigns one perrepository), so the analyzer reports the term it found instead of picking a
side, and a later fleet check can list which repositories keep push collapse.
Decision worth reversing cheaply if the coordinator disagrees: it is
emitted on BOTH accepted forms, not only the branched one, so a fleet check
can tell
github.run_idapart from a repository with no block at all.Every finding now carries an explicit
level,"error"by default and"info"for that one rule. The process exit status and the--jsonokfield are computed from the presence of any non-
infofinding, so aninformational rule cannot mask a blocking one, and a new info rule cannot
silently turn a red gate green. Info findings print on stdout; blocking
findings keep stderr and the non-zero exit.
The
concurrency-group-driftmessage now names both accepted forms.Nothing else in the accepted set moves.
cancel-in-progressstill admitsexactly the literal
trueand the byte-identical contract-only text, whichrepositories not yet reshaped still carry;
${{ github.workflow }}-${{ github.ref }},the
head_refvariant, the group-only shorthand, the extra-key and malformedshapes, and the whole exception surface are untouched.
components/concurrency-policy/README.mdgains a section on the branched formwith the per-repository fallback table, the folded-versus-single-line rule, the
informational finding, and a pointer to melodic-software/github-iac#378. The
opening paragraph no longer claims a default-branch run is never cancelled,
because with
|| github.refthat is the repository's decision.components/concurrency-policy/THREAT-MODEL.mdrestates the never-cancelledobjective as the two-valued fallback decision, adds the contract-only eviction
objective, rewrites the
github.refrow (that term is admitted only as afallback, never as the whole key), and adds two rows: the contract branch
without
github.run_id, and the level field as the control that keeps aninformational rule from masking a blocking one.
Verification
node --test components/concurrency-policy/concurrency-policy.test.mjs:31 pass, 0 fail, up from 25 on
origin/main. Six new tests.term, asserting both no blocking finding and the reported term; the branched
group paired with
cancel-in-progress: trueand with the contract-onlytext (the grammar leaves the two fields independent).
fromJSONarrayliteral; a predicate with the base-edit clause dropped; the predicate
stripped of its surrounding parentheses; fallback
github.head_ref,github.sha,github.ref_name,github.run_number; and a contract branchof
format('ci-contract-{0}', …), or one carryinggithub.shaorgithub.run_attemptin place ofgithub.run_id. Each is exactly oneconcurrency-group-driftand no reported fallback term.--jsonon aninfo-only repository exits
0with"ok": trueand the full expectedfinding object, and on a drifted one exits
1with"ok": false.blocking findings and informational findings through separate accessors;
no assertion was weakened to accommodate the new rule.
npm run lint:concurrency-policyagainst this repository exits 0,printing two info lines (
ci.ymlandclaude-review.yml, both the canonicalform with
github.run_id) andConcurrency policy passed.Standards' ownci.yml, which carries the canonical group and the contract-onlycancel-in-progresstext from ci: fold the pull-request contract into ci-status and carry it forward on contract-only events #526, is unaffected.npx @biomejs/biome check components/concurrency-policyclean;npm run lint:mdclean over 122 files; lefthook pre-commit ran on the commitand was never bypassed.
actionlintorzizmorsurface changes.Related
.work/ci-perf/wave-d/phase-6b-design.mdin github-iac, section"Race analysis and fix". This pull request implements only the grammar half of
its Decision block. The
ci-statuscarry-forward wait, thecarry-forward-wait-secondsinput, thecontract-predicatecomposite and thev0.22.0 tag are ci-workflows changes and are not in this repository.
distribution/sync-manifest.ymlhas noconcurrency-policycomponent definition and no target rows for it, so thismerge triggers no sync pull request. The manifest is not edited.
unconditional. No consumer repository can adopt the branched group until it
merges, and no consumer in this repository's sync roster is affected by it.
cancel-in-progress; the two are now derived from one constant rather thanwritten twice.
🤖 Generated with Claude Code
https://claude.ai/code/session_019APkoJh8NVN773d82fBBSG