Repository navigation
fix(javascript): resolve root package exports arrays - #1046
Conversation
N0zoM1z0
left a comment
There was a problem hiding this comment.
Reviewed the complete patch and traced root exports selection through the existing ordered target walker and artifact resolver. The two removed array rejections fix #1041; the existing array semantics correctly retain declaration order and target refusal.
Independent verification at final head c239c04cf31b7b622c2bf81f3aa767e0f711a7e9:
- Fresh locked install and production build with Node 24.18.0/npm 11.16.0 on Linux x64.
- Three focused files: 54 tests passed, including the package filesystem/Node oracle cases, URI/path resolution, and the complete post-SDK input compatibility guard from merged #919.
- Full standalone typecheck, lint/module-boundary checks, and generated-document checks passed.
- Eight actual CLI/MCP analyses produced identical results and matched Node: top-level/root/nested arrays, invalid and unmatched entries, empty/blocked arrays, target order, and first-target absence. Empty or blocked arrays did not use index fallback; a missing first target did not select a later target.
The only follow-up was synchronizing merged main and retaining both documentation paragraphs in the conflict. The final diff remains the original three files; no generated MCP catalog is tracked. #1040 target validation remains a separate issue.
The original head's complete CI passed. Fresh CI is now running for this final follow-up head; merge will wait for those exact results.
Co-authored-by: N0zoM1z0 <[email protected]>
Summary
Fixes #1041. Resolve package
exportsarrays at the top level and under the root"."subpath using the existing exports-target walker.Problem and expected behavior
A package with
exports: ["./actual.cjs"]resolves in Node but REA reports unavailable/invalid package metadata. The same happens for{ ".": ["./actual.cjs"] }. Valid arrays should select the same target as Node rather than falling back to legacy index files.Change and scope
Remove the two premature array rejections from
packageExport. The existing recursiveexportTargetsimplementation already handles ordered arrays, invalid entries, unmatched conditions, and nested arrays. Add four filesystem regressions that compare production reconstruction directly withcreateRequire(...).resolve(...), retaining the existing legacy-resolution cases.Contract and boundary impact
Evidence and regression coverage
Tests: top-level array, root-subpath array, invalid/unmatched entries before a valid target, nested array with a require condition.
Base reproduction: four new cases failed while 13 existing cases passed; each Node oracle selected the actual target successfully.
Built CLI:
analyze-javascript-application <temporary-directory> --jsonforrequire("fixture")with exports["./actual.cjs"]emittedresolution_status: "resolved",resolved_path: "node_modules/fixture/actual.cjs"even with an index fallback present.Remaining proof gaps: no live binary providers or non-Linux execution; static package resolution only.
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
Node 24.18.0 / npm 11.16.0, Linux arm64.
npm run test:focused -- tests/boundary/filesystem/javascriptPackagePrecedence.test.ts src/application/javascript/JavaScriptArtifactPathResolution.test.ts— 46 passed; includes production build prerequisite.npm run check— all six tasks passed.Compatibility, safety, and release
No breaking schema changes, migrations, package metadata, authentication, or process changes. Real Hopper/Ghidra and browser workflows were not run because provider behavior is unchanged. Target traversal semantics remain owned by the existing walker.
Review checklist
Prepared with OpenAI Codex assistance.