Skip to content

test(code-splitting): pin flag-off wrapped-esm init emission#10324

Merged
graphite-app[bot] merged 1 commit into
mainfrom
codex/strict-flag-off-init-pins
Jul 21, 2026
Merged

test(code-splitting): pin flag-off wrapped-esm init emission#10324
graphite-app[bot] merged 1 commit into
mainfrom
codex/strict-flag-off-init-pins

Conversation

@hyfdev

@hyfdev hyfdev commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Adds three executable flag-off regression fixtures for wrapped-ESM init emission changes that landed with #10104. None enables strictExecutionOrder, and this PR changes no production source.

The earlier version of this PR required each barrel directly, which wrapped the immediate importee and bypassed the shared init-target collector it claimed to cover. The two collector fixtures now keep the immediate barrel at WrapKind::None in a shared chunk, while later require() calls wrap the leaf owners and make their init symbols reachable from the main chunk.

Coverage

Importer-local namespace liveness

namespace_liveness_gating imports the barrel namespace but reads only ns.a(). A second entry places the unwrapped barrel in a shared chunk; later requires make both wrapped leaf init symbols reachable.

  • Current output emits only init_leaf_a() at the namespace-import position. init_leaf_b() stays at its later explicit require position.
  • Pre-feat(code-splitting): wrap strict execution order modules on demand #10104 output emitted init_leaf_a(), init_leaf_b() together at the namespace-import position.
  • The shared barrel still evaluates both leaves exactly once; runtime order is A, B, BEFORE_REQUIRE:a, MAIN.

Sorted, non-ambiguous star-export routing

ambiguous_star_reexport has two wrapped leaves that both export x. The entry uses a real export * from record; a dynamic CommonJS re-export keeps that record included, while the second entry keeps the immediate barrel unwrapped and in another chunk.

  • Current output excludes ambiguous x from the collector's sorted, non-ambiguous export map and emits no owner init before __reExport(...).
  • Pre-feat(code-splitting): wrap strict execution order modules on demand #10104 output selected an ambiguous owner and emitted init_mod_a() before __reExport(...).
  • Runtime confirms x is absent and both owners still evaluate exactly once through the shared barrel.

Excluded re-export to a TLA wrapper

excluded_reexport_tla uses codeSplitting: false, so an inline dynamic import wraps the barrel and its static dependency chain even with strict execution order disabled. With moduleSideEffects: false, the carrier's unused re-export is excluded while the same TLA leaf remains live through a separate used import.

Behavior / snapshot impact

Tests only: two existing fixtures are corrected, one TLA fixture is added, and their generated snapshots are pinned. No existing production code or unrelated snapshot changes.

Validation

  • Rebased onto main at cccf1d0d849c71e80c02fe3ff17a97192f3bf258.

  • Generated all three fixtures with the macOS native binding from current-main CI run 29795703407; every _test.mjs passed under Node.

  • Compared each committed snapshot byte-for-byte with those generated assets after applying the integration harness's runtime-module hiding.

  • Re-ran the same sources with the pre-feat(code-splitting): wrap strict execution order modules on demand #10104 binding from CI run 29559371389: both collector fixtures show the obsolete extra init, and the TLA fixture logs CARRIER:undefined.

  • vp fmt ... --check, typos, JS syntax checks, JSON parsing, and git diff --check pass. The pre-commit vp check --fix hook also completed cleanly.

  • CI run 29819995357: Repo, Rust, Node, Cargo, WASI, native-build, and Node 20/22/24 test jobs passed. Vite Test Ubuntu and the three Ubuntu Dev Server jobs stopped before tests because the Vite rolldown-canary branch no longer rebases cleanly onto vite/main (pnpm-lock.yaml conflict); this is unrelated Vite checkout noise.

AI usage disclosure

Per the AI Usage Policy, OpenAI Codex was used to rebase and review the PR, design the corrected regression shapes, and verify generated output. I reviewed the final diff and validation evidence.


Follow-up to #10104; addresses Major 2b/2c from the review discussion: #10104 (comment)

@hyfdev
hyfdev force-pushed the codex/strict-entry-transitive-init-gate branch from 4306dd7 to 3bbc10b Compare July 16, 2026 15:14
@hyfdev
hyfdev force-pushed the codex/strict-flag-off-init-pins branch from 3e47ed5 to 5d53731 Compare July 16, 2026 15:14
@hyfdev
hyfdev force-pushed the codex/strict-flag-off-init-pins branch from 5d53731 to b2066a6 Compare July 21, 2026 08:32
@hyfdev
hyfdev changed the base branch from codex/strict-entry-transitive-init-gate to main July 21, 2026 08:32
@hyfdev
hyfdev force-pushed the codex/strict-flag-off-init-pins branch from b2066a6 to eafc697 Compare July 21, 2026 09:22
@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 42363da
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a5f75fd91c28a00082db17f

@hyfdev hyfdev changed the title test(code-splitting): pin flag-off wrapped-esm init emission after collector unification test(code-splitting): pin flag-off wrapped-esm init emission Jul 21, 2026
@hyfdev
hyfdev marked this pull request as ready for review July 21, 2026 10:00
Copilot AI review requested due to automatic review settings July 21, 2026 10:00

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.

@hyfdev
hyfdev force-pushed the codex/strict-flag-off-init-pins branch from 7f1fae6 to bcce900 Compare July 21, 2026 13:18

hyfdev commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Jul 21, 1:36 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.
  • Jul 21, 1:36 PM UTC: hyfdev added this pull request to the Graphite merge queue.
  • Jul 21, 1:42 PM UTC: Merged by the Graphite merge queue.

## Summary

Adds three executable **flag-off** regression fixtures for wrapped-ESM init emission changes that landed with #10104. None enables `strictExecutionOrder`, and this PR changes no production source.

The earlier version of this PR required each barrel directly, which wrapped the immediate importee and bypassed the shared init-target collector it claimed to cover. The two collector fixtures now keep the immediate barrel at `WrapKind::None` in a shared chunk, while later `require()` calls wrap the leaf owners and make their init symbols reachable from the main chunk.

## Coverage

### Importer-local namespace liveness

`namespace_liveness_gating` imports the barrel namespace but reads only `ns.a()`. A second entry places the unwrapped barrel in a shared chunk; later requires make both wrapped leaf init symbols reachable.

- Current output emits only `init_leaf_a()` at the namespace-import position. `init_leaf_b()` stays at its later explicit require position.
- Pre-#10104 output emitted `init_leaf_a(), init_leaf_b()` together at the namespace-import position.
- The shared barrel still evaluates both leaves exactly once; runtime order is `A, B, BEFORE_REQUIRE:a, MAIN`.

### Sorted, non-ambiguous star-export routing

`ambiguous_star_reexport` has two wrapped leaves that both export `x`. The entry uses a real `export * from` record; a dynamic CommonJS re-export keeps that record included, while the second entry keeps the immediate barrel unwrapped and in another chunk.

- Current output excludes ambiguous `x` from the collector's sorted, non-ambiguous export map and emits no owner init before `__reExport(...)`.
- Pre-#10104 output selected an ambiguous owner and emitted `init_mod_a()` before `__reExport(...)`.
- Runtime confirms `x` is absent and both owners still evaluate exactly once through the shared barrel.

### Excluded re-export to a TLA wrapper

`excluded_reexport_tla` uses `codeSplitting: false`, so an inline dynamic import wraps the barrel and its static dependency chain even with strict execution order disabled. With `moduleSideEffects: false`, the carrier's unused re-export is excluded while the same TLA leaf remains live through a separate `used` import.

- Current output emits `await init_leaf()` in the carrier's async wrapper before its later statement.
- Pre-#10104 output emitted bare `init_leaf()`, producing `CARRIER:undefined` before the leaf's top-level await completed.
- Current runtime order is `LEAF:before, LEAF:after, CARRIER:ready, BARREL:used:marker`.

## Behavior / snapshot impact

Tests only: two existing fixtures are corrected, one TLA fixture is added, and their generated snapshots are pinned. No existing production code or unrelated snapshot changes.

## Validation

- Rebased onto `main` at `cccf1d0d849c71e80c02fe3ff17a97192f3bf258`.
- Generated all three fixtures with the macOS native binding from current-main CI [run 29795703407](https://github.com/rolldown/rolldown/actions/runs/29795703407); every `_test.mjs` passed under Node.
- Compared each committed snapshot byte-for-byte with those generated assets after applying the integration harness's runtime-module hiding.
- Re-ran the same sources with the pre-#10104 binding from CI [run 29559371389](https://github.com/rolldown/rolldown/actions/runs/29559371389): both collector fixtures show the obsolete extra init, and the TLA fixture logs `CARRIER:undefined`.
- `vp fmt ... --check`, `typos`, JS syntax checks, JSON parsing, and `git diff --check` pass. The pre-commit `vp check --fix` hook also completed cleanly.

- CI [run 29819995357](https://github.com/rolldown/rolldown/actions/runs/29819995357): Repo, Rust, Node, Cargo, WASI, native-build, and Node 20/22/24 test jobs passed. Vite Test Ubuntu and the three Ubuntu Dev Server jobs stopped before tests because the Vite `rolldown-canary` branch no longer rebases cleanly onto `vite/main` (`pnpm-lock.yaml` conflict); this is unrelated Vite checkout noise.

## AI usage disclosure

Per the [AI Usage Policy](https://rolldown.rs/contribution-guide/#ai-usage-policy), OpenAI Codex was used to rebase and review the PR, design the corrected regression shapes, and verify generated output. I reviewed the final diff and validation evidence.

---

Follow-up to #10104; addresses Major 2b/2c from the review discussion: #10104 (comment)
@graphite-app
graphite-app Bot force-pushed the codex/strict-flag-off-init-pins branch from bcce900 to 42363da Compare July 21, 2026 13:36
@graphite-app
graphite-app Bot merged commit 42363da into main Jul 21, 2026
33 checks passed
@graphite-app
graphite-app Bot deleted the codex/strict-flag-off-init-pins branch July 21, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants