Skip to content

Comments

fix: skip symbols that are imported from other module when deconflicting module symbols#7510

Merged
IWANABETHATGUY merged 1 commit intomainfrom
12-15-fix_7507
Dec 15, 2025
Merged

fix: skip symbols that are imported from other module when deconflicting module symbols#7510
IWANABETHATGUY merged 1 commit intomainfrom
12-15-fix_7507

Conversation

@IWANABETHATGUY
Copy link
Member

@IWANABETHATGUY IWANABETHATGUY commented Dec 15, 2025

closed #7507
Before:

We were deconflicting symbols even when the final declaration was not in the current module. Some symbols declared via ImportStmt actually point to another module. This caused the deconfliction order to differ from our intended logic.

Expected behavior: When multiple modules use the same top-level name, modules with higher execution order (i.e., executed later) should be more likely to retain the original name.

After:

The output now aligns with our deconfliction logic.

here is an example:

https://github.com/rolldown/rolldown/pull/7510/changes#diff-18487ef445297a090c03a52fc7ac8ab76667ed7a3ea19e182c6ac9f9c1e45260

You could refer any other cases that snapshot has changed.

Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite: merge 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.

@IWANABETHATGUY IWANABETHATGUY changed the title fix: 7507 fix: skip imported symbols when deconflicting module symbols Dec 15, 2025
@IWANABETHATGUY IWANABETHATGUY changed the title fix: skip imported symbols when deconflicting module symbols fix: skip symbols that are imported from other module when deconflicting module symbols Dec 15, 2025
@netlify
Copy link

netlify bot commented Dec 15, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 24b3650
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/693ff2f5b55abe0008551fd3

@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review December 15, 2025 11:38
Copilot AI review requested due to automatic review settings December 15, 2025 11:38
@netlify
Copy link

netlify bot commented Dec 15, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 1748472
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/694023e90242f30008c907a4

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in the deconflicting logic where symbols imported from other modules were incorrectly being processed during module symbol deconflicting. The fix ensures that only symbols owned by the current module are deconflicted, while imported symbols (which already have their canonical names determined in their original modules) are skipped.

Key changes:

  • Added a check to skip imported symbols during deconflicting by verifying canonical_ref.owner != module.idx
  • Updated test snapshots to reflect the corrected symbol naming behavior
  • Added a new test case (issue_7507) to verify the fix works correctly with keepNames option

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 1 comment.

File Description
crates/rolldown/src/utils/chunk/deconflict_chunk_symbols.rs Core fix: added check to skip symbols imported from other modules during deconflicting; includes debug statements that should be removed
crates/rolldown/tests/rolldown/topics/keep_names/issue_7507/src/* New test case demonstrating the bug fix with imported functions that have the same name
Multiple artifacts.snap files Updated test snapshots showing corrected symbol renaming behavior after the fix
integration_rolldown__filename_with_hash.snap Updated hash values in snapshot due to changed code generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 2025

Benchmarks Rust

group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.01     67.5±2.89ms        ? ?/sec    1.00     66.6±2.41ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.01     73.9±1.99ms        ? ?/sec    1.00     72.8±2.31ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    112.5±3.54ms        ? ?/sec    1.00    112.2±3.28ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.01    124.3±2.46ms        ? ?/sec    1.00    123.1±3.42ms        ? ?/sec
bundle/bundle@threejs                                        1.00     41.4±3.13ms        ? ?/sec    1.00     41.3±2.50ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.01     44.7±1.19ms        ? ?/sec    1.00     44.4±0.92ms        ? ?/sec
bundle/bundle@threejs10x                                     1.02   413.4±11.91ms        ? ?/sec    1.00    405.0±8.92ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.01   477.6±10.06ms        ? ?/sec    1.00    474.2±9.15ms        ? ?/sec
scan/scan@rome_ts                                            1.00     87.8±3.07ms        ? ?/sec    1.03     90.1±2.10ms        ? ?/sec
scan/scan@threejs                                            1.01     30.0±1.96ms        ? ?/sec    1.00     29.8±2.00ms        ? ?/sec
scan/scan@threejs10x                                         1.00    303.8±6.01ms        ? ?/sec    1.00    304.9±5.56ms        ? ?/sec

@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 15, 2025

Merge activity

  • Dec 15, 2:17 PM UTC: IWANABETHATGUY added this pull request to the Graphite merge queue.
  • Dec 15, 2:29 PM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'node-test (ubuntu-latest) / Node Test', 'node-test (macos-latest) / Node Test', 'node-test (windows-latest) / Node Test').
  • Dec 15, 3:05 PM UTC: IWANABETHATGUY added this pull request to the Graphite merge queue.

graphite-app bot pushed a commit that referenced this pull request Dec 15, 2025
…ing module symbols (#7510)

closed #7507
**Before:**

We were deconflicting symbols even when the final declaration was not in the current module. Some symbols declared via `ImportStmt` actually point to another module. This caused the deconfliction order to differ from our intended logic.

**Expected behavior:** When multiple modules use the same top-level name, modules with higher execution order (i.e., executed later) should be more likely to retain the original name.

- Previous logic: https://github.com/rolldown/rolldown/blob/64d18ac5a18050dedf22f8c9a9ee48a232af6ba1/crates/rolldown/src/utils/chunk/deconflict_chunk_symbols.rs#L127-L132

**After:**

The output now aligns with our deconfliction logic.

- Updated logic: https://github.com/rolldown/rolldown/blob/8ea0a88bf0ae95a71028c8c9c5b170f225a37dd1/crates/rolldown/src/utils/chunk/deconflict_chunk_symbols.rs#L110-L115

here is an example:

https://github.com/rolldown/rolldown/pull/7510/changes#diff-18487ef445297a090c03a52fc7ac8ab76667ed7a3ea19e182c6ac9f9c1e45260

You could refer any other cases that snapshot has changed.
…ing module symbols (#7510)

closed #7507
**Before:**

We were deconflicting symbols even when the final declaration was not in the current module. Some symbols declared via `ImportStmt` actually point to another module. This caused the deconfliction order to differ from our intended logic.

**Expected behavior:** When multiple modules use the same top-level name, modules with higher execution order (i.e., executed later) should be more likely to retain the original name.

- Previous logic: https://github.com/rolldown/rolldown/blob/64d18ac5a18050dedf22f8c9a9ee48a232af6ba1/crates/rolldown/src/utils/chunk/deconflict_chunk_symbols.rs#L127-L132

**After:**

The output now aligns with our deconfliction logic.

- Updated logic: https://github.com/rolldown/rolldown/blob/8ea0a88bf0ae95a71028c8c9c5b170f225a37dd1/crates/rolldown/src/utils/chunk/deconflict_chunk_symbols.rs#L110-L115

here is an example:

https://github.com/rolldown/rolldown/pull/7510/changes#diff-18487ef445297a090c03a52fc7ac8ab76667ed7a3ea19e182c6ac9f9c1e45260

You could refer any other cases that snapshot has changed.
Copilot AI review requested due to automatic review settings December 15, 2025 15:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@IWANABETHATGUY IWANABETHATGUY merged commit c7c080d into main Dec 15, 2025
28 checks passed
@IWANABETHATGUY IWANABETHATGUY deleted the 12-15-fix_7507 branch December 15, 2025 15:25
This was referenced Dec 17, 2025
shulaoda added a commit that referenced this pull request Dec 17, 2025
## [1.0.0-beta.55] - 2025-12-17

### 🚀 Features

- add validation errors for incompatible `inlineDynamicImports` options (#7539) by @Copilot
- rolldown_plugin_vite_reporter: truncate long importer lists in ineffective dynamic import warnings (#7528) by @Copilot
- export `memfs` from `rolldown/experimental` for browser builds (#7490) by @Copilot
- implement `postBanner` and `postFooter` (#7487) by @sevenc-nanashi
- port getLogFilter helper from Rollup for advanced log filtering (#6890) by @taearls
- dev: initialize `rolldown_plugin_lazy_compilation` (#7488) by @hyf0
- enable `experimental.transform_hires_sourcemap: 'boundary'` by default (#7478) by @sapphi-red
- apply merge CJS namespace optimizations more generally (#7475) by @sapphi-red

### 🐛 Bug Fixes

- avoid panic on invalid values for `output.exports`, `output.format`, `output.hash_characters` (#7542) by @sapphi-red
- handle `__proto__` export for module namespace correctly (#7534) by @sapphi-red
- handle `__proto__` export correctly (#7533) by @sapphi-red
- rolldown_plugin_vite_resolve: acquire resolver lock before package json resolution (#7524) by @sapphi-red
- disable syntax transform optimization for `minify: 'dce-only'` (#7520) by @sapphi-red
- arrow function expression keep names (#7519) by @IWANABETHATGUY
- skip symbols that are imported from other module when deconflicting module symbols (#7510) by @IWANABETHATGUY
- preserve class names in assignment expressions with keepNames option (#7491) by @IWANABETHATGUY
- accessor with decorators should be kept (#7499) by @Copilot
- rolldown_plugin_vite_reporter: support `Infinity` for chunk_limit (#7497) by @shulaoda
- change filename template validation errors from UNHANDLEABLE_ERROR to INVALID_OPTION (#7472) by @Copilot
- `no entry found for key` error when merging CJS namespace exports (#7474) by @sapphi-red
- generate output with syntax error when wrapped esm module using tla syntax (#7468) by @IWANABETHATGUY

### 🚜 Refactor

- dev: rename `experimental.hmr` to `experimental.devMode` (#7527) by @hyf0
- pass addon option to rust as it is (#7526) by @hyf0
- remove unused stmtinfo meta flag (#7518) by @IWANABETHATGUY

### 📚 Documentation

- clarify `closeBundle` behavior (#7525) by @sapphi-red

### 🧪 Testing

- add tests for static string postBanner and postFooter (#7516) by @Copilot
- disable pluginTimings in Rust integration tests to avoid snapshot noise (#7485) by @shulaoda
- port Rollup JSX tests to `crates/rolldown/tests/rollup` (#7480) by @sapphi-red
- re-triage some esbuild JSX preserve tests (#7479) by @sapphi-red
- disable pluginTimings by default to avoid snapshot noise (#7471) by @shulaoda

### ⚙️ Miscellaneous Tasks

- mark feature that will not be supported as ignored in rollup test status (#7535) by @sapphi-red
- support `banner`/`footer`/`intro`/`outro` for config variants (#7532) by @sapphi-red
- `dce/dce_of_decorators` esbuild test is now passing (#7531) by @sapphi-red
- deps: update github-actions (major) (#7495) by @renovate[bot]
- deps: update npm packages (#7493) by @renovate[bot]
- add a check to verify failedReasons are updated (#7521) by @sapphi-red
- deps: update test262 submodule for tests (#7523) by @sapphi-red
- deps: update taiki-e/install-action action to v2.63.2 (#7496) by @renovate[bot]
- deps: update oxc apps (#7511) by @renovate[bot]
- deps: update oxc to v0.103.0 (#7513) by @camc314
- fix format in `.github/instructions/bug-investigation.instructions.md` (#7506) by @sapphi-red
- add instructions for REPL decoding (#7502) by @sapphi-red
- deps: update github-actions (#7492) by @renovate[bot]
- deps: cargo-shear v1.9.0 (#7483) by @Boshen
- deps: update dependency oxlint-tsgolint to v0.9.0 (#7484) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.8.6 (#7470) by @renovate[bot]
- add syntax validation for test output chunks that are not executed (#7466) by @IWANABETHATGUY
- deps: update dependency rust to v1.92.0 (#7467) by @renovate[bot]
- deps: update test262 submodule for tests (#7457) by @sapphi-red

### ❤️ New Contributors

* @sevenc-nanashi made their first contribution in [#7487](#7487)
* @taearls made their first contribution in [#6890](#6890)

Co-authored-by: shulaoda <[email protected]>
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.

[Bug]: wrapped commonjs module dependency incorrect naming deconflict

2 participants