Skip to content

fix(javascript): preserve trailing slash in package directory requests - #1615

Merged
morluto merged 1 commit into
morluto:mainfrom
immanuwell:fix/package-directory-trailing-slash
Oct 10, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
immanuwell:fix/package-directory-trailing-slash

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 423b11c into morluto:main Oct 10, 2026
17 of 19 checks passed
@morluto

morluto commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Welcome to REA, @immanuwell! Thanks for tracking down why require("fixture/") selected a file instead of the package directory, and for checking the CLI and MCP results against Node's resolver. Squash-merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build, CI, packaging, and publishing bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants