[PR #663] [MERGED] fix(javascript): scope candidate ambiguity to query traversal #2146

Closed
opened 2026-10-16 21:14:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/663
Author: @kaoru0822-kitauji
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/semantic-candidate-relevance


📝 Commits (1)

  • f94fc79 fix(javascript): scope candidate ambiguity to query traversal

📊 Changes

2 files changed (+205 additions, -11 deletions)

View changed files

📝 src/domain/javascriptSemanticGraphTraversal.test.ts (+196 -0)
📝 src/domain/javascriptSemanticQuery.ts (+9 -11)

📄 Description

Summary

Classify candidate relations using the same direction and relation eligibility as semantic graph traversal.

No separate issue: this is a focused, reproduced query-classification defect.

Problem and expected behavior

A complete resolved caller-to-callee graph returns a callers query as found with complete coverage. Adding an unrelated candidate reads relation touching a returned node changes that same result to ambiguous/partial, even though callers traversal cannot follow reads. Incoming candidates also incorrectly taint forward queries, and outgoing candidates incorrectly taint backward queries.

Only candidates traversable from the query's reached nodes should introduce candidate ambiguity.

Change and scope

Reuse the existing adjacency builder for candidate-only relevance. This applies the same directed endpoints, callers/ownership eligibility, and explicit allowed-relations filter. Count each relevant relation once.

The actual traversal, candidate opt-in behavior, unknown-frontier handling, and graph-level coverage assessment are unchanged. Relevant excluded candidates still keep the result ambiguous.

Contract and boundary impact

  • Semantic owner: pure semantic-query candidate relevance.
  • CLI/MCP: corrected status/coverage for irrelevant candidates; no tools or schemas change.
  • Provider/platform: none.
  • Evidence/provenance: no observations are removed or promoted; genuine candidate and incomplete-graph uncertainty remains.
  • Process/authorization/cleanup: none.
  • Generated metadata/package: none.

Evidence and regression coverage

On fc80ea8, five irrelevant-candidate cases fail while 15 controls pass. Fixed coverage includes:

  • Both directed modes, callers, and ownership.
  • Relevant/irrelevant candidates with both opt-in values.
  • Explicit relation filtering and preserved partial graph coverage.
  • Relevant candidates at the end of a 70-edge reachable path.

The tests verify retained nodes/relations against the unaffected control where candidates are ineligible.

Validation performed

After updating the local base to main 5802ef8:

  • Traversal, semantic-query, schema, and call-analysis suites: 32 tests passed.
  • npm run check: passed.
  • npm run jscpd: passed.
  • npm run scan:todos: passed.
  • git diff --check: passed.
  • Independent review: no findings across all relation kinds/directions, filters, opt-ins, endpoint seeds, long paths, and conservative unknown/incomplete/missing-target controls.

Node.js 24.19.0, npm 11.9.0. Hosted CI is tracked separately; no complete local suite pass is claimed.

Compatibility, safety, and release

No schema, packaging, provider, or execution changes. Real Hopper/Ghidra and package-install verification were not rerun for this pure-domain change.

Prepared with AI assistance.


🔄 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/663 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/semantic-candidate-relevance` --- ### 📝 Commits (1) - [`f94fc79`](https://github.com/morluto/rea/commit/f94fc7967b2e5604c144d3638515caad6273a0c6) fix(javascript): scope candidate ambiguity to query traversal ### 📊 Changes **2 files changed** (+205 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascriptSemanticGraphTraversal.test.ts` (+196 -0) 📝 `src/domain/javascriptSemanticQuery.ts` (+9 -11) </details> ### 📄 Description ## Summary Classify candidate relations using the same direction and relation eligibility as semantic graph traversal. No separate issue: this is a focused, reproduced query-classification defect. ## Problem and expected behavior A complete resolved caller-to-callee graph returns a callers query as `found` with complete coverage. Adding an unrelated candidate `reads` relation touching a returned node changes that same result to `ambiguous`/`partial`, even though callers traversal cannot follow reads. Incoming candidates also incorrectly taint forward queries, and outgoing candidates incorrectly taint backward queries. Only candidates traversable from the query's reached nodes should introduce candidate ambiguity. ## Change and scope Reuse the existing adjacency builder for candidate-only relevance. This applies the same directed endpoints, callers/ownership eligibility, and explicit allowed-relations filter. Count each relevant relation once. The actual traversal, candidate opt-in behavior, unknown-frontier handling, and graph-level coverage assessment are unchanged. Relevant excluded candidates still keep the result ambiguous. ## Contract and boundary impact - Semantic owner: pure semantic-query candidate relevance. - CLI/MCP: corrected status/coverage for irrelevant candidates; no tools or schemas change. - Provider/platform: none. - Evidence/provenance: no observations are removed or promoted; genuine candidate and incomplete-graph uncertainty remains. - Process/authorization/cleanup: none. - Generated metadata/package: none. ## Evidence and regression coverage On `fc80ea8`, five irrelevant-candidate cases fail while 15 controls pass. Fixed coverage includes: - Both directed modes, callers, and ownership. - Relevant/irrelevant candidates with both opt-in values. - Explicit relation filtering and preserved partial graph coverage. - Relevant candidates at the end of a 70-edge reachable path. The tests verify retained nodes/relations against the unaffected control where candidates are ineligible. ## Validation performed After updating the local base to main `5802ef8`: - Traversal, semantic-query, schema, and call-analysis suites: 32 tests passed. - `npm run check`: passed. - `npm run jscpd`: passed. - `npm run scan:todos`: passed. - `git diff --check`: passed. - Independent review: no findings across all relation kinds/directions, filters, opt-ins, endpoint seeds, long paths, and conservative unknown/incomplete/missing-target controls. Node.js 24.19.0, npm 11.9.0. Hosted CI is tracked separately; no complete local suite pass is claimed. ## Compatibility, safety, and release No schema, packaging, provider, or execution changes. Real Hopper/Ghidra and package-install verification were not rerun for this pure-domain change. Prepared with AI assistance. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:14:53 +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#2146
No description provided.