[PR #1833] [MERGED] fix(javascript): preserve namespace re-export relationships #4847

Closed
opened 2026-10-31 00:55:58 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1833
Author: @shoyann
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @morluto

Base: main ← Head: fix/javascript-namespace-reexports


📝 Commits (2)

  • 429e739 fix(javascript): preserve namespace re-export relationships
  • 9812dcd fix(javascript): exclude erased namespace type exports

📊 Changes

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

View changed files

📝 src/domain/javascript/javascriptSemanticProjection.ts (+11 -3)
📝 tests/acceptance/applications/exportedFunctionBindingsCli.test.ts (+168 -0)

📄 Description

Summary

Fixes #1831.

JavaScript namespace re-exports such as export * as ns from "./dependency.mjs" were absent from semantic module links and exported-name inventories even when coverage reported complete. Retain the namespace binding and its dependency relationship through the shared producer, CLI, and MCP graph.

Problem and expected behavior

Node exposes ns, but REA previously reported zero export relationships and no export names for that declaration. Static file dependencies were already present. The semantic graph should preserve the imported namespace (*), declared exported name, source specifier, and original source evidence.

Change and scope

Extend collectNamedExports to handle value ExportNamespaceSpecifier declarations using the existing re-export representation. Namespace re-exports have no local binding; TypeScript export type * as Types declarations are excluded because they are erased at runtime. Named exports and ordinary star re-exports continue through their existing paths; no schema or resolution policy changes are needed.

Contract and boundary impact

  • Semantic owner and earliest changed stage: JavaScript semantic module-link projection.
  • CLI and MCP/tool-catalog contract: unchanged schemas; both surfaces now report the omitted namespace export and resolved relationship.
  • Provider, bridge, target-format, or platform compatibility: ordinary ESM source syntax, including string-literal namespace export names; no provider or platform changes.
  • Evidence, artifact, provenance, or reconstruction contract: preserve source digest and specifier range on the export observation and exposing edge.
  • Process execution, authorization, cleanup, or containment impact: none; production analysis remains static, and Node executes only test-owned fixtures as an oracle.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Added real Node/stdio MCP/CLI regressions covering identifier and string-literal namespace export names alongside named and ordinary star controls, plus a mixed .mts barrel with erased type-only and retained value namespace exports. Its type-only dependency throws if executed; Node confirms it is not loaded.

  • On base 76e4153, the public workflow test failed because the barrel exposed only two of its four declared export relationships; the standalone minimal CLI fixture reported export_names: [], export_relationships: 0, and complete coverage.

  • Corrected representative module fields: {"export_names":["ns"],"export_relationships":1}. The namespace relationship has imported_name: "*", exported_name: "ns", and local_name: null.

  • Assertions cover resolved dependency edges, artifact digests, exact source ranges, and complete coverage.

  • Remaining proof gaps: executed under Node 24.18.0 / npm 11.16.0 on WSL Ubuntu x64; no native Windows/macOS run claimed.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/acceptance/applications/exportedFunctionBindingsCli.test.ts src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts src/domain/javascript/javascriptSemanticAnalysis.require_links.test.ts tests/composition/javascript-applications/javascriptModuleRelationships.test.ts — 111/111 passed.
  • npm run check — passed, including typecheck, formatting, lint, module boundaries, and architecture guards (lint warnings, zero errors).
  • git diff --check — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: WSL Ubuntu, actual Node evaluation, compiled CLI and stdio MCP; optional providers are not involved.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new production execution or filesystem authority.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed (existing contract unchanged).
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 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/1833 **Author:** [@shoyann](https://github.com/shoyann) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/javascript-namespace-reexports` --- ### 📝 Commits (2) - [`429e739`](https://github.com/morluto/rea/commit/429e7392c4033ee44dec9674c8dbd1e69b0d710d) fix(javascript): preserve namespace re-export relationships - [`9812dcd`](https://github.com/morluto/rea/commit/9812dcdf8350378a46bc546ae4089d8ba3860871) fix(javascript): exclude erased namespace type exports ### 📊 Changes **2 files changed** (+179 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptSemanticProjection.ts` (+11 -3) 📝 `tests/acceptance/applications/exportedFunctionBindingsCli.test.ts` (+168 -0) </details> ### 📄 Description ## Summary Fixes #1831. JavaScript namespace re-exports such as `export * as ns from "./dependency.mjs"` were absent from semantic module links and exported-name inventories even when coverage reported complete. Retain the namespace binding and its dependency relationship through the shared producer, CLI, and MCP graph. ## Problem and expected behavior Node exposes `ns`, but REA previously reported zero export relationships and no export names for that declaration. Static file dependencies were already present. The semantic graph should preserve the imported namespace (`*`), declared exported name, source specifier, and original source evidence. ## Change and scope Extend `collectNamedExports` to handle value `ExportNamespaceSpecifier` declarations using the existing re-export representation. Namespace re-exports have no local binding; TypeScript `export type * as Types` declarations are excluded because they are erased at runtime. Named exports and ordinary star re-exports continue through their existing paths; no schema or resolution policy changes are needed. ## Contract and boundary impact - Semantic owner and earliest changed stage: JavaScript semantic module-link projection. - CLI and MCP/tool-catalog contract: unchanged schemas; both surfaces now report the omitted namespace export and resolved relationship. - Provider, bridge, target-format, or platform compatibility: ordinary ESM source syntax, including string-literal namespace export names; no provider or platform changes. - Evidence, artifact, provenance, or reconstruction contract: preserve source digest and specifier range on the export observation and exposing edge. - Process execution, authorization, cleanup, or containment impact: none; production analysis remains static, and Node executes only test-owned fixtures as an oracle. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Added real Node/stdio MCP/CLI regressions covering identifier and string-literal namespace export names alongside named and ordinary star controls, plus a mixed `.mts` barrel with erased type-only and retained value namespace exports. Its type-only dependency throws if executed; Node confirms it is not loaded. - On base `76e4153`, the public workflow test failed because the barrel exposed only two of its four declared export relationships; the standalone minimal CLI fixture reported `export_names: []`, `export_relationships: 0`, and complete coverage. - Corrected representative module fields: `{"export_names":["ns"],"export_relationships":1}`. The namespace relationship has `imported_name: "*"`, `exported_name: "ns"`, and `local_name: null`. - Assertions cover resolved dependency edges, artifact digests, exact source ranges, and complete coverage. - Remaining proof gaps: executed under Node 24.18.0 / npm 11.16.0 on WSL Ubuntu x64; no native Windows/macOS run claimed. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- tests/acceptance/applications/exportedFunctionBindingsCli.test.ts src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts src/domain/javascript/javascriptSemanticAnalysis.require_links.test.ts tests/composition/javascript-applications/javascriptModuleRelationships.test.ts` — 111/111 passed. - `npm run check` — passed, including typecheck, formatting, lint, module boundaries, and architecture guards (lint warnings, zero errors). - `git diff --check` — passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: WSL Ubuntu, actual Node evaluation, compiled CLI and stdio MCP; optional providers are not involved. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new production execution or filesystem authority. ## Review checklist - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed (existing contract unchanged). - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:55:58 +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#4847
No description provided.