impact: list doc mentions apart from affected code

Merged
BO
1mo ago
+74-12

OrangeOrchid reported that codegraph impact on one function in a private downstream project counted 17 Markdown headings among its 27 affected symbols.

Cause. The impact walk follows every incoming edge. The function is imported by ttdSyncService.ts, and Markdown sections that link to that file's path have references edges into the file node. So at depth 2 the walk collected those sections as dependents, and from there any docs that link to them.

Fix:

  • src/graph/traversal.ts adds isDocumentationNode (a Markdown node). The walk still records a doc section but no longer continues from it.
  • The CLI's impact counts code only, and prints doc mentions under "Mentioned in docs (N) — may need updating, not affected".
  • JSON output moves doc nodes from affected into a new docs array. nodeCount now counts code only.
  • MCP's codegraph_impact formatter gets the same split.
  • The viewer's blast summary no longer counts docs as dependents.

Checked on a fixture (a function, an importing file, and a doc section linking that file): "5 affected symbols" became "3 affected symbols", plus "Mentioned in docs (2)".

Gate: a new graph.test.ts case, which fails without the fix: a doc section that mentions a dependent is reported, and a doc that links only that section is not reached. Full suite: 304 files, 5,185 tests. CHANGELOG has a Fixes entry.