[PR #2031] [MERGED] test(javascript): consolidate module lookup regressions #4971

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2031
Author: @xu91102
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @morluto

Base: main ← Head: fix/esm-relative-exact-files


📝 Commits (4)

  • 4e6a47e fix(javascript): resolve relative ESM URLs as exact files
  • 48b82a9 test(javascript): merge main and retain exact ESM regressions
  • 6ece0ee test(javascript): consolidate module lookup regressions
  • 8f96a93 test(javascript): align module coverage with upstream controls

📊 Changes

1 file changed (+39 additions, -14 deletions)

View changed files

📝 tests/acceptance/applications/JavaScriptModuleLookupCli.test.ts (+39 -14)

📄 Description

Summary

The separate module-lookup acceptance files repeat the compiled CLI and stdio MCP workflows already owned by JavaScriptModuleLookupCli.test.ts. Fold their useful assertions into that existing journey and give the fixture an explicit CommonJS package scope so Node controls are independent of the temporary directory's parent package.

Refs #2020, #2021 and #2022. The production loader fixes are already on main in c0904b4c1a; the query-bearing ESM and index.cjs controls are also upstream in b7f563e15f. This diff retains the additional fixture isolation, TypeScript inference and value assertions in the existing test file.

Problem and expected behavior

The original standalone CommonJS fixture fails when TMPDIR is inside an ESM package: its .js controls inherit ESM scope and return an empty module namespace instead of the expected value. The regression fixture must own its module type, preserve Node's actual success/failure behavior and avoid adding parallel workflows for the same loader rules.

Change and scope

  • Reuse the upstream query-bearing ESM and index.cjs controls without duplicate fixtures; extend the existing CLI/MCP matrix with a rejected extensionless .mjs candidate, a valid index.js directory and .mts/.cts emitted-source counterpart inference.
  • Assert real Node return values, including the empty-main fallback's value 42, while retaining the existing rejection and package-ancestry assertions.
  • Set the fixture root's package type to CommonJS. No additional test file or parameterized workflow is added.

Contract and boundary impact

  • Semantic owner and earliest changed stage: existing JavaScript module-lookup acceptance fixture; production resolution is unchanged.
  • CLI and MCP/tool-catalog contract: unchanged; both compiled public surfaces are exercised.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: preserve resolved paths, explicit lookup failures and native Node controls.
  • Process execution, authorization, cleanup, or containment impact: existing fixture-owned temporary-directory cleanup and CLI/MCP harness retained.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests updated: JavaScriptModuleLookupCli.test.ts.

  • Base evidence: the previous standalone CommonJS test produced 1 failed / 1 passed case with TMPDIR inside the ESM checkout. The consolidated fixture passed both cases in that same parent package scope.

  • User-visible CLI/MCP output: query-bearing exact paths and TypeScript source counterparts resolve; unsupported CommonJS extension/index probes remain unresolved.

  • Remaining proof gaps: TypeScript cases assert REA's static source-counterpart inference; they do not compile or execute those TypeScript fixtures. Full deterministic CI and other operating systems are pending.

  • 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

Executed with Node 24.18.0 / npm 11.16.0 on macOS arm64:

  • npm run test:focused -- tests/acceptance/applications/JavaScriptModuleLookupCli.test.ts src/application/javascript/JavaScriptArtifactPathResolution.test.ts tests/boundary/filesystem/javascript-applications/javascriptApplicationTypeScript.test.ts — 120 tests / 3 files passed.
  • npm run test:focused -- tests/acceptance/applications/JavaScriptModuleLookupCli.test.ts, with fixture TMPDIR inside the ESM checkout — 2 tests passed; owned temporary directory cleaned up.
  • npm run check — all 6 tasks and architecture guards passed; 844 lint warnings, 0 errors.
  • npm run verify:test-discovery — 909 test files discovered exactly once.
  • Independent Standards and Spec review of the final diff — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: real local Node, compiled CLI and stdio MCP; no browser/native provider or cross-platform run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: only existing test fixtures and controls change; no new external provider or production authorization behavior.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed (no production contract changes).
  • User-visible CLI/MCP assertions cover representative resolved and unresolved paths.
  • I checked the final diff 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/2031 **Author:** [@xu91102](https://github.com/xu91102) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/esm-relative-exact-files` --- ### 📝 Commits (4) - [`4e6a47e`](https://github.com/morluto/rea/commit/4e6a47e57a538e02194279f7fd67ed48884ad0d2) fix(javascript): resolve relative ESM URLs as exact files - [`48b82a9`](https://github.com/morluto/rea/commit/48b82a97266683b948c60c7c7b2491c05f62f037) test(javascript): merge main and retain exact ESM regressions - [`6ece0ee`](https://github.com/morluto/rea/commit/6ece0eea4fb0c408c530dd4555b3d4397caa69d6) test(javascript): consolidate module lookup regressions - [`8f96a93`](https://github.com/morluto/rea/commit/8f96a93cdd70b6add4b1af34351f866029189f65) test(javascript): align module coverage with upstream controls ### 📊 Changes **1 file changed** (+39 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `tests/acceptance/applications/JavaScriptModuleLookupCli.test.ts` (+39 -14) </details> ### 📄 Description ## Summary The separate module-lookup acceptance files repeat the compiled CLI and stdio MCP workflows already owned by `JavaScriptModuleLookupCli.test.ts`. Fold their useful assertions into that existing journey and give the fixture an explicit CommonJS package scope so Node controls are independent of the temporary directory's parent package. Refs #2020, #2021 and #2022. The production loader fixes are already on main in c0904b4c1aabfccf2f0ab12f44960a0a1fbbbfae; the query-bearing ESM and `index.cjs` controls are also upstream in b7f563e15f854061dc1507896181b7b24ac3b5f0. This diff retains the additional fixture isolation, TypeScript inference and value assertions in the existing test file. ## Problem and expected behavior The original standalone CommonJS fixture fails when `TMPDIR` is inside an ESM package: its `.js` controls inherit ESM scope and return an empty module namespace instead of the expected value. The regression fixture must own its module type, preserve Node's actual success/failure behavior and avoid adding parallel workflows for the same loader rules. ## Change and scope - Reuse the upstream query-bearing ESM and `index.cjs` controls without duplicate fixtures; extend the existing CLI/MCP matrix with a rejected extensionless `.mjs` candidate, a valid `index.js` directory and `.mts`/`.cts` emitted-source counterpart inference. - Assert real Node return values, including the empty-main fallback's value 42, while retaining the existing rejection and package-ancestry assertions. - Set the fixture root's package type to CommonJS. No additional test file or parameterized workflow is added. ## Contract and boundary impact - Semantic owner and earliest changed stage: existing JavaScript module-lookup acceptance fixture; production resolution is unchanged. - CLI and MCP/tool-catalog contract: unchanged; both compiled public surfaces are exercised. - Provider, bridge, target-format, or platform compatibility: unchanged. - Evidence, artifact, provenance, or reconstruction contract: preserve resolved paths, explicit lookup failures and native Node controls. - Process execution, authorization, cleanup, or containment impact: existing fixture-owned temporary-directory cleanup and CLI/MCP harness retained. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Tests updated: `JavaScriptModuleLookupCli.test.ts`. - Base evidence: the previous standalone CommonJS test produced 1 failed / 1 passed case with `TMPDIR` inside the ESM checkout. The consolidated fixture passed both cases in that same parent package scope. - User-visible CLI/MCP output: query-bearing exact paths and TypeScript source counterparts resolve; unsupported CommonJS extension/index probes remain unresolved. - Remaining proof gaps: TypeScript cases assert REA's static source-counterpart inference; they do not compile or execute those TypeScript fixtures. Full deterministic CI and other operating systems are pending. - [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 Executed with Node 24.18.0 / npm 11.16.0 on macOS arm64: - `npm run test:focused -- tests/acceptance/applications/JavaScriptModuleLookupCli.test.ts src/application/javascript/JavaScriptArtifactPathResolution.test.ts tests/boundary/filesystem/javascript-applications/javascriptApplicationTypeScript.test.ts` — 120 tests / 3 files passed. - `npm run test:focused -- tests/acceptance/applications/JavaScriptModuleLookupCli.test.ts`, with fixture `TMPDIR` inside the ESM checkout — 2 tests passed; owned temporary directory cleaned up. - `npm run check` — all 6 tasks and architecture guards passed; 844 lint warnings, 0 errors. - `npm run verify:test-discovery` — 909 test files discovered exactly once. - Independent Standards and Spec review of the final diff — passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: real local Node, compiled CLI and stdio MCP; no browser/native provider or cross-platform run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: only existing test fixtures and controls change; no new external provider or production authorization behavior. ## Review checklist - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed (no production contract changes). - [x] User-visible CLI/MCP assertions cover representative resolved and unresolved paths. - [x] I checked the final diff 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-31 00:57:34 +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#4971
No description provided.