Skip to content

fix(strict-execution-order): wrap eager modules that forward wrapped definers - #11186

Merged
hyfdev merged 1 commit into
mainfrom
hyfdev/10294-forwarded-definer-init-20261012
Oct 19, 2026
Merged

hyfdev merged 1 commit into
mainfrom
hyfdev/10294-forwarded-definer-init-20261012

Conversation

@hyfdev

@hyfdev hyfdev commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Under on-demand wrapping, a re-exported snapshot can observe a later mutation even though its forwarding module is imported at startup. This change preserves initialization order when that forwarding module retains local initialization code.

// state.js
export let state = 0;
export function bump() { state++; }

// value.js
import { state } from './state.js';
export const SNAPSHOT = state;

// shared.js
export { SNAPSHOT } from './value.js';
export const LOCAL = 'local';

// main.js
import { LOCAL } from './shared.js';
import { bump } from './state.js';
export const local = LOCAL;
bump();
export const load = () => import('./lazy.js').then((m) => m.SNAPSHOT);

// lazy.js
export { SNAPSHOT } from './shared.js';

Enable strictExecutionOrder and experimental.onDemandWrapping, preserve entry exports with preserveEntrySignatures: 'allow-extension', and place only value.js in a manual chunk group with includeDependenciesRecursively: false. With these settings, await load() returned 1; it returns 0.

Here, tree shaking removes the re-export statement, and eager shared.js emits no call to initialize value.js. The on-demand planner wraps modules whose initializers would call an already selected wrapper, repeating through forwarding chains. It resolves those calls with every eligible module wrapped, since wrapping determines which module owns a re-export's initialization.

Transparent forwarding modules, whose wrappers own no initialization calls, and mixed modules dropped by constant inlining have separate initialization gaps in both strict modes, tracked in #10294.

Part of #10294.

@hyfdev
hyfdev changed the base branch from hyfdev/seo-init-reachability-20261008 to hyfdev/11151-retained-init-timing-20261011 October 12, 2026 06:04
@hyfdev
hyfdev added this pull request to stack #11163 October 12, 2026 06:04
@netlify

netlify Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 8a5792f
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6ad6303b2784ee55c9f09432
😎 Deploy Preview https://deploy-preview-11186--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://hyfdev-10294-forwarded-definer-init-20261012-rolldown-rs.voidzero-docs.workers.dev (commit 8a5792f)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://869ef3f1-rolldown-rs.voidzero-docs.workers.dev 8a5792f 2026-10-19T15:05:22.000Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://beca37ed-rolldown-rs.voidzero-docs.workers.dev fbd3f65 2026-10-14T03:44:02.369Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://f6deba5c-rolldown-rs.voidzero-docs.workers.dev 52233c2 2026-10-14T03:36:58.148Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://a4f2f7c1-rolldown-rs.voidzero-docs.workers.dev 24da912 2026-10-13T07:57:42.576Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://f29dcf8e-rolldown-rs.voidzero-docs.workers.dev 73df5c4 2026-10-12T06:42:04.655Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://9764e5ea-rolldown-rs.voidzero-docs.workers.dev 27cde68 2026-10-12T06:29:40.996Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://109ec462-rolldown-rs.voidzero-docs.workers.dev 591f121 2026-10-12T06:06:35.752Z Visit the dashboard ↗

@hyfdev
hyfdev removed this pull request from stack #11163 October 12, 2026 06:07
@hyfdev
hyfdev changed the base branch from hyfdev/11151-retained-init-timing-20261011 to hyfdev/seo-init-reachability-20261008 October 12, 2026 06:07
@hyfdev
hyfdev added this pull request to stack #11187 October 12, 2026 06:07
@hyfdev
hyfdev force-pushed the hyfdev/10294-forwarded-definer-init-20261012 branch from 591f121 to 27cde68 Compare October 12, 2026 06:27
Base automatically changed from hyfdev/seo-init-reachability-20261008 to main October 12, 2026 06:39
@hyfdev
hyfdev force-pushed the hyfdev/10294-forwarded-definer-init-20261012 branch 2 times, most recently from 73df5c4 to 24da912 Compare October 13, 2026 07:56
@hyfdev
hyfdev marked this pull request as ready for review October 13, 2026 08:01
Copilot AI balanced review requested due to automatic review settings October 13, 2026 08:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codspeed

codspeed Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 4 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 7 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing hyfdev/10294-forwarded-definer-init-20261012 (fbd3f65) with main (e148823)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@hyfdev
hyfdev force-pushed the hyfdev/10294-forwarded-definer-init-20261012 branch 2 times, most recently from 52233c2 to fbd3f65 Compare October 14, 2026 03:41

hyfdev commented Oct 19, 2026 •

Copy link
Copy Markdown
Member Author

Merge activity

  • Oct 19, 2:58 PM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 19, 2:58 PM UTC: hyfdev added this pull request to the Graphite merge queue.
  • Oct 19, 3:00 PM UTC: The Graphite merge queue couldn't merge this PR because it failed for an unknown reason.

…definers (#11186)

Under on-demand wrapping, a re-exported snapshot can observe a later mutation even though its forwarding module is imported at startup. This change preserves initialization order when that forwarding module retains local initialization code.

```js
// state.js
export let state = 0;
export function bump() { state++; }

// value.js
import { state } from './state.js';
export const SNAPSHOT = state;

// shared.js
export { SNAPSHOT } from './value.js';
export const LOCAL = 'local';

// main.js
import { LOCAL } from './shared.js';
import { bump } from './state.js';
export const local = LOCAL;
bump();
export const load = () => import('./lazy.js').then((m) => m.SNAPSHOT);

// lazy.js
export { SNAPSHOT } from './shared.js';
```

Enable `strictExecutionOrder` and `experimental.onDemandWrapping`, preserve entry exports with `preserveEntrySignatures: 'allow-extension'`, and place only `value.js` in a manual chunk group with `includeDependenciesRecursively: false`. With these settings, `await load()` returned `1`; it returns `0`.

Here, tree shaking removes the re-export statement, and eager `shared.js` emits no call to initialize `value.js`. The on-demand planner wraps modules whose initializers would call an already selected wrapper, repeating through forwarding chains. It resolves those calls with every eligible module wrapped, since wrapping determines which module owns a re-export's initialization.

Transparent forwarding modules, whose wrappers own no initialization calls, and mixed modules dropped by constant inlining have separate initialization gaps in both strict modes, tracked in #10294.

Part of #10294.
@graphite-app
graphite-app Bot force-pushed the hyfdev/10294-forwarded-definer-init-20261012 branch from fbd3f65 to 8a5792f Compare October 19, 2026 14:59
@hyfdev
hyfdev merged commit cef9e5c into main Oct 19, 2026
36 checks passed
@hyfdev
hyfdev deleted the hyfdev/10294-forwarded-definer-init-20261012 branch October 19, 2026 15:21
@rolldown-guard rolldown-guard Bot mentioned this pull request Oct 21, 2026
shulaoda added a commit that referenced this pull request Oct 21, 2026
## [1.2.15] - 2026-10-21

### 🚀 Features

- rolldown_plugin_vite_resolve: add `isBundled` to pick the browser-external stub format (#11260) by @h-a-n-a
- dev: mark entry modules in the HMR module graph (#11252) by @h-a-n-a
- mark module starts with `// <id>` comments instead of `#region` pairs (#11235) by @IWANABETHATGUY

### 🐛 Bug Fixes

- plugin: stop `this.resolve` recursion between plugins with `skipSelf: true` (#11181) by @anzal1
- rolldown_plugin_vite_resolve: handle external `require` for `ssr.target: 'webworker'` (#11205) by @sapphi-red
- rolldown_plugin_vite_build_import_analysis: only wrap dynamic imports with static specifiers in __vitePreload (#10879) by @smeng9
- strict-execution-order: wrap eager modules that forward wrapped definers (#11186) by @hyfdev
- chunk-import-map: keep common chunk keys unique when enabling inline common chunks (#11230) by @hyfdev
- only register signal-exit handler when a trace subscriber is active (#11208) by @DaniilIsupov

### 🧪 Testing

- fold hand-unrolled Rust test tables (#11212) by @Brooooooklyn

### ⚙️ Miscellaneous Tasks

- deps: upgrade oxc to 0.155.0 (#11228) by @Dunqing
- rollup-tests: retriage failed tests (#11251) by @sapphi-red
- deps: update rollup submodule for tests to v4.64.12 (#11249) by @rolldown-guard[bot]
- deps: update test262 submodule for tests (#11242) by @rolldown-guard[bot]

### ❤️ New Contributors

* @anzal1 made their first contribution in [#11181](#11181)
* @smeng9 made their first contribution in [#10879](#10879)
* @DaniilIsupov made their first contribution in [#11208](#11208)

Co-authored-by: shulaoda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants