currentstate

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package currentstate validates parsed ADR application authority and topics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Severity Severity
	Message  string
}

func Check

func Check(records []adr.ADR, corpusTopics []topic.Topic) []Finding

Check validates application sequences, operation history, forward results, and inverse provenance. Parsed record formats identify the legacy bootstrap.

func CheckPair

func CheckPair(before, after Universe) []Finding

CheckPair validates the current-state transition from the before universe to the after universe (ADR-0135): every current-state-v1 ADR status change across the pair is a legal lifecycle edge, and the claim add/update/remove mutations between the two topic corpora correspond exactly to the operations of the ADRs that reached Implemented across the pair. An update must preserve the claim Origin, extend its Revised-by by exactly the updating ADR while keeping the prior list as an exact prefix, and change a canonical field that is neither provenance nor formatting; a claim mutation with no matching operation and an operation with no matching mutation are both rejected. It also runs the full after-state static Check, so a legal transition still lands in a valid state. Parsed record formats identify the closed migration bootstrap. Findings are returned sorted by message.

type Loaded

type Loaded struct {
	ADRs   []adr.ADR
	Topics topic.Corpus
}

Loaded is one immutable current-state view: the cutoff-aware ADR records and the topic corpus assembled from the same snapshot. A caller runs Check over the records and topics and EvaluateCoverage over the topic corpus, so both the static handshake and coverage read a single consistent universe.

func LoadFromTree

func LoadFromTree(tree *snapshot.Tree, cfg *config.Config, boundaries adr.FormatBoundaries, gaps []int) (Loaded, error)

LoadFromTree assembles the ADR and topic corpora from a single snapshot Tree, so a working-tree, index, or commit universe yields exactly the current-state view that tree encodes (ADR-0135). cfg supplies the docs directory, configured domains, and marker-source families; parse it from the same tree for a single-universe load. boundaries are the lock's ADR format cutoffs routing per-ADR legacy/V1/V2 parsing, and gaps are the recorded absent lower ADR numbers the contiguity check tolerates. It does not run Check or EvaluateCoverage; the command layer applies eligibility filters and routes findings.

func (Loaded) Universe

func (l Loaded) Universe() Universe

Universe reduces a Loaded view to the before/after inputs CheckPair compares.

type Severity

type Severity int
const (
	Error Severity = iota
	Warn
)

func (Severity) String

func (s Severity) String() string

type Universe

type Universe struct {
	ADRs   []adr.ADR
	Topics []topic.Topic
}

Universe is one parsed current-state view reduced to the two inputs the transition check compares: the cutoff-aware ADR records and the topic set. It is the loader-agnostic shape the working, index, and commit loaders each collapse to, mirroring Check's parsed-input contract so CheckPair reads a Git diff without knowing how either side was loaded. Loaded.Universe builds one.

Jump to

Keyboard shortcuts

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