Repository navigation
fix(javascript): preserve import-equals declaration and export evidence - #2062
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: 19b93435c9
ℹ️ 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".
NIU-123370
left a comment
There was a problem hiding this comment.
Local review completed. The shared import-equals classifier preserves the type-only and internal-alias boundaries, and the MTS format guard matches NodeNext output. Build plus focused domain/CLI/MCP suites passed: 23 tests.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6d513b2d5
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
rea/src/domain/javascript/javascriptSemanticProjection.ts
Lines 131 to 134 in c341940
When a selected .d.ts, .d.mts, or .d.cts contains import X = require("pkg") without the optional type keyword, Babel leaves importKind as a value even though declaration files are ambient and emit no JavaScript. Those files are admitted by relevantKind, and both new collectors call this path-blind predicate, so application analysis now emits require/imports edges for a dependency that never exists at runtime; carry the source-path/declaration context into this classification and skip ambient declarations.
AGENTS.md reference: AGENTS.md:L21-L21
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4fdf57f4f
ℹ️ 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".
baron
left a comment
There was a problem hiding this comment.
Reviewed exact head 5490c62 and current-main integration. No confirmed source blocker or justified additional refactor.
Declaration/export loader mode is retained by the immutable provenance owner, normalized once before origin deduplication, and consumed consistently by both resolution paths. Unknown/ambiguous mode and exact lexical callable ownership are preserved. Pinned validation: 47 semantic tests, check:fast and both compiled public CLI/MCP import-equals cases passed on isolated current-main integration. Distinct malformed, identity and scope cases remain; no gratuitous test pruning or provider claims. Current exact-head CI is green.
Summary
Recognize the import-equals alias as a declaration, retain its legacy require reference, and preserve the require branch on both direct exported values and exported local aliases in CTS/MTS. Keep the original source evidence and exported value.
Fixes #2058
Problem and expected behavior
An import-equals declaration incorrectly produced a read at its identifier, while the legacy reference producer omitted the dependency. For export import typed = require("typed-package") in MTS, the direct require link chose the require branch but its exported-binding association could fall back to the import branch. The same failure occurred for
import raw = require("typed-package"); const alias = raw; export { alias };when only the direct binding retained the mode.Change and scope
Main integrated the original import-equals lookup and fixed CTS/MTS module formats in e4532b5. Retain those shared implementations. Recognize import-equals identifiers as declarations, retain require provenance through aliases/member/destructure propagation, and finalize local exports from already computed immutable binding provenance. Normalize implicit CTS static-import origins before deduplication so a static import and import-equals of the same package retain their shared exported association. Preserve MTS ambiguity when import and require select different targets. Synchronize the shared strict private module-link vocabulary for compatibility with #2060; this branch does not add an inline-type producer.
CI baseline: the prior failures were independently reproduced on c22111e. Upstream commit 621cee1 (PR #2137) now fixes the same warm-only completion fixture expectations. Merge that commit and retain its exact test/verifier implementation. The final contribution contains no completion-fixture or package-verifier changes relative to pinned main 621cee1.
Contract and boundary impact
Evidence and regression coverage
Tests updated: Extend the existing unboundRequires CLI/MCP workflow and domain binding/reference regression. Actual TypeScript NodeNext emission and external Node consumers of both CTS and MTS direct exports and local aliases print "42 42"; the same package import branch contains 99. Check require and exported-binding associations, exports/exposes, fixed formats, source SHA/ranges and type-only erasure. The domain regression retains exactly the real alias read; internal aliases and type-only declarations do not create external runtime dependencies.
Executed evidence: The domain false-read assertion failed before the declaration fix. Both public workflows failed before legacy retention and again before export-mode propagation, then passed after the respective corrections. The exported local-alias scenario additionally produced two valid RED failures after TypeScript/Node controls passed, and is now GREEN through both public workflows. Native compiler/Node controls ran before graph assertions. The original issue fixture was replayed twice with source-digest checks.
User-visible CLI/MCP output: The require relationship and exported typed and alias associations all resolve to node_modules/typed-package/actual.cjs; typed stays exported. CTS reports commonjs and MTS reports esm. Type-only imports produce no runtime dependency.
Additional review acceptance: native CTS prints 42/42/42 for the static, require and mixed exported choices; MTS prints 99/42/99. Both public workflows preserve the CTS mixed association and leave the distinct MTS mixed origins ambiguous. No parallel workflow was added.
Remaining proof gaps: Actual execution covers Node 24.18.0 / TypeScript 7.0.2 on macOS arm64, compiled CLI and real stdio MCP. Native binary providers/live browsers are outside this source-analysis change.
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:focusedwith 35 selected files — 686 tests passed. Includes the existing public CLI/MCP workflow, resolver/provider/cancellation/worker boundaries, and readiness checks. All 23 semantic-domain suites were included after extending origin metadata.npm run check— typecheck, lint, format, knip, metadata and architecture guards passed; 0 lint errors. Existing lint warnings remain.npm run verify:test-discovery— all 915 test files discovered exactly once.npm run checkand test discovery passed. The disposable integration checkout was restored clean.5490c6203a38b47d174f1cdc89c000573f2c1acb. Earlier successful runs are not substituted for this head.Compatibility, safety, and release
Review checklist