impact

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

@index BFS 기반 blast-radius 분석 엔진. 코드 변경의 영향 범위를 그래프 순회로 계산한다.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

Analyzer computes impact radius over the graph. @intent estimate which nodes may be affected by a change

func New

func New(store EdgeReader) *Analyzer

New creates an impact analyzer. @intent construct a blast-radius analyzer around a graph reader

func (*Analyzer) ImpactRadius

func (a *Analyzer) ImpactRadius(ctx context.Context, nodeID uint, depth int) ([]model.Node, error)

ImpactRadius performs BFS traversal to find all nodes within the given depth. Used by MCP get_impact_radius tool and pre-merge check prompt.

@param nodeID the starting node for blast-radius analysis @param depth BFS traversal depth limit @return all nodes reachable within depth hops @intent identify blast radius of code changes for risk assessment @domainRule traverses both outgoing and incoming edges bidirectionally @see changes.Service.Analyze

func (*Analyzer) ImpactRadiusBounded

func (a *Analyzer) ImpactRadiusBounded(ctx context.Context, nodeID uint, depth int, opts RadiusOptions) (*RadiusResult, error)

ImpactRadiusBounded performs the bidirectional BFS that backs ImpactRadius with explicit caps. @intent expose a limit-aware blast radius traversal for cost-sensitive callers @param nodeID starting node for the BFS @param depth maximum BFS hop count (further capped by opts.MaxDepth) @param opts traversal limits applied during BFS @return RadiusResult with visited nodes and truncation metadata @domainRule traverses outgoing and incoming edges in lock step at each depth @ensures Truncated is true when MaxNodes stopped traversal before adding another node

type EdgeReader

type EdgeReader interface {
	GetEdgesFrom(ctx context.Context, nodeID uint) ([]model.Edge, error)
	GetEdgesFromNodes(ctx context.Context, nodeIDs []uint) ([]model.Edge, error)
	GetEdgesTo(ctx context.Context, nodeID uint) ([]model.Edge, error)
	GetEdgesToNodes(ctx context.Context, nodeIDs []uint) ([]model.Edge, error)
	GetNodeByID(ctx context.Context, id uint) (*model.Node, error)
	GetNodesByIDs(ctx context.Context, ids []uint) ([]model.Node, error)
}

EdgeReader exposes graph queries required for impact analysis. @intent abstract bidirectional edge and node lookups for blast-radius traversal

type RadiusOptions

type RadiusOptions struct {
	MaxDepth int
	MaxNodes int
}

RadiusOptions caps how far ImpactRadiusBounded is allowed to expand. @intent let callers limit BFS depth and visited node count for safety

type RadiusResult

type RadiusResult struct {
	Nodes         []model.Node
	Truncated     bool
	MaxDepth      int
	MaxNodes      int
	ReturnedNodes int
}

RadiusResult reports the resolved nodes and whether limits truncated traversal. @intent surface the visited node set together with truncation metadata

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL