Repository navigation
fix(javascript): keep export bindings out of module views - #9486
Conversation
Exported symbol bindings reuse the javascript-module node kind, so the modules collection counted one row per export alongside the owning module. On a CommonJS or ESM file with N exports, inspect_analysis_view reported N+1 module units, module pages listed indistinguishable rows sharing the module path, and item selection by selector.path failed with "Multiple modules have path". Treat a node whose observations carry semantic_role export-binding as an export of its owning module, not a module unit, and exclude it from module entries. Export bindings remain distinct graph entities for export-shape comparison and version matching. Validation: a domain regression in analysisView.test.ts and a CLI acceptance regression over a real CommonJS analysis both fail on main and pass with this change. Also ran the analysis view, MCP boundary, CLI boundary and JavaScript acceptance suites (125 tests), npm run check:fast, and the MCP catalog schema test after regenerating .cache/mcp-tool-catalog.json.
Codex Review Summary: ✅ CompletedThis 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. |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThe PR adds one shared check that separates module units from exported symbols.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
G[Retained graph nodes] --> C[Shared module-unit check]
C --> V[Module pages, items, references and counts]
C --> F[Module seeds]
C --> R[Runtime candidates and load-state rows]
G --> E[Export-shape selection and string or node-ID seeds]
X[Export bindings] -. excluded .-> C
X --> E
Reviews (5) · Last reviewed commit: "fix(javascript): share module-unit class..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a056a294b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const isExportBindingNode = (node: ApplicationNode): boolean => | ||
| node.observations.some( | ||
| ({ properties }) => properties.semantic_role === "export-binding", | ||
| ); |
There was a problem hiding this comment.
Reuse module-unit classification in sibling workflows
When a file with exports is passed to reconcile_javascript_runtime, this view-local predicate leaves src/domain/javascript/javascriptRuntimeLoadState.ts:isLoadStateNode admitting every export binding as a JavaScript module; current binding nodes have no loadable path, so each adds an unknown row and inflates summary.static_unknown. The same duplicated kind check in javascriptFeatureSeed.ts:kindMatches also makes a {kind: "module", match: "substring"} seed for the file match every export. Move this predicate to the graph/domain owner and reuse it in these sibling consumers (or emit a distinct binding kind) so the fix applies consistently.
AGENTS.md reference: AGENTS.md:L27-L33
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Partially answered by the view predicate at this head, and the sibling paths are outside this PR.
isExportBindingNode and isModuleNode in javascriptApplicationView.ts are exactly the fix that landed in dc4ae77: a module-kind node carrying semantic_role: export-binding is not a module unit, so pages only module units for a CommonJS file that exports symbols no longer puts the two bindings in the modules page.
isLoadStateNode and kindMatches live outside src/domain/analysisView/, and neither is a javascriptApplicationView projection: changing them changes what reconcile_javascript_runtime and feature-seed matching report, which is a separate surface from this PR\x27s scope. Hoisting the predicate to the graph owner so all four consumers share it is the right structural answer and I have not done it here — it would need its own boundary regressions for the runtime-load and seed paths. Opening that as a follow-up rather than widening this PR.
| view, | ||
| }), | ||
| ); | ||
| const result = await cli.run({ |
There was a problem hiding this comment.
Run parity commands through the shared CLI process
TestCli.run starts a fresh compiled process, and this case invokes it once for analysis plus both inspection paths, although all three commands have no stdin or explicit timeout. As a result this single regression pays CLI startup and registration three times in every focused or CI run; use the fixture's runFileCli/sharedCliRun for these calls so the file-scoped process is reused.
AGENTS.md reference: AGENTS.md:L91-L91
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 9ec58a2. All three commands in this case now go through runFileCli, which reuses the fixture\x27s file-scoped process; the case has no stdin and no explicit timeout, so it can share one. Passes in 4.5s.
The case starts a compiled CLI process for each of its three commands, paying startup and tool registration three times per run. The fixture already provides a file-scoped process for calls with no stdin or explicit timeout, so use it.
…-view case The acceptance case's inline graph type did not match what oxfmt emits for the 80-column limit, so `format:check` refused the tree. Reflow only; the assertions are unchanged.
|
Everything else in |
The `inspect-native-data-type` argument description line is 82 columns, over the repository's 80-column `.oxfmtrc.json` limit, so `npm run format:check` fails on main and on every branch merged from it. It came in with morluto#9465 and the following commits to this file did not touch it. Reformat the one call the formatter objects to; no behaviour change.
|
Pushed
Filed separately as #9505 so
Not run: the full test shard matrix. |
Fixes #9478. Export-binding nodes describe symbols, but several consumers treated every javascript-module node as a module unit. This inflated module views, feature seeds and runtime reconciliation.
A shared domain classifier now owns module-unit and source-module admission. Views, feature selection, runtime load state and static candidates use it while retaining each consumer's existing source-module policy. Export nodes and explicit node-id selection remain available; historical nodes with omitted roles retain their prior classification.
Validation on head 7d47be7: 76 focused tests passed across public CommonJS CLI feature selection, analysis views and runtime reconciliation. Both new sibling-consumer assertions failed before the shared fix. check:fast and docs:check passed. Local fixtures establish these workflows; no real browser/runtime provider or full repository suite was run.
Author readiness
Human owner: @2SinceJuly