Repository navigation
ci: let the allowlist pre-approve an action no workflow uses yet, bounded by a release (#1206) - #1291
Conversation
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: CHANGES at 861638f
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
test/actionPins.test.ts:495assertsapprovedUnusedExpiryProblems(readAllowlistFile().approved_unused, treeVersion)is[]for the shipped empty list, butscripts/lib/action-pins.mjs:144-146returns the not-a-minor-release problem for a tree version that is notx.y.0before it looks at any entry: withapproved_unused: []there is nothing to bound and the problem fires anyway.- Releases bump the patch on every day but the week's first (
docs/decisions/0008-release-cadence.md:16-18; measuredpackage.jsonat v0.4.1 =0.4.1, at v0.4.5 =0.4.5), andtest (24)runsnpm testunconditionally (.github/workflows/ci.yml:159-164,:185) overtsx --test test/*.test.ts(package.json:17), so the first release after0.5.0goes red with no exemption in the file at all. - Measured at this tip:
package.json0.5.1plus the shippedapproved_unused: []→ 27/28,not okonly on that assertion; shipped0.5.0→ 28/28. Fix: return[]whenentries.length === 0(or bound an empty list to the tree's minor instead of failing its shape). - Not dirty:
mergeable=true, andmainmovede5c9e118→c65fc583only insrc/app.ts,src/api/openapi.ts,test/openapi.test.ts,docs/api.md,docs/architecture.md,changelog.d/1243.added.md, none of these 7 files — no rebase ground. - No UI face: allowlist data, one checker plus its declaration, a docs paragraph, a changelog entry and a test.
Ran:
npx tsx --test test/actionPins.test.tsat861638fa→ 28/28 passnpx tsx --test test/actionPins.test.tsat286a680d→ 0 pass, 1 fail (SyntaxError, noapprovedUnusedExpiryProblemsexport), so the red is realnode --input-type=module -e "..."→approvedUnusedExpiryProblems([], "0.5.1")returns the not-a-minor-release problem,([], "0.5.0")returns[]npx tsx --test test/actionPins.test.tsin a copy of this tree withpackage.json0.5.1and the shipped allowlist → 27/28,not okon the empty-list assertionnode scripts/action-pins.mjs --workflows .github/workflows→action-pins: ok (92 pinned references across 12 workflow files, all on the 10-action allowlist; 5 actions: write job(s) gated on the actor)curlcheck-runs?filter=latestat861638fa→ci-oksuccess,pr-lintsuccess,review-gatefailure (pre-verdict), 0 pending, 0 other failuresnode -eon the diff,docs/decisions/0027-preapproved-actions.md, ADR 0008,.github/workflows/ci.yml:537-560and:159-185
Not run: npm run check / the full npm test, npm ci, Docker, a browser, a live instance, any probe edit to the pushed tree; no network call in the suite.
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES at 861638f
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
test/actionPins.test.ts:495assertsapprovedUnusedExpiryProblems(readAllowlistFile().approved_unused, treeVersion)is[]for the shipped empty list, butscripts/lib/action-pins.mjs:144-146returns the not-a-minor-release problem for a tree version that is notx.y.0before it looks at any entry: withapproved_unused: []there is nothing to bound and the problem fires anyway.- Releases bump the patch on every day but the week's first (
docs/decisions/0008-release-cadence.md:16-18; measuredpackage.jsonat v0.4.1 =0.4.1, at v0.4.5 =0.4.5), andtest (24)runsnpm testunconditionally (.github/workflows/ci.yml:159-164,:185) overtsx --test test/*.test.ts(package.json:17), so the first release after0.5.0goes red with no exemption in the file at all. - Measured at this tip:
package.json0.5.1plus the shippedapproved_unused: []→ 27/28,not okonly on that assertion; shipped0.5.0→ 28/28. Fix: return[]whenentries.length === 0(or bound an empty list to the tree's minor instead of failing its shape). - Not dirty:
mergeable=true, andmainmovede5c9e118→c65fc583only insrc/app.ts,src/api/openapi.ts,test/openapi.test.ts,docs/api.md,docs/architecture.md,changelog.d/1243.added.md, none of these 7 files — no rebase ground. - No UI face: allowlist data, one checker plus its declaration, a docs paragraph, a changelog entry and a test.
Format fix: the gate parser (scripts/lib/review-gate.mjs:40) reads PASS|INC|REQUEST_CHANGES only, so this first line says REQUEST_CHANGES; the refusal, its grounds and the measurements are identical to review 6036496566.
Ran:
npx tsx --test test/actionPins.test.tsat861638fa→ 28/28 passnpx tsx --test test/actionPins.test.tsat286a680d→ 0 pass, 1 fail (SyntaxError, noapprovedUnusedExpiryProblemsexport), so the red is realnode --input-type=module -e "..."→approvedUnusedExpiryProblems([], "0.5.1")returns the not-a-minor-release problem,([], "0.5.0")returns[]npx tsx --test test/actionPins.test.tsin a copy of this tree withpackage.json0.5.1and the shipped allowlist → 27/28,not okon the empty-list assertionnode scripts/action-pins.mjs --workflows .github/workflows→action-pins: ok (92 pinned references across 12 workflow files, all on the 10-action allowlist; 5 actions: write job(s) gated on the actor)curlcheck-runs?filter=latestat861638fa→ci-oksuccess,pr-lintsuccess,review-gatefailure (pre-verdict), 0 pending, 0 other failuresnode -eon the diff,docs/decisions/0027-preapproved-actions.md, ADR 0008,.github/workflows/ci.yml:537-560and:159-185
Not run: npm run check / the full npm test, npm ci, Docker, a browser, a live instance, any probe edit to the pushed tree; no network call in the suite.
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES at ff60edd
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
test/actionPins.test.ts:501 asserts the shipped approved_unused list is exactly [], so #1206's own acceptance ("with a one-name exemption whose action no workflow uses") fails: with actions/cache allowed and approved_unused: [{name:'actions/cache',issue:1206,expires_at:'0.7.0'}], node --test test/actionPins.test.ts is 27/28, not ok 26, actual [{expires_at:'0.7.0',issue:1206,name:'actions/cache'}]. Assert that shipped entries are bounded by the tree version, not that the list is empty.
scripts/lib/action-pins.mjs:149-152 (pinned by test/actionPins.test.ts:511-515) returns not-a-minor-release for any non-empty list whenever the tree version is not x.y.0, so a valid in-bounds entry dies on every non-Monday release (docs/decisions/0008-release-cadence.md:16-18); that contradicts #1206/ADR 0027, which fails only at or past expires_at. Fix: accept x.y.z tree versions and bound against major.minor (0.5.1 → 0.5.0); at/past expires_at and beyond two minors stay red.
The original defect is fixed and I verified it myself: empty approved_unused is 28/28 at 0.5.0 and at 0.5.1, and genuinely misbounded entries still fail — so only the two items above block.
No UI face: allowlist data, checker, declaration, docs and tests only.
Ran:
curlhead,check-runs?filter=latest, reviews and diff atff60edde— 32 check runs, all green includingci-ok,pr-lint,test (24),coverage;review-gatefailure is only the missing verdictnode --test test/actionPins.test.tswithpackage.jsonat 0.5.0 — 28/28; at 0.5.1 — 28/28node --test test/actionPins.test.tswith one unusedactions/cacheexemption — 27/28 at both 0.5.0 and 0.5.1node --input-type=moduleprobes ofapprovedUnusedExpiryProblems— valid0.6.0entry on0.5.1rejected not-a-minor, while expired0.5.0on0.5.1,0.9.0beyond two minors and0.6.0on0.5.0behave as specifiednode scripts/action-pins.mjs --workflows .github/workflows— ok, 92 pinned references across 12 files; red-first commit286a680dstill 0 pass / 1 fail (SyntaxError: no export namedapprovedUnusedExpiryProblems)curlcomparee5c9e118...4e5ed78f— main moved 2 commits over 7 files, zero overlap with this PR's 7 files, andmergeable:true, so no rebase ground
Not run:npm run checkin full and the Playwrightvisualjob; no rebase and no branch push.
`approvedUnusedExpiryProblems` returned the not-a-minor-release problem for any tree whose version is not `x.y.0` before it looked at a single entry, so the shipped `approved_unused: []` would red the first patch release: ADR 0008 bumps the patch on every day but the week's first, and `test (24)` runs the suite unconditionally. An empty list now returns no problems at any version; a non-empty entry on a patch tree is still refused, so the empty case is not a loophole for an unbounded entry. The test asserts both halves: the shipped empty list is green on `0.5.0` and `0.5.1`, and a real entry on `0.5.1` still produces the problem naming the version. docs/security.md says which rule was chosen. Verified at this tip: `npx tsx --test test/actionPins.test.ts` 28/28; the same file on a copy of the tree with `package.json` at `0.5.1` 28/28; `npm run check` exit 0 with 3407 tests passing.
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at 254da4e
Written-by: HugoXK-bot
Author: Fledge Platform Verdict
test/actionPins.test.ts:501's assert.deepEqual(shipped, []) is gone: :510-516 now asserts the shipped entries are bounded by the tree version read from package.json at :511, with the empty list pinned separately by synthetic [] at :518-519 on 0.5.1 and 0.5.0.
#1206's own acceptance is reachable: with actions/cache allowed and approved_unused: [{name:'actions/cache',issue:1206,expires_at:'0.7.0'}] deliberately unused, the suite is 28/28 on both 0.5.1 and 0.5.0 (it was 27/28, not ok 26 before this commit).
scripts/lib/action-pins.mjs:160-162 returns [] before reading the tree when the list is empty, and treeMinor at :143-147 reads any released x.y.z and bounds it to its minor (0.5.1→0.5.0); RELEASE_VERSION at :36 keeps expires_at on x.y.0.
The non-empty checks are not weakened: expired 0.5.0 on 0.5.1 and 0.6.0 on 0.6.1, 0.8.0/0.9.0 beyond two minors on 0.5.1, expires_at 0.6.1 and a non-version tree all still fail with their named messages.
No UI face: allowlist data, checker, d.mts, docs, changelog and tests only.
Ran:
curlhead,check-runs?filter=latest, reviews and comparee5c9e118...254da4ee— 4 commits, 7 files+284/−12; 32 check runs, all success exceptreview-gate(the missing verdict);mergeable:true,mergeable_state:blocked; no prior review at this shanode --test test/actionPins.test.tswithpackage.jsonat 0.5.0 — 28/28 pass, 0 failnode --test test/actionPins.test.tswithpackage.jsonat 0.5.1 — 28/28 pass, 0 failnode --test test/actionPins.test.tsat 0.5.1 with one unusedactions/cacheexemption — 28/28 pass, 0 failnode --input-type=moduleprobes ofapprovedUnusedExpiryProblems—0.6.0on0.5.1and0.7.0on0.5.2return[]; expired,0.8.0/0.9.0,expires_at 0.6.1and treelatestare all rejectednode scripts/action-pins.mjs --workflows .github/workflows— ok, 92 pinned references across 12 files, 10-action allowlistcurlcomparee5c9e118...4e5ed78f(currentmain) — 2 commits over 7 unrelated files, zero overlap with this diff, so no rebase ground
Not run:npm run checkin full and the Playwrightvisualjob (both skipped in CI at this sha); no rebase, no push, no merge.
The seat refused `ff60edde` on two points, both release-timing. First, `test/actionPins.test.ts` asserted the shipped `approved_unused` list is exactly `[]`, which reds this card's own acceptance case: a one-name exemption whose action no workflow uses. The test now asserts that the shipped entries are bounded by the tree's version, not that the list is empty, and pins the empty list with a synthetic `[]` on `0.5.0` and on `0.5.1`. Second, `approvedUnusedExpiryProblems` refused any non-empty list on a tree whose version is not `x.y.0`, so a valid in-bounds entry died on every non-Monday release (ADR 0008). A checkout is now read as any released `x.y.z` and bounded as its minor — `0.5.1` as `0.5.0` — while `expires_at` stays a `x.y.0` promise and a tree at or past it, or more than two minors beyond it, still fails. Verified at this tip: `npx tsx --test test/actionPins.test.ts` 28/28; a one-name in-bounds exemption on a `0.5.0` and on a `0.5.1` tree 28/28 each; the same entry lapsed at `expires_at 0.5.0` on `0.5.1` and at `0.8.0` (beyond two minors) on `0.5.1` each 27/28 with the bound named; `npm run check` exit 0, 3407 tests.
Written-by: Fledge Platform Dev-1
Fixes #1206
The procedure in
docs/security.mdcould not be executed. An action had to be on the reviewed list before any workflow used it, and a list entry no workflow used was a test failure, so an entry could neither land alone nor beside its first use. ADR 0027 (docs/decisions/0027-preapproved-actions.md, statusProposed) records the mechanism, and this PR carries its terms line for line.What the diff does, in seven files:
.github/agent/action-allowlist.jsongainsapproved_unused, empty in this PR.allowed_actionsis untouched.scripts/lib/action-pins.mjsgains the reader. One entry is exactlyname,issueandexpires_at;nameis an exactowner/repoand must already be inallowed_actions; duplicates fail; a missing key is an empty one; a non-array, a bare string, a null element, a missing field, an extra field, a non-integerissueand a non-x.y.0expires_atall fail.readAllowlistkeeps its signature and its meaning.approvedUnusedExpiryProblemsstates the bound as failures: a tree whosepackage.jsonversion is at or past an entry'sexpires_atfails (equality deliberately, because that is the release pull request where a person decides), an expiry more than two minors ahead fails, and each message names the entry, its issue and its expiry plus the two legal moves — delete it, or renew it with a comment on the issue.test/actionPins.test.tsgains the three assertions the card names plus the expiry assertion, and the both-directions test keeps its original message for the non-exempted case.scripts/action-pins.mjsreports how many pre-approved entries the file carries, so an exemption never reads as an ordinary entry.scripts/lib/action-pins.d.mtsdeclares the new exports, so the TypeScript suite still typechecks.docs/security.mdparagraph in the procedure andchangelog.d/1206.changed.md.Not in this PR, by the card's non-goals:
actions/cacheitself, any workflow change, any change to the refusal for an unlisted action, and any enforcement that pretends to come from the base branch. Card two moves the check into the base checker.The red, as pushed at open. This PR opened on its first commit (
286a680d73166993be1a989a72c542b35504ec70), which is the test alone:npx tsx --test test/actionPins.test.tsat that tip →not ok 1 - test/actionPins.test.ts,SyntaxError: The requested module '../scripts/lib/action-pins.mjs' does not provide an export named 'approvedUnusedExpiryProblems'.npx tsx --test test/actionPins.test.tsat the basee5c9e118477dffe799eb23dc8cf739c669b18151with"actions/cache"added toallowed_actions→not ok 24 - the allowlist and the workflow tree name exactly the same repositories,the list names an action no workflow uses. That is the deadlock this card exists to remove, reproduced at the base.Ran at the intermediate tip
861638fab9faad229ddf10f218b2fe9048d20549(still the tip of commits one and two):npm ci→ 88 packages, clean installnpm run check→lint: 11 warning(s) in 8 entries match the baseline, typecheck pass,npm test3407 tests / 3407 pass / 0 fail,npm run buildpass, exit 0npx tsx --test test/actionPins.test.ts→ 28 tests, 28 pass, 0 fail{ "name": "actions/cache", "issue": 1206, "expires_at": "0.6.0" }added besideactions/cacheinallowed_actions, the same file passes 28/28 — an exemption whose action no workflow uses is expressibleuses: actions/cache@<sha> # v4.2.0line to a workflow while that entry stands →not ok 24,an exemption outlived its purpose: a workflow uses the action, so the entry must be deleted in the change that adds the usenode scripts/pr-lint.mjs --pr 1291→pr-lint: ok (#1291, T3, 7 files)node scripts/risk-gate.mjs --base origin/main→risk-tier: T3; basis: .github/agent/action-allowlist.jsonThe two probe edits above were reverted; the pushed tree carries
approved_unused: []and no workflow change.The seat's refusal, and the third commit. Verdict
6036542460(REQUEST_CHANGESat861638fa) found a real defect, and it is a release-timing one rather than a matter of style.approvedUnusedExpiryProblemsreturned the not-a-minor-release problem for any tree version that is notx.y.0before it looked at an entry, so the shippedapproved_unused: []was fine on0.5.0and red on0.5.1. Releases bump the patch on every day but the week's first (ADR 0008:package.jsonread0.4.1at v0.4.1 and0.4.5at v0.4.5), andtest (24)runsnpm testunconditionally, so the first patch release after0.5.0would have gone red with no exemption in the file at all.Of the two repairs the verdict allowed I took the first:
approvedUnusedExpiryProblemsnow returns[]whenentries.length === 0, before it looks at the version at all. An empty list has nothing to bound, so there is no bound to check — bounding it to the tree's own minor instead would invent a version check over an empty array and turn a patch release into a decision about nothing. The rule it leaves behind is narrow on purpose: the exemption skip is conditional onentries.length === 0, so a real entry on a patch tree still produces the not-a-minor-release problem and the empty list is not a loophole for an unbounded entry.test/actionPins.test.tsnow asserts both halves: the shipped empty list is green on the tree's own version, on0.5.0and on0.5.1, and a genuineexpires_at: 0.6.0entry on a0.5.1tree still fails with the problem naming0.5.1. The non-empty assertions were not weakened.docs/security.mdsays which of the two rules was chosen.The red for this commit, captured before the fix on the same tree:
npx tsx --test test/actionPins.test.tswith the new assertions and no code change → 27/28,not ok 26 - an exemption lapses at its release version and cannot outrun two minors,an empty approved_unused must stay green on a 0.5.1 treeRan at the intermediate tip
ff60edde7cb245dbb36c13c0597f8849617b9de1(commits one to three):npm run check→ exit 0:lint: 11 warning(s) in 8 entries match the baseline, typecheck pass,npm test3407 tests / 3407 pass / 0 fail,npm run buildpassnpx tsx --test test/actionPins.test.ts→ 28 tests, 28 pass, 0 failpackage.jsonat0.5.1and the shippedapproved_unused: []→ 28/28, which is the release the verdict said would rednode scripts/pr-lint.mjs --pr 1291→pr-lint: ok (#1291, T3, 7 files)node scripts/risk-gate.mjs --base e5c9e118477dffe799eb23dc8cf739c669b18151→risk-tier: T3; basis: .github/agent/action-allowlist.jsonNo rebase: the seat measured
mergeable=trueandmainmoved only insrc/app.ts,src/api/openapi.ts,test/openapi.test.ts,docs/api.md,docs/architecture.mdandchangelog.d/1243.added.md, none of them a file this PR touches.286a680dis untouched, so the red evidence at open still reads as it did.The seat's second refusal, and the fourth commit. Verdict
6037035100(REQUEST_CHANGESatff60edde) blocked two things and confirmed the earlier fix itself: "the original defect is fixed", emptyapproved_unused28/28 at0.5.0and at0.5.1. Both blocks were release-timing.test/actionPins.test.tsasserted the shipped list is exactly[], so the card's own acceptance case redded: withactions/cacheallowed and{name:'actions/cache',issue:1206,expires_at:'0.7.0'}inapproved_unusedthe file was 27/28. That assertion is gone. The test now asserts what the card asks for — the shipped entries are bounded by this tree's version, never that the list is empty — and pins the empty-list rule separately with a synthetic[]on0.5.0and on0.5.1, so neither state is bought by breaking the other.approvedUnusedExpiryProblemsrefused any non-empty list whenever the tree version was notx.y.0, so a valid in-bounds entry died on every non-Monday release (docs/decisions/0008-release-cadence.md). A checkout is now read as any releasedx.y.zand bounded as the minor it belongs to —0.5.1as0.5.0— whileexpires_atstays anx.y.0promise, because that is what a person writes. At or past that minor, and more than two minors beyond it, still fail; a version that is not a version still cannot bound anything.The red for this commit, captured before the fix on the same tree:
npx tsx --test test/actionPins.test.ts→ 27/28,not ok 26, actual.github/agent/action-allowlist.json: "0.5.1" is not a minor release version (x.y.0), so no exemption can be bounded against it, expected[]0.5.0and0.5.1Ran at the tip
254da4eededca18d0a85b6f66d485a6572101512:npm run check→ exit 0:lint: 11 warning(s) in 8 entries match the baseline, typecheck pass,npm test3407 tests / 3407 pass / 0 fail,npm run buildpassnpx tsx --test test/actionPins.test.ts→ 28 tests, 28 pass, 0 failactions/cacheadded toallowed_actions, entryexpires_at: 0.7.0) → 28/28 on a0.5.0tree and 28/28 on a0.5.1treeexpires_at: 0.5.0on the0.5.1tree → 27/28,actions/cache was pre-approved on #1206 and expires at 0.5.0; this tree is 0.5.1. Delete the entry, or renew it…0.8.0on the0.5.1tree → 27/28,more than two minors beyond this tree's 0.5.1approved_unused: []and no workflow changenode scripts/pr-lint.mjs --pr 1291→pr-lint: ok (#1291, T3, 7 files)node scripts/risk-gate.mjs --base e5c9e118477dffe799eb23dc8cf739c669b18151→risk-tier: T3; basis: .github/agent/action-allowlist.jsonNot run: Docker, a browser, any live instance, any live repository setting. No network call in the suite.
Risk and rollback. T3 (
.github/agent/**plusscripts/), so it needs a PASS at this tip. It weakens nothing for an unlisted action: the admission path still readsallowed_actionsonly, so a workflow using a name that sits solely inapproved_unusedis refused exactly as today. Rollback isgit revertof the four commits; the key is additive, and an emptyapproved_unusedchanges no judgement.Docs-not-needed is not claimed:
docs/security.mdis edited here because its procedure was the defect.