[PR #5574] [CLOSED] fix(javascript): keep unavailable analysis scopes unknown in version comparison #6973

Closed
opened 2026-11-01 21:44:25 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5574
Author: @kaoru0822-kitauji
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/compare-unselected-scopes


📝 Commits (1)

  • 0a0d313 fix(javascript): keep unavailable analysis scopes unknown in version comparison

📊 Changes

3 files changed (+135 additions, -1 deletions)

View changed files

📝 docs/javascript-application-workflows.md (+5 -1)
📝 src/domain/javascript/javascriptApplicationVersionItems.ts (+42 -0)
📝 tests/acceptance/applications/applicationVersionMatchingCli.test.ts (+88 -0)

📄 Description

Summary

Fixes #5534. compare-application-versions reported the unselected lib.js parse-scope placeholder as added (or removed when swapped) when comparing complete analysis against --source-path main.js analysis of the same artifact. That placeholder now stays unknown in either direction and no longer increments added/removed.

Problem and expected behavior

The analysis producer records an unselected or failed parse scope as an unknown-kind node whose observations all carry Evidence state unavailable. The comparison classified unmatched nodes only by opposite-graph coverage, so against complete opposite coverage it treated this analysis-gap marker as a positive application entity. Expected: unresolved applicability stays unknown, with a limitation identifying the unavailable analysis.

Change and scope

src/domain/javascript/javascriptApplicationVersionItems.ts: before claiming one-sided absence, leftOnlyItem/rightOnlyItem consult the producer's Evidence state. A one-sided node whose observations are all unavailable becomes unknown with dimensions ["availability", "coverage"], a comparison limitation, and the producer's own Evidence limitations, such as "Source is outside the caller-selected source_paths; it was inventoried but not analyzed.". Nodes with any observed or inferred observation are classified as before, so real additions and removals are still reported. docs/javascript-application-workflows.md documents the rule.

Not included: the separate changed asset item that the issue mentions (analysis metadata difference). Matched pairs of unavailable markers are also left unchanged.

Scope: an ordinary fix inside existing boundaries; no maintainer scope decision applies.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the domain comparison classifier (javascriptApplicationVersionItems.ts) now reads the producer's Evidence state. The producer is unchanged.

  • Contribution scope fit and linked maintainer decision: not applicable (bug fix).

  • CLI and MCP/tool-catalog contract: no schema change. Item status, dimensions and limitations change only for one-sided all-unavailable nodes.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: Evidence links are preserved, and the producer's limitations now appear on the item.

  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

Evidence and regression coverage

  • Tests added or updated: tests/acceptance/applications/applicationVersionMatchingCli.test.ts, "keeps unselected source scopes unknown while genuine additions remain added". It runs the issue's public CLI workflow: full vs --source-path main.js in both directions, a full/full control against an independently analyzed copy, and a main-only to full comparison that must still report the genuinely added javascript-asset.

  • Base reproduction: with the source fix reverted, the new test fails with expected { unchanged: +0, added: 1, … } to match object { added: +0, removed: +0 }. With the fix, it passes.

  • User-visible CLI/MCP output: the unselected-scope item is now status: "unknown", dimensions: ["availability", "coverage"], and its limitations include the producer's unselected-source limitation.

  • Remaining proof gaps: the MCP adapter was not exercised separately. It uses the same domain classifier, but this is source-derived only. Other unavailable-scope families, such as analysis failures, are covered only by the shared rule and have no dedicated test.

  • 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

  • npm run test:focused -- tests/acceptance/applications/applicationVersionMatchingCli.test.ts src/domain/javascript/javascriptApplicationVersion{Comparison,Matching,Relationships,RelationshipUncertainty,Relocation}.test.ts tests/acceptance/applications/applicationVersionRelocationCli.test.ts tests/acceptance/applications/applicationWorkflowCli.test.ts: 8 files, 74 tests passed.
  • The same new test with the source fix reverted: 1 failed (above), 3 passed.
  • npm run check:fast: typecheck and lint succeeded.
  • npm run docs:check: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Results that were previously wrong added/removed counts become unknown.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable (macOS local CLI only).
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new target interaction.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • 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.

🤖 Generated with Claude Code


🔄 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/5574 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/compare-unselected-scopes` --- ### 📝 Commits (1) - [`0a0d313`](https://github.com/morluto/rea/commit/0a0d31331eb1b184aa657147e6b332369c3798dd) fix(javascript): keep unavailable analysis scopes unknown in version comparison ### 📊 Changes **3 files changed** (+135 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/javascript-application-workflows.md` (+5 -1) 📝 `src/domain/javascript/javascriptApplicationVersionItems.ts` (+42 -0) 📝 `tests/acceptance/applications/applicationVersionMatchingCli.test.ts` (+88 -0) </details> ### 📄 Description ## Summary Fixes #5534. `compare-application-versions` reported the unselected `lib.js` parse-scope placeholder as `added` (or `removed` when swapped) when comparing complete analysis against `--source-path main.js` analysis of the same artifact. That placeholder now stays `unknown` in either direction and no longer increments `added`/`removed`. ## Problem and expected behavior The analysis producer records an unselected or failed parse scope as an `unknown`-kind node whose observations all carry Evidence state `unavailable`. The comparison classified unmatched nodes only by opposite-graph coverage, so against complete opposite coverage it treated this analysis-gap marker as a positive application entity. Expected: unresolved applicability stays `unknown`, with a limitation identifying the unavailable analysis. ## Change and scope `src/domain/javascript/javascriptApplicationVersionItems.ts`: before claiming one-sided absence, `leftOnlyItem`/`rightOnlyItem` consult the producer's Evidence state. A one-sided node whose observations are all `unavailable` becomes `unknown` with dimensions `["availability", "coverage"]`, a comparison limitation, and the producer's own Evidence limitations, such as "Source is outside the caller-selected source_paths; it was inventoried but not analyzed.". Nodes with any observed or inferred observation are classified as before, so real additions and removals are still reported. `docs/javascript-application-workflows.md` documents the rule. Not included: the separate `changed` asset item that the issue mentions (analysis metadata difference). Matched pairs of unavailable markers are also left unchanged. Scope: an ordinary fix inside existing boundaries; no maintainer scope decision applies. ## Contract and boundary impact - Semantic owner and earliest changed stage: the domain comparison classifier (`javascriptApplicationVersionItems.ts`) now reads the producer's Evidence `state`. The producer is unchanged. - Contribution scope fit and linked maintainer decision: not applicable (bug fix). - CLI and MCP/tool-catalog contract: no schema change. Item status, dimensions and limitations change only for one-sided all-unavailable nodes. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: Evidence links are preserved, and the producer's limitations now appear on the item. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata, package, or installation impact: none. - [x] Read existing files or captured data. ## Evidence and regression coverage - Tests added or updated: `tests/acceptance/applications/applicationVersionMatchingCli.test.ts`, "keeps unselected source scopes unknown while genuine additions remain added". It runs the issue's public CLI workflow: full vs `--source-path main.js` in both directions, a full/full control against an independently analyzed copy, and a main-only to full comparison that must still report the genuinely added `javascript-asset`. - Base reproduction: with the source fix reverted, the new test fails with `expected { unchanged: +0, added: 1, … } to match object { added: +0, removed: +0 }`. With the fix, it passes. - User-visible CLI/MCP output: the unselected-scope item is now `status: "unknown"`, `dimensions: ["availability", "coverage"]`, and its limitations include the producer's unselected-source limitation. - Remaining proof gaps: the MCP adapter was not exercised separately. It uses the same domain classifier, but this is source-derived only. Other unavailable-scope families, such as analysis failures, are covered only by the shared rule and have no dedicated test. - [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 - `npm run test:focused -- tests/acceptance/applications/applicationVersionMatchingCli.test.ts src/domain/javascript/javascriptApplicationVersion{Comparison,Matching,Relationships,RelationshipUncertainty,Relocation}.test.ts tests/acceptance/applications/applicationVersionRelocationCli.test.ts tests/acceptance/applications/applicationWorkflowCli.test.ts`: 8 files, 74 tests passed. - The same new test with the source fix reverted: 1 failed (above), 3 passed. - `npm run check:fast`: typecheck and lint succeeded. - `npm run docs:check`: passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. Results that were previously wrong `added`/`removed` counts become `unknown`. - Real Hopper/Ghidra, browser, or OS coverage: not applicable (macOS local CLI only). - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new target interaction. ## Author readiness Human owner: - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [ ] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [ ] 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:44:25 +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#6973
No description provided.