[PR #1035] [MERGED] fix: select Node legacy package entry fields for import and require #2599

Closed
opened 2026-10-17 21:08:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1035
Author: @rudycelekli
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/node-package-legacy-entry-fields


📝 Commits (1)

  • 8b29d28 fix(javascript): use Node legacy package entry fields

📊 Changes

3 files changed (+145 additions, -5 deletions)

View changed files

📝 src/application/javascript/JavaScriptArtifactPathResolution.test.ts (+29 -0)
📝 src/application/javascript/JavaScriptArtifactPathResolution.ts (+6 -4)
📝 tests/boundary/filesystem/javascriptPackagePrecedence.test.ts (+110 -1)

📄 Description

Summary

Make explicit Node import/require package edges select the legacy main entry or existing index fallback rather than the bundler-specific module field. Discovered through source tracing and native Node/compiled CLI comparison; there is no corresponding open issue to link.

Problem and expected behavior

With main: "actual.cjs", module: "bundler.mjs", Node imports actual.cjs but REA points both import relationships at bundler.mjs. With only module, Node import and require load index.js, while REA points at bundler.mjs.

Change and scope

Explicit import/require resolution ignores the module field. Declared exports handling and the existing generic main/module heuristic when the module kind is omitted stay intact. This corrects one entry-field selection cause; it does not claim complete Node resolution parity.

Contract and boundary impact

  • Semantic owner and earliest changed stage: package-entry selection in JavaScriptArtifactPathResolution.
  • CLI and MCP/tool-catalog contract: schemas and tool inventory unchanged; shared analysis results identify the correct selected package path.
  • Provider, bridge, target-format, or platform compatibility: real Node 24.18.0 import/require oracle on macOS; no external provider or bridge changes.
  • Evidence, artifact, provenance, or reconstruction contract: static relationships retain their inferred status and limitations; selected path matches the native fixture loader.
  • Process execution, authorization, cleanup, or containment impact: analysis continues to read inert source. Only the owned regression fixtures execute in the independent Node oracle; case-scoped awaited cleanup. Admission and containment unchanged.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: six native-loader filesystem cases and two owner cases preserving generic undefined-kind behavior.

  • Base reproduction: current main 6e4535c1 produces three wrong CLI targets and three passing controls. The changed owner pair fails 3 tests and passes 47 on the original source.

  • User-visible output: import main+module changes resolved_path from node_modules/fixture/bundler.mjs to node_modules/fixture/actual.cjs; module-only import/require changes it to node_modules/fixture/index.js. After the fix all six public CLI cases agree with the native resolved identity and executed value.

  • Remaining proof gaps: full inherited hosted acceptance passed at the signed head below; no broader Node parity claim.

  • 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

  • Own physical npm ci, pinned Node 24.18.0/npm 11.16.0 and unchanged lockfile: 366 packages, passed.
  • npm run build:cached: passed; focused boundary runner rebuilt the fixed source.
  • npm run test:focused -- six resolution/reconstruction owners: 88 passed, 0 failed.
  • npm run check: passed. First attempt caught my enlarged describe callback exceeding the existing limit; generic cases moved into a separate group and limit unchanged.
  • npm run verify:test-discovery: passed.
  • Actual compiled analyze-javascript-application versus native Node loader: 3 affected / 3 controls before, 6 correct after.
  • Required inherited CI run 37698763344: all 22 jobs passed at signed/DCO 8b29d289fcc2299f216d54ea0845130bda8f5d27, including all four source shards and aggregate coverage, static/docs/conformance/readiness gates, and native package/runtime lanes. The separate generated-files workflow is not substituted for full CI.
  • The frozen three-file diff and native Node/public CLI evidence received independent source review before signed preparation.

Two initial focused invocations named nonexistent files and failed before tests ran; actual six-file selection passed. A direct formatter attempt lacked Node on PATH and did not run; pinned invocation passed. A preliminary oracle compared macOS /var and /private/var aliases; retained current-main before/after proof canonicalizes the owned fixture root and compares actual identities.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS native Node and public CLI only; Hopper/Ghidra/IDA/browser and paid providers not run or claimed.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: owned inert fixture modules only; no analysis execution added, no admission changes, no operator settings or secrets used.

Review checklist

  • One focused outcome and Conventional Commit title.
  • Reason for no linked issue stated above.
  • Changed observable behavior and compatibility controls covered.
  • Owning contracts and generated metadata unchanged; no regeneration needed.
  • Representative user-visible output included.
  • Final diff checked for secrets, unrelated cleanup, and unsupported claims.

🔄 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/1035 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/node-package-legacy-entry-fields` --- ### 📝 Commits (1) - [`8b29d28`](https://github.com/morluto/rea/commit/8b29d289fcc2299f216d54ea0845130bda8f5d27) fix(javascript): use Node legacy package entry fields ### 📊 Changes **3 files changed** (+145 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/application/javascript/JavaScriptArtifactPathResolution.test.ts` (+29 -0) 📝 `src/application/javascript/JavaScriptArtifactPathResolution.ts` (+6 -4) 📝 `tests/boundary/filesystem/javascriptPackagePrecedence.test.ts` (+110 -1) </details> ### 📄 Description ## Summary Make explicit Node import/require package edges select the legacy `main` entry or existing index fallback rather than the bundler-specific `module` field. Discovered through source tracing and native Node/compiled CLI comparison; there is no corresponding open issue to link. ## Problem and expected behavior With `main: "actual.cjs", module: "bundler.mjs"`, Node imports `actual.cjs` but REA points both import relationships at `bundler.mjs`. With only `module`, Node import and require load `index.js`, while REA points at `bundler.mjs`. ## Change and scope Explicit import/require resolution ignores the `module` field. Declared `exports` handling and the existing generic main/module heuristic when the module kind is omitted stay intact. This corrects one entry-field selection cause; it does not claim complete Node resolution parity. ## Contract and boundary impact - Semantic owner and earliest changed stage: package-entry selection in `JavaScriptArtifactPathResolution`. - CLI and MCP/tool-catalog contract: schemas and tool inventory unchanged; shared analysis results identify the correct selected package path. - Provider, bridge, target-format, or platform compatibility: real Node 24.18.0 import/require oracle on macOS; no external provider or bridge changes. - Evidence, artifact, provenance, or reconstruction contract: static relationships retain their inferred status and limitations; selected path matches the native fixture loader. - Process execution, authorization, cleanup, or containment impact: analysis continues to read inert source. Only the owned regression fixtures execute in the independent Node oracle; case-scoped awaited cleanup. Admission and containment unchanged. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Tests added or updated: six native-loader filesystem cases and two owner cases preserving generic undefined-kind behavior. - Base reproduction: current main `6e4535c1` produces three wrong CLI targets and three passing controls. The changed owner pair fails 3 tests and passes 47 on the original source. - User-visible output: import `main+module` changes `resolved_path` from `node_modules/fixture/bundler.mjs` to `node_modules/fixture/actual.cjs`; module-only import/require changes it to `node_modules/fixture/index.js`. After the fix all six public CLI cases agree with the native resolved identity and executed value. - Remaining proof gaps: full inherited hosted acceptance passed at the signed head below; no broader Node parity claim. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - Own physical `npm ci`, pinned Node 24.18.0/npm 11.16.0 and unchanged lockfile: 366 packages, passed. - `npm run build:cached`: passed; focused boundary runner rebuilt the fixed source. - `npm run test:focused --` six resolution/reconstruction owners: 88 passed, 0 failed. - `npm run check`: passed. First attempt caught my enlarged describe callback exceeding the existing limit; generic cases moved into a separate group and limit unchanged. - `npm run verify:test-discovery`: passed. - Actual compiled `analyze-javascript-application` versus native Node loader: 3 affected / 3 controls before, 6 correct after. - Required inherited [CI run 37698763344](https://github.com/rudycelekli/rea/actions/runs/37698763344): all 22 jobs passed at signed/DCO `8b29d289fcc2299f216d54ea0845130bda8f5d27`, including all four source shards and aggregate coverage, static/docs/conformance/readiness gates, and native package/runtime lanes. The separate generated-files workflow is not substituted for full CI. - The frozen three-file diff and native Node/public CLI evidence received independent source review before signed preparation. Two initial focused invocations named nonexistent files and failed before tests ran; actual six-file selection passed. A direct formatter attempt lacked Node on PATH and did not run; pinned invocation passed. A preliminary oracle compared macOS `/var` and `/private/var` aliases; retained current-main before/after proof canonicalizes the owned fixture root and compares actual identities. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: macOS native Node and public CLI only; Hopper/Ghidra/IDA/browser and paid providers not run or claimed. - Package or release metadata impact: none. - Security, privacy, process, or containment review: owned inert fixture modules only; no analysis execution added, no admission changes, no operator settings or secrets used. ## Review checklist - [x] One focused outcome and Conventional Commit title. - [x] Reason for no linked issue stated above. - [x] Changed observable behavior and compatibility controls covered. - [x] Owning contracts and generated metadata unchanged; no regeneration needed. - [x] Representative user-visible output included. - [x] Final diff checked for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:08:02 +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#2599
No description provided.