Documentation
¶
Overview ¶
Package history provides persistent storage for analysis results over time. This enables blast radius trends, hotspot evolution, and coupling drift tracking.
History is stored in a separate SQLite database (.contextception/history.sqlite) to keep it independent from the index, which gets rebuilt frequently.
Index ¶
- Constants
- func HistoryPath(repoRoot string) string
- type BlastDistribution
- type BlastRadiusTrend
- type FileRiskHistory
- type HotspotFrequency
- type Store
- func (s *Store) Close() error
- func (s *Store) GetBlastDistribution(since time.Time) ([]BlastDistribution, error)
- func (s *Store) GetBlastRadiusTrend(limit int, branch string) ([]BlastRadiusTrend, error)
- func (s *Store) GetFileRiskHistory(filePath string, limit int) ([]FileRiskHistory, error)
- func (s *Store) GetHotspotEvolution(limit int, since time.Time) ([]HotspotFrequency, error)
- func (s *Store) RecordRun(report *model.ChangeReport, commitSHA, branch string) (int64, error)
- func (s *Store) RunCount() (int, error)
Constants ¶
const HistoryFile = "history.sqlite"
HistoryFile is the filename of the history database.
Variables ¶
This section is empty.
Functions ¶
func HistoryPath ¶
HistoryPath returns the path to the history database for a repo.
Types ¶
type BlastDistribution ¶
type BlastDistribution struct {
Level string `json:"level"`
Count int `json:"count"`
Percent float64 `json:"percent"`
}
BlastDistribution shows what percentage of runs had each blast level.
type BlastRadiusTrend ¶
type BlastRadiusTrend struct {
Date string `json:"date"`
Level string `json:"level"`
Files int `json:"files"`
Branch string `json:"branch,omitempty"`
}
BlastRadiusTrend returns blast radius levels over time.
type FileRiskHistory ¶
type FileRiskHistory struct {
Date string `json:"date"`
BlastLevel string `json:"blast_level"`
Status string `json:"status"`
}
FileRiskHistory shows how a file's blast radius has changed over time.
type HotspotFrequency ¶
type HotspotFrequency struct {
File string `json:"file"`
Count int `json:"count"`
LastSeen string `json:"last_seen"`
}
HotspotFrequency represents how often a file appears as a hotspot.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages the historical analysis database.
func (*Store) GetBlastDistribution ¶
func (s *Store) GetBlastDistribution(since time.Time) ([]BlastDistribution, error)
GetBlastDistribution returns the distribution of blast radius levels.
func (*Store) GetBlastRadiusTrend ¶
func (s *Store) GetBlastRadiusTrend(limit int, branch string) ([]BlastRadiusTrend, error)
GetBlastRadiusTrend returns the last N analysis runs' blast radius.
func (*Store) GetFileRiskHistory ¶
func (s *Store) GetFileRiskHistory(filePath string, limit int) ([]FileRiskHistory, error)
GetFileRiskHistory returns the risk history for a specific file.
func (*Store) GetHotspotEvolution ¶
GetHotspotEvolution returns files that appear most frequently as hotspots.