feat: Select runnable task entrypoints (#13452)
## Summary
- Fixes #937
- Add the `futureFlags.strictTaskEntrypointSelection` opt-in
- Use command-bearing package tasks as requested entrypoints while
retaining internal transit tasks
- Preserve scriptless orchestration graphs and prune orchestration
branches that cannot reach runnable work
- Support task-level filter traversal, implicit Cargo tasks, command
overrides, and proxy tasks
- Update schemas, types, docs, and architecture notes
## Enable the flag
```jsonc
{
"$schema": "https://turborepo.dev/schema.json",
"futureFlags": {
"strictTaskEntrypointSelection": true
},
"tasks": {
"build": {
"dependsOn": ["^build"]
},
"test": {
"dependsOn": ["build"]
}
}
}
```
## Behavior examples
### Requested tasks start where they can run
Given `app` has a `test` script and `lib` does not:
```console
$ turbo run test --dry
```
Before enabling the flag, both `app#test` and `lib#test` can be task
entrypoints. With the flag enabled, only `app#test` is an entrypoint.
Its configured dependencies, including scriptless transit tasks needed
for ordering and hashing, remain in the graph.
### Scriptless orchestration reaches runnable work
Given this configuration:
```jsonc
{
"tasks": {
"package-checks": {
"dependsOn": ["package:types"]
},
"package:types": {}
}
}
```
If only `pkg-a` defines a `package:types` command, then:
```console
$ turbo run package-checks --dry
```
retains `pkg-a#package-checks -> pkg-a#package:types` and removes
package branches that cannot reach runnable work. If no package defines
a command anywhere in the requested graph, the fully scriptless
orchestration graph is preserved.
### Filters do not manufacture missing entrypoints
If `@repo/types` has no `test` command:
```console
$ turbo run test --filter=@repo/types --dry
```
selects no tasks. Explicit dependency traversal can still cross a
missing requested task:
```console
$ turbo run test --filter=@repo/types... --dry
```
and retain runnable dependencies reached through it.
## Testing
- `cargo lint`
- `cargo fmt --all -- --check`
- `cargo check -p turborepo-lib -p turborepo-engine -p turbo --tests`
- `cargo test -p turborepo-lib run::task_filter::tests`
- `cargo test -p turbo --test task_entrypoints_test`
- `cargo test -p turbo --test cargo_workspace_test cargo_verification`
- `pnpm --filter @turbo/types verify-schema`
- local-binary dry runs for `test`, `package-checks`, `package:types`,
`topo`, `quality`, and filtered mixed-task runs