[GH-ISSUE #5534] [Bug] compare-application-versions reports unselected source scopes as added or removed #3368

Closed
opened 2026-10-31 00:39:37 +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/5534

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

compare-application-versions reports an unavailable, unselected JavaScript parse-scope placeholder as added when comparing complete analysis against analysis of the same artifact with only --source-path main.js. Swapping the inputs reports that placeholder as removed. Each item has node_kind: "unknown", dimensions: ["availability"], and no item limitations, and increments the corresponding summary count despite identical artifact bytes.

Reproduction

An independent verifier ran the following workflow with the baseline's built CLI and isolated user configuration/data/cache/state directories. All six analysis/comparison commands below exited 0. Each failing direction was executed once.

Create a directory <fixture> containing exactly these two files:

lib.js:

export function shared() {
  return 1;
}

main.js:

export const name = "one";

Copy both files unchanged into a separate directory <fixture-copy>. Analyze:

node scripts/rea.mjs analyze-javascript-application <fixture> --format json > full.json
node scripts/rea.mjs analyze-javascript-application <fixture> --source-path main.js --format json > selected.json
node scripts/rea.mjs analyze-javascript-application <fixture-copy> --format json > full-copy.json

Construct three JSON input files using the complete parsed response objects: forward-input.json is {"left": <full.json>, "right": <selected.json>}; reverse-input.json swaps those responses; control-input.json uses full.json left and full-copy.json right. The angle-bracket notation denotes substituted JSON objects, not literal strings or filenames. Compare:

node scripts/rea.mjs compare-application-versions forward-input.json --format json
node scripts/rea.mjs compare-application-versions reverse-input.json --format json
node scripts/rea.mjs compare-application-versions control-input.json --format json

The separate complete-analysis copy supplies distinct authenticated Evidence for the control. Reusing the exact same Evidence on both sides is rejected and is not this bug.

Expected behavior

The unselected lib.js analysis scope should remain unknown in either comparison direction, with a limitation identifying the unavailable source analysis. Its placeholder should not increment added or removed.

docs/javascript-artifact-reconstruction.md:88-104,343-350 preserves complete inventory identity while treating unselected/unavailable parse scopes as uncertainty rather than absence. AGENTS.md, Architecture and Cleanup, requires unresolved applicability to remain unknown. docs/javascript-application-workflows.md:323-330 conditions one-sided absence claims on opposite coverage; complete opposite coverage does not establish that an unavailable analysis marker is a positive application entity. This last conclusion is source-derived reasoning.

Impact and scope

P2: a supported partial-analysis comparison returns a false availability change and summary count. The same two-file artifact reproduced the defect once in each direction. An independently analyzed unchanged copy used as a full/full control reported seven unchanged items and no additions or removals, demonstrating the workaround of fully analyzing both inputs when feasible. MCP, other artifact formats, other unavailable-scope families, and broader frequency were not tested. No artifact mutation or security boundary crossing was demonstrated.

REA version

6.7.0; source commit 074768901f3cdc8205b61773fb1faf6f6c7b3ca8 (built source CLI).

Runtime and platform

Node.js v26.12.0; macOS (Darwin), arm64. NOT_ENOUGH_INFO: the verifier did not record the macOS version. No native provider or external service was used.

Target and artifact context

Two synthetic local JavaScript application directories containing the same lib.js and main.js bytes. Analysis responses provide the authentic Evidence envelopes used by the comparison commands.

Interface

CLI

Earliest failure stage

Native analysis or reconstruction

Relevant output or evidence

The verifier extracted these summaries from normalized_result:

forward: unchanged=0 added=1 removed=0 changed=1 unknown=6
reverse: unchanged=0 added=0 removed=1 changed=1 unknown=6
control: unchanged=7 added=0 removed=0 changed=0 unknown=0

The forward comparison's only added item has these reduced fields:

{"node_kind":"unknown","status":"added","dimensions":["availability"],"limitations":[]}

The reverse item has the same kind, dimensions, and empty limitations, with status: "removed". The selected graph identifies this node as the lib.js parse scope, with Evidence state unavailable and these properties:

{"path":"lib.js","operation":"select-javascript-sources","limitation":"Source is outside the caller-selected source_paths; it was inventoried but not analyzed."}

Complete analysis had complete graph coverage; selected analysis had partial coverage and source_selection.unselected_files: 1. Both compared root artifact hashes matched. The real lib.js asset remained present on both sides; its corresponding source-module and export-return-shape analysis nodes were already classified unknown. The separate changed asset item reflects differing analysis metadata and is outside this report.

Typed outcome or recovery expected

Preserve the unavailable scope as unknown, retain its Evidence and limitation, and exclude that marker from positive added/removed counts. Preserve genuine additions/removals and the full/full control's unchanged result.

Analysis or suspected cause

Source-derived reasoning at the baseline: src/application/javascript/JavaScriptArtifactGraphStructure.ts:218-230 projects the unselected scope; src/application/javascript/JavaScriptArtifactGraphContext.ts:211-268 records its unavailable Evidence. src/domain/javascript/javascriptApplicationVersionItems.ts:237-279 derives unmatched availability status from opposite-graph coverage without considering this scope's unavailable Evidence.

Upstream main was fetched before submission at 52d1a72af047a73b787b8935b032786a34966036. The only later commit touching the cited files, e9fc8fb30, changes runtime-path/Electron ownership logic, leaving the cited unselected-scope production and unmatched classification logic unchanged. Runtime reproduction is established at the baseline, not claimed for this newer revision.

Additional context

Prepared with AI assistance and independently reproduced by a separate verifier. Open and closed issue/PR searches covered the command, unselected sources, placeholders, availability symptoms, and source module. Related #5407 and PR #5428 concern a zero-unselected-file warning; #5195 and PR #5196 concern export pairing after artifact changes. Those have separate inputs and closure conditions.

NOT_ENOUGH_INFO: no last-known-good version or first-bad release was established. Proposed regression check, not executed: compare complete analyses where a source file is genuinely added to ensure true availability changes remain reportable.

Originally created by @coygeek on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5534 ### 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 `compare-application-versions` reports an unavailable, unselected JavaScript parse-scope placeholder as `added` when comparing complete analysis against analysis of the same artifact with only `--source-path main.js`. Swapping the inputs reports that placeholder as `removed`. Each item has `node_kind: "unknown"`, `dimensions: ["availability"]`, and no item limitations, and increments the corresponding summary count despite identical artifact bytes. ### Reproduction An independent verifier ran the following workflow with the baseline's built CLI and isolated user configuration/data/cache/state directories. All six analysis/comparison commands below exited 0. Each failing direction was executed once. Create a directory `<fixture>` containing exactly these two files: `lib.js`: ```js export function shared() { return 1; } ``` `main.js`: ```js export const name = "one"; ``` Copy both files unchanged into a separate directory `<fixture-copy>`. Analyze: ```sh node scripts/rea.mjs analyze-javascript-application <fixture> --format json > full.json node scripts/rea.mjs analyze-javascript-application <fixture> --source-path main.js --format json > selected.json node scripts/rea.mjs analyze-javascript-application <fixture-copy> --format json > full-copy.json ``` Construct three JSON input files using the complete parsed response objects: `forward-input.json` is `{"left": <full.json>, "right": <selected.json>}`; `reverse-input.json` swaps those responses; `control-input.json` uses `full.json` left and `full-copy.json` right. The angle-bracket notation denotes substituted JSON objects, not literal strings or filenames. Compare: ```sh node scripts/rea.mjs compare-application-versions forward-input.json --format json node scripts/rea.mjs compare-application-versions reverse-input.json --format json node scripts/rea.mjs compare-application-versions control-input.json --format json ``` The separate complete-analysis copy supplies distinct authenticated Evidence for the control. Reusing the exact same Evidence on both sides is rejected and is not this bug. ### Expected behavior The unselected `lib.js` analysis scope should remain `unknown` in either comparison direction, with a limitation identifying the unavailable source analysis. Its placeholder should not increment `added` or `removed`. `docs/javascript-artifact-reconstruction.md:88-104,343-350` preserves complete inventory identity while treating unselected/unavailable parse scopes as uncertainty rather than absence. `AGENTS.md`, Architecture and Cleanup, requires unresolved applicability to remain unknown. `docs/javascript-application-workflows.md:323-330` conditions one-sided absence claims on opposite coverage; complete opposite coverage does not establish that an unavailable analysis marker is a positive application entity. This last conclusion is source-derived reasoning. ### Impact and scope P2: a supported partial-analysis comparison returns a false availability change and summary count. The same two-file artifact reproduced the defect once in each direction. An independently analyzed unchanged copy used as a full/full control reported seven unchanged items and no additions or removals, demonstrating the workaround of fully analyzing both inputs when feasible. MCP, other artifact formats, other unavailable-scope families, and broader frequency were not tested. No artifact mutation or security boundary crossing was demonstrated. ### REA version 6.7.0; source commit `074768901f3cdc8205b61773fb1faf6f6c7b3ca8` (built source CLI). ### Runtime and platform Node.js v26.12.0; macOS (Darwin), arm64. NOT_ENOUGH_INFO: the verifier did not record the macOS version. No native provider or external service was used. ### Target and artifact context Two synthetic local JavaScript application directories containing the same `lib.js` and `main.js` bytes. Analysis responses provide the authentic Evidence envelopes used by the comparison commands. ### Interface CLI ### Earliest failure stage Native analysis or reconstruction ### Relevant output or evidence The verifier extracted these summaries from `normalized_result`: ```text forward: unchanged=0 added=1 removed=0 changed=1 unknown=6 reverse: unchanged=0 added=0 removed=1 changed=1 unknown=6 control: unchanged=7 added=0 removed=0 changed=0 unknown=0 ``` The forward comparison's only added item has these reduced fields: ```json {"node_kind":"unknown","status":"added","dimensions":["availability"],"limitations":[]} ``` The reverse item has the same kind, dimensions, and empty limitations, with `status: "removed"`. The selected graph identifies this node as the `lib.js` parse scope, with Evidence state `unavailable` and these properties: ```json {"path":"lib.js","operation":"select-javascript-sources","limitation":"Source is outside the caller-selected source_paths; it was inventoried but not analyzed."} ``` Complete analysis had complete graph coverage; selected analysis had partial coverage and `source_selection.unselected_files: 1`. Both compared root artifact hashes matched. The real `lib.js` asset remained present on both sides; its corresponding source-module and export-return-shape analysis nodes were already classified `unknown`. The separate `changed` asset item reflects differing analysis metadata and is outside this report. ### Typed outcome or recovery expected Preserve the unavailable scope as `unknown`, retain its Evidence and limitation, and exclude that marker from positive added/removed counts. Preserve genuine additions/removals and the full/full control's unchanged result. ### Analysis or suspected cause Source-derived reasoning at the baseline: `src/application/javascript/JavaScriptArtifactGraphStructure.ts:218-230` projects the unselected scope; `src/application/javascript/JavaScriptArtifactGraphContext.ts:211-268` records its unavailable Evidence. `src/domain/javascript/javascriptApplicationVersionItems.ts:237-279` derives unmatched availability status from opposite-graph coverage without considering this scope's unavailable Evidence. Upstream main was fetched before submission at `52d1a72af047a73b787b8935b032786a34966036`. The only later commit touching the cited files, `e9fc8fb30`, changes runtime-path/Electron ownership logic, leaving the cited unselected-scope production and unmatched classification logic unchanged. Runtime reproduction is established at the baseline, not claimed for this newer revision. ### Additional context Prepared with AI assistance and independently reproduced by a separate verifier. Open and closed issue/PR searches covered the command, unselected sources, placeholders, availability symptoms, and source module. Related #5407 and PR #5428 concern a zero-unselected-file warning; #5195 and PR #5196 concern export pairing after artifact changes. Those have separate inputs and closure conditions. NOT_ENOUGH_INFO: no last-known-good version or first-bad release was established. Proposed regression check, not executed: compare complete analyses where a source file is genuinely added to ensure true availability changes remain reportable.
Author
Owner

@matbrgz commented on GitHub (Oct 20, 2026):

Cross-referencing with canonical issue #4681 ([Bug] Application version comparison treats unresolved relationship targets as aligned) and siblings #5195, #5406, and #5535. Addresses false scope additions/removals during application version comparison. Cataloged under Cluster AO in consolidation tracker #4330.

<!-- gh-comment-id:6293049329 --> @matbrgz commented on GitHub (Oct 20, 2026): Cross-referencing with canonical issue #4681 (`[Bug] Application version comparison treats unresolved relationship targets as aligned`) and siblings #5195, #5406, and #5535. Addresses false scope additions/removals during application version comparison. Cataloged under Cluster AO in consolidation tracker #4330.
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#3368
No description provided.