fix: Include the managed execution fingerprint in `turbo query` task hashes (#15191)
`turbo query` skipped managed tool selection in JavaScript-only
repositories with `futureFlags.experimentalSetup` and `turbo.lock`, so
it computed unmanaged task hashes while `turbo run` included the managed
execution fingerprint (`turborepo.setup.execution.v1:<fingerprint>`).
That hash mismatch caused remote cache lookups driven by `turbo query`
to miss on managed JS-only repositories and risked matching stale
unmanaged artifacts after a toolchain upgrade.
- Select and activate managed tools for `turbo query` the same way as
`turbo run` and `turbo watch`, so task hashes carry the same managed
execution fingerprint and missing, damaged, or drifted setups fail with
`turbo setup` guidance instead of returning unmanaged hashes.
- Keep `turbo ls`, `turbo query ls`, `turbo boundaries`, `turbo
devtools`, `turbo trace`, and the no-task listing on the probe-only
discovery path because they never hash tasks.
- Validate repository-local `turbo` pins for `turbo query` in managed
JS-only repositories before handoff, while leaving `turbo query ls`
unchanged.
Unmanaged repositories and repositories without
`futureFlags.experimentalSetup` are unchanged.
Fixes
[PIPE-9049](https://linear.app/vercel/issue/PIPE-9049/fix-turbo-query-omitting-managed-execution-fingerprint-for-js-only)
<details><summary>Validation and details</summary>
### Validation
- `cargo fmt --check` — passed.
- `cargo check -p turborepo-cli -p turbo --all-targets` — passed.
- `cargo clippy -p turborepo-cli -p turbo --all-targets -- -D warnings`
— passed.
- `cargo test -p turborepo-cli --lib` — 648 passed, 0 failed, 2 ignored.
- `cargo test -p turbo --test setup_run_journey --test
setup_lock_affected_test --test setup_run_ecosystems --test
final_hash_contract --test managed_run_pin_test --test
managed_info_exits --test query` — 40 passed, 0 failed.
### Details
- Before the fix,
`query_task_hashes_match_managed_run_and_track_tool_upgrades` in
`setup_run_journey` failed with `turbo query` returning
`486e080279beebc4` while `turbo run build --dry=json` returned
`dc448f704974b937`, and an incompatible local `turbo` pin ran directly
during `turbo query` instead of reporting upgrade guidance.
- After the fix, `turbo query` matches `turbo run build --dry=json`
before and after a Node version upgrade in `.nvmrc` + `turbo.lock`,
fails closed on declaration drift and damaged installations, and refuses
incompatible local pins while `turbo ls` and `turbo query ls` keep
working in JS-only repositories.
- Updated `setup_lock_affected_test` to provision a fixture `turbo.lock`
and tool store on qualified hosts so both `turbo run --dry=json` and
`turbo query` exercise managed lockfile change detection end to end.
</details>
Co-authored-by: vercel-v[bot]
<353008837+vercel-v[bot]@users.noreply.github.com>
Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>