Skip to content

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

Open
Bharat Middha (bmiddha) wants to merge 1 commit into
bmiddha-catalog-config-fallbackfrom
bmiddha-catalog-aware-preferred-versions
Open

Bharat Middha (bmiddha) wants to merge 1 commit into
bmiddha-catalog-config-fallbackfrom
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
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]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

1 participant