turbo
875285e2 - fix: Filter phantom tasks from affectedTasks query results (#12324)

Commit
48 days ago
fix: Filter phantom tasks from affectedTasks query results (#12324) ## Summary - `affectedTasks` returned tasks for packages that don't have the corresponding script in `package.json` (e.g. `lib-no-test#test` when `lib-no-test` has no `test` script but root `turbo.json` defines `test`) - Adds a `script.is_some()` check to the resolver filter, consistent with how `turbo run` and `packages { tasks }` already behave - Adds integration test with a fixture package (`lib-no-test`) that has `build`/`typecheck` but no `test` script ## Background `turbo query` builds its engine with `add_all_tasks()` + `do_not_validate_engine()`, creating entries for every `(workspace, task)` combination from `turbo.json` without checking `package.json` scripts. This means phantom tasks (where a package lacks the script) end up in engine iteration. `RepositoryTask::new()` already correctly populates `script` from `package.json` — the field just wasn't being used for filtering. `turbo run` validates the engine and checks `package_has_task`, and `packages { tasks }` reads directly from `package.json` scripts — both correctly exclude phantom tasks. This change makes `affectedTasks` consistent with them.
Author
Parents
Loading