Repository navigation
fix: make entries-aware chunk merging deterministic - #11002
Merged
Merged
Conversation
✅ Deploy Preview for rolldown-rs canceled.
|
hyfdev
commented
Sep 26, 2026
hyfdev
force-pushed
the
fix/entries-aware-merge-determinism
branch
from
September 26, 2026 03:44
ec25fe5 to
92f0de4
Compare
hyfdev
marked this pull request as ready for review
September 26, 2026 07:00
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues remain.
Review effort: Lite
Findings: None
What changed in this PR
Makes entries-aware chunk merging deterministic regardless of module loading order.
Changes:
- Sorts modules by execution order before subgroup assignment.
- Adds regression coverage for controlled loading orders.
- Documents deterministic merge behavior.
| File | Summary |
|---|---|
packages/rolldown/tests/behaviors/entries-aware-merge.test.ts |
Regression test for deterministic output |
internal-docs/manual-code-splitting/implementation.md |
Documents deterministic tie-breaking |
crates/rolldown/src/stages/generate_stage/manual_code_splitting.rs |
Implements execution-order-based subgroup keys |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merging this PR will not alter performance
Comparing Footnotes
|
@rolldown/browser
@rolldown/debug
rolldown
@rolldown/binding-android-arm-eabi
@rolldown/binding-android-arm64
@rolldown/binding-darwin-arm64
@rolldown/binding-darwin-x64
@rolldown/binding-freebsd-x64
@rolldown/binding-linux-arm-gnueabihf
@rolldown/binding-linux-arm64-gnu
@rolldown/binding-linux-arm64-musl
@rolldown/binding-linux-ppc64-gnu
@rolldown/binding-linux-s390x-gnu
@rolldown/binding-linux-x64-gnu
@rolldown/binding-linux-x64-musl
@rolldown/binding-openharmony-arm64
@rolldown/binding-wasm32-wasi
@rolldown/binding-win32-arm64-msvc
@rolldown/binding-win32-x64-msvc
commit: |
shulaoda
approved these changes
Sep 28, 2026
Member
Author
Merge activity
|
Repeated builds of identical input can produce different chunk contents and filenames when entries-aware merging is enabled. This PR makes merge decisions independent of module loading order. For four equal-size modules, changing only their discovery order can change the merge result: Before: ```text Build 1: [a, c] [b, d] Build 2: [a, b] [c, d] ``` After: ```text Build 1: [a, b] [c, d] Build 2: [a, b] [c, d] ``` Merge ties are resolved by numeric subgroup keys, which are assigned while iterating a hash set of module indices. Parallel loading changes those indices, which can change the keys and the chosen merges. For a positive merge threshold, the fix assigns subgroup keys after sorting the current group's modules by execution order. The sort uses integer keys and only the current group's modules. Sorting and its buffer allocation are skipped when merging is disabled. Validation: - Added a regression test that compares filenames and code across three controlled loading orders; it fails before the fix and passes after it. - The issue's standalone reproduction produces identical filenames and bytes for all 48 output files. The threshold-0 control is also byte-identical. - Passed 29 related Rust tests, 11 JavaScript code-splitting fixtures, Clippy, and formatting/lint checks. Fixes #10886.
graphite-app
Bot
force-pushed
the
fix/entries-aware-merge-determinism
branch
from
September 28, 2026 03:13
92f0de4 to
30c7703
Compare
Merged
shulaoda
added a commit
that referenced
this pull request
Sep 30, 2026
## [1.2.12] - 2026-09-30 ### 🚀 Features - inline common chunks containing import() and deduplicate shared code in lazy chunks (#11034) by @hyfdev - experimental `inlineCommonChunks` support (#10899) by @hyfdev - dev: ship imported bindings for HMR partial accept (#10856) by @h-a-n-a ### 🐛 Bug Fixes - chunking: re-derive chunk exec orders after the runtime leaves its host chunk (#11005) by @hyfdev - code-splitting: gate member-read init paths on the reading statement (#11039) by @hyfdev - code-splitting: retain initialization paths through re-exported namespaces (#11037) by @hyfdev - dev: reject non-ESM output formats in dev mode (#11038) by @h-a-n-a - dev: align `import.meta.hot.accept` deps with Vite (#10997) by @h-a-n-a - dev: clear the resolver cache when a file is created or deleted (#10986) by @waltuov - error: name the resolved specifier in unresolved import diagnostics (#11014) by @linyiru - make entries-aware chunk merging deterministic (#11002) by @hyfdev - watch: avoid restarting macOS watcher for unchanged paths (#10992) by @sep2 ### 🚜 Refactor - dev: ship the dev runtime entry as one file (#10998) by @h-a-n-a - binding: remove `__internalForcePanic` (#10989) by @IWANABETHATGUY ### 📚 Documentation - fix cloudflare preview builds (#10996) by @sapphi-red - fix build config loader warning (#10994) by @sapphi-red - deps: use Vite 8 (#10993) by @sapphi-red ### ⚡ Performance - dev: only ship rows with dynamic edges in registerGraph (#11019) by @h-a-n-a ### 🧪 Testing - code-splitting: cover more re-exported namespace shapes (#11042) by @hyfdev - webcontainer: cover the WebContainer download fallback in plain Node (#10966) by @shulaoda - dev: pin the runtime entry file layout that Vite serves (#10983) by @h-a-n-a ### ⚙️ Miscellaneous Tasks - pin VOID_API_URL for the docs deploy (#11041) by @shulaoda - opt into the WebContainer smoke test for napi bumps and loader changes (#10967) by @shulaoda - deps: upgrade oxc to 0.152.0 (#11018) by @camc314 - deps: update rust crates (#11012) by @renovate[bot] - deps: update npm packages (#11011) by @renovate[bot] - deps: update crate-ci/typos action to v1.50.3 (#11023) by @renovate[bot] - deps: update test262 submodule for tests (#11022) by @rolldown-guard[bot] - deps: update rollup submodule for tests to v4.63.5 (#11021) by @rolldown-guard[bot] - deps: update dependency vite-plus to v1 (#11017) by @renovate[bot] - deps: update github actions (#11010) by @renovate[bot] - remove `CLAUDE.md` (#10925) by @iiio2 - verify release debug info by matching file IDs (#10988) by @IWANABETHATGUY - deps: update rollup submodule for tests to v4.63.4 (#10940) by @rolldown-guard[bot] ### ❤️ New Contributors * @waltuov made their first contribution in [#10986](#10986) * @linyiru made their first contribution in [#11014](#11014) * @sep2 made their first contribution in [#10992](#10992) Co-authored-by: shulaoda <[email protected]>
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.
Repeated builds of identical input can produce different chunk contents and filenames when entries-aware merging is enabled. This PR makes merge decisions independent of module loading order.
For four equal-size modules, changing only their discovery order can change the merge result:
Before:
After:
Merge ties are resolved by numeric subgroup keys, which are assigned while iterating a hash set of module indices. Parallel loading changes those indices, which can change the keys and the chosen merges.
For a positive merge threshold, the fix assigns subgroup keys after sorting the current group's modules by execution order. The sort uses integer keys and only the current group's modules. Sorting and its buffer allocation are skipped when merging is disabled.
Validation:
Fixes #10886.