Repository navigation
fix(javascript): preserve namespace re-export relationships - #1833
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 429e7392c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (t.isExportSpecifier(specifier)) | ||
| if ( | ||
| t.isExportSpecifier(specifier) || | ||
| t.isExportNamespaceSpecifier(specifier) |
There was a problem hiding this comment.
Exclude erased namespace type exports
When a .ts/.mts file contains export type * as Types from "./types.js", Babel represents the specifier as an ExportNamespaceSpecifier while node.exportKind is "type", so this new arm emits the same value-level re-export link as export * as Types. addJavaScriptSourceModules then counts Types in export_relationships and export_names and marks the graph complete, although TypeScript/Node type stripping produces no such export; gate this arm on the non-type export kind (or retain the type kind explicitly rather than treating it as a value export).
AGENTS.md reference: AGENTS.md:L17-L17
Useful? React with 👍 / 👎.
|
Thanks for filling in the namespace re-export path, @shoyann. |
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
collectNamedExportsto handle valueExportNamespaceSpecifierdeclarations using the existing re-export representation. Namespace re-exports have no local binding; TypeScriptexport type * as Typesdeclarations 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
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
.mtsbarrel 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 reportedexport_names: [],export_relationships: 0, and complete coverage.Corrected representative module fields:
{"export_names":["ns"],"export_relationships":1}. The namespace relationship hasimported_name: "*",exported_name: "ns", andlocal_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
Review checklist
type(scope): outcome.