[PR #1944] [MERGED] feat(javascript): analyze selected application sources #4928

Closed
opened 2026-10-31 00:56:58 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1944
Author: @N0zoM1z0
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/1848-javascript-source-selection


📝 Commits (1)

  • 59b8478 feat(javascript): analyze selected application sources

📊 Changes

24 files changed (+790 additions, -18 deletions)

View changed files

📝 .agents/skills/reverse-engineer-anything/references/javascript-applications.md (+13 -1)
📝 docs/javascript-artifact-reconstruction.md (+39 -0)
📝 src/application/javascript/JavaScriptApplicationEvidence.ts (+3 -0)
📝 src/application/javascript/JavaScriptApplicationService.test.ts (+107 -0)
📝 src/application/javascript/JavaScriptApplicationService.ts (+3 -0)
📝 src/application/javascript/JavaScriptArtifactAnalysis.ts (+37 -2)
📝 src/application/javascript/JavaScriptArtifactGraphBuilder.ts (+6 -0)
📝 src/application/javascript/JavaScriptArtifactGraphStructure.ts (+9 -1)
📝 src/application/javascript/JavaScriptArtifactReconstruction.ts (+7 -1)
📝 src/application/javascript/JavaScriptArtifactReconstructionInput.ts (+2 -0)
📝 src/application/javascript/JavaScriptSemanticGraphBuilder.ts (+10 -0)
📝 src/artifacts/javascript/JavaScriptArtifactFiles.ts (+78 -7)
📝 src/cli/coreBinaryCommands.ts (+22 -4)
📝 src/cli/electronCommands.ts (+3 -0)
📝 src/cliObservationOptions.ts (+6 -0)
📝 src/contracts/javascript/electronToolContracts.ts (+9 -1)
📝 src/domain/analysisView/analysisView.ts (+2 -0)
📝 src/domain/analysisView/javascriptApplicationView.ts (+5 -0)
📝 src/domain/javascript/javascriptApplicationAnalysis.ts (+6 -0)
📝 src/domain/javascript/javascriptArtifactFiles.ts (+7 -1)

...and 4 more files

📄 Description

Summary

Let analysts obtain evidence for known entry sources before unrelated application analysis. Both CLI routes accept repeated --source-path; MCP accepts exact source_paths. The complete artifact inventory and identity remain intact.

Fixes #1848.

Problem and expected behavior

Previously the application reader allocated text for every relevant file and the shared analyzer processed the entire application. detail: "summary" only reduced delivery after that work. An entry-source question needs a producing selection boundary, with honest coverage for everything left unexamined.

Change and scope

Validate exact relevant inventory paths before acquisition. Stream-verify unselected bytes without allocating or decoding their text. Analyze selected files in first-request order before projecting omitted scopes; preserve repeated caller choices while performing each file's work once. Unselected files and relationships remain explicit unknowns rather than parse failures. Supporting manifests, HTML and source maps must be selected explicitly; imports do not expand the scope.

Contract and boundary impact

  • Semantic owner and earliest changed stage: shared domain source-selection contract, then inventoried file acquisition in JavaScriptArtifactFiles.
  • CLI and MCP/tool-catalog contract: additive source_paths and repeated --source-path on dedicated and generic static application routes. Explicit native/snapshot routing rejects selection instead of discarding it. Converted live input/output schemas validated through the SDK client and Ajv.
  • Provider, bridge, target-format, or platform compatibility: built-in static directory/ASAR analysis, including nested ASAR prefixes; no deep-provider or bridge changes.
  • Evidence, artifact, provenance, or reconstruction contract: preserve requested paths in parameters and source_selection in results/summaries; preserve full root digest, inventory commitments and per-file identities. Omitted readable files report outside-analysis-scope, and application coverage stays partial. Unknown paths and known unavailable source bytes have distinct typed corrections.
  • Process execution, authorization, cleanup, or containment impact: existing worker limits, cancellation, cleanup and target byte checks remain in force; application code is never executed.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: authored contracts and skill reference updated; generated catalogs/skills validated and left ignored. No dependency or installation changes.

Evidence and regression coverage

  • Tests added or updated: public CLI directory/ASAR scope and identity; fresh stdio MCP summary/retained retrieval, actual advertised schemas, invalid-input recovery, nested archives and unavailable companions; first-request priority, cancellation with partial Evidence and unselected-byte mutation rejection. Existing resource, integrity, reconstruction and input/output contract regressions retained.
  • Base reproduction or other evidence: at base 12ee785e5, the request has no source selection and reconstruction acquires all relevant text before invoking the file analyzer. Summary delivery occurs after analysis.
  • User-visible CLI/MCP output: source_selection: {requested_paths: ["main.js", "package.json"], unselected_files: 36}, selected-source progress, exact preserved inventory identities and partial coverage for omitted sources.
  • Remaining proof gaps: no contemporaneous unscoped timing comparison is claimed. The real entry's static and semantic analysis remain partial, with zero parse failures; source selection does not imply whole-application or runtime completeness.

For evidence-bearing changes:

  • 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

  • Focused tests: 120 passed across 14 files, covering the new CLI/MCP cases, application service, content identity, integrity policy, SDK cancellation, analysis views, prior checkpoint reserve, input/output references, compact schemas reconstruction composition and early/late producer cancellation.
  • npm run check — passed, including typecheck, lint, formatting, unused-code/metadata checks and architecture guards.
  • npm run docs:check — passed.
  • npm run verify:test-discovery — all 866 test files discovered exactly once.
  • Real unchanged released 27,477,966-byte ASAR, selected 203,962 bytes of text: CLI 12.05 s, peak 571,240,448 B; fresh stdio MCP summary 17.21 s, full retrieval/export/ping verification 18.31 s, peak 978,518,016 B. One source parsed, 87 findings and 13,424 semantic nodes retained; 36 other relevant files remain outside scope. Complete normalized CLI/MCP parity, original SHA-256 unchanged, all scope OOM/max events zero. Runs were serial under one CPU and a 3-GiB scope.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; omit source selection to retain the existing full-analysis request and result shape. Exact paths only; glob/subtree expansion and implicit dependency analysis are outside this increment.
  • Real Hopper/Ghidra, browser, or OS coverage: not required by this static feature; real Linux CLI/MCP verified. Local real macOS/Windows and live application execution were not performed.
  • Package or release metadata impact: additive feature/tool-catalog and packaged skill documentation; no dependency/version edits.
  • Security, privacy, process, or containment review: selection does not skip inventory or byte-integrity verification, expand execution authority, raise resource ceilings or discard caller choices. No released artifacts or local evidence files are committed.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1944 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/1848-javascript-source-selection` --- ### 📝 Commits (1) - [`59b8478`](https://github.com/morluto/rea/commit/59b8478ab0c77d9f2dbdd6eff90e56c8248e866e) feat(javascript): analyze selected application sources ### 📊 Changes **24 files changed** (+790 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `.agents/skills/reverse-engineer-anything/references/javascript-applications.md` (+13 -1) 📝 `docs/javascript-artifact-reconstruction.md` (+39 -0) 📝 `src/application/javascript/JavaScriptApplicationEvidence.ts` (+3 -0) 📝 `src/application/javascript/JavaScriptApplicationService.test.ts` (+107 -0) 📝 `src/application/javascript/JavaScriptApplicationService.ts` (+3 -0) 📝 `src/application/javascript/JavaScriptArtifactAnalysis.ts` (+37 -2) 📝 `src/application/javascript/JavaScriptArtifactGraphBuilder.ts` (+6 -0) 📝 `src/application/javascript/JavaScriptArtifactGraphStructure.ts` (+9 -1) 📝 `src/application/javascript/JavaScriptArtifactReconstruction.ts` (+7 -1) 📝 `src/application/javascript/JavaScriptArtifactReconstructionInput.ts` (+2 -0) 📝 `src/application/javascript/JavaScriptSemanticGraphBuilder.ts` (+10 -0) 📝 `src/artifacts/javascript/JavaScriptArtifactFiles.ts` (+78 -7) 📝 `src/cli/coreBinaryCommands.ts` (+22 -4) 📝 `src/cli/electronCommands.ts` (+3 -0) 📝 `src/cliObservationOptions.ts` (+6 -0) 📝 `src/contracts/javascript/electronToolContracts.ts` (+9 -1) 📝 `src/domain/analysisView/analysisView.ts` (+2 -0) 📝 `src/domain/analysisView/javascriptApplicationView.ts` (+5 -0) 📝 `src/domain/javascript/javascriptApplicationAnalysis.ts` (+6 -0) 📝 `src/domain/javascript/javascriptArtifactFiles.ts` (+7 -1) _...and 4 more files_ </details> ### 📄 Description ## Summary Let analysts obtain evidence for known entry sources before unrelated application analysis. Both CLI routes accept repeated `--source-path`; MCP accepts exact `source_paths`. The complete artifact inventory and identity remain intact. Fixes #1848. ## Problem and expected behavior Previously the application reader allocated text for every relevant file and the shared analyzer processed the entire application. `detail: "summary"` only reduced delivery after that work. An entry-source question needs a producing selection boundary, with honest coverage for everything left unexamined. ## Change and scope Validate exact relevant inventory paths before acquisition. Stream-verify unselected bytes without allocating or decoding their text. Analyze selected files in first-request order before projecting omitted scopes; preserve repeated caller choices while performing each file's work once. Unselected files and relationships remain explicit unknowns rather than parse failures. Supporting manifests, HTML and source maps must be selected explicitly; imports do not expand the scope. ## Contract and boundary impact - Semantic owner and earliest changed stage: shared domain source-selection contract, then inventoried file acquisition in `JavaScriptArtifactFiles`. - CLI and MCP/tool-catalog contract: additive `source_paths` and repeated `--source-path` on dedicated and generic static application routes. Explicit native/snapshot routing rejects selection instead of discarding it. Converted live input/output schemas validated through the SDK client and Ajv. - Provider, bridge, target-format, or platform compatibility: built-in static directory/ASAR analysis, including nested ASAR prefixes; no deep-provider or bridge changes. - Evidence, artifact, provenance, or reconstruction contract: preserve requested paths in parameters and `source_selection` in results/summaries; preserve full root digest, inventory commitments and per-file identities. Omitted readable files report `outside-analysis-scope`, and application coverage stays partial. Unknown paths and known unavailable source bytes have distinct typed corrections. - Process execution, authorization, cleanup, or containment impact: existing worker limits, cancellation, cleanup and target byte checks remain in force; application code is never executed. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: authored contracts and skill reference updated; generated catalogs/skills validated and left ignored. No dependency or installation changes. ## Evidence and regression coverage - Tests added or updated: public CLI directory/ASAR scope and identity; fresh stdio MCP summary/retained retrieval, actual advertised schemas, invalid-input recovery, nested archives and unavailable companions; first-request priority, cancellation with partial Evidence and unselected-byte mutation rejection. Existing resource, integrity, reconstruction and input/output contract regressions retained. - Base reproduction or other evidence: at base `12ee785e5`, the request has no source selection and reconstruction acquires all relevant text before invoking the file analyzer. Summary delivery occurs after analysis. - User-visible CLI/MCP output: `source_selection: {requested_paths: ["main.js", "package.json"], unselected_files: 36}`, selected-source progress, exact preserved inventory identities and partial coverage for omitted sources. - Remaining proof gaps: no contemporaneous unscoped timing comparison is claimed. The real entry's static and semantic analysis remain partial, with zero parse failures; source selection does not imply whole-application or runtime completeness. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - Focused tests: **120 passed across 14 files**, covering the new CLI/MCP cases, application service, content identity, integrity policy, SDK cancellation, analysis views, prior checkpoint reserve, input/output references, compact schemas reconstruction composition and early/late producer cancellation. - `npm run check` — passed, including typecheck, lint, formatting, unused-code/metadata checks and architecture guards. - `npm run docs:check` — passed. - `npm run verify:test-discovery` — all **866** test files discovered exactly once. - Real unchanged released **27,477,966-byte ASAR**, selected 203,962 bytes of text: CLI **12.05 s**, peak **571,240,448 B**; fresh stdio MCP summary **17.21 s**, full retrieval/export/ping verification **18.31 s**, peak **978,518,016 B**. One source parsed, 87 findings and 13,424 semantic nodes retained; 36 other relevant files remain outside scope. Complete normalized CLI/MCP parity, original SHA-256 unchanged, all scope OOM/max events zero. Runs were serial under one CPU and a 3-GiB scope. ## Compatibility, safety, and release - Breaking changes or migration steps: none; omit source selection to retain the existing full-analysis request and result shape. Exact paths only; glob/subtree expansion and implicit dependency analysis are outside this increment. - Real Hopper/Ghidra, browser, or OS coverage: not required by this static feature; real Linux CLI/MCP verified. Local real macOS/Windows and live application execution were not performed. - Package or release metadata impact: additive feature/tool-catalog and packaged skill documentation; no dependency/version edits. - Security, privacy, process, or containment review: selection does not skip inventory or byte-integrity verification, expand execution authority, raise resource ceilings or discard caller choices. No released artifacts or local evidence files are committed. ## Review checklist - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:56:58 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#4928
No description provided.