From 2872ab17580eeca5dc86f0d2ce8837b2b1cbf289 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 25 Sep 2026 17:45:37 +0000 Subject: [PATCH] fix(release): don't fail a publish on npm read lag #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. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01PV2ZJ8dVTShiA3PSCGjCYm --- docs/releasing.md | 2 +- scripts/releaser.ts | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/releasing.md b/docs/releasing.md index 05c50f978..b1862ca7c 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -176,7 +176,7 @@ The releaser accepts these flags: - `--tag ` -- publish with a specific npm dist-tag (e.g., `canary`, `snapshot`); defaults to `latest` - `--version ` -- override the version read from `package.json` -All publishes are idempotent -- the script checks the registry before publishing and skips already-published versions, and a publish that npm rejects because the version already exists counts as done. The check reads the per-version document (`registry.npmjs.org//`), which the registry CDN does not cache, so a version published seconds earlier is visible right away. Before publishing the `clerk` wrapper, the script waits (up to five minutes) for every platform package to be readable. If one platform publish fails, the others still run to completion before the job exits, so a re-run only has to publish what is actually missing. +All publishes are idempotent -- the script checks the registry before publishing and skips already-published versions, and a publish that npm rejects because the version already exists counts as done. The check reads the per-version document (`registry.npmjs.org//`), which the registry CDN does not cache, but npm can still take several minutes to serve a new version back. Before publishing the `clerk` wrapper, the script waits up to two minutes for every platform package to be readable; if one is still unreadable after that, it logs a warning and publishes the wrapper anyway, because npm already accepted every platform publish. If one platform publish fails, the others still run to completion before the job exits, so a re-run only has to publish what is actually missing. #### Environment Variables diff --git a/scripts/releaser.ts b/scripts/releaser.ts index 527d352c3..27e24f1ff 100644 --- a/scripts/releaser.ts +++ b/scripts/releaser.ts @@ -105,12 +105,21 @@ await publishDependenciesBeforePackage( waitUntilAvailable: dryRun ? undefined : async () => { + // Best effort. npm accepted the publish, so the version exists; the + // registry can take several minutes to serve it back (observed + // >5 min on the uncached per-version endpoint). Failing here only + // strands the wrapper, which is subject to the same read lag. console.log(`Waiting for ${name}@${version} to become available on npm...`); - await waitUntilPublished(name, version, { - intervalMs: 5_000, - timeoutMs: 300_000, - isPublished, - }); + try { + await waitUntilPublished(name, version, { + intervalMs: 5_000, + timeoutMs: 120_000, + isPublished, + }); + } catch (error) { + const reason = error instanceof Error ? error.message : String(error); + console.log(`::warning::${reason}; continuing because npm accepted the publish`); + } }, }; }),