vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.02k stars 1.79k forks source link

Package not found when filtering with package and git specifier #9096

Closed Xiot closed 1 week ago

Xiot commented 2 weeks ago

Verify canary release

Link to code that reproduces this issue

https://github.com/Xiot/turbo-filter-break

What package manager are you using / does the bug impact?

Yarn v2/v3/v4 (node_modules linker only)

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

turbo 2.1.1-canary.0

Describe the Bug

When using a filter like

turbo run lint '--filter=...@repo/eslint-config[HEAD~1]'

turbo returns an error if @repo/eslint-config wasn't modified in the latest commit.

× No package found with name '@repo/eslint-config' in workspace

I originally brought this up in discord. https://discord.com/channels/818588653005176832/1279503316111327292/1279503316111327292

The use case for this, is that I want to run lint on any package that changes, or if the eslint-config package changes, I want to run lint on everything.

turbo run lint '--filter=...@repo/eslint-config[HEAD~1]' '--filter=[HEAD^1]'

Expected Behavior

The package is found, and in the case of the sha 05b00c9 in the linked repo, no tasks are executed.

To Reproduce

git clone https://github.com/Xiot/turbo-filter-break.git
cd turbo-filter-break
turbo run lint '--filter=...@repo/eslint-config[HEAD~1]'

Additional context

The filter worked correctly in 1.13.4, however fails in 2.0.0.

Looking at the breaking changes in the 2.0.0 release, by gut feeling is that it is related to https://github.com/vercel/turborepo/pull/8142

chris-olszewski commented 1 week ago

I see the issue here the [HEAD~1] part of the filters out @repo/eslint-config causing the name filter to fail as it doesn't find anything. I'll rework the filter logic so the validation logic doesn't reuse the already filtered package set.

Xiot commented 1 week ago

Thanks for the quick fix!