baseline

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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

View Source
const SchemaVersion = "archfit.baseline.v1"

SchemaVersion is the fixed schema_version value for baseline files.

Variables

This section is empty.

Functions

func Save

func Save(_ context.Context, path string, b Baseline) error

Save writes b to path as JSON. It sets SchemaVersion before writing.

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

func Load(_ context.Context, path string) (Baseline, error)

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

func (b Baseline) HasFingerprint(fingerprint string) bool

HasFingerprint reports whether the given fingerprint exists in the baseline's accepted findings.

Jump to

Keyboard shortcuts

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