feat: explain_dependency(A, B) — shortest call-path finder #26

Closed
opened 2026-07-20 22:38:15 +02:00 by buildagent · 1 comment
Member

Rank 5 of the 2026-07-20 index-data brainstorm (_prdoc/records/brainstorm-2026-07-20-index-data-catalog.md).

What: given two symbols, return the shortest call path between them over symbol_edges — and, reversed, "through which chain does tool X break if B's signature changes".

Why: best value/cost ratio in the entire brainstorm. Demonstrated: path from an mcp-server test to indexer internals (read_code_reports_served_span_honestly → pre_index → db::open → apply_pragmas, 4 hops, 3 crates) found in one BFS; reproducing with existing tools needs ~4 sequential find_callees calls where open alone has 30+ callees to sift — the most token-expensive agent pattern observed.

Cost: trivial — BFS over 4,109 edges at query time, sub-millisecond; no schema change, no new data.

Rank 5 of the 2026-07-20 index-data brainstorm (`_prdoc/records/brainstorm-2026-07-20-index-data-catalog.md`). **What**: given two symbols, return the shortest call path between them over `symbol_edges` — and, reversed, "through which chain does tool X break if B's signature changes". **Why**: best value/cost ratio in the entire brainstorm. Demonstrated: path from an mcp-server test to indexer internals (`read_code_reports_served_span_honestly → pre_index → db::open → apply_pragmas`, 4 hops, 3 crates) found in one BFS; reproducing with existing tools needs ~4 sequential `find_callees` calls where `open` alone has 30+ callees to sift — the most token-expensive agent pattern observed. **Cost**: trivial — BFS over 4,109 edges at query time, sub-millisecond; no schema change, no new data.
Author
Member

Shipped in v0.5.20 (I029 Track B) as the explain_dependency MCP tool.

BFS shortest path over symbol_edges with per-hop edge weight, reverse direction, and honesty guarantees hardened by the adversarial review: found:false carries both endpoint files' resolution rates (absence-of-path ≠ proof of independence), from==to requires an actual cycle (a real self-loop returns [x, x] with its edge weight; no trivial empty-path false positive), and stale symbol_edges rows (no FK; deletion window) are endpoint-joined out at load and surfaced as stale_edges — a dangling id can never be spliced into a fabricated path.

Validated on this repository: pre_index → open → apply_pragmas (mcp-server test harness → indexer internals, 3 crates) found in one call. Covered by 7-language e2e.

Shipped in **v0.5.20** (I029 Track B) as the `explain_dependency` MCP tool. BFS shortest path over `symbol_edges` with per-hop edge `weight`, `reverse` direction, and honesty guarantees hardened by the adversarial review: `found:false` carries both endpoint files' resolution rates (absence-of-path ≠ proof of independence), `from==to` requires an **actual cycle** (a real self-loop returns `[x, x]` with its edge weight; no trivial empty-path false positive), and stale `symbol_edges` rows (no FK; deletion window) are endpoint-joined out at load and surfaced as `stale_edges` — a dangling id can never be spliced into a fabricated path. Validated on this repository: `pre_index → open → apply_pragmas` (mcp-server test harness → indexer internals, 3 crates) found in one call. Covered by 7-language e2e.
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
h-dv/code-index#26
No description provided.