Skip to content

fix(changeset-preview): match get-release-plan to the repo's changesets major - #423

Closed
DogPawHat wants to merge 1 commit into
TanStack:mainfrom
DogPawHat:fix/changeset-preview-release-plan-version
Closed

DogPawHat wants to merge 1 commit into
TanStack:mainfrom
DogPawHat:fix/changeset-preview-release-plan-version

Conversation

@DogPawHat

@DogPawHat DogPawHat commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

🎯 Changes

The Changeset Version Preview comment shows major bumps for minor changesets on repos that have moved to changesets v3. For example, on TanStack/query#12059 it shows @tanstack/react-query 5.104.3 → 6.0.0, while changeset-bot and the real release give a minor (5.105.0).

Cause

The action always used @changesets/get-release-plan@^4, which is built on the changesets v2 libraries (@changesets/config@^3, @changesets/assemble-release-plan@^6). In v2, a minor bump makes every package that lists it in peerDependencies go major, unless the config sets ___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange. TanStack/query removed that option when it moved to changesets v3 (TanStack/query#11583), because v3 doesn't need it. Its fixed group then takes every package to 6.0.0.

Results with a single '@tanstack/react-query': minor changeset on TanStack/query:

Tool @tanstack/react-query lit-query / svelte-query
pnpm exec changeset status (@changesets/cli 3.0.3) 5.104.1 → 5.105.0 minor patch
@changesets/get-release-plan@4.0.16 (current action) 5.104.1 → 6.0.0 major 1.0.0 / 7.0.0 major
@changesets/get-release-plan@4.0.16 + the experimental option put back in the config 5.104.1 → 5.105.0 minor patch
@changesets/get-release-plan@5.0.2 5.104.1 → 5.105.0 minor patch

Fix

A plain bump to v5 would break repos that still use changesets v2. Of the 12 repos using this action, 5 are on @changesets/cli@^2:

changesets v3 changesets v2
form, hotkeys, pacer, query, store, table, template devtools, persist, router, virtual, workflow

So the action now installs both majors under npm aliases (get-release-plan-v4, get-release-plan-v5). It resolves @changesets/cli/package.json from GITHUB_WORKSPACE and uses the matching get-release-plan (cli v2 → v4, cli v3 → v5). If the CLI can't be found or its major isn't known, it falls back to v5 with a warning. Every user runs Setup Tools, which installs the repo's dependencies, before this action, so the CLI can be found.

I also tried loading get-release-plan from the repo's own node_modules, so the preview could never drift from the release tool. That doesn't work for v3, because @changesets/cli@3 no longer depends on @changesets/get-release-plan.

v5 has no API changes that affect this script: the default export is still the function, and ReleasePlan.releases[] has the same shape. v5 is ESM-only and needs Node ^22.11 || ^24 || >=26.

Testing

Ran GITHUB_WORKSPACE=… node preview-changeset-versions.mjs against fresh, installed clones:

  • TanStack/query (cli 3.0.3 → v5) with '@tanstack/react-query': minor: the fixed group shows 5.104.3 → 5.105.0 minor; lit/svelte/vue-query-devtools show patch. There are no major bumps, and the result matches pnpm exec changeset status package for package.
  • TanStack/router (cli 2.30.0 → v4) with '@tanstack/router-core': minor: router-core shows minor and the rest show patch. This matches changeset status ("NO packages to be bumped at major").
  • Workspace without @changesets/cli: warns and falls back to v5.

Follow-up

After this merges, the repos need to bump their pinned TanStack/config/.github/changeset-preview@<sha> to pick up the fix. TanStack/query pins e4b48f16568324f76f467aa4c2aac2f05db632c3 in .github/workflows/pr.yml (job version-preview).

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr. (This changes only a GitHub Action, which test:pr doesn't cover. I tested it manually as described above.)

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated release preview tooling to work with supported versions of the Changesets CLI by selecting compatible release-plan support. When the CLI version cannot be detected or is unsupported, the tooling uses its default compatibility option. This helps keep release previews available across different workspace configurations without changing the preview experience.

…ts major

The preview always used @changesets/get-release-plan@4 (changesets v2
libraries). Repos on changesets v3 dropped the
onlyUpdatePeerDependentsWhenOutOfRange experimental option, which v2 needs,
so minor bumps showed as major in the preview (e.g. TanStack/query
@tanstack/react-query 5.104.3 -> 6.0.0 instead of 5.105.0).

Bundle both v4 and v5 under npm aliases and pick the one that matches the
@changesets/cli major installed in GITHUB_WORKSPACE, defaulting to v3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DogPawHat
DogPawHat requested a review from a team as a code owner October 17, 2026 17:13
@changeset-bot

changeset-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9532513

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

@nx-cloud

nx-cloud Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 9532513

Command Status Duration Result
nx affected --targets=test:sherif,test:docs,tes... ✅ Succeeded <1s View ↗
nx run-many --target=build ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-10-17 17:13:50 UTC

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bfdf4d2f-812d-436c-93ca-5aea557f4d7d
📥 Commits

Reviewing files that changed from the base of the PR and between d9fd42a and 9532513.

📒 Files selected for processing: 2
  • .github/changeset-preview/package.json
  • .github/changeset-preview/preview-changeset-versions.mjs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The preview script now detects the workspace Changesets CLI major version and dynamically loads the corresponding release-plan package. The package manifest adds aliases for release-plan versions 4 and 5.

Changes: Changeset release-plan selection

Layer / File(s) Summary
Resolve the matching release-plan package
.github/changeset-preview/package.json, .github/changeset-preview/preview-changeset-versions.mjs
The package manifest adds aliases for release-plan versions 4 and 5. The script selects version 4 for CLI v2 and version 5 for CLI v3. If detection fails or finds an unsupported major, the script warns and uses the v3 mapping. main awaits the loader before requesting the release plan.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: alemtuzlak, lachlancollins

Merge Risk: ⚪ Minimal · up to 95325

The action reports a failed package load, and its installation workflow supports the new aliases. No issue identified here needs to delay merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: selecting the compatible get-release-plan version for the repository's Changesets major.
Description check Passed The description is complete and follows the repository template. It explains the problem, cause, fix, testing, release impact, and follow-up work. It also explains why pnpm test:pr was not run.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 17, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@tanstack/eslint-config@423
npm i https://pkg.pr.new/@tanstack/publish-config@423
npm i https://pkg.pr.new/@tanstack/typedoc-config@423
npm i https://pkg.pr.new/@tanstack/vite-config@423

commit: 9532513

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​changesets/​get-release-plan@​5.0.21001006794100

View full report

@DogPawHat
DogPawHat marked this pull request as draft October 17, 2026 17:28
@DogPawHat DogPawHat closed this Oct 17, 2026
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.

1 participant