baseline

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 13 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 baseline is what makes a committed oracle baseline checkable without the Java validators: every baseline records which pin, which bridge sources and which corpora its run measured, and this package both writes that record and compares a committed one against the repository as it stands now.

Index

Constants

View Source
const (
	OriginOurs   = "ours"
	OriginPinned = "pinned"
)

Origin says who owns an input, which is what decides the action a mismatch calls for: our own material moving is a movement to adjudicate, the pinned reference moving underneath a baseline is a provisioning defect to investigate.

View Source
const PinPath = "scripts/pilot-pin.sh"

PinPath is the single source of the pilot pin every oracle resolves its validators and corpora from.

Variables

This section is empty.

Functions

func CheckCommitted

func CheckCommitted(committedPath, refresh string, current Record) error

CheckCommitted is the Java-free guard: it reads a committed baseline's provenance and reports how it differs from the repository as it stands, naming the command that re-records it.

func Differences

func Differences(was, now any) []string

Differences reports where two decoded reports differ, as field paths with their values, deepest-first per member so the first line names a real leaf.

func DigestFile

func DigestFile(path string) (string, error)

DigestFile is the digest of one file's bytes.

func DigestFiles

func DigestFiles(dir string, rel []string) (string, error)

DigestFiles is the digest of a named set of files: a hash over each path and the digest of its contents, so a renamed, added or edited file all move it. The paths are slash-separated and relative to dir.

func DigestStrings

func DigestStrings(lines []string) string

DigestStrings is the digest of a list of already-canonical strings, used for registries that live in code rather than on disk.

func ErrataDigest

func ErrataDigest(entries []errata.Entry) string

ErrataDigest identifies the declared overlay: what it corrects is part of what the oracles read, so a changed registry is a changed measurement.

func Explain

func Explain(baselinePath, refresh string, mismatches []Mismatch) string

Explain is the failure a provenance guard prints: which baseline, which fields, what each mismatch means and the command that re-records it.

func Reproduces

func Reproduces(committedPath string, fresh []byte) error

Reproduces reports whether a fresh report still matches the committed baseline. The recording date is excluded: it states when the baseline was committed, not what was measured.

func Today

func Today() string

Today is the stamp -update writes into a baseline.

func Validate

func Validate(recorded Record) error

Validate reports what a committed record fails to state. A baseline missing its provenance is exactly the stale baseline this package exists to catch.

func Write

func Write(committedPath string, fresh []byte) error

Write records a fresh report as the committed baseline. The oracle stamps the recording date itself, so the bytes written here are the run's own.

Types

type Cause

type Cause int

Cause classifies a provenance mismatch by the action it calls for.

const (
	// CausePin: the repository's pin moved and the baseline predates it.
	CausePin Cause = iota
	// CauseOurs: material this repository owns moved.
	CauseOurs
	// CausePinned: the pinned reference material changed underneath the baseline.
	CausePinned
)

type Input

type Input struct {
	Name   string `json:"name"`
	Dir    string `json:"dir"`
	Origin string `json:"origin"`
	Files  int    `json:"files"`
	Digest string `json:"digest"`
}

Input is one compared corpus root, identified by the digest of the files the run actually read rather than by its directory's contents on any one machine.

type Mismatch

type Mismatch struct {
	Field    string
	Recorded string
	Current  string
	Cause    Cause
}

Mismatch is one field of a committed provenance record that no longer matches the repository.

func Compare

func Compare(recorded, current Record) []Mismatch

Compare reports how a committed record differs from the repository's current one. An input the current record does not state — a corpus absent from this checkout — is not compared: the point of this check is to run without them.

type Pin

type Pin struct {
	Tag      string
	Artifact string
}

Pin is the resolved pilot pin.

func ReadPin

func ReadPin(root string) (Pin, error)

ReadPin resolves the pin from scripts/pilot-pin.sh.

func (Pin) Release

func (p Pin) Release() string

Release is the pin as the validators' pilot-pin.txt states it.

type Record

type Record struct {
	PilotTag      string `json:"pilotTag"`
	PilotArtifact string `json:"pilotArtifact"`
	// Errata is the digest of the declared overlay, which changes what the
	// oracles read and therefore what they measure.
	Errata string  `json:"errataRegistry"`
	Tools  []Tool  `json:"tools,omitempty"`
	Inputs []Input `json:"inputs"`
	// Recorded is the date the baseline was committed, stamped by the -update
	// flag. A plain run leaves it empty so two runs stay byte-identical.
	Recorded string `json:"recorded,omitempty"`
}

Record is the provenance block a baseline carries: the identities of the run's inputs, never their machine-specific paths, so any checkout can check it.

type Tool

type Tool struct {
	Name         string `json:"name"`
	Source       string `json:"source"`
	SourceDigest string `json:"sourceDigest"`
	Release      string `json:"release"`
}

Tool is one reference bridge: the pilot release it was built against, and the digest of the in-repository source it was compiled from.

func Bridges

func Bridges(root, release string) ([]Tool, error)

Bridges identifies the reference validators by the digest of the source they are compiled from and by the pilot release the caller resolved them at.

Jump to

Keyboard shortcuts

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