Skip to content

test: fail any lane workflow that does not emit the lane-outcome record - #857

Merged
kyle-sexton merged 17 commits into
mainfrom
feat/lane-outcome-emitter-check
Oct 22, 2026
Merged

kyle-sexton merged 17 commits into
mainfrom
feat/lane-outcome-emitter-check

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: melodic-software/architecture#7

Refs: melodic-software/claude-code-account-rotation#288

Summary

A test that fails CI when a ci-workflows lane stops emitting the lane-outcome record (docs/lane-outcome.md). A lane job is any job with a step that uses anthropics/claude-code-action or .github/actions/run-claude-cli. Each lane job must have, in the same job, a report-lane-outcome step, and every such step must set credential and lane-id. A literal lane-id must match the record's LANE_ID_PATTERN. Enforcement in consumer repositories is out of scope and tracked in architecture#7.

Fix

  • .github/scripts/lane-outcome-emitters.test.cjs: scans every .github/workflows/*.yml with the shared workflow-yaml.cjs parser and reuses LANE_ID_PATTERN from report-lane-outcome/classify.cjs.
  • A second test pins the detected lane set to the four real lane jobs (intake-triage.yml claude and subscription, pr-review.yml claude, pr-review-security.yml claude), so a detection regex that stops matching fails instead of passing on zero lanes.
  • Eight fixtures under .github/scripts/fixtures/lane-outcome-emitters/ cover: no report step, an empty credential, an empty lane-id, a second report step missing lane-id, run-claude-cli with no report, an invalid literal lane-id, and two passing shapes.
  • No workflow or action changes: every lane on main already passes (feat(report-lane-outcome): document the lane-outcome record as a public JSON contract #853, feat(review): name the credential in review-lane and intake handoff lane records #856).

Verification

  • node --test .github/scripts/*.test.cjs: 579 pass, 0 fail at d7fee9e (after merging main at 8dd0857).
  • node --test .github/actions/*/*.test.cjs: 143 pass, 0 fail.
  • npx @biomejs/biome@2.5.11 ci --error-on-warnings .github/scripts: clean.
  • A fresh-context phase verifier passed 7/7 acceptance criteria at 9e8dcfb and killed 4 of 4 mutants of the check.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 17 commits October 21, 2026 23:52
report-lane-outcome now writes the lane-outcome record, the marker
`lane-outcome ` and one JSON object, after each annotation's first
sentence and before any free text, so the runner's 4,096-character cut
never reaches it. The record is written when the new lane-id input and a
credential that maps to a kind are both present; otherwise the legacy
tokens stand alone with a warning naming what is missing. A new handoff
input marks a key leg that handed off, written as a notice.

docs/lane-outcome.md documents the contract (format, fields, outcome
mapping, limit classes, emitter rule, compatibility rules) and
schemas/lane-outcome.v1.schema.json is its JSON Schema 2020-12. Intake
triage passes lane-id at both report calls. The legacy key=value tokens
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The legacy tokens and the lane-outcome record now serialize one facts
object, each gate applied once, and the step's two closures are one.
A test holds the schema to the emitter's patterns, closed sets and
limits, and turns are bounded to the six digits the schema allows.
The contract's key-leg example is now what v1 emits, the tests read
the examples from docs/lane-outcome.md, and the doc points to the
schema for patterns and limits. Only a half-wired caller (exactly one
of lane-id and credential set) gets the missing-record warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A caller that passes only a credential is not wired for the record yet and stays silent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legacy tokens are built as on main in every branch, the turn cap applies to the record only, handoff changes the level only with a record, and the record follows the first sentence in the incomplete and validation-skip messages. A pin test holds the no-lane-id output to main's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the code has them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Eight 100-character ids keep the sentence before the record short, so
the runner's 4,096-character cut never reaches the record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review lanes take credential-name (default CLAUDE_CODE_OAUTH_TOKEN)
and fallback-credential-name, pass the slot that ran and a lane-id to
report-lane-outcome, and write the first attempt's usage-limit record as
a handoff notice when the fallback runs. Intake's key leg now reports on
a handoff with the launcher's handoff flag, and the status line names
the credential of the leg it reports, in legacy tokens only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The credential token sits before the semicolon, and the line is
byte-identical to main's without one. The README inputs table gains
credential-name and fallback-credential-name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…writes two records

- A caller with lane-id gets a notice on handoff "true" even when no
  record can be written; with no lane-id the level is unchanged.
- MAX_MODELS is exported and the RECORD_MAX_MODELS alias is gone.
- The intake status step's secret-name regex is held equal to
  CREDENTIAL_PATTERN by a test, and its suffix has its own variable.
- README, workflow comments and the handoff input say whichever attempt
  hands off writes its own handoff record; credential-name says when its
  default is right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A job running anthropics/claude-code-action or run-claude-cli must carry a
report-lane-outcome step that sets credential and lane-id.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A job running anthropics/claude-code-action or run-claude-cli must carry a
report-lane-outcome step that sets credential and lane-id.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e-cli without a report

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tter-check

# Conflicts:
#	.github/scripts/claude-review-outcome-wiring.test.cjs
#	.github/scripts/intake-triage-legs.test.cjs
#	docs/lane-outcome.md
@kyle-sexton
kyle-sexton enabled auto-merge October 22, 2026 13:49
@claude

claude Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 4m 46s —— View job


Code review: lane-outcome emitter check

  • Gather context (diff, PR context file, rule files, REVIEW.md)
  • Read changed files
  • Check path-scoped rules (.claude/rules/pr-body-contract.md, etc.)
  • Review correctness, test coverage, maintainability
  • Adversarial validation of candidates
  • Post findings

No findings. This PR adds .github/scripts/lane-outcome-emitters.test.cjs and its fixtures with no production code changes, so the review surface is the test logic itself.

What I checked:

  • Traced RUNS_CLAUDE/REPORTS_OUTCOME and laneJobs/reportGaps/findMissingEmitters in lane-outcome-emitters.test.cjs against every uses: line in the three real lane workflows (intake-triage.yml, pr-review.yml, pr-review-security.yml) by hand — the hardcoded intake-triage.yml:claude, intake-triage.yml:subscription, pr-review-security.yml:claude, pr-review.yml:claude canary list matches the actual job keys and uses: steps on disk, including the two-attempt (primary/fallback) shape in pr-review-security.yml's single claude job.
  • Confirmed .github/workflows/pr-require-checks.yml's mention of run-claude-cli (a step name/run: command, not a uses:) is correctly excluded by the regex, so the canary list isn't missing a lane.
  • Compared the credential/lane-id requirement against docs/lane-outcome.md's "Emitter rule" (report-lane-outcome only writes the record when both lane-id and credential match their patterns) — the test's requirement that every report step set both, plus validating a literal lane-id against the imported LANE_ID_PATTERN, matches that contract. The asymmetry (no literal-pattern check for credential) is consistent with current usage: every real credential: value is an expression, never a literal, so there's no live gap today.
  • Walked each of the 8 fixtures against findMissingEmitters' logic (empty/missing credential, empty/missing lane-id, a second report step dropping lane-id, an invalid literal lane-id, run-claude-cli with no report, and the two passing shapes including a reusable-workflow-call job with no steps: that's correctly excluded) — each fixture's expected output matches the implementation.
  • Spot-checked that workflow-yaml.cjs (unchanged, already covered by its own workflow-yaml.test.cjs and reused by ~10 other test files scanning the same workflow directory) strips the trailing # v1.0.253-style comment from uses: values, so the regex match on the real pinned anthropics/claude-code-action@<sha> lines isn't accidentally broken by the comment.

Caveat: I could not execute node --test in this sandbox (the tool-approval step for running node was unavailable), so the 579/0 and mutant-kill numbers in the PR description are author-claimed and unverified by me — my review is a static trace against the real workflow files and docs/lane-outcome.md, not a test run.

claude-lane-summary: lane=claude-review sha=d7fee9e4b037303c9651997410f305c0f58a9d88 run=39790337413

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T13:50:53.031209Z d7fee9e 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.

@claude

claude Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 17s —— View job


Security review

  • Gather context (PR diff, changed files)
  • Review test/fixture files for security-relevant surface
  • Check manifest/plugin changes (none present)
  • Verify findings adversarially
  • Post final results

No security issues found.

This PR adds only a test file (.github/scripts/lane-outcome-emitters.test.cjs) and eight static YAML fixtures under .github/scripts/fixtures/lane-outcome-emitters/. No .github/workflows/*.yml, .github/actions/*, or plugin-manifest files are touched, and none of the fixtures are themselves live workflows (GitHub Actions only discovers files directly under .github/workflows/, not .github/scripts/fixtures/...), so there is no new execution, trust-boundary, or secret-handling surface. workflow-yaml.cjs and report-lane-outcome/classify.cjs, which the new test imports, are pre-existing and unmodified by this diff.

No CLAUDE.md/AGENTS.md/rules-file changes, and no .claude-plugin/plugin.json or marketplace.json changes, so the instruction-surface-deletion and plugin-manifest checks don't apply here — no manifest <field>: lines to report.

claude-lane-summary: lane=claude-security-review sha=d7fee9e4b037303c9651997410f305c0f58a9d88 run=39790337413

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 22, 2026
@github-actions

Copy link
Copy Markdown

claude-security-review has reviewed this pull request through d7fee9e; a later push is reviewed from there.

Merged via the queue into main with commit 164c280 Oct 22, 2026
30 checks passed
@kyle-sexton
kyle-sexton deleted the feat/lane-outcome-emitter-check branch October 22, 2026 13:53
@github-actions

Copy link
Copy Markdown

claude-review has reviewed this pull request through d7fee9e; a later push is reviewed from there.

kyle-sexton added a commit to melodic-software/standards that referenced this pull request Oct 22, 2026
…contracts (#843)

Refs: melodic-software/claude-code-account-rotation#288

## Summary

Registers the ci-workflows v0.61.0 tag
(`164c2809f6150429b6f24d4a2777bb377af953d9`) contracts for
`intake-triage.yml`, `pr-review.yml` and `pr-review-security.yml`, in
the same shape as #842 did for v0.60.0.

## Fix

- `components/runner-policy/policy.json`: three entries keyed
`@164c2809…`, verbatim copies of the `@82ca5ca…` (v0.60.0) entries, each
placed right after its v0.60.0 entry.
- `components/runner-policy/README.md`: a v0.61.0 sign-off paragraph
after the v0.60.0 one.
- `components/runner-policy/runner-policy.test.mjs`:
`REPINE_LANE_SHA_V0_61_0` and a test that the three v0.61.0 contracts
equal their v0.60.0 entries and that exactly three v0.61.0 contracts
exist.

v0.61.0 is v0.60.0 plus melodic-software/ci-workflows#856 and
melodic-software/ci-workflows#857 (`git log 82ca5ca..164c280`). In `git
diff 82ca5ca 164c280`:

- `intake-triage.yml`: no change to `workflow_call` inputs, secrets, job
permissions or `runs-on`; only steps, job outputs and the status job
change.
- `pr-review.yml` and `pr-review-security.yml`: each adds two optional
inputs, `credential-name` (default `CLAUDE_CODE_OAUTH_TOKEN`) and
`fallback-credential-name` (default empty). Callers do not pass them, so
`allowedInputs` stays as at v0.60.0. Secrets, permissions and routing
are unchanged.

## Verification

- `npm run test:runner-policy`: 328 tests, 328 pass, 0 fail, including
the new v0.61.0 test.
- Adding `credential-name` to the new `pr-review` entry made the new
test fail (1 fail); the file was then restored.
- `npm run lint:runner-policy`: `Runner policy passed.`
- biome (`components/biome/biome.json`) on `components/runner-policy`,
markdownlint, typos, editorconfig-checker and gitleaks: clean (lefthook
pre-commit also passed).

## Related

- #842 (v0.60.0 registration this copies)
- melodic-software/ci-workflows#856
- melodic-software/ci-workflows#857
- melodic-software/claude-code-account-rotation#288

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
kyle-sexton added a commit to melodic-software/claude-code-account-rotation that referenced this pull request Oct 22, 2026
… run (#309)

Refs: #288

## Summary

Adds the first real lane-outcome annotation to `LaneOutcomeTests`. It is
from claude-code-plugins check run
[119996073843](https://github.com/melodic-software/claude-code-plugins/actions/runs/39827904468/job/119996073843),
the review lane on
[claude-code-plugins#9074](melodic-software/claude-code-plugins#9074),
which runs ci-workflows
[v0.61.0](https://github.com/melodic-software/ci-workflows/releases/tag/v0.61.0).
The message was read back through `GET
/repos/{owner}/{repo}/check-runs/{id}/annotations` and pasted verbatim.

## Fix

- `LaneOutcomeTests.ARealReviewLaneAnnotationIsReadFromItsJsonRecord`.
The real message's legacy tokens and its JSON record carry the same
class and credential. The test rewrites the legacy `class=` token, then
asserts that the parser still returns the record's `skipped-validation`.
This proves the JSON path read it.

What the real annotation settles (release 2.4.0 plan, Phase 8 open
questions):

- A record written by `report-lane-outcome` reaches the check-run
annotations API intact, with the marker mid-line and free text after the
JSON.
- This message has no newline between the sentence and the marker, and
the parser reads it.

## Verification

- `dotnet test --project tests/ClaudeCodeAccountRotation.Core.Tests -c
Release --filter-class "*LaneOutcomeTests"`: 34 succeeded, 0 failed.
- `dotnet format --verify-no-changes` on the file: clean.
`eng/check-no-machine-paths.sh`: clean.

## Related

-
[ci-workflows#856](melodic-software/ci-workflows#856),
[#857](melodic-software/ci-workflows#857),
[claude-code-plugins#9074](melodic-software/claude-code-plugins#9074)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant