[turbopack] Remove incorrect debug_assert in try_read_task_cell - #91699
Conversation
Reading a cell is not restricted to non-top-level tasks — cells can be read strongly consistent from anywhere. The assert was misleading and overly restrictive. Co-Authored-By: Claude <noreply@anthropic.com>
Merging this PR will not alter performance
Comparing Footnotes
|
Failing test suitesCommit: d996581 | About building and testing Next.js
Expand output● instant-nav-panel › should show loading skeleton during SPA navigation after clicking Start
Expand output● allowed-dev-origins, basePath: "" › configured allowed origins › should block no-cors requests without a referer even when origins are configured
Expand output● segment cache (staleness) › expires runtime prefetches when their stale time has elapsed |
…cceed Now that the incorrect debug_assert_not_in_top_level_task was removed from try_read_task_cell, reading a cell from a top-level task is valid (cell reads are strongly consistent). Update the test accordingly. Co-Authored-By: Claude <noreply@anthropic.com>
Stats from current PR🟢 1 improvement
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
What?
Removes the
debug_assert_not_in_top_level_taskcall fromtry_read_task_cellinturbopack/crates/turbo-tasks/src/manager.rs.Why?
The assertion was wrong.
debug_assert_not_in_top_level_taskpanics with the message:The restriction only applies to eventually consistent reads (e.g. task output reads), which can return stale data if called from a top-level task (
.run_once(...)). Cell reads, however, are strongly consistent — they always return up-to-date data. There is no semantic reason to forbid reading a cell from a top-level task, and the assert was producing false positives in valid call sites.How?
Delete the three lines that guard and invoke
debug_assert_not_in_top_level_taskinsidetry_read_task_cell. The function itself and its usage intry_read_task_output/try_read_local_output(which are genuinely eventually-consistent) are unchanged.