Skip to content

fix(release): wait for npm's tarballs and run a pinned npm that moves next - #334

Merged
Moltenship merged 2 commits into
mainfrom
fix/release-tarballs-next-tag
Nov 26, 2026
Merged

Moltenship merged 2 commits into
mainfrom
fix/release-tarballs-next-tag

Conversation

@Moltenship

@Moltenship Moltenship commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

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.tgz and calendar-testing-2.0.0.tgz. npm's package documents already listed 2.0.0 with latest. The tarballs answered 404 at 07:43 and 200 at 07:45. waitForPublished read only the package documents.

Now waitForPublished (tools/release/src/published.ts) also downloads each version's dist.tarball, as soon as its package document lists the version.

  • The download: it sends no cache-control header, so it sees what npm's CDN hands an installer. It hashes the bytes to sha512-….
  • The patience: same as for the package documents. It polls every 30 s for up to 15 minutes. A 404 or other status waits, and so does a network error. Bytes that differ from the gate's integrity fail at once. On a timeout it names each tarball still waiting, with its status and URL.
  • Fewer downloads: a tarball that matched isn't fetched again.

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:

  • check and publish read package documents only.
  • The next-tag step reads only the next tag.

So no tarball download happens before this wait.

2. next didn't move

The runner's Node 26 bundles npm 11.20.0. npm's docs (docs.npmjs.com/trusted-publishers) give these first versions:

  • npm publish through trusted publishing: 11.5.1.
  • npm dist-tag through trusted publishing: 11.21.0 on npm 11, 12.2.0 on npm 12.

The fix. tools/release now depends on npm 11.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.ts runs that npm as process.execPath plus npm's own bin/npm-cli.js, with no PATH lookup. That npm now runs:

  • npm publish;
  • npm dist-tag add in the next-tag step;
  • npm trust in vp 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@x step. Every job that holds a credential already runs vp 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 … --provenance with the pinned npm and --dry-run on 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's oidc/token/exchange/package/<name> endpoint for each package. That's the same endpoint the pinned npm's npm publish calls (lib/utils/oidc.js). I didn't give the dry-run job id-token: write so 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:

  • The setting is manageDistTags in a trusted publisher's permissions.
  • npm shows it only through GET /-/package/<name>/trust, which takes a maintainer's token with 2FA (npm-otp). It doesn't take the OIDC-exchanged token.
  • The exchange's response carries no permissions.
  • No documented call answers "would a dist-tag change be allowed" without making one.

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's permissions array. vp run release:trust now lists the packages whose trusted publisher lacks manageDistTags, and vp run release:trust --dry-run does that without changing anything. npm trust can't turn the setting on (11.21.3 has --allow-publish and --allow-stage-publish only), 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's npm 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:full passed on the first commit, a55c03e: 41 of 41 steps. vp run ready passed 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-run from 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 @next checks 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 check job's trust exchange passing for all 11 packages.
    • The finish step's new tarball wait.

    The only things it says a release would stop at are the branch: not main, and not on origin/main.

Review

Claude Opus 5.5 (high), one round. No blockers.

  • Should-fix 1, release:trust read a failed npm trust list as "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.
  • Should-fix 2, the permission name manageDistTags was a guess: it comes from npm's API docs (api-docs.npmjs.com, Trust: the permission enum createPackage, createStagedPackage, manageDistTags, and "present only when dist-tag access has been explicitly enabled"). The source is now cited in allowsDistTag. I can't check it against live output without the owner's login, so the "off" line also prints the raw permissions array, which would show a misread name.
  • Nit 3, the dry run stopped on an npm publish --dry-run failure: fixed. A refusal is now a problem that the dry run reports.
  • Nit 4, a different CDN edge might still serve the install job a stale 404: not changed. The wait now downloads each tarball through the same public CDN an installer uses, and checks its bytes. A per-edge stale 404 after that is possible but much less likely. A retry belongs in registry:e2e, and I left it out to keep this PR to the release tooling.
  • Nit 5, the pinned npm shadows npm in tools/release scripts' PATH: noted in npm.ts. No script relies on the runner's npm.
  • Nit 6, missing tests: added one for fetchTarball's non-200 answer.
    • A test of publish()'s dry run would need a git checkout and tarballs. A missing --dry-run would fail with ENEEDAUTH in that job, which holds no token.
    • setUp is interactive and stays untested. Its parsing and report (allowsDistTag, distTagReport) are tested.
  • Nit 7, an over-long comment line in next-tag.ts: fixed.

🤖 Generated with Claude Code

Moltenship and others added 2 commits November 26, 2026 12:12
… 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>
@Moltenship

Copy link
Copy Markdown
Owner Author

Local gate: vp run ready:full was green on a55c03e (41 of 41 steps), and vp run ready was green on 50e5be3 (34 of 34). On 50e5be3, CI's release-gate passed in run 45783621243, and the 2.0.1 release dry run passed in run 45784162751. The PR body has the review's findings and what I did about each.

@Moltenship

Copy link
Copy Markdown
Owner Author

Merging on 50e5be3. Local vp run ready passed after the review fixes (34 of 34), and vp run ready:full once on a55c03e (41 of 41). CI release-gate is green on the head (run 45783621243), and so is the release dry run of 2.0.1 (run 45784162751), which published nothing: npm still has latest and next at 2.0.0. The review has no open blocker or should-fix finding.

@Moltenship
Moltenship merged commit 7160490 into main Nov 26, 2026
12 checks passed
@Moltenship
Moltenship deleted the fix/release-tarballs-next-tag branch November 26, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant