Repository navigation
feat(release): refuse to publish until GitHub enforces the release protections - #3388
Conversation
Size Report
Startup median (7 runs, lower is better):
|
506da75 to
8e2a549
Compare
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
The release gate in 8e2a549 does what the PR describes, but one Cubic thread still holds: guardsReleaseTags can accept a tag ruleset that does not cover every v* tag. Left as is, a ruleset with an exclude pattern or a broad bypass list would pass the check, and the gate would not protect tags the way the release depends on. The fix is one rule: a ruleset counts only if every ref matching refs/tags/v* is covered, so no exclude pattern overlaps it and bypass_actors is empty or admin-level only (return a gap when bypass_actors is missing from the response). Please also catch only 404s in readRepositorySetup, and add one test per weakening field. Open review threads: the exclude handling and the all-gaps test still apply, as does one lower-priority thread. The thread on token permissions for the rulesets read does not apply, because the rulesets list needs only metadata read, and the Plan job already grants actions:read for the environment reads. The thread on the per-id ruleset fetch does not apply either, because the list endpoint returns summaries without rules or conditions, so that second fetch is required. Please resolve both. Not blocking, and fine to take or leave: the refusal message points to a CONTRIBUTING.md "One-time repository setup" section that lands in #3381, so merge that first or together with this PR; and no test reaches readRepositorySetup or the mode gate in main(), so narrowing the check to nightly would keep the suite green, which an injectable fetch plus one stable-mode refusal test would catch. The eight non-passing checks were all cancelled by newer runs, with no failed step. Lint & Format, Typecheck and Coverage run the changed test file, so please let a rerun finish. I did not run the tests or call the live GitHub API. I could not confirm that the Plan job's token sees every ruleset field, but a hidden field blocks the release and does not let it through. The first nightly after the one-time setup will show the pass path. There are no conflicts. |
212c05f to
63dca49
Compare
…otections npm trusts every release.yml run that reaches the npm-publish environment, and a run's own copy of the plan proves nothing. Before a nightly or stable publish, the plan reads the repository's settings and refuses unless npm-publish deploys only from main and v* tags, the release environment requires a reviewer, and an active tag ruleset restricts creating, updating, and deleting v* tags.
…on API errors A tag ruleset counts only with no exclusions and, where GitHub shows its bypass list, only admin bypass. A missing environment is a setup gap only on a 404; any other API failure now fails the plan instead of reading as a gap.
63dca49 to
ae04bdd
Compare
|
Fixed in
I did not treat a missing The per-ruleset fetch and token-permission threads are answered and resolved as not applicable. Not taken: an injectable fetch to test |
|
The PR is ready at ae04bdd. The earlier findings from 8e2a549 are fixed, and I found no new problem in the changes since then. Not blocking, and you can take or leave these: the Plan job runs with the read-only On the other threads, the cubic-dev-ai threads on the ref_name.exclude check and the custom_branch_policies test are fixed at this head, and the one on 404-only handling is fixed too, so you can resolve all three. The thread on unauthenticated ruleset reads does not apply, because a 403 would throw uncaught and fail closed without publishing. The thread on the per-id ruleset fetch does not apply either, because the list endpoint returns summaries without rules, so the extra read-only calls are needed. You can resolve both. CI is likely unrelated to this change. Smoke Tests and Bundle Size never load |
Summary
npm trusts every
release.ymlrun that reaches thenpm-publishenvironment, and the plan a run executes is that run's own copy, so it can't protect anything by itself. Before a nightly or stable publish, the plan now reads the repository's settings through the public API. It refuses, and names each gap, unless all of these hold. Only a 404 counts as "not configured"; any other API error fails the plan.npm-publishdeploys only from the branchmainand the tag patternv*releaseenvironment requires a reviewerrefs/tags/v*tag, with no exclusions and, where GitHub shows its bypass list, only admin bypassThis makes merging the stack before the one-time setup safe: the release workflow fails until the setup is done. #3381 documents the setup. 2 files.
Validation
At
ae04bddfd3:release-plan.test.tspasses 29/29 (with the stacked tests). Each protection gap is named on its own.