Skip to content

Fix several changeset version issues with workspace protocol dependencies#1888

Merged
Andarist merged 13 commits intochangesets:mainfrom
mixelburg:fix/workspace-prefix-semver-comparison
Apr 1, 2026
Merged

Fix several changeset version issues with workspace protocol dependencies#1888
Andarist merged 13 commits intochangesets:mainfrom
mixelburg:fix/workspace-prefix-semver-comparison

Conversation

@mixelburg
Copy link
Copy Markdown
Contributor

Fixes #1886

Problem

When a package uses explicit -style versions (as opposed to the shorthand , , ), the shouldUpdateDependencyBasedOnConfig function passes the raw range string (including the workspace: prefix) to semver.satisfies. Semver can't parse the prefix and always returns false, making the function treat every explicit workspace range as "out of range" and forcing unnecessary version bumps.

For example, if pkg-a has "pkg-b": "workspace:^1.0.0" in peerDependencies and pkg-b bumps from 1.0.0 to 1.0.1, changesets would incorrectly decide the range is violated and bump pkg-a as well — even with onlyUpdatePeerDependentsWhenOutOfRange: true.

Fix

Strip the workspace: prefix from depVersionRange before calling semverSatisfies. The implicit workspace aliases (^, ~, *) are not real semver ranges, so they're handled separately (the caller already continues on them).

Changes

  • packages/apply-release-plan/src/utils.ts: strip prefix, guard implicit aliases
  • packages/apply-release-plan/src/utils.test.ts: new unit tests for the fixed cases

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 12, 2026

🦋 Changeset detected

Latest commit: 2ea0a77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@changesets/assemble-release-plan Patch
@changesets/get-dependents-graph Patch
@changesets/apply-release-plan Patch
@changesets/cli Patch
@changesets/get-release-plan Patch
@changesets/config Patch

Not sure what this means? Click here to learn what changesets are.

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.37%. Comparing base (3ab4d89) to head (2ea0a77).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
.../assemble-release-plan/src/determine-dependents.ts 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1888      +/-   ##
==========================================
+ Coverage   81.84%   83.37%   +1.52%     
==========================================
  Files          55       56       +1     
  Lines        2396     2466      +70     
  Branches      725      748      +23     
==========================================
+ Hits         1961     2056      +95     
+ Misses        429      404      -25     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread packages/apply-release-plan/src/utils.test.ts Outdated
@Andarist Andarist changed the title fix(apply-release-plan): strip workspace: prefix before semver range comparison Fix several changeset version issues with workspace protocol dependencies Apr 1, 2026
@Andarist Andarist added this pull request to the merge queue Apr 1, 2026
Merged via the queue into changesets:main with commit 036fdd4 Apr 1, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 1, 2026
nnecec pushed a commit to nnecec/changesets-docs that referenced this pull request Apr 16, 2026
…encies (changesets#1888)

* fix(apply-release-plan): strip workspace: prefix before semver range comparison

* fix: restore yarn.lock from upstream to fix CI parse error

* style: fix prettier formatting

* style: fix prettier formatting in apply-release-plan utils

* remove the lock

* fix implementation

* fix: add oldVersion to test fixtures and format files

* style: fix prettier formatting in apply-release-plan

* add tests

* fix workspace:path/to/pkg

* add more tests

* fix dir in test-utils

* fix changesets

---------

Co-authored-by: Maks Pikov <mixelburg@users.noreply.github.com>
Co-authored-by: Maks Pikov <mixelburg@gmail.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
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.

shouldUpdateDependencyBasedOnConfig is called with workspace:... depVersionRanges

2 participants