[GH-ISSUE #5407] [Bug] Selecting every JavaScript source warns about nonexistent unselected sources #3277

Closed
opened 2026-10-31 00:38:42 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @coygeek on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5407

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

Explicitly selecting both files in a two-file JavaScript application makes both analyze-javascript-application and analyze return a graph limitation about unknown relationships through unselected sources. The same results report source_selection.unselected_files: 0 and complete graph coverage. All calls exit 0.

Reproduction

An independent verifier ran the following cases from the source checkout using its existing built runtime, with an isolated HOME and XDG configuration/data/cache/state environment. No dependency installation or rebuild was performed.

Create a directory containing exactly these files, each ending with a newline:

main.mjs:

import { value } from "./util.mjs"; export const answer = value + 1;

util.mjs:

export const value = 41;

Use that directory as <fixture-directory> and run:

node scripts/rea.mjs analyze-javascript-application <fixture-directory> --source-path main.mjs --source-path util.mjs --format json
node scripts/rea.mjs analyze <fixture-directory> --source-path main.mjs --source-path util.mjs --format json

Both emit the zero-file limitation below. The verifier also ran these controls:

node scripts/rea.mjs analyze-javascript-application <fixture-directory> --format json
node scripts/rea.mjs analyze-javascript-application <fixture-directory> --source-path main.mjs --format json

Omitting selection produces complete coverage without the caller-selected limitation. Selecting only main.mjs produces partial coverage and correctly reports one unselected file. The verifier replayed the four-case reproduction and observed the same results.

Expected behavior

When no relevant file remains outside the selected scope, omit the caveat asserting unknown relationships through unselected sources. Preserve the applicable caveat and partial coverage when a file is excluded.

docs/javascript-artifact-reconstruction.md:70-106 documents exact source selection and partial coverage while files remain outside scope. Source-derived support: src/application/javascript/JavaScriptArtifactGraphBuilder.ts:180 treats selection as a coverage gap only when unselected_files > 0. This expectation concerns the nonexistent source-selection gap; it does not assert runtime or whole-application completeness.

Impact and scope

P3 wording defect in the tested static directory analysis. The limitation is misleading, while the selection count and graph coverage remain accurate. Omitting selection on the same complete fixture avoids the notice. MCP and ASAR variants were not exercised; no consequential analysis change was demonstrated.

REA version

6.7.0; source commit 074768901f3cdc8205b61773fb1faf6f6c7b3ca8.

Runtime and platform

Node.js v26.12.0; macOS arm64. This static workflow does not use Hopper or Ghidra.

Target and artifact context

A local directory containing only the two synthetic ESM files shown above.

Interface

CLI

Earliest failure stage

Native analysis or reconstruction

Relevant output or evidence

For both complete-selection calls, the verifier extracted these fields from normalized_result:

{
  "source_selection": {
    "requested_paths": ["main.mjs", "util.mjs"],
    "unselected_files": 0
  },
  "graph.coverage": {
    "status": "complete",
    "truncated": false,
    "omitted_count": 0,
    "limits": []
  }
}

graph.coverage above abbreviates the nested field path. Both calls also included this exact entry in normalized_result.graph.limitations:

Caller-selected source analysis leaves 0 inventoried files outside analysis scope. Inventory identity covers the complete artifact; relationships through unselected sources remain unknown.

The complete-selection and omitted-selection graphs each had seven nodes and eight edges, with no file marked outside analysis scope.

Typed outcome or recovery expected

Keep the accurate zero-unselected count and complete graph coverage. Include the unselected-source limitation only when relevant sources actually remain outside scope.

Analysis or suspected cause

Source-derived reasoning: src/application/javascript/JavaScriptArtifactGraphBuilder.ts:271-275 adds the notice whenever source_selection exists, without checking whether unselected_files is greater than zero. The coverage calculation already makes that distinction. A fresh upstream check at e84468c0bb0476412ac0c8161f7c2ecc9a6864ca found the same condition at lines 332-338; the intervening change to this file does not modify it. Runtime reproduction is established at the baseline above, not claimed for this newer revision.

Additional context

Prepared with AI assistance and independently reproduced by a separate verifier. Related issue and PR searches covered the command name, the source module, unselected sources, and the exact zero-file wording. No matching report was found.

Originally created by @coygeek on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5407 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Evidence, artifacts, or reconstruction ### Observed behavior Explicitly selecting both files in a two-file JavaScript application makes both `analyze-javascript-application` and `analyze` return a graph limitation about unknown relationships through unselected sources. The same results report `source_selection.unselected_files: 0` and complete graph coverage. All calls exit 0. ### Reproduction An independent verifier ran the following cases from the source checkout using its existing built runtime, with an isolated HOME and XDG configuration/data/cache/state environment. No dependency installation or rebuild was performed. Create a directory containing exactly these files, each ending with a newline: `main.mjs`: ```js import { value } from "./util.mjs"; export const answer = value + 1; ``` `util.mjs`: ```js export const value = 41; ``` Use that directory as `<fixture-directory>` and run: ```sh node scripts/rea.mjs analyze-javascript-application <fixture-directory> --source-path main.mjs --source-path util.mjs --format json node scripts/rea.mjs analyze <fixture-directory> --source-path main.mjs --source-path util.mjs --format json ``` Both emit the zero-file limitation below. The verifier also ran these controls: ```sh node scripts/rea.mjs analyze-javascript-application <fixture-directory> --format json node scripts/rea.mjs analyze-javascript-application <fixture-directory> --source-path main.mjs --format json ``` Omitting selection produces complete coverage without the caller-selected limitation. Selecting only `main.mjs` produces partial coverage and correctly reports one unselected file. The verifier replayed the four-case reproduction and observed the same results. ### Expected behavior When no relevant file remains outside the selected scope, omit the caveat asserting unknown relationships through unselected sources. Preserve the applicable caveat and partial coverage when a file is excluded. `docs/javascript-artifact-reconstruction.md:70-106` documents exact source selection and partial coverage while files remain outside scope. Source-derived support: `src/application/javascript/JavaScriptArtifactGraphBuilder.ts:180` treats selection as a coverage gap only when `unselected_files > 0`. This expectation concerns the nonexistent source-selection gap; it does not assert runtime or whole-application completeness. ### Impact and scope P3 wording defect in the tested static directory analysis. The limitation is misleading, while the selection count and graph coverage remain accurate. Omitting selection on the same complete fixture avoids the notice. MCP and ASAR variants were not exercised; no consequential analysis change was demonstrated. ### REA version 6.7.0; source commit `074768901f3cdc8205b61773fb1faf6f6c7b3ca8`. ### Runtime and platform Node.js v26.12.0; macOS arm64. This static workflow does not use Hopper or Ghidra. ### Target and artifact context A local directory containing only the two synthetic ESM files shown above. ### Interface CLI ### Earliest failure stage Native analysis or reconstruction ### Relevant output or evidence For both complete-selection calls, the verifier extracted these fields from `normalized_result`: ```json { "source_selection": { "requested_paths": ["main.mjs", "util.mjs"], "unselected_files": 0 }, "graph.coverage": { "status": "complete", "truncated": false, "omitted_count": 0, "limits": [] } } ``` `graph.coverage` above abbreviates the nested field path. Both calls also included this exact entry in `normalized_result.graph.limitations`: ```text Caller-selected source analysis leaves 0 inventoried files outside analysis scope. Inventory identity covers the complete artifact; relationships through unselected sources remain unknown. ``` The complete-selection and omitted-selection graphs each had seven nodes and eight edges, with no file marked outside analysis scope. ### Typed outcome or recovery expected Keep the accurate zero-unselected count and complete graph coverage. Include the unselected-source limitation only when relevant sources actually remain outside scope. ### Analysis or suspected cause Source-derived reasoning: `src/application/javascript/JavaScriptArtifactGraphBuilder.ts:271-275` adds the notice whenever `source_selection` exists, without checking whether `unselected_files` is greater than zero. The coverage calculation already makes that distinction. A fresh upstream check at `e84468c0bb0476412ac0c8161f7c2ecc9a6864ca` found the same condition at lines 332-338; the intervening change to this file does not modify it. Runtime reproduction is established at the baseline above, not claimed for this newer revision. ### Additional context Prepared with AI assistance and independently reproduced by a separate verifier. Related issue and PR searches covered the command name, the source module, unselected sources, and the exact zero-file wording. No matching report was found.
Author
Owner

@coygeek commented on GitHub (Oct 24, 2026):

Checked the reported fix on main at d87e73f2db.

The source-selection caveat is now emitted only when unselected_files is nonzero, using the same condition as coverage-gap accounting. The acceptance test explicitly selects both JavaScript files, asserts unselected_files=0 and absence of relationships-through-unselected-sources text. The test covers analyze-javascript-application; the shared graph builder serves direct analyze as well.

Implementation: JavaScriptArtifactGraphBuilder.ts, JavaScriptArtifactGraphBuilder.ts.

The relevant regression checks in javascriptGraphQueryCoverage.test.ts passed in the focused test run on this revision. This closure is based on the current source and those checks; provider fixtures do not establish a real-engine run. Closing as completed on main.

<!-- gh-comment-id:6380756728 --> @coygeek commented on GitHub (Oct 24, 2026): Checked the reported fix on `main` at d87e73f2db50be72d33a4b3c7199af35518b441c. The source-selection caveat is now emitted only when unselected_files is nonzero, using the same condition as coverage-gap accounting. The acceptance test explicitly selects both JavaScript files, asserts unselected_files=0 and absence of relationships-through-unselected-sources text. The test covers analyze-javascript-application; the shared graph builder serves direct analyze as well. Implementation: [JavaScriptArtifactGraphBuilder.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/application/javascript/JavaScriptArtifactGraphBuilder.ts#L336), [JavaScriptArtifactGraphBuilder.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/src/application/javascript/JavaScriptArtifactGraphBuilder.ts#L245). The relevant regression checks in [javascriptGraphQueryCoverage.test.ts](https://github.com/morluto/rea/blob/d87e73f2db50be72d33a4b3c7199af35518b441c/tests/acceptance/applications/javascriptGraphQueryCoverage.test.ts) passed in the focused test run on this revision. This closure is based on the current source and those checks; provider fixtures do not establish a real-engine run. Closing as completed on main.
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#3277
No description provided.