Skip to content

feat(resolve-config): let lane-rules.json add actions read to one activity - #9409

Merged
kyle-sexton merged 3 commits into
mainfrom
feat/pr-merge-actions-read-grant
Oct 23, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
feat/pr-merge-actions-read-grant

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

No related issue: owner decision Q8 (owner, 2026-10-23): the lanes App token may carry actions: read for pr-merge's reads only.

Summary

pr-merge reads verdict artifacts, run listings and run records with GITHUB_TOKEN. When that token's limit runs out, those reads need a fallback. The owner allowed the lanes App token to carry actions: read, read-only, for pr-merge alone. This PR adds the mechanism and grants nothing yet: no lane-rules.json row sets the new field.

Fix

  • resolve.mjs: a lane-rules.json row may set activity-grants, mapping activity names to exactly { "actions": "read" }.
    • resolve and resolveGrant add that to the activity's effect row.
    • Any other value is rejected as lane-grant.
    • A name the config's lane does not hold adds nothing, because the row serves every config that runs the lane (the README example's pr-merge holds merge).
  • resolve-config: new actions output (read, or empty).
  • request-lane-token: new optional actions input, read or empty. It joins the broker comparison only when it is set, so a broker that grants actions to a job that resolved none fails red as effect-mismatch. Check mode refuses it.
  • pr-merge.yml: passes actions to the token request.

Broker pin: melodic-software/azure-iac#83

Verification

  • Tests written first, and each new test failed before the change:
    • resolve.test.mjs: three new tests.
    • request-lane-token.test.mjs: four new tests.
    • merge-job.test.mjs: one new wiring test.
  • npm test in .github/actions/resolve-config: 661 pass, 0 fail.
  • request-lane-token, check-trusted-trigger and pr-merge script tests pass.
  • actionlint is clean on pr-merge.yml.

Related

Deploy order:

  1. Merge this PR. It is inert.
  2. Merge azure-iac#83 and deploy it.
  3. Merge the data PR.

Merging the data before the broker deploys fails every pr-merge mint with effect-mismatch.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits October 23, 2026 09:38
…ivity

Owner decision Q8: the lanes App token may carry actions read for
pr-merge's reads only. A lane-rules.json row may now name leaves of its
lane under activity-grants, each mapped to exactly {"actions": "read"};
resolve and resolveGrant add it to the effect row, and anything else is
rejected as lane-grant. resolve-config outputs actions, request-lane-token
compares it when set, and pr-merge.yml passes it. No row sets it yet, so
every grant stays as it was.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ane lacks

lane-rules.json serves every config that runs a lane, and the README
example's pr-merge lane holds `merge`, not `merge-pr`. A name the lane
does not hold now adds nothing instead of rejecting the config; the
value must still be exactly {"actions": "read"}.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 23, 2026 13:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T13:55:17.229227Z da83cea 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

Copy link
Copy Markdown
Contributor

claude-review reviewed da83cea7e35db4d668c0009d0ec43a25145eec0d: 0 finding(s), 0 as inline comments.

Code review of #9409 at da83cea: no findings. I read the whole diff (11 files) and the PR context. I did not run the tests; the PR's test counts are the author's claim and I did not check them.

What I checked

  • activity-grants validation (resolve.mjs). checkActivityGrants runs inside loadConfig's per-lane loop, so both resolve and resolveGrant apply it. It accepts only { "actions": "read" } per activity and rejects anything else as lane-grant.
  • Lookup safety. activityGrantOf uses Object.hasOwn, so names like constructor add nothing. The tests cover this.
  • Frozen grants. grantFor validates the base effect row before spreading the extra grant, then freezes the result. The base effect-grants.json row is not mutated; a test asserts it.
  • Output and token wiring.
    • resolve-config.mjs emits actions as "" when the grant has none.
    • request-lane-token adds actions to the broker comparison only when it is set. A broker that grants actions to a job that resolved none therefore fails red as effect-mismatch.
    • Check mode refuses the input.
    • pr-merge.yml passes it through.
    • Tests cover each of these paths.
  • Inertness. No lane-rules.json row sets activity-grants in this PR, so nothing changes at runtime until the stacked data PR (feat(pr-merge): grant merge-pr's lane token actions read #9410). The deploy order in the PR body is stated.
  • Closing issue. The PR closes none ("No related issue: owner decision Q8"), so there are no acceptance criteria to check.
  • Manifests, hold classes, embedded instructions. The diff touches no plugin manifest. It touches no trust-gate path, adds no model or API spend, and the PR context carries no embedded instructions.

Not verified

  • The broker side (azure-iac#83) is outside this repository, so I did not check that it returns actions in the shape this comparison expects.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed da83cea7e35db4d668c0009d0ec43a25145eec0d: 0 finding(s), 0 as inline comments.

I found no security issues in PR #9409 at head da83cea. I read the full diff (.claude-lane/pr.diff), the PR context, and the surrounding loadConfig code in resolve.mjs.

critical-findings: 0

What the change does. It adds an opt-in activity-grants mechanism to lane-rules.json. A row can add actions: read to named activities of its lane. No data row sets it yet, so the PR is inert until the follow-up data PR (#9410).

Why I found nothing.

  • Validation covers the broker path. checkActivityGrants runs inside loadConfig, which resolve() and resolveGrant() both call. Each activity must map to exactly { "actions": "read" }. This is checked before grantFor spreads extra over the effect row, so extra cannot override contents, issues or pull-requests, or add another scope.
  • Prototype keys are guarded. activityGrantOf uses Object.hasOwn for both the lane and activity lookups. constructor, __proto__ and similar names add nothing, and the tests cover constructor.
  • The new input can only widen what the job expects, and the broker still has to agree. request-lane-token accepts actions only as read or empty. It adds the permission to the broker comparison only when it is set. A broker answer that differs from the job's own resolution fails red as effect-mismatch, including a broker that grants actions when the job resolved none.
  • Check mode refuses the input. check mode includes ACTIONS in the "takes no grant" guard, so it cannot widen the check endpoint's body.
  • No new shell injection. inputs.actions reaches the script through an env: variable, not through ${{ }} inside the run: body. It is quoted and validated before use. The jq comparison passes it with --arg.
  • Scope is intended. The widening is read-only and per activity. It matches the owner decision recorded in the PR context.

Manifest check. The diff changes no .claude-plugin/plugin.json or marketplace.json, so no manifest <field> lines apply.

Instruction surfaces. The diff deletes or softens no standing instruction (CLAUDE.md, rules files, skill or agent bodies, hook allowlists).

Trust-gate paths. The diff does not touch .github/standards/trusted-actors/**, .github/actions/check-trusted-trigger/**, CODEOWNERS or .gitmodules, so there is no hold.

Embedded text. The PR context contains no embedded directives aimed at the review lane.

Not verified. The broker side (melodic-software/azure-iac#83) is outside this diff, so I did not review it. The PR's stated deploy order (this PR, then the broker pin, then the data PR) is an operational dependency, not a vulnerability. Merging the data PR first would fail pr-merge mints with effect-mismatch, which fails closed. I did not consult the instruction exception register, because no instruction was removed.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 7ed3d8f Oct 23, 2026
99 of 101 checks passed
@kyle-sexton
kyle-sexton deleted the feat/pr-merge-actions-read-grant branch October 23, 2026 14:17
github-merge-queue Bot pushed a commit that referenced this pull request Oct 23, 2026
No related issue: owner decision Q8 (owner, 2026-10-23): the lanes App
token may carry `actions: read` for pr-merge's reads only.

## Summary

This grants pr-merge's `merge-pr` lane token `actions: read`. The peer
session poteto builds pr-merge's read fallback off `GITHUB_TOKEN` on top
of it. The token stays read-only for Actions, and no other lane or
activity gets it.

## Fix

- `lane-rules.json`: the `pr-merge` row sets `"activity-grants": {
"merge-pr": { "actions": "read" } }`.
- `live-config.test.mjs`: pins that `merge-pr` resolves `actions: read`
and that every other live slot resolves none.
- The `pr-merge.yml` comments and
`docs/conventions/pr-pipeline/README.md` no longer say the lane token
holds no Actions permission.

Stacked on #9409 (merged) and azure-iac#83 (merged and deployed, run
39968516268).

## Verification

- The new live-config test failed before the data change and passes
after it.
- `npm test` in `.github/actions/resolve-config`: 662 pass, 0 fail. The
pr-merge script tests and request-lane-token tests pass.
- `actionlint` is clean.

## Related

- #9409: the `activity-grants` mechanism, the base of this PR.
- melodic-software/azure-iac#83: the broker check.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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