impact

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package impact computes blast radius for changing a symbol.

Package impact computes blast radius for changing a symbol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AffectedSymbol

type AffectedSymbol struct {
	Name       string  `json:"name"`
	File       string  `json:"file"`
	Package    string  `json:"package"`
	Distance   int     `json:"distance"`
	Confidence float64 `json:"confidence"`
	Community  int     `json:"community"`
}

AffectedSymbol represents a caller that would be affected by a change.

type HiddenCaller

type HiddenCaller struct {
	File       string  `json:"file"`
	Line       int     `json:"line"`
	Text       string  `json:"text"`
	Confidence float64 `json:"confidence"` // 0.4-0.6
}

HiddenCaller represents a potential caller found via text search.

func FindHiddenCallers

func FindHiddenCallers(ctx context.Context, client *oxcodes.Client, root, symbolName, language string) []HiddenCaller

FindHiddenCallers searches for string references to a symbol that the call graph might have missed (callbacks, config, reflection).

type Options

type Options struct {
	MaxDepth int
	OxCodes  *oxcodes.Client  // optional: enables hidden caller search
	Root     string           // required when OxCodes is set
	Language string           // optional: limit search to this language
	Refs     graphx.CrossRefs // optional: enables TESTED_BY edge lookup
	Repo     string           // required when Refs is set (repo key for graph queries)
}

Options configures the impact analysis.

type Result

type Result struct {
	Symbol             string           `json:"symbol"`
	Found              bool             `json:"found"`
	DirectCallers      []AffectedSymbol `json:"direct_callers"`
	TransitiveCallers  []AffectedSymbol `json:"transitive_callers"`
	HiddenCallers      []HiddenCaller   `json:"hidden_callers,omitempty"`
	TotalAffected      int              `json:"total_affected"`
	AffectedPackages   []string         `json:"affected_packages"`
	CommunitiesCrossed int              `json:"communities_crossed"`
	BlastRadius        string           `json:"blast_radius"` // none, low, medium, high
	RiskScore          float64          `json:"risk_score"`
	// TestsCovering are test functions that directly cover the target symbol.
	// Populated when the graph has TESTED_BY edges; empty otherwise.
	TestsCovering []graphx.SymbolRef `json:"tests_covering,omitempty"`
}

Result is the output of an impact analysis.

func Analyze

func Analyze(ctx context.Context, cg *callgraph.CallGraph, symbolName string, opts Options) *Result

Analyze computes blast radius for changing the named symbol. Uses reverse BFS from the target to find all callers. When opts.OxCodes is set, also searches for hidden callers via string references.

Jump to

Keyboard shortcuts

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