Repository navigation
fix(release): wait for npm's tarballs and run a pinned npm that moves next - #334
Merged
Merged
Conversation
… next The 2.0.0 release's install job got a 404 for two tarballs that npm's packuments already listed. The finish job's wait now also downloads each version's dist.tarball and checks its integrity before it pushes main, so nothing reads a tarball before npm's CDN serves it. The publish job ran the runner's npm 11.20.0, which can't move a dist-tag through trusted publishing. tools/release now depends on npm 11.21.3, pinned with its integrity in the lockfile, and the release runs that npm for npm publish, npm dist-tag and npm trust. The dry run runs the release's npm publish with --dry-run on each tarball. vp run release:trust lists the packages whose trusted publisher doesn't allow npm dist-tag, which only a maintainer's login can read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the review: release:trust no longer reads a failed npm trust list as "dist-tag off", and gives npm's 2FA prompt a terminal once. The dry run reports a tarball npm publish --dry-run refuses instead of stopping. A test covers fetchTarball's non-200 answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Owner
Author
|
Merging on 50e5be3. Local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two gaps that release run 45774483713 (2.0.0) showed.
1. The install job ran before npm served every tarball
"Install the release from npm" got HTTP 404 for
calendar-core-2.0.0.tgzandcalendar-testing-2.0.0.tgz. npm's package documents already listed 2.0.0 withlatest. The tarballs answered 404 at 07:43 and 200 at 07:45.waitForPublishedread only the package documents.Now
waitForPublished(tools/release/src/published.ts) also downloads each version'sdist.tarball, as soon as its package document lists the version.cache-controlheader, so it sees what npm's CDN hands an installer. It hashes the bytes tosha512-….Where the wait runs. The wait was already in the finish job, before the push of
main(which the docs site's registry follows) and before the install job (needs: finish). So that's where the tarball check goes too. I checked what else reads the release earlier:checkandpublishread package documents only.nexttag.So no tarball download happens before this wait.
2.
nextdidn't moveThe runner's Node 26 bundles npm 11.20.0. npm's docs (docs.npmjs.com/trusted-publishers) give these first versions:
npm publishthrough trusted publishing: 11.5.1.npm dist-tagthrough trusted publishing: 11.21.0 on npm 11, 12.2.0 on npm 12.The fix.
tools/releasenow depends onnpm11.21.3, the latest npm 11 (released 18 Nov, so it passes pnpm's minimum release age). It's in the catalog. The lockfile pins it with its integrity, which I checked against the registry.tools/release/src/npm.tsruns that npm asprocess.execPathplus npm's ownbin/npm-cli.js, with no PATH lookup. That npm now runs:npm publish;npm dist-tag addin the next-tag step;npm trustinvp run release:trust. The owner no longer needs a global npm 11.15.Why the lockfile, not a step in the workflow. The pin is in the lockfile instead of an
npm install -g npm@xstep. Every job that holds a credential already runsvp install --frozen-lockfile --ignore-scripts. That install now brings in this npm, checked against the lockfile's integrity and with no install scripts, so the workflow gains no new download and no new trust. A global install would fetch npm outside the lockfile, by version alone. A test fails if the pinned npm can't publish through trusted publishing or move a dist-tag.The dry run. The dry-run job holds no OIDC token. Its "Check what publishing would do" step now runs the release's own
npm publish … --provenancewith the pinned npm and--dry-runon each tarball. npm reads the tarball, checks the tag, and checks the version against the registry. It stops before uploading. The trust exchange itself shows in the check job, which calls npm'soidc/token/exchange/package/<name>endpoint for each package. That's the same endpoint the pinned npm'snpm publishcalls (lib/utils/oidc.js). I didn't give the dry-run jobid-token: writeso that npm could do the exchange itself. A dry run from any branch would then hold a token that can publish."Allow npm dist-tag": can the tooling tell before a release?
From the workflow, no:
manageDistTagsin a trusted publisher'spermissions.GET /-/package/<name>/trust, which takes a maintainer's token with 2FA (npm-otp). It doesn't take the OIDC-exchanged token.So the next-tag step's dry run says the workflow can't see the setting.
From the owner's login, yes.
npm trust list --json(npm 11.21.3) prints each configuration'spermissionsarray.vp run release:trustnow lists the packages whose trusted publisher lacksmanageDistTags, andvp run release:trust --dry-rundoes that without changing anything.npm trustcan't turn the setting on (11.21.3 has--allow-publishand--allow-stage-publishonly), so the report points to npmjs.com.docs/internal/releasing.md(One-time setup, step 4) and the release skill say this.Docs
docs/internal/releasing.md: the pinned npm, the tarball wait, the dry run'snpm publish --dry-run, and how to check the dist-tag setting..claude/skills/release/SKILL.md: what to tell the owner about the dist-tag setting after a stable release or a dry run.Gate
On head 50e5be3:
Local:
vp run ready:fullpassed on the first commit, a55c03e: 41 of 41 steps.vp run readypassed after the review fixes: 34 of 34.CI's on-demand
release-gate: green, run 45783621243. Run 45781247717 was green on a55c03e.Release dry run with
vp run release 2.0.1 --dry-runfrom this branch: green, run 45784162751. Run 45781363770 was green on a55c03e. I used 2.0.1 because it's a stable version above 2.0.0, so the dry run takes the stable path: the@nextchecks and the next-tag step. Its log shows:npm 11.21.3 took all 11 for npm publish --dry-run.A release would point next at 2.0.1 on 11 packages, with npm 11.21.3 through trusted publishing, followed by the line saying the workflow can't see "Allow npm dist-tag".The only things it says a release would stop at are the branch: not
main, and not onorigin/main.Review
Claude Opus 5.5 (high), one round. No blockers.
release:trustread a failednpm trust listas "dist-tag off": fixed in 50e5be3. A failure now runs the list once more in the terminal, where npm can prompt for 2FA, and then tries the captured call again. If that still fails, a real run throws with npm's output, and a dry run reports the package as unknown.manageDistTagswas a guess: it comes from npm's API docs (api-docs.npmjs.com, Trust: the permission enumcreatePackage,createStagedPackage,manageDistTags, and "present only when dist-tag access has been explicitly enabled"). The source is now cited inallowsDistTag. I can't check it against live output without the owner's login, so the "off" line also prints the rawpermissionsarray, which would show a misread name.npm publish --dry-runfailure: fixed. A refusal is now a problem that the dry run reports.registry:e2e, and I left it out to keep this PR to the release tooling.npmintools/releasescripts' PATH: noted innpm.ts. No script relies on the runner's npm.fetchTarball's non-200 answer.publish()'s dry run would need a git checkout and tarballs. A missing--dry-runwould fail with ENEEDAUTH in that job, which holds no token.setUpis interactive and stays untested. Its parsing and report (allowsDistTag,distTagReport) are tested.next-tag.ts: fixed.🤖 Generated with Claude Code