fix(callers): quote and count every call site inside a caller - #406
TigerkidYang wants to merge 2 commits into
Conversation
The graph keeps one edge per calling function, so a function that calls the symbol three times was listed once with only its first call site quoted, and nothing said the others existed (trailhq#363). Quote every matching line in the caller's span, tag the hit with the site count when there is more than one, and expose the site line numbers as `sites` in --json (quoted text stays out of the JSON contract).
…own declaration Review follow-ups: the tag reads `· N sites` because the walk also follows references/imports/extends edges; a recursive function is its own caller and its declaration line named the symbol without being a site, so it is dropped; the JSON `sites` doc states when the key is absent.
🌱 graft blast radius2 areas changed → 3 areas can be affected. 6 dependent symbols, depth 2. flowchart TB
A0(("Tool Invocation<br/>3 symbols"))
A1(("Workspace Federation<br/>2 symbols"))
A2(("CLI Entry Point<br/>1 symbol"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2 reached;
Who knows this code — 2 people across 5 areas
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 All 6 dependent symbols, grouped by areaTool Invocation — 3 symbols in 1 file
Workspace Federation — 2 symbols in 2 files
CLI Entry Point — 1 symbol in 1 file
Test signal per changed area — 2 ✗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.
1 test suite also references this code1 symbol, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
Fixes #363.
What
The graph keeps one edge per (caller, relation, callee), so a function that calls the symbol three times was listed once by
graft callers, with only its first call site quoted and nothing saying the others existed. Counting call sites off that list gives 7 for a true 9, as the report shows.referenceLines()(new, next toreferenceLine()insrc/blast/evidence.ts) returns every line in the caller's span that references the symbol.graft callersquotes each of them and tags the hit with· N siteswhen there is more than one (sites, notcall sites: the walk also follows references/imports/extends edges).--jsonhits gain an optionalsites: number[]— line numbers only; the quoted text stays out of the data contract, as the existing test insists.hitLine()keeps its old signature (an optional quote, now also accepting an array), so the MCP tool and workspace renderers are unchanged.Known approximation
Line matching reuses the same word-boundary regex the existing single quote uses, so a comment naming the symbol counts as a site and two calls on one line count once. Recording call positions at extraction time (
extract.tshas the tree-sitter node in hand when it emits thecallsRawEdge) and aggregating them ontoEdgeV1during resolve would make this exact and relation-aware; that is a graph-schema change, so I left it as a follow-up rather than folding it in here.Testing
sitesis[5, 6, 7]/[10]and contains no quoted text, and a recursive caller's declaration line is not a site.npm testin anode:22-bookwormcontainer: 1222 tests, 1217 passed, 0 failed (the rest skipped);tsc --noEmitclean.AI disclosure
Implemented with Claude (Claude Code); I reviewed the change and ran the suite.
🤖 Generated with Claude Code