Repository navigation
feat(runner-policy): accept a list of exact caller permission maps for a migration - #950
Conversation
…r a migration
A contract's allowedCallerPermissions is one exact map or a non-empty list
of exact maps; a caller passes when its effective permissions equal any one
listed map exactly. The single-map form and its error wording are unchanged.
intake-triage.yml lists the old map {contents: read, issues: write} and the
new one with actions: read, so callers can move to the new map after the
sync instead of deadlocking on it. The README's contract revision lockstep
item 3 records the expand/contract order.
Refs: melodic-software/claude-code-plugins#13586
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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-review reviewed No findings. I read all 5 changed files and traced every consumer of
I could not run |
|
claude-security-review reviewed No security findings in this pull request. What I reviewed. All five changed files in Why nothing was flagged.
Trust controls. None of the changed files is in the listed trust-control set: the trusted-trigger check, token request, kill switch, token broker, merge holds or the other Not read. critical-findings: 0 |
Refs: melodic-software/claude-code-plugins#13586 ## Summary Contract step of the intake-triage permission expand/contract. #950 listed the old and new caller maps; melodic-software/claude-code-plugins#13660 moves the only caller to the new map (`actions: read`). This PR drops the old map, so the contract is again one exact map. Draft until melodic-software/claude-code-plugins#13660 merges: its sync would otherwise reject the caller still on main. ## Fix - `components/runner-policy/policy.json`: intake-triage's `allowedCallerPermissions` is the single map `{actions: read, contents: read, issues: write}`. ## Verification - `node --test components/runner-policy/runner-policy.test.mjs`: 232 pass, 0 fail. ## Related - #950, melodic-software/claude-code-plugins#13630, melodic-software/claude-code-plugins#13660, then melodic-software/ci-workflows#996. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
…970) Closes #968 ## Summary A secret change to a reusable workflow's runner-policy contract had a built-in deadlock window: every caller had to send exactly the contract's one secret map, so callers on either side of the component sync failed `ci-status` until both sides landed. This gives `allowedSecrets` the same expand/contract shape #950 gave `allowedCallerPermissions`. ## Fix - `policy.schema.json`: a new `secretMaps` definition, `oneOf` one exact `stringMap` or a non-empty, unique list of them. Both `runnerInputContract` and `hostedOnlyContract` reference it for `allowedSecrets`. - `runner-policy.mjs`: #950's helpers become shape-neutral (`exactMapEntries`, `exactMapsError`) and now serve both permissions and secrets. A caller's `secrets:` block passes when it equals any one listed map exactly. There is no subset or superset matching. With a single map, the error wording is the same as before. With a list, a mismatch names every listed map. Every listed map is validated the way the single map was: each value must be one whole `${{ secrets.<NAME> }}` expression, and a contract with a caller-permission waiver must map same-name or role-named. The visibility-scoped contract scan reads the union of all listed maps, so a denylisted secret that appears only in the new map is still caught. - `README.md`: "Contract revision lockstep" item 3 now describes the expand/contract order for secrets and permissions together. The lines that describe the secret map's shape now cover the list form. - No `policy.json` entry changes. ## Verification - `npm run test:runner-policy`: 241 pass, 0 fail. The baseline on `main` was 232. The nine new tests cover: - old, new and mismatched callers against both the single-map and list forms (pass, pass, fail); - superset, subset and expression drift; - an empty list rejected by the schema; - per-map expression and same-name validation; - the hosted-only list form; - a denylisted secret that appears only in a second listed map. - Mutation check: I made the status check use only the last listed map and the visibility scan read only the first map. Four of the new tests failed, and they passed again after I reverted both mutations. - The pre-commit hooks passed: biome, markdownlint, editorconfig, typos and gitleaks. ## Related - Refs #950 (the same change for `allowedCallerPermissions`) - Refs melodic-software/ci-workflows#1040 (the planned surface check; it reads `allowedSecrets` and must accept the list form) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015XWwmb8QAX8QQkewRWMWYs Co-authored-by: Claude Opus 5.5 <[email protected]>
Closes #971 ## Summary #950 (multi-map caller permissions) and #970 (multi-map secrets) let a contract list several exact maps so a change can land expand/contract. Nothing enforced the contract step. A listed map is fleet-wide, so no single repository's unused-entry check can tell that the old map has gone unused. This adds a required switchover date that the analyzer enforces. That was option 1 of the owner's decision (Q5, 2026-11-08). ## Fix - `policy.schema.json`: adds `allowedSecretsUntil` to both contract types and `allowedCallerPermissionsUntil` to runner-input contracts (`^[0-9]{4}-[0-9]{2}-[0-9]{2}$`). - `runner-policy.mjs` enforces the four rules for both fields: - At load, it fails a list of more than one map that has no date. - At load, it fails the date field on a single map or a one-entry list. - At audit, `contract-switchover-expired` fails once today (UTC) is past the date while more than one map is still listed. The finding names each contract and field, and says to remove the old map and its date field. - At audit, `contract-switchover-window` fails a date more than 90 days after today. - It also rejects a date that matches the pattern but does not exist, such as `2026-02-30`. - Each date rule emits one finding that names every affected contract, because findings are deduplicated by file, job and rule. - `auditRepository` takes an injectable `today` (`YYYY-MM-DD`) that defaults to the current UTC date. - `README.md`: item 3 of "Contract revision lockstep" now gives the date fields, their format, the 90-day cap, the failure the day after the date, and the rule that the follow-up removes the date together with the old map. The two lines that describe each field's shape point to it. - `policy.json`: no entry lists more than one map today, so none needed a date and the file is unchanged. ## Verification - `npm run test:runner-policy`: 247 pass, 0 fail. The baseline on `main` was 241. - The new tests cover each of the four rules for both fields. - They check the boundary days: a date equal to today passes and the next day fails; today plus 90 days passes and plus 91 fails. - They also cover two expired switchovers named in one finding, and invalid dates. - The test helper sets a fixed `today`, and the existing multi-map fixtures carry a date. - Mutation check: changing either boundary comparison from `>` to `>=` made the two boundary tests fail. Both comparisons are restored. - `node components/runner-policy/runner-policy.mjs --root .` reports "Runner policy passed." against the real `policy.json`. - The pre-commit hooks passed: biome, markdownlint, editorconfig, typos and gitleaks. ## Related - Refs #950 (multi-map caller permissions) - Refs #970 (multi-map secrets) - Refs melodic-software/ci-workflows#1040 (the planned surface check; it reads the synced contract and must accept the two new date fields) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015XWwmb8QAX8QQkewRWMWYs Co-authored-by: Claude Opus 5.5 <[email protected]>
Refs: melodic-software/claude-code-plugins#13586
Summary
The runner-policy contract matches a caller's permissions against
allowedCallerPermissionsexactly. standards#949 addedactions: readto the intake-triage contract, so every caller must now grant it. The claude-code-plugins caller cannot add it before the sync, because the old synced contract rejects it, and the sync PR cannot be hand-edited (check-managed-files). Under a requiredci-statusthat is a deadlock.This PR lets a contract list several exact maps, so a permission change lands expand/contract:
actions: read.Fix
runner-policy.mjs:allowedCallerPermissionsis one exact map or a non-empty list of exact maps. A caller passes when its effective permissions equal any one listed map exactly; each map is still matched exactly, so the ceiling stays exact. With more than one map, the failure names every allowed map (must be exactly one of {...}, {...}). The single-map form keeps its existing per-scope wording. The config checks (at least one write scope, satisfiesminimumCallerPermissions) run per map and name the failing index.policy.schema.json:allowedCallerPermissionsisoneOfa permission map or aminItems: 1,uniqueItemsarray of permission maps.policy.json: intake-triage lists{contents: read, issues: write}and{actions: read, contents: read, issues: write}. No other contract changes.README.md: "Contract revision lockstep" item 3 describes the expand/contract order for a caller permission change; the contract description admits the list form.Verification
npm run test:runner-policy: 232 pass, 0 fail. New cases: a caller matching the first map passes; matching the second passes; matching neither fails with a message listing both; a superset, subset or access drift of either map fails; the single-map form passes on an exact match and keeps its old messages; the schema rejects an empty list; every listed map must carry a write scope.npm run lint:runner-policy: passed.cioncomponents/runner-policy: clean. markdownlint on the README: clean.Related
🤖 Generated with Claude Code