fix: Prevent filterUsingTasks --filter from pulling dependents into Task Graph#12535
Merged
anthonyshew merged 2 commits intomainfrom Apr 2, 2026
Merged
fix: Prevent filterUsingTasks --filter from pulling dependents into Task Graph#12535anthonyshew merged 2 commits intomainfrom
filterUsingTasks --filter from pulling dependents into Task Graph#12535anthonyshew merged 2 commits intomainfrom
Conversation
…lterUsingTasks filter_engine_to_tasks() was calling retain_affected_tasks() which does a reverse DFS (finding dependents) before a forward DFS (finding dependencies). This caused --filter ./packages/* to include apps that depend on those packages. Add retain_filtered_tasks() that does forward DFS only, and use it in the --filter codepath. Dependent expansion is already handled during selector resolution via include_dependents.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
filterUsingTasks --filter from pulling dependents into Task Graph
github-actions Bot
added a commit
that referenced
this pull request
Apr 2, 2026
## Release v2.9.4-canary.3 Versioned docs: https://v2-9-4-canary-3.turborepo.dev ### Changes - release(turborepo): 2.9.4-canary.2 (#12533) (`d2944c4`) - docs: Send siteId as label on feedback GitHub issues (#12527) (`6644f34`) - Replace local ai-agent-detection with @vercel/agent-readability (#12528) (`86d34cc`) - fix: Prevent `filterUsingTasks` `--filter` from pulling dependents into Task Graph (#12535) (`d3aca27`) Co-authored-by: Turbobot <turbobot@vercel.com>
github-actions Bot
added a commit
that referenced
this pull request
Apr 5, 2026
## Release v2.9.4 Versioned docs: https://v2-9-4.turborepo.dev ### Changes - release(turborepo): 2.9.3 (#12524) (`0b48404`) - fix: Always update $schema URL to versioned format during migration (#12529) (`389cd5e`) - release(turborepo): 2.9.4-canary.1 (#12530) (`7f8cb9a`) - fix: Support `turbo.jsonc` in codemod transforms (#12532) (`e570d29`) - feat: Add incremental task caching (#12531) (`39c4934`) - release(turborepo): 2.9.4-canary.2 (#12533) (`d2944c4`) - docs: Send siteId as label on feedback GitHub issues (#12527) (`6644f34`) - Replace local ai-agent-detection with @vercel/agent-readability (#12528) (`86d34cc`) - fix: Prevent `filterUsingTasks` `--filter` from pulling dependents into Task Graph (#12535) (`d3aca27`) - release(turborepo): 2.9.4-canary.3 (#12536) (`074a0ef`) - build(deps): Bump @xmldom/xmldom from 0.8.11 to 0.8.12 in /examples/with-react-native-web (#12537) (`295a89b`) - fix: Only enforce signature key length for keys that exist (#12538) (`27ac52f`) - release(turborepo): 2.9.4-canary.4 (#12539) (`f745fc7`) - fix: Validate engine concurrency after task-level filtering (#12540) (`a38658a`) - release(turborepo): 2.9.4-canary.5 (#12541) (`ac99fac`) - fix: Preserve prerelease info in schema URL during codemod migration (#12542) (`81b39a5`) - feat: Allow `--affected` and `--filter` to be combined (#12543) (`98ab3b6`) - fix(config): Deep-merge nested OTEL config across priority sources (#12513) (`f214dc8`) - release(turborepo): 2.9.4-canary.6 (#12544) (`0e763f8`) - fix: Retain microfrontend proxy tasks when using `filterUsingTasks` (#12545) (`a4b943e`) - release(turborepo): 2.9.4-canary.7 (#12546) (`b7d89a4`) - fix: Bun workspace lockfile pruning producing invalid output (#12548) (`0346076`) - fix: Respect dirty .gitignore patterns during task input hashing (#12557) (`1254916`) - release(turborepo): 2.9.4-canary.8 (#12558) (`01802b4`) --------- Co-authored-by: Turbobot <turbobot@vercel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--filter ./packages/*withfilterUsingTasksenabled was incorrectly including apps in the task graphfilter_engine_to_tasks()was callingretain_affected_tasks()which does a reverse DFS (finding dependents) before a forward DFS (finding dependencies) — correct for--affected, wrong for--filterEngine::retain_filtered_tasks()that does forward DFS only (transitive dependencies for execution, no dependent expansion)Why
When a user writes
--filter ./packages/*, they expect only tasks frompackages/*to run. The...dependent/dependency expansion is handled during selector resolution — the final pruning step should only add upstream dependencies needed for execution, not pull in downstream consumers.How to test
cargo test -p turborepo-lib -- task_filter— includes a regression test (filter_does_not_include_dependents) that sets upapp#build -> ui#buildand asserts filtering touidoes not pull inapp.