fix(release): stop npm read lag from failing publishes - #498
Conversation
The canary publish job has failed three times since 2026-09-16, all on registry read-after-write lag: - ad60f44, 5a5a5c9: every platform package published, then the wait for them timed out after 120s. `npm view` fetches the full packument, which the registry CDN and npm's own cache hold for five minutes (`cache-control: max-age=300`), so polling kept reading the copy cached by the pre-publish check. - eeb86c5 (re-run): the pre-check still read win32-arm64 as missing though attempt 1 had published it, and npm rejected the publish with "cannot publish over the previously published versions". Check the per-version document (`/<name>/<version>`) directly instead, which the CDN does not cache, with retries for 5xx and network errors. Treat npm's publish-conflict rejection as success. Let every platform publish finish before failing, since exiting mid-upload orphans `npm publish` processes whose upload can still land, and report all failures together. Give the availability wait five minutes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PV2ZJ8dVTShiA3PSCGjCYm
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (6)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Files not reviewed due to moderation or processing errors (6)
Included review availability: 7 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour. 📝 WalkthroughWalkthroughThe release tooling now checks per-version npm registry documents and retries eligible check failures. Publishing reports whether a package was newly published or already existed. Dependency publishing waits for all dependency operations to settle before reporting failures. The releaser logs duplicate-version results and waits up to five minutes for platform packages to become readable. The release documentation describes these behaviors. Priority: ⬆️ High Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to No specific issue requiring a fix before merge is established by the supplied evidence; normal release checks still apply. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review coverage is incomplete: 6 files could not be fully reviewed. Findings from completed review steps are included; see review info for details. Comment |
#498 moved the availability check to the per-version registry document, which the CDN does not cache, and gave the wait five minutes. The first canary after it merged (6772446) still failed: all eight platform packages published, and none read back within five minutes from the runner, though they were readable a few minutes later. The lag is on npm's side, not in a cache we can bypass. npm had already accepted every platform publish, and the wrapper is subject to the same read lag, so failing the job only strands the wrapper. Keep the wait as a best effort (two minutes), and on timeout log a warning and publish the wrapper anyway. Claude-Session: https://claude.ai/code/session_01PV2ZJ8dVTShiA3PSCGjCYm Co-authored-by: Claude <noreply@anthropic.com>
Requested by Wyatt · project thread
Before: the canary npm publish failed on three of the last five pushes to
main(ad60f44, eeb86c5, 5a5a5c9). Every platform package published fine, but the releaser then gave up after 120s waiting to see them, and a re-run failed with npm's "You cannot publish over the previously published versions".After: the releaser sees a fresh publish right away, treats "already published" as done, and a re-run picks up where the failed attempt stopped.
Both failures come from the same thing.
npm viewfetches the full packument, which the registry CDN and npm's own local cache hold for five minutes (cache-control: public, max-age=300,cf-cache-status: HIT). The pre-publish check caches the packument without the new version, so every poll in the 120s window reads that stale copy. On the eeb86c5 re-run, the pre-check still read win32-arm64 as missing though attempt 1 had published it, so npm rejected the second publish.How:
isPublishednow reads the per-version document (registry.npmjs.org/<name>/<version>), which is not CDN-cached (cf-cache-status: DYNAMIC), and retries 429, 5xx and network errors.check-release.tsandsnapshot.tsuse the same function and get the fix too.publishtreats npm's publish-conflict rejection as success.publishDependenciesBeforePackageusesPromise.allSettled, so one failure no longer exits while othernpm publishuploads are still running (the logs show them being killed as orphans, and a killed upload can still land). All failures are reported together and the wrapper is skipped.No changes to
.github/workflows/release.ymlor.changeset/config.json, so this does not overlap with #496. Scripts-only change, so no changeset.🤖 Generated with Claude Code
https://claude.ai/code/session_01PV2ZJ8dVTShiA3PSCGjCYm
Generated by Claude Code