Repository navigation
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: f11cc3dc05
ℹ️ 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".
| @@ -154,7 +152,7 @@ const contextualCandidate = ( | |||
| if (!declared.startsWith(".") && !declared.startsWith("/")) | |||
| return bareModuleCandidate(input, declared); | |||
There was a problem hiding this comment.
Normalize suffixes before legacy package-path lookup
When an ES-module bare subpath has a query or fragment and the package has no exports (for example, import "fixture/feature.js?cache=1"), Node 24 still loads feature.js; only exports key selection treats the suffix as literal. Passing the full request into bareModuleCandidate also feeds it to the legacy branch at lines 294-298, which looks for an inventoried file literally named feature.js?cache=1 and reports not-found (or can select that wrong literal file). Keep the full subpath through selectPackageExport, but strip its suffix before the no-exports filesystem lookup.
AGENTS.md reference: AGENTS.md:L21-L21
Useful? React with 👍 / 👎.
Summary
Bare ESM package specifiers lost their query/fragment spelling before exports lookup, inventing dependencies that Node rejects and missing explicitly exported punctuated keys. Preserve the full bare package request and apply URL normalization only to URL-like paths. Fixes #1883.
Problem and expected behavior
Given a package exporting only
./feature, Node rejectsimport "fixture/feature?cache=1"withERR_PACKAGE_PATH_NOT_EXPORTED. REA previously reportednode_modules/fixture/feature.cjsas resolved by silently looking up./feature. The import now remains external/unresolved. An explicitly exported./literal?cache=1still resolves by that exact key.Change and scope
Keep module-specifier text intact until bare package requests are distinguished from relative/file URLs. Strip query/fragment text in the relative ESM URL branch, retaining existing HTML, source-map URL, file URL, and CommonJS behavior. Package export selection itself is unchanged.
Contract and boundary impact
Evidence and regression coverage
New compiled CLI and stdio MCP acceptance coverage checks unexported query and fragment requests plus an explicitly exported query-bearing subpath.
Separate real Node subprocesses resolve each request against the same on-disk package: the unexported requests return
ERR_PACKAGE_PATH_NOT_EXPORTED, and the explicit full key loads its intended module.On base
fb94d9dde0ccda83ae520ac6fb22b1d283562cf3, both new surface tests failed because REA invented the./featuretarget. Both pass after the fix.A separate actual CLI reproduction produced the wrong resolved target twice while direct Node execution rejected the request.
Existing relative ESM, file URL, CommonJS, conditional exports, and package-subpath tests pass.
Review: self-review of the fixed base, complete patch, and new acceptance test; no actionable findings.
Remaining proof gaps: full deterministic coverage is left to upstream CI; real native engines and browser runtime are outside this static resolution change.
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
All local checks used Node 24.18.0 / npm 11.16.0 on macOS 27.0.1 arm64.
npm run test:focused -- tests/acceptance/applications/packageSpecifierSuffixCli.test.tsbefore the production fix — 2 expected regression failures.npm run test:focused -- tests/acceptance/applications/packageSpecifierSuffixCli.test.ts tests/acceptance/applications/packageSubpathsCli.test.ts tests/boundary/javascript/packageConditionalExports.test.ts src/application/javascript/JavaScriptModuleSpecifierPaths.test.ts src/application/javascript/JavaScriptArtifactPathResolution.test.ts— 181 tests passed across 5 files, including freshly built CLI/MCP workflows.npm run check— passed typecheck, lint, formatting, knip, metadata, module boundaries, and architecture guards; 758 lint warnings, zero errors.npm run verify:test-discovery— all 843 test files discovered exactly once.git diff --check— passed.action_required); no CI jobs have executed. This is not counted as a passing check.Compatibility, safety, and release
Review checklist