CodeGraph/docs
Section 4.3

Impact Analysis (Upstream)

Calculates the complete blast radius of modifying a file or symbol by walking incoming structural relationships backward.

Source: server/src/analytics/impact/ImpactAnalyzer.ts

Upstream Reachability Semantics

In CodeGraph, an edge A --[calls]--> B means A calls B. Therefore, if an engineer changes B, the entity directly affected is A.

The ImpactAnalyzer traverses the graph with direction: "incoming" across the 5 structural relationship kinds:

server/src/analytics/impact/ImpactAnalyzer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export class ImpactAnalyzer { constructor(private readonly traversal: GraphTraversal) {} analyze(sourceNodeId: string, options: ImpactAnalysisOptions = {}): ImpactAnalysisResult { const traversalResult = this.traversal.traverse(sourceNodeId, { direction: "incoming", relationshipKinds: [ "calls", "imports", "extends", "implements", "instantiates", ], maxDepth: options.maxDepth, }); return { sourceNodeId, impactedNodeIds: traversalResult.nodes, depthByNode: traversalResult.depthByNode, }; } }

Interpreting Hop Depth

  • Depth 1: Direct consumers (immediate callers, direct file importers, direct subclasses).
  • Depth 2: Transitive consumers (callers of callers).
  • Depth N: Distant upstream modules affected by transitive dependency chains.