Skip to content

fix: prevent implicit root exclusion when user filters are provided#10465

Merged
zkochan merged 3 commits intopnpm:mainfrom
tensorworkerr:fix/root-filter-exclusion
Jan 16, 2026
Merged

fix: prevent implicit root exclusion when user filters are provided#10465
zkochan merged 3 commits intopnpm:mainfrom
tensorworkerr:fix/root-filter-exclusion

Conversation

@tensorworkerr
Copy link
Copy Markdown
Contributor

@tensorworkerr tensorworkerr commented Jan 16, 2026

Previously, pnpm would implicitly exclude the root package if pnpm-workspace.yaml was present, even if the user explicitly provided filters that should have matched the root (e.g. --filter . or --filter root-pkg).

This change ensures that the implicit exclusion is only applied when NO user filters are provided.

fixes issue: #10462

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=178221229

@zkochan zkochan requested a review from Copilot January 16, 2026 13:56
Copy link
Copy Markdown
Contributor

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

This PR fixes an issue where pnpm would implicitly exclude the root package when pnpm-workspace.yaml is present, even when users explicitly provided filters that should match the root (like --filter . or --filter root-pkg).

Changes:

  • Modified the implicit root exclusion logic to only apply when no user filters are provided
  • Added comprehensive test coverage for both --filter <root> and --filter . scenarios
  • Added a changeset documenting this as a major change

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pnpm/src/main.ts Updated the condition for implicit root exclusion to check if filters array is empty
pnpm/test/recursive/filter.ts Added two test cases verifying that explicit filters on root package work correctly
.changeset/stupid-wasps-turn.md Added changeset documenting the breaking change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

},
})

execPnpmSync(['init'])
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The execPnpmSync(['init']) call appears redundant since the prepare() function already creates a package.json with the specified configuration. This extra init step may be unnecessary and could be removed to simplify the test.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, i see you already pushed a commit for this Thanks

version: '1.0.0',
})

execPnpmSync(['init'])
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The execPnpmSync(['init']) call appears redundant since the prepare() function already creates a package.json with the specified configuration. This extra init step may be unnecessary and could be removed to simplify the test.

Copilot uses AI. Check for mistakes.
@tensorworkerr
Copy link
Copy Markdown
Contributor Author

@zkochan Seems like one test deployment failed. It might not be related to this change and can be a flaky test but if not, please let me know, happy to dig deeper

@zkochan zkochan merged commit 29cb667 into pnpm:main Jan 16, 2026
11 of 12 checks passed
zkochan added a commit that referenced this pull request Jan 16, 2026
…10465)

* fix: prevent implicit root exclusion when user filters are provided

* docs: add changeset

* test: remove redundant init

---------

Co-authored-by: tensorworker <tensorworker@proton.me>
Co-authored-by: Zoltan Kochan <z@kochan.io>
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.

3 participants