Skip to content

[rush] Resolve PNPM catalog references in implicitly preferred versions - #6139

Merged
Bharat Middha (bmiddha) merged 1 commit into
mainfrom
bmiddha-catalog-aware-preferred-versions
Nov 10, 2026
Merged

Bharat Middha (bmiddha) merged 1 commit into
mainfrom
bmiddha-catalog-aware-preferred-versions

Conversation

@bmiddha

@bmiddha Bharat Middha (bmiddha) commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Rush computed implicitly preferred versions from raw package.json specifiers, so a dependency declared as catalog: got the preferred version "catalog:". rush install then crashed with TypeError: Invalid comparator: catalog: if that package was also in preferredVersions, and the pnpmfile stopped narrowing transitive ranges for it.

DependencyAnalyzer now resolves catalog:/catalog:<name> references using the catalogs of the declaring project's subspace. PnpmfileConfiguration also skips semver.subset() when either specifier isn't a SemVer range.

Details

  • A reference with no matching catalog entry is skipped instead of being treated as a version; PNPM fails the install for it anyway.
  • If the explicit and implicit preferred versions can't be compared (npm: aliases, git URLs), the explicit one wins.
  • IDependencyAnalysis.catalogNamesByPackageName records which catalogs each package is referenced through, for use by rush add.
  • Workspace projects' own catalog: specifiers are unchanged, so lockfiles that record specifier: catalog: are still up to date.

How it was tested

Unit tests for catalog resolution (including per-subspace catalogs), the preferredVersions crash, pnpmfile range narrowing, and isWorkspaceProjectModifiedAsync with a v9 lockfile using catalog specifiers.

@github-project-automation github-project-automation Bot moved this to Needs triage in Bug Triage Oct 14, 2026
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from 7d32ecd to c0498ce Compare October 14, 2026 20:53
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from c0498ce to 5e0ac4a Compare October 15, 2026 01:43
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from 5e0ac4a to aa9f4b6 Compare October 20, 2026 21:13
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from aa9f4b6 to f255cb4 Compare October 28, 2026 04:41
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from f255cb4 to db53126 Compare October 30, 2026 21:05
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from db53126 to c847fb9 Compare November 8, 2026 01:10
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from c847fb9 to da8c5e1 Compare November 8, 2026 01:58
@bmiddha
Bharat Middha (bmiddha) marked this pull request as ready for review November 8, 2026 02:37
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from da8c5e1 to 9e393a0 Compare November 9, 2026 20:55
Base automatically changed from bmiddha-catalog-config-fallback to main November 9, 2026 21:34
Implicitly preferred versions used the raw "catalog:" specifier, which
made semver.subset() throw in rush install for cataloged packages listed
in preferredVersions and disabled pnpmfile range narrowing for them.
Also skip semver.subset() for specifiers that aren't SemVer ranges.

Co-authored-by: Copilot App <[email protected]>
@bmiddha
Bharat Middha (bmiddha) force-pushed the bmiddha-catalog-aware-preferred-versions branch from 9e393a0 to ea8fcb2 Compare November 9, 2026 21:34
@bmiddha
Bharat Middha (bmiddha) merged commit d5a3dcf into main Nov 10, 2026
8 checks passed
@bmiddha
Bharat Middha (bmiddha) deleted the bmiddha-catalog-aware-preferred-versions branch November 10, 2026 01:02
@github-project-automation github-project-automation Bot moved this from Needs triage to Closed in Bug Triage Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

2 participants