Skip to content

Comments

fix: no entry found for key error when merging CJS namespace exports#7474

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-11-fix_no_entry_found_for_key_error_when_merging_cjs_namespace_exports
Dec 12, 2025
Merged

fix: no entry found for key error when merging CJS namespace exports#7474
graphite-app[bot] merged 1 commit intomainfrom
12-11-fix_no_entry_found_for_key_error_when_merging_cjs_namespace_exports

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Dec 12, 2025

no entry found for key error was happening for this case (the case added in tests).

Copy link
Member Author

sapphi-red commented Dec 12, 2025


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.

@netlify
Copy link

netlify bot commented Dec 12, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 41b396c
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/693bcf60b1aaac0008d1af65

@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2025

Benchmarks Rust

  • target: main(a4ca830)
  • pr: 12-11-fix_no_entry_found_for_key_error_when_merging_cjs_namespace_exports(41b396c)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     58.8±1.35ms        ? ?/sec    1.01     59.4±1.65ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.01     65.7±2.67ms        ? ?/sec    1.00     65.1±1.42ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00     99.6±1.89ms        ? ?/sec    1.02    101.2±2.91ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    111.3±1.87ms        ? ?/sec    1.01    112.6±2.15ms        ? ?/sec
bundle/bundle@threejs                                        1.00     36.8±1.79ms        ? ?/sec    1.00     36.7±2.25ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     39.6±0.83ms        ? ?/sec    1.00     39.6±0.63ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    367.1±4.70ms        ? ?/sec    1.01    372.4±4.89ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    421.5±3.60ms        ? ?/sec    1.01    427.5±5.09ms        ? ?/sec
scan/scan@rome_ts                                            1.01     78.0±1.85ms        ? ?/sec    1.00     77.5±1.65ms        ? ?/sec
scan/scan@threejs                                            1.00     26.7±1.95ms        ? ?/sec    1.00     26.5±1.77ms        ? ?/sec
scan/scan@threejs10x                                         1.00    274.1±5.86ms        ? ?/sec    1.00    275.0±5.14ms        ? ?/sec

@sapphi-red sapphi-red marked this pull request as ready for review December 12, 2025 06:54
Copilot AI review requested due to automatic review settings December 12, 2025 06:54
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 "no entry found for key" error that occurred when merging CommonJS namespace exports. The root cause was that namespace_ref from namespace_alias was being used directly to look up in the canonical_names map without first canonicalizing it through the symbol reference database's union-find structure.

Key Changes:

  • Added a test case that reproduces the bug scenario where a CJS module is imported by two different files, causing namespace refs to be merged
  • Fixed the bug by canonicalizing namespace_ref before looking it up in canonical_names

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/rolldown/tests/rolldown/cjs_compat/module.exports_export/safely_merge_cjs_ns_reexport/_config.json Configuration for new test case
crates/rolldown/tests/rolldown/cjs_compat/module.exports_export/safely_merge_cjs_ns_reexport/entry.js Test entry point that re-exports default from CJS module with namespace alias
crates/rolldown/tests/rolldown/cjs_compat/module.exports_export/safely_merge_cjs_ns_reexport/helper.js Helper module that imports from the same CJS module, triggering namespace ref merging
crates/rolldown/tests/rolldown/cjs_compat/module.exports_export/safely_merge_cjs_ns_reexport/node_modules/this-is-only-used-for-testing/index.js Mock CJS module for testing
crates/rolldown/tests/rolldown/cjs_compat/module.exports_export/safely_merge_cjs_ns_reexport/node_modules/this-is-only-used-for-testing/package.json Package definition for mock CJS module
crates/rolldown/tests/rolldown/cjs_compat/module.exports_export/safely_merge_cjs_ns_reexport/artifacts.snap Expected output snapshot for test case
crates/rolldown/tests/snapshots/integration_rolldown__filename_with_hash.snap Updated snapshot with new test case hash
crates/rolldown/src/utils/chunk/render_chunk_exports.rs Core fix: canonicalize namespace_ref before looking it up in canonical_names

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

@sapphi-red sapphi-red self-assigned this Dec 12, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 12, 2025

Merge activity

  • Dec 12, 7:10 AM UTC: sapphi-red added this pull request to the Graphite merge queue.
  • Dec 12, 7:17 AM 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 12, 8:16 AM UTC: sapphi-red added this pull request to the Graphite merge queue.
  • Dec 12, 8:33 AM UTC: Merged by the Graphite merge queue.

graphite-app bot pushed a commit that referenced this pull request Dec 12, 2025
#7474)

`no entry found for key` error was happening for this case (the case added in tests).
@graphite-app graphite-app bot force-pushed the 12-11-fix_no_entry_found_for_key_error_when_merging_cjs_namespace_exports branch from 771f672 to bd4a269 Compare December 12, 2025 07:11
#7474)

`no entry found for key` error was happening for this case (the case added in tests).
Copilot AI review requested due to automatic review settings December 12, 2025 08:16
@graphite-app graphite-app bot force-pushed the 12-11-fix_no_entry_found_for_key_error_when_merging_cjs_namespace_exports branch from bd4a269 to 41b396c Compare December 12, 2025 08:16
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.

@graphite-app graphite-app bot merged commit 41b396c into main Dec 12, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 12-11-fix_no_entry_found_for_key_error_when_merging_cjs_namespace_exports branch December 12, 2025 08:33
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.

2 participants