Repository navigation
fix(javascript): preserve package and source-map boundary identity - #1939
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a77c43b5a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5caa68f56f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d9efffbd7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
TL;DR: All three fixes work at 0d548f3, and the source-map fix is the same patch as xu91102's. Commit 3a77c43 broke imports with a suffix in old packages, and two later commits fixed that. Then 0d548f3 makes old packages refuse some imports, as Node does. This follows my earlier #1887 comment. The link is below. The PR head moved while I tested. I ran 3a77c43, then 5caa68f, then 0d548f3. The newest head, 6d9efff, came after my runs. The base is d802304 (#1902), the merge base. It was main when I started, so this also covers a Not run item in my #1887 comment. Old packages here means packages with no Source mapsCommit 6277401 holds the same patch as xu91102's 851cd98. The two diffs differ only in one git blob-hash line, which comes from the rebase. The author is kept. The later commits do not touch the source-map files. I ran the same 17 fixture folders as before, through the CLI and the MCP server, on the base and on all three heads. The two agreed on every folder. The three heads gave identical results.
This matches my #1887 results row for row. The six bad prefixes still say "Source map is not valid JSON". Inline The PR says it keeps original bytes, digests and source provenance. For every recovered folder, on the CLI and on MCP, I checked this:
I added three folders with hard source text: accents, a fox emoji, CJK, CRLF, a tab, trailing spaces and U+2028. Two of them have a prefix. All three pass the checks above. Base recovers only the clean one. The result holds a digest of the recovered source, not the text. So this is a digest match, not a byte-for-byte diff of the text. The other two fixesI used the files from issues #1881 and #1883, the shape from the PR test, and a legacy package. I also ran plain Node on every specifier, on Node 22.23.1, 24.18.0 and 26.11.1. All three agreed. The CLI and MCP agreed too.
"Linked" means REA resolved the import to the right file. "Not linked" means REA marked it external. Node refuses with Commit 3a77c43 broke the first two What commit 0d548f3 changes, from its diff and my runs: an ESM import into an old package must now name a real file. A directory import is rejected, and the note says package main and index lookup were not tried. An import with no extension is not found. The Tests
The 12 files are the 3 new ones, the 4 related source-map files from my #1887 run, and 5 existing path-resolution files. The one Node 22 failure is in The three new test files fail on the base. The suffix test, in its 0d548f3 form, fails on the base with 2 failures out of 2. Not run
Thanks, xu91102, for the source-map fix and the clear issue. Thanks, morluto, for folding it in and for the follow-up commits. All 17 fixtures and 3 byte checks
Commands# build each tree (Node 24.18.0); the lock file is identical, so one node_modules served all trees
npm ci && npm run build && npm run test:prepare
# source-map fixtures: 17 folders plus 3 byte-check folders, CLI and stdio MCP from each tree
node scripts/rea.mjs analyze-javascript-application <folder> --format json
# MCP: tool analyze_javascript_application, input_path=<folder>, format=directory,
# over stdio against node scripts/rea.mjs mcp from the same tree
# package fixtures (5 folders): same CLI and MCP calls, then plain Node on each specifier
node --input-type=module -e 'await import("<specifier>")'
# tests
npm run test:focused -- <12 files> # Node 22 and 26: the same, with that node first on PATH
npm run test:fastTiming is from a shared box. Other test jobs were running. The load average was 2.5 to 7 on 24 threads. Test setup
🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9db68c0d81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95ec1e4220
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Fixes #1881, fixes #1882, fixes #1883.
Bare ESM specifiers preserve query/fragment identity through exports lookup, package self-references use the correct loader rules, and retained prefixed source maps recover original-source evidence while preserving their bytes and digests.
The branch integrates @xu91102's implementation commits from #1888, #1884 and #1887, retaining their original authorship. Those PRs are superseded by this integration.
Behavior and ownership
@scopetherefore cannot steal an ESM import of the installed@scope/pkgdependency. Loader conditions and exports encapsulation remain intact.legacy?xcannot select a literal suffixed directory or silently fall back tolegacy. Exact suffixed self names and CommonJS literal dependency names retain their distinct behavior.Contract and boundary impact
Artifact path resolution owns module identity and lookup; the domain source-map envelope owns the parsing view. CLI/MCP input schemas and tool catalog are unchanged. Module edges preserve original specifiers, source digests, locations and explicit unknowns. Process authority, package installation and generated metadata are unchanged.
Validation
Executed on macOS with pinned Node 24.18.0:
No breaking input change or migration. These workflows exercise REA CLI/MCP and real Node resolution; they do not establish browser, Electron, Windows or Bun runtime behavior. Heavy resource-exhaustion tests and real Hopper/Ghidra/IDA providers were not run for this change.