Skip to content

fix: preserve edge confidence in call trace results - #336

Open
cookerpapa wants to merge 1 commit into
trailhq:mainfrom
cookerpapa:fix/trace-edge-confidence
Open

fix: preserve edge confidence in call trace results#336
cookerpapa wants to merge 1 commit into
trailhq:mainfrom
cookerpapa:fix/trace-edge-confidence

Conversation

@cookerpapa

Copy link
Copy Markdown

Preserve confidence in call trace results (point 4 of #330), complementing #335's import-resolution fix.

  • Keep the original edge confidence in direct and BFS hits.
  • Expose pathConfidence as the weakest grade on the existing first BFS path.
  • Include both fields in CLI JSON and show confidence in shared CLI/MCP output.
  • Document the semantics; cover all four grades, both directions, cycles, diamonds, multi/file seeds, unresolved endpoints, and a real CLI/MCP fixture.

Traversal order, deduplication, depth, and resolution remain unchanged.

Validation:

  • All 7 new regressions pass; the initial 6 fail on main before the fix.
  • A targeted run had 153/154 passing tests; the remaining exact-output assertion was updated for the label. The final CLI/confidence run passes all 21 tests; the other 133 passed in the earlier run.
  • npm run build and git diff --check passed.

@trailhq-graft

trailhq-graft Bot commented Sep 10, 2026

Copy link
Copy Markdown

🌱 graft blast radius

1 area changed → 4 areas can be affected. 8 dependent symbols, depth 2.
Tests: 1 area updated its tests.
Tag: @anirudhkumar-nanonets — 5 of 5 areas · @shhdwi — 4 of 5 areas

flowchart TB
  A0(("Tool Invocation<br/>3 symbols"))
  A1(("Blast Radius<br/>2 symbols"))
  A2(("Workspace Federation<br/>2 symbols"))
  A3(("CLI Entry Point<br/>1 symbol"))
  classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
  class A0,A1,A2,A3 reached;
Loading
Can be affected Symbols Nearest hop Reached from
Tool Invocation 3 src/mcp/tools.ts:L132-L147 renderMatches — calls, depth 1 Call Graph Traversal
Blast Radius 2 src/blast/blast.ts:L179-L269 blastRadius — calls, depth 1 Call Graph Traversal
Workspace Federation 2 src/graph/workspace.ts:L659-L695 federateCallers — calls, depth 1 Call Graph Traversal
CLI Entry Point 1 src/cli.ts:L1-L1197 cli.ts — calls, depth 2 Call Graph Traversal
Who knows this code — 2 people across 5 areas
Area Who knows it
Call Graph Traversal · changed @shhdwi — 7 commits, last 2mo ago · @anirudhkumar-nanonets — 5 commits, last 17d ago
Tool Invocation · affected @shhdwi — 14 commits, last 29d ago · @anirudhkumar-nanonets — 7 commits, last 8d ago
Blast Radius · affected @anirudhkumar-nanonets — 3 commits, last 14d ago
Workspace Federation · affected @shhdwi — 6 commits, last 29d ago · @anirudhkumar-nanonets — 3 commits, last 30d ago
CLI Entry Point · affected @anirudhkumar-nanonets — 36 commits, last 8d ago · @shhdwi — 23 commits, last 28d ago

Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no @ has no GitHub handle in its commit email — tag them by hand, or add a .mailmap entry. A suggestion from history, not a CODEOWNERS rule.

All 8 dependent symbols, grouped by area

Tool Invocation — 3 symbols in 1 file

  • src/mcp/tools.ts:L132-L147 — renderMatches (calls, depth 1)
    136: hitsFor: (n: NodeV1) => EdgeHit[],
  • src/mcp/tools.ts:L153-L199 — callWorkspaceTool (calls, depth 2)
  • src/mcp/tools.ts:L247-L329 — callSingleTool (calls, depth 2)
    281: // file at depth>1 it walks the file node AND every symbol defined in

Blast Radius — 2 symbols in 1 file

  • src/blast/blast.ts:L179-L269 — blastRadius (calls, depth 1)
    193: /** Merged dependents, keyed by node id, at the shallowest depth any file reached
  • src/blast/blast.ts:L388-L396 — blastRadiusIn (calls, depth 2)

Workspace Federation — 2 symbols in 2 files

  • src/graph/workspace.ts:L659-L695 — federateCallers (calls, depth 1)
    681: else for (const h of hits) lines.push(hitLine(direction, h, showDepth));
  • src/graph/workspace-cli.ts:L132-L144 — runWorkspaceCallers (calls, depth 2)

CLI Entry Point — 1 symbol in 1 file

  • src/cli.ts:L1-L1197 — cli.ts (calls, depth 2)
    1: #!/usr/bin/env node
Test signal per changed area — 1 ✓

Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.

  • Call Graph Traversal — 4 of 6 reached · 1 test file changed here: test/graph-confidence.test.ts
    • not reached: hitJson, weakestConfidence
4 test suites also reference this code

4 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.

  • test/graph-references.test.ts
  • test/graph-traverse.test.ts
  • test/regression-single-repo.test.ts
  • test/workspace.test.ts

⚠️ 1 changed file not in the graph (README.md) — no parser claims the extension, or the index predates the file.

graft blast · origin/main...HEAD · depth 2 · 5 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant