fix(ci): validate the whole release before publishing any of it - #45
fix(ci): validate the whole release before publishing any of it#45yakimoto wants to merge 2 commits into
Conversation
publish-npm.yml could not succeed on a first tag push. `packages/adk/` sorts first, is already on npm at its local version, and npm rejects a republish — so the loop died there under `set -e` before reaching the 45 packages that have never shipped. Skipping collisions alone would have been worse than the bug: `packages/sdk` is 3 files against a published 2.0.14 of 286, and being numerically ahead at 3.0.0 it would have gone straight to the `latest` dist-tag. Three changes: - already-published versions are skipped, not fatal — a monorepo-wide tag always includes packages that did not change - a version behind the registry, or a tarball less than half the size of the one it replaces, fails validation - validation runs as a separate pass over every package before anything is published, so one bad package cannot strand the ones that sort after it Registry lookups go to registry.npmjs.org over curl rather than `npm view`, because a scoped @wave-av:registry setting outranks --registry and can answer about the wrong registry entirely — the same trap that mis-identified these packages' publisher in #42. Actions are SHA-pinned; this is the one workflow here holding publish rights. Verified locally with the publish call stubbed: shrink guard trips on sdk and publishes nothing (exit 1); a behind-registry version trips and publishes nothing (exit 1); a clean fixture publishes both packages with the expected preview/latest tags (exit 0). Refs #44, #42
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_60acbb40-0806-49dd-a66d-2bcdfb823330) |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
…claim The size guard mis-diagnoses packages/sdk. It is not a shell — it is a re-export barrel over 44 product packages, and small is what correct looks like for one. The comment asserting otherwise is now fixed, and the guard is documented as a known false positive to narrow rather than delete when the umbrella is ready. Adds a dependency check that catches what size cannot: a dependency that exists neither on the registry nor in this workspace. That is a broken reference no amount of publishing can satisfy. Deliberately NOT a registry-only check. 45 of the 49 packages depend on @wave-av/core, which is itself unpublished, so requiring every dependency to be on npm already would reject nearly the whole workspace on the first coordinated release. A gate that always fires teaches people to route around it. Verified both directions locally, since CI cannot run: all 45 packages with @wave-av dependencies pass, and a synthetic dependency on a package that exists nowhere is rejected by name while its workspace sibling is not. Also tightens the registry_meta slug check. The case pattern only anchored the first character, so a name like a/../x would have reached the URL.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_30b17538-d2d9-40c7-ad21-82b3576c0ff3) |
Fixes the two problems in #44.
publish-npm.ymlis a good design — OIDC trusted publishing, provenance, an environment gate, per-packagepreview/latesttagging. It just could not run.packages/adk/sorts first, sits at 1.0.14 both locally and on npm, and npm rejects a republish; underset -ethe job died there, before reaching the 45 packages that have never shipped at all.The obvious repair — skip versions that already exist — is worse than the bug.
packages/sdkis 3 files against a published 2.0.14 of 286 files, and because it carries version 3.0.0 it is numerically ahead, so it would have sailed through to thelatestdist-tag and become the newest stable release for every consumer of@wave-av/sdk.What changed
Collisions are skipped, not fatal. A monorepo-wide tag always sweeps up packages that did not change.
Two things now fail validation: a version that sorts behind the registry, and a tarball less than half the
unpackedSizeof the one it replaces. The second is the one that matters — a version number tells you nothing about whether the package still has its contents in it.Validation is a separate pass over every package before anything publishes. Inline validation meant one bad package stranded everything sorting after it —
sdkfailing would have silently droppedsearchthroughzoom, twelve packages that were fine. A release is either coherent or it doesn't go.Registry lookups use
curlagainstregistry.npmjs.org, notnpm view. A scoped@wave-av:registrysetting outranks--registry, sonpm viewcan answer about GitHub Packages instead. That is not hypothetical — it's the specific trap that caused these packages' publisher to be mis-identified in #42, and I hit it again while testing this change.Actions are SHA-pinned (same v4 releases, just immutable). This is the one workflow in the repo holding publish rights.
Verification
Actions is billing-locked org-wide (wave-rig#174), so this has not run in CI. I tested it by extracting the exact
run:block out of the YAML and executing it withpnpm publishstubbed:Against all 49 real packages, current state — 48 evaluated,
sdktrips the shrink guard, zero publishes:A version behind the registry — fails, and the other packages are still evaluated rather than skipped:
Clean fixture — publishes both, with the right dist-tags (
0.0.2→preview,0.1.0→latest):What this does not fix
sdk@3.0.0being a 75-line shell is still a real problem — this change makes it a loud stop instead of a bad release. Somebody has to decide whether that directory is the source of truth for@wave-av/sdkat all, which is the open question in #42.And this guards one door. Five of the six published
@wave-avpackages were published from somewhere else entirely, so a guard here does not prevent a release from there.Refs #44, #42.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes the npm publish gate and release validation logic on a workflow with OIDC publish permissions; mistakes could block legitimate releases or (if guards were wrong) allow bad publishes, though the change is intended to reduce supply-chain risk.
Overview
Hardens
publish-npm.ymlso monorepo tag pushes can complete without accidentally shipping bad or duplicate@wave-av/*packages.Publish script now uses a two-pass flow: every package is validated first (skip versions already on npm, refuse publishing behind the registry, refuse tarballs less than half the published
unpackedSize), and nothing publishes if any package fails. Registry metadata is fetched viacurltoregistry.npmjs.orginstead ofnpm view, avoiding scoped-registry misreads.GitHub Actions steps (checkout, pnpm, setup-node) are SHA-pinned on the workflow that holds publish rights.
Reviewed by Cursor Bugbot for commit 4c190bd. Configure here.
Summary by cubic
Validate the whole npm release before publishing anything to avoid partial or wrong releases. Skip already-published versions and block backward versions, suspiciously small tarballs, and packages with unresolved
@wave-av/*dependencies.Bug Fixes
@wave-av/*packages; publish only if all pass.@wave-av/*deps that exist neither on npm nor in this workspace; allow deps satisfied by the same release.registry.npmjs.orgwithcurlinstead ofnpm viewto avoid scoped-registry misreads, and tighten slug validation.Dependencies
actions/checkout,pnpm/action-setup, andactions/setup-node.Written for commit 58bdb14. Summary will update on new commits.