next.js
81d6086b - turbo-tasks-backend: fix transient root test race (#101700)

Commit
7 hours ago
turbo-tasks-backend: fix transient root test race (#101700) ## Summary Fixes a race in `parentless_calls_of_transient_tasks_are_only_roots_if_root_functions` (added in #101614). The test created the transient `root` operation and made a parentless call to `transient_endpoint` in the same `tt.run` closure, then asserted that the endpoint had exactly one transient ref. The operation has no output yet, so it is scheduled right away, and `tt.run` doesn't wait for it to finish. When it runs, it calls the same `transient_endpoint` task (`TransientValue` arguments compare by value). `connect_children` then adds a second transient ref for that transient parent edge. Whenever the operation finished before the assertion ran, the test saw `left: 2, right: 1`. The backend behavior is correct, since both refs are legitimate. The fix only reorders the test: it makes and checks the parentless endpoint call in its own `tt.run` before the operation exists, then creates the operation and checks that it is a root. All the original assertions are kept. ## Verification - Original test under CPU load on 8 cores: 98/300 and 91/300 runs failed at `437:5` with `left: 2`, matching the canary CI failure. - Fixed test: 0/300 failures idle and 0/1000 under the same CPU load. - Diagnostic A/B (not committed): waiting for the operation to complete before the original assertion fails every time with `left: 2`. The fixed test passes with the same wait. - `cargo test -p turbo-tasks-backend --test existing_outputs_from_new_roots`: 4 passed. - `cargo clippy -p turbo-tasks-backend --test existing_outputs_from_new_roots -- -D warnings` passes. <!-- NEXT_JS_LLM --> <!-- fleet 34cec176-22f1-48d8-bee2-848abef58cb3 --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading