[PR #2060] [CLOSED] fix(javascript): preserve TypeScript resolution modes and native type erasure #4998

Closed
opened 2026-10-31 00:57:50 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2060
Author: @xu91102
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: fix/cts-static-module-lookup


📝 Commits (10+)

  • b6621b3 fix(javascript): resolve CTS static imports with CommonJS semantics
  • f01866d fix(javascript): retain explicit TypeScript import resolution modes
  • ae71496 test(mcp): align completion checks with warm provider state
  • 8017dd8 fix(javascript): preserve type re-export loader provenance
  • adf8526 chore: merge upstream completion fixture fixes
  • 43412f2 fix(javascript): retain complete TypeScript resolution evidence
  • df30e39 refactor(javascript): centralize type resolution node classification
  • 9340559 fix(javascript): retain type namespace re-exports
  • ec414e9 fix(javascript): preserve erased type references in native analysis
  • 995a083 fix(javascript): preserve native type erasure across module analysis

📊 Changes

42 files changed (+3513 additions, -329 deletions)

View changed files

📝 src/application/javascript/ElectronBoundaryAnalysis.ts (+8 -5)
📝 src/application/javascript/ElectronBoundaryGraphNative.ts (+55 -34)
📝 src/application/javascript/JavaScriptArtifactAnalysis.ts (+6 -4)
📝 src/application/javascript/JavaScriptArtifactGraphContext.ts (+0 -18)
📝 src/application/javascript/JavaScriptArtifactGraphFindings.ts (+2 -0)
📝 src/application/javascript/JavaScriptArtifactPathResolution.ts (+1 -1)
📝 src/composition/javascriptAnalysisWorkerProcess.ts (+10 -5)
📝 src/domain/javascript/electronNativeLoaderPaths.test.ts (+28 -6)
📝 src/domain/javascript/electronStaticAnalysis.ts (+3 -1)
📝 src/domain/javascript/electronStaticAnalysisNative.ts (+102 -60)
📝 src/domain/javascript/electronStaticAnalysisOptions.test.ts (+26 -0)
📝 src/domain/javascript/electronStaticAnalysisTypes.ts (+4 -1)
📝 src/domain/javascript/electronStaticAnalysisValues.ts (+3 -11)
📝 src/domain/javascript/javascriptAstValues.ts (+6 -0)
📝 src/domain/javascript/javascriptModuleDeclaration.ts (+39 -1)
📝 src/domain/javascript/javascriptSemanticAmbientWrites.test.ts (+30 -0)
📝 src/domain/javascript/javascriptSemanticAmbientWrites.ts (+5 -4)
📝 src/domain/javascript/javascriptSemanticAnalysis.builtin_defaults.test.ts (+30 -0)
📝 src/domain/javascript/javascriptSemanticAnalysis.require_links.test.ts (+14 -19)
📝 src/domain/javascript/javascriptSemanticAnalysis.ts (+19 -7)

...and 22 more files

📄 Description

TypeScript and checked-JavaScript erased module requests could disappear, select the wrong loader, or appear as runtime native exports. Preserve parser-owned requests, loader choice, source provenance and uncertainty through the owned worker and existing CLI/stdio MCP workflows.

Fixes #2056

  • Retain CTS/MTS import-equals, type re-exports, inline import types and JSDoc requests, including declaration erasure, explicit/omitted/unknown modes, original ranges/digests/member selections and origin modes. Only explicit type_only:false creates runtime native nodes, relationships and totals; erased and legacy-unclassified facts stay on their source asset.
  • Integrate main 7d1e4d0e2bfb77bd47203b4f962e4f034678dc75 and resolve four real source conflicts. Static consumers use upstream's one definitions pass before ambient writes; loader mode moves to the remaining third parameter. Explicit JavaScript extensions use JavaScript grammar, while detached JSDoc requests keep their TypeScript parser and separate metadata. Preserve upstream IPC deduplication and prior CommonJS lifetime/configuration-uncertainty fixes. No parallel compiled workflow, provider/schema/authority/deadline change or related cleanup deferred.
  • Tilde-fenced @import exclusion follows this PR's Markdown-example contract; TypeScript7 itself can process the directive and emit TS2307. Static syntax does not verify native binary exports.

Final head: bb04220156.

Final-byte macOS arm64 / Node24.18 / npm11.16 validation:

  • Fresh170 relevant files /2914 tests PASS, no skips. The initial160-file selection omitted the complete module-lookup/owned-worker and core mode suites; all10 missing files /353 tests then ran and passed on the same frozen bytes. Includes existing real TS7/Node controls, compiled CLI/stdio MCP, owned workers, cancellation and failure controls. No old test evidence substitutes for these runs.
  • Six static-check tasks plus module/architecture guards PASS (0 errors/1433 warnings); six documentation tasks plus5 conformance tests PASS; discovery1300 files exactlyonce PASS. Fresh independent Standards and Spec PASS.
  • Three extension scenarios combining conditional-arrow JavaScript, comparison syntax, JSDoc type aliases matching a runtime receiver and native/IPC facts pass through both actual CLI and stdio MCP, with source SHA/ranges and complete adapter parity. Node --check confirms syntax; this probe does not execute native dependencies. SDK closes are awaited, without proving OS process-family quiescence.
  • Four fresh completed CLI cost observations retain the same two immutable inputs/lock and business reads as four historical 090d observations. Full normalized output equality failed because accepted upstream owners replace container-dependent module metadata with source SHA and add boundary field; all such deltas are documented, with remaining payload values unchanged. Median elapsed1.117/1.143s, CPU1.31/1.375s; sampled family peaks505120–507344/503824–514000KiB. Historical timing, uncontrolled cache/load, estimated RSS and unmeasured tokens prevent isolated-cost or speedup claims. Entry-file hashes do not establish full runtime-tree equality.

Normal hooks, commit/push and frozen-byte checks: PASS; final contribution/integration patches and all3850 raw tracked inputs match the reviewed freeze byte for byte. CI for bb04220156: CI38668257089 completed SUCCESS. Its complete 2,297,295-byte log and all30 final jobs were read:16 success/14 conditional skips. Portable aggregate15062 PASS/129 skips combines source and shards; it is not an extra independent suite. GitHub tested synthetic83fae2685717231a26799efd25bae78b75367a36, with parents main d69acc3455 and this final PR head. Windows controls build passed; the Windows execution lane was skipped, so this is not actual Windows runtime verification. Previous 090d CI38625304403 is historical SUCCESS and does not establish new-head CI. Local full Windows/Linux, actual native engines and installed Electron were NOT RUN. Local review, remote automated review, CI and human readiness remain separate.

Author readiness

Human owner: @xu91102. Keep Draft; human declarations remain unchecked.

  • 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.

🔄 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/2060 **Author:** [@xu91102](https://github.com/xu91102) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/cts-static-module-lookup` --- ### 📝 Commits (10+) - [`b6621b3`](https://github.com/morluto/rea/commit/b6621b3b5e39bd9853cb410efcdf05e943b093c0) fix(javascript): resolve CTS static imports with CommonJS semantics - [`f01866d`](https://github.com/morluto/rea/commit/f01866de6f0ef7f9e4423df3d0e1742d2fb48bae) fix(javascript): retain explicit TypeScript import resolution modes - [`ae71496`](https://github.com/morluto/rea/commit/ae71496c8462cea4601eb0119ae96630e045d62d) test(mcp): align completion checks with warm provider state - [`8017dd8`](https://github.com/morluto/rea/commit/8017dd80829c348406257c487940c62cc0fafaef) fix(javascript): preserve type re-export loader provenance - [`adf8526`](https://github.com/morluto/rea/commit/adf85268426d442f30e6b11cb585e9efd4d5024f) chore: merge upstream completion fixture fixes - [`43412f2`](https://github.com/morluto/rea/commit/43412f2ba10276b1dfcff1482008a7e33eba71f3) fix(javascript): retain complete TypeScript resolution evidence - [`df30e39`](https://github.com/morluto/rea/commit/df30e398c96d0fa490eefab1bf519d52df6bb981) refactor(javascript): centralize type resolution node classification - [`9340559`](https://github.com/morluto/rea/commit/9340559a588307bd8b8676a4b2d1caf4aef12f29) fix(javascript): retain type namespace re-exports - [`ec414e9`](https://github.com/morluto/rea/commit/ec414e986110d40061966394e54c02396b06dcc0) fix(javascript): preserve erased type references in native analysis - [`995a083`](https://github.com/morluto/rea/commit/995a083eefbd0e2bd6437d06a54417bae063d2f9) fix(javascript): preserve native type erasure across module analysis ### 📊 Changes **42 files changed** (+3513 additions, -329 deletions) <details> <summary>View changed files</summary> 📝 `src/application/javascript/ElectronBoundaryAnalysis.ts` (+8 -5) 📝 `src/application/javascript/ElectronBoundaryGraphNative.ts` (+55 -34) 📝 `src/application/javascript/JavaScriptArtifactAnalysis.ts` (+6 -4) 📝 `src/application/javascript/JavaScriptArtifactGraphContext.ts` (+0 -18) 📝 `src/application/javascript/JavaScriptArtifactGraphFindings.ts` (+2 -0) 📝 `src/application/javascript/JavaScriptArtifactPathResolution.ts` (+1 -1) 📝 `src/composition/javascriptAnalysisWorkerProcess.ts` (+10 -5) 📝 `src/domain/javascript/electronNativeLoaderPaths.test.ts` (+28 -6) 📝 `src/domain/javascript/electronStaticAnalysis.ts` (+3 -1) 📝 `src/domain/javascript/electronStaticAnalysisNative.ts` (+102 -60) 📝 `src/domain/javascript/electronStaticAnalysisOptions.test.ts` (+26 -0) 📝 `src/domain/javascript/electronStaticAnalysisTypes.ts` (+4 -1) 📝 `src/domain/javascript/electronStaticAnalysisValues.ts` (+3 -11) 📝 `src/domain/javascript/javascriptAstValues.ts` (+6 -0) 📝 `src/domain/javascript/javascriptModuleDeclaration.ts` (+39 -1) 📝 `src/domain/javascript/javascriptSemanticAmbientWrites.test.ts` (+30 -0) 📝 `src/domain/javascript/javascriptSemanticAmbientWrites.ts` (+5 -4) 📝 `src/domain/javascript/javascriptSemanticAnalysis.builtin_defaults.test.ts` (+30 -0) 📝 `src/domain/javascript/javascriptSemanticAnalysis.require_links.test.ts` (+14 -19) 📝 `src/domain/javascript/javascriptSemanticAnalysis.ts` (+19 -7) _...and 22 more files_ </details> ### 📄 Description TypeScript and checked-JavaScript erased module requests could disappear, select the wrong loader, or appear as runtime native exports. Preserve parser-owned requests, loader choice, source provenance and uncertainty through the owned worker and existing CLI/stdio MCP workflows. Fixes #2056 - Retain CTS/MTS import-equals, type re-exports, inline import types and JSDoc requests, including declaration erasure, explicit/omitted/unknown modes, original ranges/digests/member selections and origin modes. Only explicit `type_only:false` creates runtime native nodes, relationships and totals; erased and legacy-unclassified facts stay on their source asset. - Integrate main `7d1e4d0e2bfb77bd47203b4f962e4f034678dc75` and resolve four real source conflicts. Static consumers use upstream's one definitions pass before ambient writes; loader mode moves to the remaining third parameter. Explicit JavaScript extensions use JavaScript grammar, while detached JSDoc requests keep their TypeScript parser and separate metadata. Preserve upstream IPC deduplication and prior CommonJS lifetime/configuration-uncertainty fixes. No parallel compiled workflow, provider/schema/authority/deadline change or related cleanup deferred. - Tilde-fenced `@import` exclusion follows this PR's Markdown-example contract; TypeScript7 itself can process the directive and emit TS2307. Static syntax does not verify native binary exports. Final head: bb042201566a06cdbdb8c04e80921feb90bbe74c. Final-byte macOS arm64 / Node24.18 / npm11.16 validation: - Fresh170 relevant files /2914 tests PASS, no skips. The initial160-file selection omitted the complete module-lookup/owned-worker and core mode suites; all10 missing files /353 tests then ran and passed on the same frozen bytes. Includes existing real TS7/Node controls, compiled CLI/stdio MCP, owned workers, cancellation and failure controls. No old test evidence substitutes for these runs. - Six static-check tasks plus module/architecture guards PASS (0 errors/1433 warnings); six documentation tasks plus5 conformance tests PASS; discovery1300 files exactlyonce PASS. Fresh independent Standards and Spec PASS. - Three extension scenarios combining conditional-arrow JavaScript, comparison syntax, JSDoc type aliases matching a runtime receiver and native/IPC facts pass through both actual CLI and stdio MCP, with source SHA/ranges and complete adapter parity. Node `--check` confirms syntax; this probe does not execute native dependencies. SDK closes are awaited, without proving OS process-family quiescence. - Four fresh completed CLI cost observations retain the same two immutable inputs/lock and business reads as four historical `090d` observations. Full normalized output equality failed because accepted upstream owners replace container-dependent module metadata with source SHA and add boundary `field`; all such deltas are documented, with remaining payload values unchanged. Median elapsed1.117/1.143s, CPU1.31/1.375s; sampled family peaks505120–507344/503824–514000KiB. Historical timing, uncontrolled cache/load, estimated RSS and unmeasured tokens prevent isolated-cost or speedup claims. Entry-file hashes do not establish full runtime-tree equality. Normal hooks, commit/push and frozen-byte checks: PASS; final contribution/integration patches and all3850 raw tracked inputs match the reviewed freeze byte for byte. CI for bb042201566a06cdbdb8c04e80921feb90bbe74c: [CI38668257089](https://github.com/morluto/rea/actions/runs/38668257089) completed SUCCESS. Its complete 2,297,295-byte log and all30 final jobs were read:16 success/14 conditional skips. Portable aggregate15062 PASS/129 skips combines source and shards; it is not an extra independent suite. GitHub tested synthetic83fae2685717231a26799efd25bae78b75367a36, with parents main d69acc3455c33f90a2fc4381db43d38b6af50622 and this final PR head. Windows controls build passed; the Windows execution lane was skipped, so this is not actual Windows runtime verification. Previous `090d` CI38625304403 is historical SUCCESS and does not establish new-head CI. Local full Windows/Linux, actual native engines and installed Electron were NOT RUN. Local review, remote automated review, CI and human readiness remain separate. ## Author readiness Human owner: @xu91102. Keep Draft; human declarations remain unchecked. - [ ] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:57:50 +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#4998
No description provided.