Skip to content

fix(scripts): skip occupied beta versions (WCN-3802) - #10045

Merged
zahin-mohammad merged 2 commits into
masterfrom
zahinmohammad/wcn-3802-collision-safe-beta-publish
Oct 23, 2026
Merged

zahin-mohammad merged 2 commits into
masterfrom
zahinmohammad/wcn-3802-collision-safe-beta-publish

Conversation

@zahin-mohammad

@zahin-mohammad zahin-mohammad commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Hotfix the beta/alpha release collision that left @bitgo-beta/sdk-coin-eth on the old beta tag.

The preparation script now treats the dist-tag-derived version as a candidate, checks whether that exact immutable npm version already exists, and increments until it finds a free version. The selected version is still propagated through dependent manifests before the existing build and publish steps.

Registry reads fail closed: non-404 dist-tag errors abort preparation, while a genuinely new package keeps its manifest version and still receives an exact-version collision probe. An existing dist-tag cache continues to provide deterministic offline preparation.

The verifier also sets a failing exit code when normal-mode verification fails, preventing the false-green result seen in the incident.

RCA: sdk-coin-eth beta tag stuck after prerelease version collision

Issue Number

WCN-3802

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

How Has This Been Tested?

  • yarn test:scripts — 17 passing, including free, occupied, consecutive-collision, registry-error, new-package, and dist-tag failure cases.
  • Targeted TypeScript compilation of the three changed release scripts — passing.
  • Isolated cached preparation — completed without a live registry fetch.
  • Live npm probe selected 4.4.1-beta.2099 after detecting that 4.4.1-beta.2098 already exists.

Follow-up

Keep broader registry polling, provenance validation, unpublished-version history, and recovery-mode redesign out of this hotfix and track them separately after the release is unblocked.

@linear-code

linear-code Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

WCN-3802

@zahin-mohammad
zahin-mohammad force-pushed the zahinmohammad/wcn-3802-collision-safe-beta-publish branch from dae9dfb to 6f4da3c Compare October 23, 2026 18:42
@zahin-mohammad zahin-mohammad changed the title fix(release): allocate collision-free beta versions (WCN-3802) fix(scripts): skip occupied beta versions (WCN-3802) Oct 23, 2026
Comment thread .github/workflows/publish.yml Resolved
Comment thread .github/workflows/publish.yml Resolved
Comment thread scripts/prepareRelease/distTags.ts Resolved
Comment thread scripts/prepare-release.ts Resolved
@zahin-mohammad

Copy link
Copy Markdown
Contributor Author

@claude review

@zahin-mohammad
zahin-mohammad marked this pull request as ready for review October 23, 2026 18:54
@zahin-mohammad
zahin-mohammad requested review from a team as code owners October 23, 2026 18:54

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error —— View job


I'll analyze this and get back to you.

pranishnepal
pranishnepal previously approved these changes Oct 23, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings marked 🟡 are optional suggestions and need no follow-up push.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🟣 scripts/prepareRelease/distTags.ts — pre-existing: A transient dist-tag fetch failure still skips the new collision check, so the release can retry an already-published version. The catch at distTags.ts:92-95 only warns and drops the module from the map. With tags undefined, prepare-release.ts:120 never calls findFirstUnpublishedVersion, so the module keeps its repo version unprobed. Fix: rethrow every dist-tag error except a 404 (a genuinely new package), the same fail-closed rule the new probe follows. Also probe the kept version when prevTag is undefined.

    Why this was flagged

    The trigger is a 5xx, rate-limit or network error from getDistTags for one published module during getDistTagsForModuleNames (distTags.ts:90-95). The catch logs Failed to fetch dist tags for ... and returns [], so distTags.get(m) is undefined. In incrementVersionsForModuleLocation (prepare-release.ts:108-120) prevTag then stays undefined. The new probe and the new rethrow are both skipped, and the module keeps the version in its package.json under the @ bitgo-beta scope. lerna then publishes a version that may already exist, which is the collision this PR is meant to prevent. The base behaves the same way, but the PR's new rule ('fails instead of guessing when the registry probe fails') is not applied to this sibling registry call.

    Verification: pre-existing. The unchanged catch at distTags.ts:92-95 drops the module from the map, so if (prevTag) (prepare-release.ts:120) is skipped and the new findFirstUnpublishedVersion probe never runs. The function returns undefined with no throw, so the new fail-closed throw e in incrementVersions (prepare-release.ts:183) never fires either. The base behaves the same way by the same route.

Comment thread scripts/prepare-release.ts Resolved
Comment thread scripts/verify-release.ts Resolved
Comment thread scripts/prepareRelease/distTags.ts Resolved
@zahin-mohammad

Copy link
Copy Markdown
Contributor Author

Addressed Claude's unthreaded fail-open finding in ad730f5. Dist-tag HTTP 404 now represents a genuinely new package, whose manifest version is still probed before publish. Network errors, HTTP 429, and 5xx responses now reject the batch and abort preparation instead of silently dropping the module and bypassing collision detection. Added focused 404 and 503 tests; yarn test:scripts passes with 17 tests and targeted TypeScript compilation passes.

@zahin-mohammad

Copy link
Copy Markdown
Contributor Author

@claude review

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error —— View job


I'll analyze this and get back to you.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review completed

Nothing new to post: everything this review found is already covered by existing comments on this pull request or didn't merit a separate one.

Still open from earlier reviews (2):

  • Unresolved: 2 minor or pre-existing.

@zahin-mohammad
zahin-mohammad merged commit 6fcef88 into master Oct 23, 2026
28 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.

2 participants