Skip to content

feat(javascript): analyze selected application sources - #1944

Merged
N0zoM1z0 merged 1 commit into
mainfrom
fix/1848-javascript-source-selection
Oct 11, 2026
Merged

N0zoM1z0 merged 1 commit into
mainfrom
fix/1848-javascript-source-selection

Conversation

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

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.

Respect exact source_paths at text acquisition and static analysis while
stream-verifying the full inventoried artifact. Preserve requested order,
repeated choices, unavailable-byte diagnostics and explicit omitted scopes.
Expose the same selection through both CLI routes and MCP, retaining source
scope in canonical Evidence and summary views.

Fixes #1848

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
@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-11T19:37:12.239021Z 59b8478 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.

@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: 59b8478ab0

ℹ️ 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".

Comment on lines 146 to +150
if (signal?.aborted === true)
throw new AnalysisCancelledError("analyze_javascript_application");
if (
!file.text.included &&
file.text.reason === "outside-analysis-scope"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Classify omitted files before checking cancellation

If cancellation arrives during the setImmediate() after the last selected file but before the first unselected file, this check throws before recognizing outside-analysis-scope. The catch block consequently records that omitted file as an analysis failure and cancellation-derived semantic unknown, and analyzedPaths prevents the later completion loop from correcting it. Partial Evidence then misstates why that file was not analyzed; handle the scope omission before the abort check, while still retaining the overall cancellation.

AGENTS.md reference: AGENTS.md:L17-L17

Useful? React with 👍 / 👎.

@N0zoM1z0
N0zoM1z0 merged commit 85c1d25 into main Oct 11, 2026
31 checks passed
@N0zoM1z0
N0zoM1z0 deleted the fix/1848-javascript-source-selection branch October 11, 2026 20:07
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added enhancement New feature or request area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Prioritize caller-selected JavaScript sources before unrelated application analysis

2 participants