Skip to content

fix(scripts): wait for workspace siblings to appear on npm before publishing bitgo - #9951

Merged
Charan-Ratlan merged 1 commit into
masterfrom
WCI-1858
Oct 14, 2026
Merged

Charan-Ratlan merged 1 commit into
masterfrom
WCI-1858

Conversation

@Charan-Ratlan

@Charan-Ratlan Charan-Ratlan commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

bitgo's prepack checked 3 times, 30 seconds apart, that every pinned workspace sibling was visible on npm, then failed the release. Lerna reports a package as published minutes (sometimes over an hour) before the registry shows it, so beta and stable releases often failed here and left partially published releases that needed reruns.

Implementation details

  • Replace the fixed 3-attempt check in ensureWorkspaceSiblingVersionsAvailable with a time budget: poll every 30 seconds until all siblings are visible or the budget is spent. Default 20 minutes, override with BITGO_SIBLING_AVAILABILITY_TIMEOUT_MINUTES (0 checks once without waiting).
  • Log how many siblings are still missing on each poll and, on timeout, fail with the full list of missing versions (same "still unavailable from npm" message as before).
  • Treat network errors, HTTP 429 and 5xx as transient and retry them up to 5 times in a row during the wait. Other unexpected statuses still fail at once.
  • Add injectable clock support and tests for waiting past the old limit, timeout, zero budget, transient errors and the environment override.

Ticket: WCI-1858

@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

WCI-1858

@Charan-Ratlan
Charan-Ratlan marked this pull request as ready for review October 13, 2026 11:58
@Charan-Ratlan
Charan-Ratlan requested review from a team as code owners October 13, 2026 11:58
pranavjain97
pranavjain97 previously approved these changes Oct 13, 2026
Comment thread scripts/generate-bitgo-shrinkwrap.ts Resolved
vibhavgo
vibhavgo previously approved these changes Oct 14, 2026
…lishing bitgo

problem/goal
bitgo's prepack checked 3 times, 30 seconds apart, that every pinned
workspace sibling was visible on npm, then failed the release. Lerna reports
a package as published minutes (sometimes over an hour) before the registry
shows it, so beta and stable releases often failed here and left partially
published releases that needed reruns.

implementation details
- Replace the fixed 3-attempt check in ensureWorkspaceSiblingVersionsAvailable
  with a time budget: poll every 30 seconds until all siblings are visible or
  the budget is spent. Default 20 minutes, override with
  BITGO_SIBLING_AVAILABILITY_TIMEOUT_MINUTES (0 checks once without waiting).
- Log how many siblings are still missing on each poll and, on timeout, fail
  with the full list of missing versions (same "still unavailable from npm"
  message as before).
- Treat network errors, HTTP 429 and 5xx as transient and retry them up to 5
  times in a row during the wait. Other unexpected statuses still fail at once.
- Add injectable clock support and tests for waiting past the old limit,
  timeout, zero budget, transient errors and the environment override.

verification
- npx mocha --require tsx scripts/tests/generate-bitgo-shrinkwrap.test.ts:
  13 passing.
- prettier and eslint clean on the changed files.
- Checked the wait against the real npm registry with read-only requests:
  returns at once when versions exist, fails after the budget naming a missing
  version. Not run in an actual publish.

Ticket: WCI-1858
@Charan-Ratlan
Charan-Ratlan merged commit f84a2af into master Oct 14, 2026
24 checks passed
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.

3 participants