turbopack: ignore deferred circuit breaker cycles - #98929
Draft
lukesandberg wants to merge 1 commit into
Draft
lukesandberg wants to merge 1 commit into
lukesandberg wants to merge 1 commit into
Conversation
Contributor
Tests PassedCommit: fff8442 |
lukesandberg
added this pull request to stack #98930
September 19, 2026 05:25
Co-authored-by: Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
lukesandberg
force-pushed
the
codex/side-effects/circuit-breaker-edges
branch
from
September 19, 2026 19:27
9ddf016 to
fff8442
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Export circuit breakers protect evaluation cycles by exposing lazy export getters before module execution. A cycle that closes only through a deferred module edge cannot be traversed during evaluation, so applying circuit-breaker code generation to it adds unnecessary early export setup and getters.
This change reuses the evaluation timing recorded on module-reference binding metadata when selecting circuit-breaker cycles. The cycle detector still considers only parallel, used edges, and now also excludes edges proven to execute after their parent module finishes evaluating. Deferred references remain in every reachability, export-usage, chunking, and runtime-loading path; only evaluation-cycle detection is narrowed.
Separate scope-hoisting fixtures pin both sides of the behavior: a cycle closed by a deferred
require()uses normal bottom-of-factory value exports, while an all-eager cycle retains early getter initialization.Verification
cargo test -p turbopack-core module_graph --libcargo nextest run -p turbopack-tests -E 'test(snapshot) | test(/circuit_breaker_(deferred|eager)_edge/) | test(/side_effect_optimization|side_effects_optimization/) | test(/async_modules/) | test(/execution__turbopack__scope_hoisting/) | test(/cjs_remove_unused_imports/)'cargo check -p turbopack-core -p turbopack-ecmascript -p turbopack-tests