changes

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

@index Application git-diff overlap and deterministic change-risk policy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitClient

type GitClient interface {
	ChangedFiles(ctx context.Context, repoDir, baseRef string) ([]string, error)
	DiffHunks(ctx context.Context, repoDir, baseRef string, paths []string) ([]Hunk, error)
}

GitClient provides git diff data needed for change analysis. @intent abstract git operations so risk analysis can consume changed files and hunks

type Hunk

type Hunk struct {
	FilePath  string
	StartLine int
	EndLine   int
}

Hunk describes a changed line range within one file. @intent represent a diff segment that can be matched against graph nodes

type Result

type Result struct {
	Items   []RiskEntry
	HasMore bool
}

Result carries one bounded page of risk entries plus pagination metadata. @intent expose paged change-risk results while keeping legacy callers working with []RiskEntry.

type RiskEntry

type RiskEntry struct {
	Node      graph.Node
	HunkCount int
	RiskScore float64
}

RiskEntry captures risk metrics for one changed node. @intent return the changed node together with overlap count and computed risk

type Service

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

Service coordinates git-based change detection and graph-backed scoring. @intent identify changed nodes and score how risky they are to modify

func New

func New(repository analyzeapp.ChangeRepository, git GitClient) *Service

New creates a change analysis service. @intent wire database and git dependencies into a reusable analyzer

func (*Service) AnalyzePage

func (s *Service) AnalyzePage(ctx context.Context, repoDir, baseRef string, limit, offset int) (Result, error)

AnalyzePage detects changed functions and returns one bounded page of risk entries. @intent bound handler response allocation while preserving the same sorted risk window that legacy Analyze would expose. @domainRule pagination limits returned items, but compute cost still scales with scoring every changed node to preserve legacy ordering. @domainRule entries are sorted by descending risk_score, then file_path, then qualified_name for stable ordering.

func (*Service) ChangedNodeIDs

func (s *Service) ChangedNodeIDs(ctx context.Context, repoDir, baseRef string) ([]uint, error)

ChangedNodeIDs returns the unique graph node IDs touched by the current diff. @intent let downstream analyzers reuse change detection without paying risk-score or AnalyzePage pagination-loop costs. @sideEffect executes git diff via GitClient. @ensures returned IDs are deterministic by file path, start line, qualified name, then node ID.

Jump to

Keyboard shortcuts

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