Skip to content

fix(deps): switch pnpm catalogMode from strict to prefer - #3289

Merged
ByronDWall merged 1 commit into
mainfrom
fix/pnpm-catalog-mode-prefer
Aug 7, 2026
Merged

ByronDWall merged 1 commit into
mainfrom
fix/pnpm-catalog-mode-prefer

Conversation

@ByronDWall

Copy link
Copy Markdown
Member

Problem

Renovate PRs against this repo fail whenever the artifact updater needs to force a lockfile resolution bump for a catalog-referenced dependency whose catalog entry is a semver range (most entries in the named catalogs, e.g. @babel/runtime-corejs3: ^7.20.13). The updater runs pnpm update <pkg>@<version> --recursive --lockfile-only, and with catalogMode: strict that command fails with ERR_PNPM_CATALOG_VERSION_MISMATCH, even when the requested version already satisfies the catalog range. This is the same failure pattern already seen and fixed in commercetools/merchant-center-application-kit (PRs #4047, #4049, #4050).

Root cause

catalogMode: strict requires exact version-string equality against the catalog specifier, rather than checking whether the requested version satisfies that specifier when it is a range. This is confirmed upstream pnpm behaviour: pnpm/pnpm#11570 reported it, and pnpm/pnpm#11706 closed it without changing the underlying comparison, so it is not expected to be fixed by a future pnpm release on its own.

There is also a separate, more recent upstream report, pnpm/pnpm#13715, filed against this exact combination of catalogMode: strict and range-based catalog entries. Worth tracking: when that issue is fixed and ships in a pnpm release, this repo can revisit switching catalogMode back to strict.

Fix

Switch catalogMode from strict to prefer in pnpm-workspace.yaml, with a comment explaining why. prefer warns on catalog drift instead of hard-failing on a version mismatch, while still preferring the catalog version when it is compatible. This unblocks Renovate's targeted-update path for range-pinned catalog entries.

scripts/check-workspace-constraints.js, run in CI, separately enforces that every dependency named in a catalog is consumed only via its catalog reference. That enforcement does not depend on catalogMode and is unaffected by this change, per pnpm's own docs on catalogMode (https://pnpm.io/settings#catalogmode).

Verification

Using the pinned [email protected] from package.json's packageManager field, via corepack pnpm ...:

  1. pnpm install --lockfile-only completes cleanly with a diff limited to pnpm-workspace.yaml, no unrelated lockfile or package.json reformatting.
  2. pnpm install (full install, to populate node_modules) completes cleanly, then node scripts/check-workspace-constraints.js reports All workspace constraints passed., confirming the separate CI guarantee is genuinely unaffected by this change.
  3. Positive confirmation of the actual fix: with catalogMode: prefer in place, pnpm update '@babel/[email protected]' --recursive --lockfile-only (a real, published, in-range patch version above the currently resolved 7.29.2, against the build catalog's ^7.20.13 range entry) exits 0, emitting a catalog-drift warning instead of the ERR_PNPM_CATALOG_VERSION_MISMATCH failure that catalogMode: strict would have produced. This test bump was not committed; the resulting lockfile and package.json changes were reverted afterward, so this PR only contains the intended pnpm-workspace.yaml edit.

@changeset-bot

changeset-bot Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 83f4151

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

@vercel

vercel Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ui-kit Ready Ready Preview Aug 7, 2026 6:51pm

Request Review

@ByronDWall
ByronDWall force-pushed the fix/pnpm-catalog-mode-prefer branch from 909cb3d to 83f4151 Compare August 7, 2026 18:50
@ByronDWall
ByronDWall marked this pull request as ready for review August 7, 2026 18:50
@ByronDWall
ByronDWall requested a review from a team as a code owner August 7, 2026 18:50
@ByronDWall
ByronDWall merged commit 69d2ec8 into main Aug 7, 2026
12 checks passed
@ByronDWall
ByronDWall deleted the fix/pnpm-catalog-mode-prefer branch August 7, 2026 18:57

This branch was successfully deployed

1 active deployment
Preview — 83f41516 Deployed Aug 7, 2026 by vercel[bot]
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