fix(code-splitting): gate entry facades on post-lowering import edges#10335
Draft
hyfdev wants to merge 2 commits into
Draft
fix(code-splitting): gate entry facades on post-lowering import edges#10335hyfdev wants to merge 2 commits into
hyfdev wants to merge 2 commits into
Conversation
hyfdev
force-pushed
the
codex/facade-gate-post-lowering-edges
branch
from
July 17, 2026 07:59
0688d2e to
1f73c9f
Compare
hyfdev
force-pushed
the
codex/flag-off-runtime-sweep-chunk-order
branch
from
July 17, 2026 08:18
39bb381 to
4957c8a
Compare
hyfdev
force-pushed
the
codex/facade-gate-post-lowering-edges
branch
from
July 17, 2026 08:18
1f73c9f to
4206c33
Compare
This was referenced Jul 17, 2026
hyfdev
force-pushed
the
codex/flag-off-runtime-sweep-chunk-order
branch
from
July 18, 2026 05:35
4957c8a to
cbe7f25
Compare
hyfdev
force-pushed
the
codex/facade-gate-post-lowering-edges
branch
from
July 18, 2026 05:35
4206c33 to
0f463fb
Compare
hyfdev
force-pushed
the
codex/flag-off-runtime-sweep-chunk-order
branch
from
July 18, 2026 05:48
cbe7f25 to
f8ec80d
Compare
hyfdev
force-pushed
the
codex/facade-gate-post-lowering-edges
branch
from
July 18, 2026 05:48
0f463fb to
ea9b969
Compare
hyfdev
force-pushed
the
codex/flag-off-runtime-sweep-chunk-order
branch
3 times, most recently
from
July 19, 2026 12:49
40e86d8 to
0f69617
Compare
graphite-app
Bot
force-pushed
the
codex/flag-off-runtime-sweep-chunk-order
branch
from
July 19, 2026 15:25
0f69617 to
ab2a338
Compare
Base automatically changed from
codex/flag-off-runtime-sweep-chunk-order
to
main
July 19, 2026 15:30
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
The strict-order entry-facade gate decided whether to split an interop-wrapped entry into a facade using the pre-lowering chunk import edges. Lowering's own
init_*forwarding can add the first cross-chunk edge into such an entry's chunk, and when that edge closes no cycle the fixpoint converges without revisiting the facade decision — so the gate never saw it. This routes the gate through the converged post-lowering edges instead, so an entry whose chunk is only reached by a lowering-added hop is still split. Over-approximation is the safe direction (more facades are always legal; wrap-all splits unconditionally).Verified mechanism
create_order_wrap_entry_facadesbuildsimported_chunksfromanalysis.import_edges(order_wrapping.rs:214), whichanalyze_execution_orderset to the pre-lowering baseline and returned at the end.post_lowering_import_edgesevery round and threw them away after cycle detection. This captures the converged round'spost_edges(the round whereadded == 0) and returns those asOrderAnalysis.import_edges.create_order_wrap_entry_facadesis the only consumer of that field (grep-verified); the wrap-all path builds empty edges and short-circuits (on_demand == false), so it is unchanged.Behavior / snapshot impact
function/experimental/strict_execution_order/facade_gate_emergent_edge(on-demand): a CommonJS entrysec(WrapKind::Cjs) co-hosts the interop-wrappedtin groupgs; an order-wrappedwrapperin chunk A carries a tree-shakenexport * from './f.js'whose droppedfimportsunusedfromt, so the excluded-statement metadata projects aninit_tforward — a post-loweringA -> gsedge with no baseline counterpart.seckeeps its inlinerequire_sec()trigger in the shared chunk (nosec2.js); with this fix the gate sees the emergent edge and splitssecinto a facade (sec.jsthin trigger +sec2.jsimpl). The only diff between the two builds is the added facade chunk._test.mjs): loading only the root does not runsec's program; loadingsecdirectly runs it once.Fixture outcome — constructibility verdict
The reviewer expected a directed fixture where "evaluating the importing chunk runs the whole entry program early." I could construct the facade-decision difference (above) but not an executable early-run, and the reason is structural — established over ≥7 distinct attempts (co-hosted order-wrapped target with a TLA entry, a CJS entry, and a plain entry; the excluded forwarder targeting the entry directly vs. a co-hosted module; single- vs. two-entry; TLA vs. CJS interop). A post-lowering-only edge (absent from the baseline) comes from exactly two sources:
dist/a.jscalls noinit_t); it exists only inpost_lowering_import_edgesfor cycle detection. So it never actually imports the entry's chunk at runtime — the facade the fix creates is a correct conservative guard, not a fix for a live crash.A rendered, baseline-invisible edge into an interop entry's chunk therefore does not appear constructible; the executable early-run is not reachable through the facade gate. The fixture pins the facade-gate behavior change directly (snapshot differentiator) and the fix stands as the correct over-approximation the review asked for. If a rendered path is later found, it converts straight into an executed assertion on this same fixture.
Validation
cargo test -p rolldown— 1872 passed (+1 new fixture, executed under node); only the 5 known environmental failures (cjs_module_lexer_compat×3 +npm_packages/util_deprecateneedpnpm install;test262_module_codeneeds the submodule). No existing snapshot changed (the localsymbols_ns2drift is pre-existingnode_modules-resolution noise, reproducible with this change reverted, and is not committed).cargo fmt --all --check— clean;cargo clippy -p rolldown --all-targets -- -D warnings— clean.Follow-up to #10104; addresses item 1 of #10104 (comment)