diff

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package diff implements snapshot comparison: which nodes, edges, and attack paths were added or removed between two graph snapshots, with attribution of what introduced each new path (PRD sections 43-44).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change[T any] struct {
	Item T
}

Change is one added or removed element.

type PathKey

type PathKey struct {
	Chain string
}

PathKey is the comparable identity of an attack path.

type PathSummary

type PathSummary struct {
	SourceID   string
	TargetID   string
	NodeChain  []string
	EdgeTypes  []string
	Confidence float64
}

PathSummary captures the identity of a path without holding the whole graph: its node chain and edge types.

func Summarize

func Summarize(p *paths.Path) *PathSummary

Key returns the comparable identity of a path.

func (*PathSummary) String

func (s *PathSummary) String() string

String renders a path summary in arrow notation.

type Report

type Report struct {
	// AddedNodes are nodes present only in the new snapshot.
	AddedNodes []*graph.Node
	// RemovedNodes are nodes present only in the old snapshot.
	RemovedNodes []*graph.Node
	// AddedEdges are edges present only in the new snapshot.
	AddedEdges []*graph.Edge
	// RemovedEdges are edges present only in the old snapshot.
	RemovedEdges []*graph.Edge
	// NewPaths are attack paths present only in the new snapshot.
	NewPaths []*PathSummary
	// GonePaths are attack paths present only in the old snapshot.
	GonePaths []*PathSummary
}

Report is the full diff between two snapshots.

func Compute

func Compute(oldG, newG *graph.Graph) (*Report, error)

Compute compares two snapshots. Paths are enumerated from every AI agent with a raised MaxPaths cap: a diff built from truncated path sets could otherwise report spurious new/gone paths. Truncation is surfaced in the returned error when it occurs.

func (*Report) Attribution

func (r *Report) Attribution(p *PathSummary) []*graph.Edge

Attribution explains which structural change most likely introduced a new path: the added edge(s) that the path traverses. Returns the best single edge plus all matching added edges.

func (*Report) IsEmpty

func (r *Report) IsEmpty() bool

IsEmpty reports whether the snapshots are graph-identical.

Jump to

Keyboard shortcuts

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