Skip to content

Fix snapshot version detection in release workflow - #491

Merged
eddeee888 merged 3 commits into
masterfrom
claude/release-snapshot-alpha-version-xrhwoj
Sep 1, 2026
Merged

Fix snapshot version detection in release workflow#491
eddeee888 merged 3 commits into
masterfrom
claude/release-snapshot-alpha-version-xrhwoj

Conversation

@eddeee888

@eddeee888 eddeee888 commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

Updated the release workflow to reliably detect and report snapshot versions of packages published during the current /release-snapshot run, addressing a race condition where npm's dist-tags could return stale data — and to only report packages that were actually published this run.

Key Changes

  • Modified the snapshot version detection logic to read package versions directly from local package.json files instead of pnpm view dist-tags
  • Added package-to-directory mapping in the PACKAGES array to enable local version lookups
  • Implemented conditional logic that:
    • Uses the local version if it matches the current snapshot release tag pattern (indicating it was just published by this run)
    • Otherwise skips the package entirely — it's left out of the comment rather than reporting a stale registry version
  • Added RELEASE_TAG environment variable to the step for version pattern matching
  • Added inline comments explaining the pkg/dir string-splitting expansions

Implementation Details

  • The fix addresses a timing issue where pnpm view/npm's dist-tags can lag a few seconds behind a publish, potentially returning the previous alpha version instead of the newly published one
  • By checking if the local version matches the expected snapshot pattern (0.0.0-{RELEASE_TAG}-*), we can confidently use it without waiting for registry propagation
  • Packages not touched by the PR's changesets (so not published this run) are no longer listed in the comment at all — previously they showed a stale version from an unrelated prior run via the pnpm view fallback

https://claude.ai/code/session_01CauycheykQG78cB3zFfAYJ

The "Get snapshot versions" step read each package's new version via
`pnpm view <pkg> dist-tags.alpha` immediately after `changeset publish`.
npm's registry can lag a few seconds behind a publish before the new
dist-tag is visible to a read, so this consistently reported the alpha
version from a previous snapshot run instead of the one just published.

Verified against a recent run (#433): it published
gcg-typescript-resolver-files@0.0.0-pr490-run433-1-... but the comment
reported 0.0.0-pr487-run427-1-... from three days earlier, even though
querying the registry later returns the correct, freshly published tag.

Fix: read the version straight from each package's local package.json
when it was actually published this run (its version already matches
the run's snapshot tag prefix, written by `changeset version --snapshot`)
instead of round-tripping through the registry. Packages untouched by
the PR's changesets (not published this run) still fall back to
`pnpm view` to report their current alpha tag.
@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 61e33a1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

❌ No permission to release snapshot

Clarify what the %% and ## parameter expansions do when splitting
each "pkg:dir" entry.
Previously, packages not touched by the PR's changesets still got a
line in the comment via a `pnpm view` fallback, showing a stale
version from an unrelated prior run. Now they're left out of the
comment entirely instead.
@eddeee888
eddeee888 marked this pull request as ready for review September 1, 2026 15:34
@eddeee888
eddeee888 merged commit dff9fdd into master Sep 1, 2026
19 checks passed
@eddeee888
eddeee888 deleted the claude/release-snapshot-alpha-version-xrhwoj branch September 1, 2026 15:36
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