[PR #1615] [MERGED] fix(javascript): preserve trailing slash in package directory requests #4701

Closed
opened 2026-10-31 00:54:09 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/package-directory-trailing-slash


📝 Commits (1)

  • 952de8b fix(javascript): preserve trailing slash in package directory requests

📊 Changes

2 files changed (+8 additions, -1 deletions)

View changed files

📝 src/application/javascript/JavaScriptArtifactPathResolution.ts (+2 -1)
📝 tests/acceptance/applications/packageSubpathsCli.test.ts (+6 -0)

📄 Description

Summary

Fix the wrong import target for require("fixture/"). Related: #1424; no matching issue found.

Problem and expected behavior

Create this app:

main.cjs                         console.log(require("fixture/"));
node_modules/fixture.js          module.exports = "file";
node_modules/fixture/index.js    module.exports = "directory";

Run node main.cjs: it prints directory. Run rea analyze-javascript-application /absolute/path/to/app: the import edge incorrectly points to node_modules/fixture.js. The trailing slash asks for the directory.

Change and scope

posix.join(directory, "") drops the slash. Preserve it before the existing confinement normalizer runs. Tiny fix, same resolver.

Contract and boundary impact

  • Semantic owner and earliest changed stage: application package-path resolution.
  • CLI and MCP/tool-catalog contract: unchanged schemas; corrected target.
  • Provider, bridge, target-format, or platform compatibility: static CommonJS analysis.
  • Evidence, artifact, provenance, or reconstruction contract: original specifier and source provenance retained.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests updated: existing CLI/MCP fixture, compared with Node's resolver.

  • Base reproduction: both acceptance cases fail on main; pass with the fix.

  • User-visible output: fixture/ resolves to fixture/index.js; fixture still resolves to fixture.js.

  • Remaining proof gaps: macOS and Windows not run.

  • 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:focused for packageSubpathsCli, JavaScriptArtifactPathResolution, JavaScriptModuleSpecifierPaths and packageConditionalExports: 134 passed.
  • npm run check: passed, lint warnings but no errors.
  • git diff --check: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Linux, Node 24.18.0; native providers not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: existing confinement and container checks retained.

Review checklist

  • Concrete problem; one focused outcome; conventional title.
  • Related work linked; no matching issue found.
  • Tests cover corrected behavior and existing failure paths.
  • No docs, schemas or generated metadata changes needed.
  • Representative output included; final diff checked for unrelated changes 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/1615 **Author:** [@immanuwell](https://github.com/immanuwell) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/package-directory-trailing-slash` --- ### 📝 Commits (1) - [`952de8b`](https://github.com/morluto/rea/commit/952de8bac47a39f0b3c63b24b7b65e191374a159) fix(javascript): preserve trailing slash in package directory requests ### 📊 Changes **2 files changed** (+8 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/application/javascript/JavaScriptArtifactPathResolution.ts` (+2 -1) 📝 `tests/acceptance/applications/packageSubpathsCli.test.ts` (+6 -0) </details> ### 📄 Description ## Summary Fix the wrong import target for `require("fixture/")`. Related: #1424; no matching issue found. ## Problem and expected behavior Create this app: ```text main.cjs console.log(require("fixture/")); node_modules/fixture.js module.exports = "file"; node_modules/fixture/index.js module.exports = "directory"; ``` Run `node main.cjs`: it prints `directory`. Run `rea analyze-javascript-application /absolute/path/to/app`: the import edge incorrectly points to `node_modules/fixture.js`. The trailing slash asks for the directory. ## Change and scope `posix.join(directory, "")` drops the slash. Preserve it before the existing confinement normalizer runs. Tiny fix, same resolver. ## Contract and boundary impact - Semantic owner and earliest changed stage: application package-path resolution. - CLI and MCP/tool-catalog contract: unchanged schemas; corrected target. - Provider, bridge, target-format, or platform compatibility: static CommonJS analysis. - Evidence, artifact, provenance, or reconstruction contract: original specifier and source provenance retained. - Process execution, authorization, cleanup, or containment impact: none. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Tests updated: existing CLI/MCP fixture, compared with Node's resolver. - Base reproduction: both acceptance cases fail on main; pass with the fix. - User-visible output: `fixture/` resolves to `fixture/index.js`; `fixture` still resolves to `fixture.js`. - Remaining proof gaps: macOS and Windows not run. - [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 - `npm run test:focused` for packageSubpathsCli, JavaScriptArtifactPathResolution, JavaScriptModuleSpecifierPaths and packageConditionalExports: 134 passed. - `npm run check`: passed, lint warnings but no errors. - `git diff --check`: passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: Linux, Node 24.18.0; native providers not applicable. - Package or release metadata impact: none. - Security, privacy, process, or containment review: existing confinement and container checks retained. ## Review checklist - [x] Concrete problem; one focused outcome; conventional title. - [x] Related work linked; no matching issue found. - [x] Tests cover corrected behavior and existing failure paths. - [x] No docs, schemas or generated metadata changes needed. - [x] Representative output included; final diff checked for unrelated changes 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:54:09 +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#4701
No description provided.