Skip to content

fix: exclude unrelated optional peers from workspace installs - #9849

Open
Sakshamm-Goyal wants to merge 1 commit into
npm:latestfrom
Sakshamm-Goyal:fix/workspace-filter-optional-peer
Open

fix: exclude unrelated optional peers from workspace installs#9849
Sakshamm-Goyal wants to merge 1 commit into
npm:latestfrom
Sakshamm-Goyal:fix/workspace-filter-optional-peer

Conversation

@Sakshamm-Goyal

Copy link
Copy Markdown

Summary

  • stop filtered workspace reification from treating peerOptional edges as requirements on their own
  • keep optional peer providers when the root or selected workspace explicitly depends on them
  • add regression coverage for both the out-of-scope and explicit-provider cases

This fixes scoped npm ci --workspace installs pulling in a package that is only declared by an unselected workspace and then reporting it as extraneous.

Validation

  • reproduced the issue with the reporter repository on npm CLI latest: sass-embedded@1.100.0 was installed and reported extraneous
  • reran the same repository with this patch: sass-embedded is absent while vite and the selected pkg-b workspace remain installed
  • node . run test -w @npmcli/arborist (59 suites, 100% statement/branch/function/line coverage, workspace lint passes)
  • focused regression verifies an explicit selected-workspace provider remains installed

Fixes #9847

@Sakshamm-Goyal
Sakshamm-Goyal requested review from a team as code owners August 7, 2026 03:26
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.

[BUG] Scoped npm ci --workspace installs an out-of-scope workspace's optional peer dependency, then reports it as extraneous

1 participant