Skip to content

Comments

[rush-lib] Add pnpm global catalog detection to rush change#5627

Open
CarltonHowell wants to merge 9 commits intomicrosoft:mainfrom
CarltonHowell:rush-change-catalog-entries
Open

[rush-lib] Add pnpm global catalog detection to rush change#5627
CarltonHowell wants to merge 9 commits intomicrosoft:mainfrom
CarltonHowell:rush-change-catalog-entries

Conversation

@CarltonHowell
Copy link

Summary

Details

  • Added catalog change detection logic in getChangedProjectsAsync() between the per-project file change detection and the includeExternalDependencies block. The new logic:
    a. Guards on rushConfiguration.isPnpm and globalCatalogs existing
    b. Computes the relative path to pnpm-config.json and checks if it's in changedFiles
    c. Loads the old pnpm-config.json to find which catalog names changed
    d. If the old file doesn't exist (new creation), treats all current catalogs as changed
    e. Builds a map of catalogName → Set by scanning each project's dependencies, devDependencies, and optionalDependencies for catalog: protocol entries
    f. Marks affected projects and their consumingProjects as changed

How it was tested

  • Unit tests added for catalog change logic

Impacted documentation

  • Currently no documentation exists for pnpm global catalog capabilities

@CarltonHowell
Copy link
Author

@microsoft-github-policy-service agree

}

// Determine which catalog names have changed
let changedCatalogNames: Set<string>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be calculating for which packages given catalog specifiers have changed; a catalog reference is for a specific dependency, so just because one version in a catalog has changed doesn't mean that a different version in the catalog has changed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks David, I've addressed the feedback and added more granular tests to target this intended behaviour.

@iclanton iclanton moved this from Needs triage to In Progress in Bug Triage Feb 18, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds PNPM global catalog (globalCatalogs) change detection to rush change so that projects using the catalog: protocol are marked as changed when catalog entries are edited, including across subspaces (addresses #5624).

Changes:

  • Extend ProjectChangeAnalyzer.getChangedProjectsAsync() to detect diffs in per-subspace pnpm-config.json catalog entries and mark impacted projects as changed.
  • Add unit tests covering catalog changes (default/named catalogs) and subspace scenarios.
  • Add new test fixture repos (repoWithCatalogs, repoWithSubspacesCatalogs) and a Rush change file.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
libraries/rush-lib/src/logic/ProjectChangeAnalyzer.ts Implements subspace-aware catalog diffing and project impact detection.
libraries/rush-lib/src/logic/test/ProjectChangeAnalyzer.test.ts Adds unit tests for catalog change detection (including subspaces).
libraries/rush-lib/src/logic/test/repoWithCatalogs/rush.json Test fixture Rush repo definition for catalog tests.
libraries/rush-lib/src/logic/test/repoWithCatalogs/a/package.json Fixture project using default catalog dependencies.
libraries/rush-lib/src/logic/test/repoWithCatalogs/b/package.json Fixture project using tools catalog (and workspace dep).
libraries/rush-lib/src/logic/test/repoWithCatalogs/c/package.json Fixture project with no catalog dependencies.
libraries/rush-lib/src/logic/test/repoWithCatalogs/d/package.json Fixture project using default catalog (single package).
libraries/rush-lib/src/logic/test/repoWithCatalogs/e/package.json Fixture project using tools catalog in devDependencies.
libraries/rush-lib/src/logic/test/repoWithCatalogs/common/config/rush/pnpm-config.json Fixture defining globalCatalogs for non-subspace repo.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/rush.json Test fixture Rush repo definition with subspaces enabled.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/a/package.json Fixture default-subspace project using default catalog.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/b/package.json Fixture default-subspace project with non-catalog dependency.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/c/package.json Fixture default-subspace project consuming a workspace dep.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/d/package.json Fixture named-subspace project using default catalog.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/e/package.json Fixture named-subspace project using tools catalog.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/f/package.json Fixture named-subspace project with no catalog deps.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/g/package.json Fixture named-subspace project using default catalog.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/h/package.json Fixture named-subspace project using tools catalog.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/subspaces/default/pnpm-config.json Fixture default subspace globalCatalogs definition.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/subspaces/default/common-versions.json Fixture default subspace common-versions config.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/subspaces/default/.pnpmfile.cjs Fixture default subspace pnpmfile.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/subspaces/project-change-analyzer-test-subspace/pnpm-config.json Fixture named subspace globalCatalogs definition.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/subspaces/project-change-analyzer-test-subspace/common-versions.json Fixture named subspace common-versions config.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/subspaces/project-change-analyzer-test-subspace/.pnpmfile.cjs Fixture named subspace pnpmfile.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/rush/version-policies.json Fixture Rush config required by test repo.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/rush/subspaces.json Fixture enabling subspaces in test repo.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/rush/pnpm-config.json Fixture root pnpm config enabling workspaces for subspaces.
libraries/rush-lib/src/logic/test/repoWithSubspacesCatalogs/common/config/rush/experiments.json Fixture enabling cross-subspace decoupled dependency exemption for tests.
common/changes/@microsoft/rush/rush-change-catalog-entries_2026-02-17-18-48.json Change file documenting the Rush CLI behavior update.

CarltonHowell and others added 2 commits February 20, 2026 12:36
…6-02-17-18-48.json

Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants