Skip to content

fix(cli): stream large JavaScript JSON results - #1024

Merged
N0zoM1z0 merged 8 commits into
mainfrom
fix/stream-javascript-json
Oct 7, 2026
Merged

N0zoM1z0 merged 8 commits into
mainfrom
fix/stream-javascript-json

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Large JavaScript application analysis can produce valid Evidence that exceeds V8's single-string limit during Incur JSON formatting. The CLI now writes JSON and JSONL incrementally for both analyze-javascript-application and directory/ASAR analyze, preserving filtering, full-output envelopes, Unicode, complete Evidence, and existing output ordering. Writes await destination completion; output errors preserve the cause on stderr without appending a second document. Application and MCP contracts remain unchanged.

Closes #623.

Validation:

  • Reproduced native RangeError: Invalid string length in the pinned Incur formatter after successfully constructing valid Evidence.
  • An opt-in real-Incur format-boundary verifier writes and independently hashes JSON (537,035,518 bytes) and JSONL (536,961,605 bytes), both larger than V8's 536,870,888-code-unit single-string limit. Linux and Windows runs passed and removed the temporary outputs. The verifier checks available disk space and keeps a 1-GiB reserve.
  • Windows verification used an existing Node 22.19.0, two CPUs, lowered priority, a 1-GiB heap, and a bounded owned workspace. The final integrated run peaked near 96 MiB working set for large-output verification and 418 MiB for the real 24.2-MB ASAR fixture. No owned processes remained.
  • The real ASAR fixture contains 61 compiled application modules and an inert resource pad. On the original frozen baseline, streaming preserved output bytes exactly and reduced peak family RSS from approximately 876 to 689 MiB, with elapsed time increasing from approximately 9.4 to 12.7 seconds.
  • A real Linux stdout-to-/dev/full run exited 1 and preserved ENOSPC on stderr, without writing a second JSON document.
  • 111 focused tests across eight suites pass, including golden formats, actual CLI/MCP, filters/slices, Unicode, backpressure, delayed completion, and failing destinations. Static, formatting, and generated-document checks pass. Installed-package verification passes with 133 tools and six prompts. Both engine-limit output checks and canonical-digest verification were repeated after integration with the merged progress fix fix(javascript): report application analysis progress on the CLI #1008. CI identified an incomplete dispatcher fixture; its new output module is now included and both routing/recovery cases pass locally.

JSON and JSONL output avoid a document-sized string; analysis still needs memory for its source and graphs. Other formats, token-count requests, and MCP text serialization retain their existing formatting boundaries. The reporter's original Obsidian/SPA assets were not available. No real Hopper/Ghidra verification was performed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 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-07T19:28:23.304043Z d3f6e2e PR opened
ℹ️ 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.

@N0zoM1z0
N0zoM1z0 merged commit 0e25bef into main Oct 7, 2026
27 checks passed
@N0zoM1z0
N0zoM1z0 deleted the fix/stream-javascript-json branch October 7, 2026 19:44
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
* fix(javascript): report application analysis progress on the CLI

* test(cli): preserve progress in filtered output checks

* fix(cli): stream large JavaScript JSON results

* test(cli): include streaming output in dispatcher fixture
@morluto morluto added bug Something isn't working area: cli CLI adapter and one-shot commands labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

analyze_javascript_application fails on large targets: RangeError: Invalid string length masked as reason 'io'

2 participants