[PR #2797] [MERGED] fix(javascript): preserve empty ESM import names in provenance #5402

Closed
opened 2026-10-31 01:06:22 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2797
Author: @chqcjq
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto

Base: main ← Head: fix/esm-empty-import-provenance


📝 Commits (1)

  • 89c2b07 fix(javascript): preserve empty ESM import names in provenance

📊 Changes

3 files changed (+110 additions, -2 deletions)

View changed files

📝 src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts (+39 -0)
📝 src/domain/javascript/javascriptSemanticAnalysis.ts (+1 -2)
➕ tests/acceptance/applications/emptyImportNameCli.test.ts (+70 -0)

📄 Description

Fixes #2647.

import { "" as selected } from "./module.mjs"; export { selected }; currently produces an import edge with the exact empty name but a local re-export origin with imported_name: "[dynamic]" and imported_path: ["[dynamic]"]. The file and module resolution both succeed, so this loses a known source identity.

Use the existing null-returning semanticStaticPropertyKey helper in bindImports, with nullish fallback, so an exact empty string remains [""]. Remove the now-unused propertyName import. Alias provenance and module relationship consumers already preserve the exact value and need no downstream workaround.

Validation:

  • Before the fix: the empty-name producer test and both public CLI/stdio MCP regressions failed (3 failed, 27 passed).
  • After the fix: all 30 focused tests pass, including compiled CLI and stdio MCP, direct re-export and nonempty-name controls. Producer coverage also checks alias propagation and distinguishes default from namespace import origins. Fixture syntax is independently accepted by node --check.
  • JavaScript domain suite: 53 files / 1,214 tests pass.
  • Typecheck, changed-file lint (no errors), formatting, docs checks, module boundaries, architecture guards, and test discovery (1,062 files) pass.
  • npm run check:ci is NOT green: its sole remaining lint error is the pre-existing max-lines-per-function error at tests/boundary/providers/ghidra/ghidraLauncher.test.ts:431 (176 lines, limit 150). The file is unchanged from base 43738bec5 (Git blob ea8fb964c6ccf62c2e72b034e4f7081d8801b4d9) and has no change in fetched upstream 2a61deafc. Duplication check is 2.98%.

The normal pre-push hook reproduces the same baseline lint failure. Pre-commit formatting/lint passed; only this push used HUSKY=0 after the checks above. CI remains enabled. Source and consumers were reviewed locally; automated Codex review is unavailable because the local CLI rejects its existing configuration.

Scope: static JavaScript analysis through real public adapters; no native analysis provider or target execution is involved. The full repository test suite was not run.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2797 **Author:** [@chqcjq](https://github.com/chqcjq) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/esm-empty-import-provenance` --- ### 📝 Commits (1) - [`89c2b07`](https://github.com/morluto/rea/commit/89c2b07a2eb664b9765971142de3ee500e12152e) fix(javascript): preserve empty ESM import names in provenance ### 📊 Changes **3 files changed** (+110 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts` (+39 -0) 📝 `src/domain/javascript/javascriptSemanticAnalysis.ts` (+1 -2) ➕ `tests/acceptance/applications/emptyImportNameCli.test.ts` (+70 -0) </details> ### 📄 Description Fixes #2647. `import { "" as selected } from "./module.mjs"; export { selected };` currently produces an import edge with the exact empty name but a local re-export origin with `imported_name: "[dynamic]"` and `imported_path: ["[dynamic]"]`. The file and module resolution both succeed, so this loses a known source identity. Use the existing null-returning `semanticStaticPropertyKey` helper in `bindImports`, with nullish fallback, so an exact empty string remains `[""]`. Remove the now-unused `propertyName` import. Alias provenance and module relationship consumers already preserve the exact value and need no downstream workaround. Validation: - Before the fix: the empty-name producer test and both public CLI/stdio MCP regressions failed (3 failed, 27 passed). - After the fix: all 30 focused tests pass, including compiled CLI and stdio MCP, direct re-export and nonempty-name controls. Producer coverage also checks alias propagation and distinguishes default from namespace import origins. Fixture syntax is independently accepted by `node --check`. - JavaScript domain suite: 53 files / 1,214 tests pass. - Typecheck, changed-file lint (no errors), formatting, docs checks, module boundaries, architecture guards, and test discovery (1,062 files) pass. - `npm run check:ci` is NOT green: its sole remaining lint error is the pre-existing `max-lines-per-function` error at `tests/boundary/providers/ghidra/ghidraLauncher.test.ts:431` (176 lines, limit 150). The file is unchanged from base `43738bec5` (Git blob `ea8fb964c6ccf62c2e72b034e4f7081d8801b4d9`) and has no change in fetched upstream `2a61deafc`. Duplication check is 2.98%. The normal pre-push hook reproduces the same baseline lint failure. Pre-commit formatting/lint passed; only this push used `HUSKY=0` after the checks above. CI remains enabled. Source and consumers were reviewed locally; automated Codex review is unavailable because the local CLI rejects its existing configuration. Scope: static JavaScript analysis through real public adapters; no native analysis provider or target execution is involved. The full repository test suite was not run. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:06:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5402
No description provided.