Skip to content

fix(workspace-tools): resolve catalog workspace deps in foreach#7161

Open
puneetdixit200 wants to merge 1 commit into
yarnpkg:masterfrom
puneetdixit200:fix/7129-catalog-workspace-topological-dev
Open

fix(workspace-tools): resolve catalog workspace deps in foreach#7161
puneetdixit200 wants to merge 1 commit into
yarnpkg:masterfrom
puneetdixit200:fix/7129-catalog-workspace-topological-dev

Conversation

@puneetdixit200

Copy link
Copy Markdown

What's the problem this PR addresses?

Fixes #7129.

When a workspace dependency is declared through a catalog entry that resolves to workspace:*, workspaces foreach --recursive --topological-dev --from ... --exclude ... can miss that workspace dependency if transparent workspace matching is disabled. The foreach dependency graph was checking raw manifest descriptors such as catalog: instead of the descriptor after Yarn's dependency reduction hooks had resolved it.

How did you fix it?

workspaces foreach now reduces dependency descriptors through the existing reduceDependency hook path before checking whether they point at a workspace. The same helper is used for recursive dependency selection, recursive dependent selection, and topological wait checks.

I also added an acceptance test that disables transparent workspaces, puts workspace:* behind a catalog entry, and verifies that foreach --recursive --topological-dev --from my-package --exclude my-package still runs the dependency workspace.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Testing

  • yarn build:cli
  • yarn workspace acceptance-tests test:integration packages/acceptance-tests/pkg-tests-specs/sources/commands/workspaces/foreach.test.js -t 'should include workspace dependencies resolved through catalogs'
  • yarn workspace acceptance-tests test:integration packages/acceptance-tests/pkg-tests-specs/sources/commands/workspaces/foreach.test.js -t 'should include dependencies|should include workspace dependencies|following the topological order'
  • yarn typecheck:all
  • yarn version check
  • yarn constraints
  • git diff --check

@puneetdixit200 puneetdixit200 force-pushed the fix/7129-catalog-workspace-topological-dev branch from 6508e1a to 8a2480c Compare May 30, 2026 16:08
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?]: If you set workspace:* in a catalog, topological-dev doesn't pick it up.

1 participant