Skip to content

fix(javascript): report JSON status for imported package manifests - #1740

Merged
N0zoM1z0 merged 1 commit into
morluto:mainfrom
immanuwell:fix/package-json-import-status
Oct 11, 2026
Merged

N0zoM1z0 merged 1 commit into
morluto:mainfrom
immanuwell:fix/package-json-import-status

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

Summary

Report JSON availability for imported package manifests. No matching issue found after searching issues and PRs.

Problem and expected behavior

require("./package.json").version resolves, but its import edge has target_json_status: null. Valid JSON should report included, just like other JSON imports.

Repro from a built checkout:

repro_dir=$(mktemp -d)
printf '%s' '{"name":"demo","version":"1.0.0"}' > "$repro_dir/package.json"
printf '%s' 'const version = require("./package.json").version;' > "$repro_dir/main.cjs"
node scripts/rea.mjs analyze-javascript-application "$repro_dir" --json
rm -r "$repro_dir"

Change and scope

The existing jsonStatus checker already does the job. Use it for package-json targets too.

Contract and boundary impact

  • Semantic owner and earliest changed stage: module relationship properties.
  • CLI and MCP/tool-catalog contract: existing result field corrected; schemas unchanged.
  • Provider, bridge, target-format, or platform compatibility: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: JSON status populated; artifact identities and provenance preserved.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Tests added: packageJsonImports.test.ts, using compiled CLI and stdio MCP. Covers valid/malformed/unavailable manifests, ordinary JSON, and JavaScript imports. Native Node confirms the valid manifest is readable.

  • Base reproduction: both new workflow tests failed on e36c82be with null instead of included.

  • User-visible output: in normalized_result.graph.edges, the manifest import now reports included, invalid, or unavailable.

  • 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 packageJsonImports, packageSubpathsCli, applicationManifestRoots, and javascriptModuleRelationships: 10 passed.
  • npm run check: passed.
  • npm run verify:test-discovery: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Linux, Node 24.18.0; static source workflow needs no engine or browser.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no changes.

Review checklist

  • This PR addresses a concrete problem.
  • One focused outcome; conventional title.
  • Related work searched; no matching issue found.
  • Tests cover changed behavior and failure paths.
  • No docs, schema, or generated metadata changes needed.
  • Representative CLI/MCP output described above.
  • Final diff checked for secrets, unrelated changes, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T08:59:31.886425Z 1b9e4c2 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5410fe307e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@immanuwell
immanuwell force-pushed the fix/package-json-import-status branch from 5410fe3 to 9f001b7 Compare October 11, 2026 08:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f001b783a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@immanuwell
immanuwell force-pushed the fix/package-json-import-status branch from 9f001b7 to 4a15bfc Compare October 11, 2026 08:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a15bfc2d5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Reproduced and reviewed current head 4a15bfc2 with a fresh runtime. The existing two public CLI/stdio-MCP tests pass, and an independent three-import fixture produces complete authenticated CLI/MCP Evidence with deeply equal normalized results and a successful subsequent MCP ping.

One status distinction still needs attention. With main.cjs explicitly requiring ./nested/package.json whose complete text is [], pinned Node 24.18.0 actually loads [] successfully through createRequire. The exact same text in array.json loads identically. This PR reports the manifest import edge's target_json_status: "invalid" while the ordinary JSON edge reports "included".

The existing edge producer's jsonStatus tests JSON text availability and JSON.parse success, which is separate from parseJavaScriptPackage requiring an object for package metadata. The package node can retain its metadata parse_status: "invalid"; the JSON import edge should preserve the syntax/availability distinction. The earlier review premise that Node necessarily rejects this explicit JSON-file import is disproven by the small runtime fixture.

Please include the actual native require('./non-object/package.json') value in the regression and keep metadata validation separate from imported JSON text status. Using the existing JSON-status parser at this edge also avoids introducing the package-analysis dependency/lookup and reparsing fallback merely to answer this different question. I have not pushed changes to the contributor's branch.

Independent fixture: valid root package object, nested/package.json containing [], array.json containing []; inert static REA analysis on both public surfaces, with 512 MiB worker heap / 60-second analysis budget. No application/browser execution was requested by REA; the explicit Node JSON-loader check was run separately.

@immanuwell
immanuwell force-pushed the fix/package-json-import-status branch from 4a15bfc to 1b9e4c2 Compare October 11, 2026 08:55
@immanuwell

Copy link
Copy Markdown
Contributor Author

@N0zoM1z0 confirmed, native require loads the array manifest. added that assertion and kept import status separate from metadata validation

@N0zoM1z0 N0zoM1z0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and independently reproduced updated head 1b9e4c2109effcc57bd0e5962547ed03b35e3d35. The JSON-text status / package-metadata distinction is now correct: Node 24.18.0 actually loads both array-valued explicit JSON imports; REA reports included for both import edges while retaining invalid for the array manifest's package metadata.

The updated public CLI/MCP regression fails against the earlier 4a15bfc2 runtime and passes after a fresh build of this head. Both changed test files pass (16 tests), including malformed/unavailable manifests and cancellation before manifest visits. An independent three-import fixture produces authenticated CLI and stdio-MCP Evidence with fully equal normalized results and a successful subsequent MCP ping. Full single-threaded typecheck, lint/module boundaries, changed-file formatting and architecture guards pass.

Also composed this exact source with current main 4daea941 in a private review branch, verified the complete expected merged tree and unchanged source blobs, then rebuilt and reran the same 16 tests, actual CLI/MCP fixture, and full typecheck successfully. This was a static-source workflow on Linux; no real browser or native analysis provider was used. The contributor's branch was not modified.

@N0zoM1z0
N0zoM1z0 merged commit 914ba83 into morluto:main Oct 11, 2026
31 checks passed
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: build Build, CI, packaging, and publishing labels Oct 14, 2026
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.

3 participants