next.js
996267da - turbo-tasks-backend: deterministic re-execution oracle in recompute_dependency test (#102048)

Commit
3 hours ago
turbo-tasks-backend: deterministic re-execution oracle in recompute_dependency test (#102048) ### What? The `recompute_dependency` test in `turbo-tasks-backend` no longer uses random markers to check that its tasks re-executed. It now uses deterministic execution ids. ### Why? `inner_compute` packed a 16-bit random tag into its output. The test asserted that this tag changed after a state change, as proof that `inner_compute` re-executed. Two executions pick the same tag about once in 65536 comparisons. The harness makes many comparisons per run, so the test occasionally failed even though the values were correct and both `inner_compute()` and `outer_compute()` had logged that they ran. ### How? - `inner_compute` and `outer_compute` each record an id from a monotonic atomic counter. Only these two test functions use the counter. - The test asserts that both ids strictly increase across the state change, as well as checking that the value goes from 1 to 2. It never checks exact id values, so other tests running in the same process don't affect it. - The ids stay valid across the harness's eviction and filesystem-cache iterations. The test cache directory is wiped on the first run, so any id restored from the cache was handed out earlier in the same process. - Every execution still produces a new cell value, so the test still exercises inner → outer invalidation. ### Verification - `cargo test --test recompute` passed 11 times in a row. With `--nocapture`, both ids increase on every harness iteration: the cold run, the post-evict memory runs and the filesystem-cache runs. - These `turbo-tasks-backend` suites pass: - `cargo test` - `cargo test --features verify_aggregation_graph` - `cargo test --features aggregation_update_no_batch` <!-- NEXT_JS_LLM --> <!-- fleet da0ad7d1-3f62-4d25-a114-313d2cbf5cad --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Fleet Dev Agent <fleet@vercel.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading