fix: Recompute eager hashing flag after prepending global inputs (#13949)
fixes #13948
### Description
`eager` on `TaskInputs` is worked out once in `from_processed`, and it
is false for a task whose only inputs are jit globs.
`prepend_global_inputs` then pushes the `global.inputs` globs into
`inputs.globs` but leaves `eager` at false, so the eager hashing pass is
skipped and the jit pass only looks at `jit_globs`. the global globs end
up hashed by neither pass, and the task keeps returning cache hits after
a global input file changes.
this adds `TaskInputs::refresh_eager` and calls it at the end of
`prepend_global_inputs`, so a task that stops being jit only gets its
eager pass back. `from_processed` now uses the same method instead of
repeating the expression, so the two cannot drift apart again.
a task that is still jit only after the call is untouched, since with no
global inputs `prepend_global_inputs` returns early.
### Testing Instructions
the repro is at
https://github.com/Nixxx19/turbo-jit-global-inputs-repro. clone it, `npm
install`, then run `npx turbo build --output-logs=hash-only` twice, edit
`config.txt`, and run it a third time. on 2.10.13-canary.1 the plain
task is a cache miss and the jit only task is a cache hit with the hash
it had before. the same repo invalidates correctly on
`globalDependencies`, and editing a file its jit globs match does
invalidate it, so it is only the global inputs going missing.
`test_global_inputs_invalidate_jit_only_task` in
`crates/turborepo/tests/global_inputs_test.rs` covers it end to end. on
the unit side `test_prepend_global_inputs_marks_jit_only_task_eager`
fails without the change and passes with it, and
`test_prepend_global_inputs_leaves_jit_only_task_alone_without_global_inputs`
guards the case that should stay lazy.
worth flagging: i could not build the full binary here, zig 0.15.2
cannot link libc against the macos 26 sdk on this machine and it fails
on a plain hello world too, so that is unrelated to this change. what i
did run locally is `turborepo-types` and `turborepo-turbo-json` green,
`cargo fmt --check` clean, and the `prepend_global_inputs` tests against
a copy of the function in a crate that does build, where the four
existing tests stay green and the new one flips with the fix. the
integration test still needs ci.
---------
Signed-off-by: nityam <185968020+Nixxx19@users.noreply.github.com>
Co-authored-by: nityam <185968020+Nixxx19@users.noreply.github.com>
Co-authored-by: Anthony Shew <anthonyshew@gmail.com>