fix(finalizer): skip wrapped ESM init fallback for static cross-chunk barrels#9520
Draft
IWANABETHATGUY wants to merge 4 commits into
Draft
fix(finalizer): skip wrapped ESM init fallback for static cross-chunk barrels#9520IWANABETHATGUY wants to merge 4 commits into
IWANABETHATGUY wants to merge 4 commits into
Conversation
Member
Author
How to use the Graphite Merge QueueAdd the label graphite: merge-when-ready to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
✅ Deploy Preview for rolldown-rs canceled.
|
62bc080 to
a8eef7d
Compare
Rely on the runtime entry import to surface a missing init_* import (it throws ReferenceError on broken output) for the three eager-path fixtures; keep the structural init_* scan only in 9502_deep_chain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Keep only the `9502` namespace-import fixture and drop the three variants. Verified by reverting the fix against each: - `9502` (namespace import): crashes with `ReferenceError: init_shared is not defined` -- the exact issue repro. - `9502_named_import`: passes without the fix; the orphan `init_shared` is still correctly imported, so it only differed cosmetically. - `9502_side_effect_import`: output byte-identical with/without the fix. - `9502_deep_chain`: catches the bug, but the fix decision is made independently per import-record, so multi-hop adds no coverage the single-hop `9502` does not already guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 15, 2026
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
Fixes #9502.
When a non-wrapped barrel module is already executed through the current chunk's static dependency chain, the finalizer should not emit an extra fallback
init_*()call for wrapped ESM re-export owners. That late synthetic call is not visible to cross-chunk import computation, so it can produce unbound identifiers such asinit_shared()in the importer chunk.This change extends the existing same-chunk guard to also cover statically imported chunks, while preserving the fallback for barrels that do not execute before the importer.
Changes
Tests
just dt crates\rolldown\tests\rolldown\issues\9502\_config.jsonjust dt crates\rolldown\tests\rolldown\issues\9502_named_import\_config.jsonjust dt crates\rolldown\tests\rolldown\issues\9502_side_effect_import\_config.jsonjust dt crates\rolldown\tests\rolldown\issues\9502_deep_chain\_config.jsonjust dt crates\rolldown\tests\rolldown\issues\8950\_config.jsonjust lint-rust