Skip to content

fix(javascript): keep export bindings out of module views - #9486

Merged
morluto merged 6 commits into
morluto:mainfrom
2SinceJuly:fix/9478-module-export-bindings
Nov 9, 2026
Merged

morluto merged 6 commits into
morluto:mainfrom
2SinceJuly:fix/9478-module-export-bindings

Conversation

@2SinceJuly

@2SinceJuly 2SinceJuly commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T10:18:07.030315Z 7d47be7 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The PR adds one shared check that separates module units from exported symbols.

  • Module views show files without counting each exported symbol.
  • Module-based feature searches return files, not export bindings.
  • Runtime matching no longer treats exported symbols as loaded files.

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
Loading

Reviews (5) · Last reviewed commit: "fix(javascript): share module-unit class..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +90 to +93
const isExportBindingNode = (node: ApplicationNode): boolean =>
node.observations.some(
({ properties }) => properties.semantic_role === "export-binding",
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@2SinceJuly

Copy link
Copy Markdown
Contributor Author

Static checks failed on two files in format:check:

  • tests/acceptance/applications/javascriptExportBindingModuleView.test.ts was introduced by this PR and is now formatted in 7d3d774.
  • src/cli/coreNativeCommands.ts is not touched here — it comes from origin/main and oxfmt --check refuses the raw origin/main blob too, so every PR based on current main inherits it. Local npm run check:ci:fast now reports only that file. Formatting it here would mix an unrelated upstream fix into this PR; it needs a fix on main.

Everything else in check:ci:fast (typecheck, lint, format of every other file) passes locally on 7d3d774.

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.
@2SinceJuly

Copy link
Copy Markdown
Contributor Author

Pushed ce061e57b, which carries the format:check fix for the shared blocker.

Static checks was failing on npm run check:ci:fast → format:check, not on anything this PR changed. src/cli/coreNativeCommands.ts has an 82-column line (Local native executable or app path) against the repo's 80-column .oxfmtrc.json; it came in with #9465, and the file is byte-identical to main here. Every branch merged from main inherits it.

Filed separately as #9505 so main itself is fixed; once that merges, this PR will go green without the cherry-pick. Verified locally on this branch after the change:

  • npm run format:check — 1 task successful.
  • npx vitest run --project acceptance tests/acceptance/applications/javascriptExportBindingModuleView.test.ts — 1 passed.
  • npx vitest run --project domain src/domain/analysisView/analysisView.test.ts — 43 passed.
  • npx vitest run --project services src/application/analysisView — 118 passed.
  • npx tsc --noEmit -p tsconfig.json — clean.

Not run: the full test shard matrix.

@morluto
morluto merged commit 908d9c0 into morluto:main Nov 9, 2026
35 of 43 checks passed
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] inspect_analysis_view collection: "modules" emits per-export export-binding rows and breaks selector.path

2 participants