Documentation
¶
Overview ¶
Package baseline handles loading and saving the archfit baseline file, which tracks accepted findings and metric snapshots across runs.
Package baseline handles loading and saving the archfit baseline file, which tracks accepted findings and metric snapshots across runs.
Index ¶
Constants ¶
const SchemaVersion = "archfit.baseline.v1"
SchemaVersion is the fixed schema_version value for baseline files.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AcceptedFinding ¶
type AcceptedFinding struct {
Fingerprint string `json:"fingerprint"`
RuleID string `json:"rule_id"`
Kind string `json:"kind,omitempty"`
// Severity is the finding's severity at acceptance time. Recorded so a delta
// run can flag findings whose severity later changed. Omitted (empty) in
// baselines written before severity tracking — treated as "unknown", never a
// severity change.
Severity string `json:"severity,omitempty"`
}
AcceptedFinding records a finding that has been accepted into the baseline. Fingerprint is the SHA256 hex ID from finding.New; RuleID is the rule that produced it. Kind distinguishes gate findings from advisory findings; empty means "gate" for backward compatibility with baseline files written before this field was added.
type Baseline ¶
type Baseline struct {
SchemaVersion string `json:"schema_version"`
Accepted []AcceptedFinding `json:"accepted"`
Metrics diagnostic.MetricSnapshot `json:"metrics"`
}
Baseline is the on-disk baseline file structure.
func Load ¶
Load reads the baseline from path. If the file does not exist, it returns an empty Baseline (not an error). If the file exists but has a mismatched schema_version, it returns an error (exit-3-style).
func (Baseline) Entries ¶
func (b Baseline) Entries() []status.AcceptedEntry
Entries returns the accepted findings as status entries, satisfying status.AcceptedSet. The dependency points outward-in: the persistence layer adapts to the core's interface, never the reverse.
func (Baseline) HasFingerprint ¶
HasFingerprint reports whether the given fingerprint exists in the baseline's accepted findings.