adr

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package adr parses ADR files under docs/decisions, renders the INDEX.md decision index, and scaffolds new ADR files from the rendered template (awf new adr). Generated by awf render (regenerates docs/decisions/INDEX.md).

Index

Constants

View Source
const (
	V1FormatMarker = "current-state-v1"
	V2FormatMarker = "current-state-v2"
	V3FormatMarker = "current-state-v3"
	V4FormatMarker = "current-state-v4"
)

Format markers are the exact governed `format:` frontmatter values.

Variables

View Source
var ErrDecisionSelectorAmendable = errors.New("amendable Decision content")

ErrDecisionSelectorAmendable reports an ordinal selector against amendable pre-V4 Decision content.

View Source
var ErrDecisionSelectorIncompatible = errors.New("incompatible Decision selector")

ErrDecisionSelectorIncompatible reports a selector that cannot address the target ADR format.

View Source
var ErrDecisionSelectorUnknown = errors.New("unknown Decision selector")

ErrDecisionSelectorUnknown reports a compatible selector absent from a record.

View Source
var FilenameRe = regexp.MustCompile(`^(\d{4})-.+\.md$`)

FilenameRe matches an ADR filename (NNNN-slug.md); group 1 is the 4-digit number.

Functions

func ContentDigest added in v0.22.0

func ContentDigest(sections map[string]string) string

ContentDigest computes the current-state-v1 content-sha256 over the five canonical sections in fixed order, excluding frontmatter and Status history. Each section is serialized as its heading line followed by its body with trailing whitespace stripped, so cosmetic trailing-blank-line noise does not change the digest while any substantive edit does. Each stamped history event records this value as of its own append; the latest stamp must always match it, and a terminal status freezes it permanently (ADR-0188). awf both computes and re-verifies it, so this canonical form is the single source of truth.

func CurrentFormatMarker added in v0.30.0

func CurrentFormatMarker() string

CurrentFormatMarker returns the exact marker newly authored ADRs use.

func ErrNotADRRecord added in v0.30.0

func ErrNotADRRecord(name string) error

ErrNotADRRecord names a decisions-directory file that is neither a numbered record nor a pending current-state-v3 record. Such a file used to be silently ignored; ADR-0202 item 4 makes it a corpus error.

func FileIdentity added in v0.30.0

func FileIdentity(base string) string

FileIdentity returns the identity a decisions-directory basename declares: the four-digit number of a numbered record, the slug of a pending record, or the empty string for a reserved or non-Markdown file. Callers classifying a path as a decision record ask this rather than matching the filename grammar themselves, so the pending form is recognized everywhere it is legal.

func FormatMarker added in v0.30.0

func FormatMarker(format Format) string

FormatMarker returns the governed `format:` frontmatter value for format, or the empty string for Legacy.

func FrozenContentEqual added in v0.22.0

func FrozenContentEqual(before, after ADR) bool

FrozenContentEqual reports whether a pair preserves canonical ADR content. A V1 record is editable only while Proposed; a V2 record is editable until it reaches a terminal status. Past its freeze point a record's five content-sha256 sections are locked at their before-state digest (ADR-0188).

func HistoriesEqual added in v0.30.0

func HistoriesEqual(before, after ADR) bool

HistoriesEqual reports whether a pair's Status history is byte-identical. The numbering transition takes this rather than either append-tolerant variant: numbering touches no history event, so the pair's history must not move at all (ADR-0202 item 9).

func HistoryTransitionValid added in v0.22.0

func HistoryTransitionValid(before, after ADR) bool

HistoryTransitionValid reports whether the before history survives as an exact prefix of the after history and the appended events form a legal ordered lifecycle. Parsing owns complete digest, operation, progress, and terminal validation; this pair helper replays the event kinds and status edges so its direct unit fixtures preserve the same lifecycle boundary.

func IdentityOrder added in v0.30.0

func IdentityOrder(id string) int

IdentityOrder returns the provenance sort rank of an identity reference. A stable sort over it leaves pending identities in their authored order after every numbered one.

func IsReservedBasename added in v0.30.0

func IsReservedBasename(name string) bool

IsReservedBasename reports whether a decisions-directory basename is one of the three reserved non-record files. Every corpus walk excludes exactly these and treats what remains as a record, so the exclusion set has one home.

func IsSlugIdentity added in v0.30.0

func IsSlugIdentity(ref string) bool

IsSlugIdentity reports whether an identity reference is the pending slug form rather than the four-digit number form.

func KnownFormatMarker added in v0.30.0

func KnownFormatMarker(marker string) bool

KnownFormatMarker reports whether marker names one registered governed ADR format.

func NewFile added in v0.6.0

func NewFile(dir, title string) (string, error)

NewFile scaffolds a new numbered ADR under dir in the current registered format. It allocates the next sequential number, fills the rendered template's date and heading, strips marker comments, and refuses to overwrite its path.

func NewPendingFile added in v0.30.0

func NewPendingFile(dir, title string) (string, error)

NewPendingFile scaffolds a slug-identified pending ADR under dir: `<slug>.md` with heading `# ADR-<slug>:` and no number. A pending record always uses the registry's current authoring format, so the format is not the caller's to choose. Numbering at integration turns it into the numbered form.

func RenderIndexMD added in v0.22.0

func RenderIndexMD(corpus Corpus) string

RenderIndexMD renders the decisions/INDEX.md index for corpus (ADR-0135 item 8). It replaces the status-partitioned ACTIVE.md with two sections: "In flight" lists the Proposed and Accepted ADRs whose adoption is still under way, and "History" is a compact roll of the terminal Implemented and Abandoned decisions kept only as rationale. Both sections always render, with a placeholder line when empty, so the content is never blank and its document-map link resolves out of the box. The content carries no generated-by banner - that is the caller's job (internal/project's generateIndexMD, via injectBanner).

func RenumberPending added in v0.30.0

func RenumberPending(dir, slug string, number int) error

RenumberPending renames the pending record `<slug>.md` under dir to `NNNN-<slug>.md` and rewrites its `# ADR-<slug>:` heading to `# ADR-NNNN:`. Nothing else moves: the retained `slug:` frontmatter key, every body byte, and every Status history event survive verbatim, which is what makes numbering digest-safe and history-free (ADR-0202 item 9).

It is the rewrite seam the numbering command performs its rename through, and the only reader and writer of a decision record's path outside this package's corpus construction seams. Keeping it here is what lets the command live in internal/project without joining the enumerated raw-bytes accessors (adr-system/adr-lifecycle:corpus-raw-access-enumerated).

func TransitionLegal added in v0.22.0

func TransitionLegal(from, to string, format ...Format) bool

TransitionLegal reports whether from -> to is legal for the selected format. Omitting format preserves the V1 behavior used by existing callers.

Types

type ADR

type ADR struct {
	Number   string            // e.g. "0001"
	Title    string            // e.g. "ADR-0001: Template Overlay Rendering Engine"
	Status   string            // e.g. "Accepted"
	Date     string            // frontmatter date, retained verbatim as YYYY-MM-DD text
	Filename string            // e.g. "0001-template-overlay-rendering-engine.md"
	Path     string            // path as globbed
	Domains  []string          // `domains:` frontmatter (ADR-0014)
	Tags     []string          // `tags:` frontmatter (keyword labels)
	Related  []int             // `related:` frontmatter (ADR numbers)
	Sections map[string]string // `## ` heading -> non-fenced section body

	// Governed fields are populated only for a record carrying a recognized
	// intrinsic format marker. A legacy-format record leaves them zero.
	Format     Format         // Legacy, CurrentStateV1, CurrentStateV2, or CurrentStateV3
	NoneState  bool           // State changes section is exactly "None."
	Operations []Operation    // parsed `## State changes` operations
	History    []HistoryEvent // parsed `## Status history` events
	// Slug is the mandatory retained `slug:` frontmatter key of a V3 record. It
	// is the identity of a pending record (Number is empty until numbering) and
	// survives numbering so an `ADR-<slug>` reference stays resolvable
	// (ADR-0202 items 2 and 3). Pre-V3 records carry none.
	Slug string
	// contains filtered or unexported fields
}

ADR is a parsed ADR record.

func ParseBytes added in v0.18.0

func ParseBytes(name string, data []byte) (ADR, bool, error)

ParseBytes parses one ADR from bytes: status and the other frontmatter fields, plus the title from the first `# ` heading. It is the seam the git-blob consumers take (ADR-0130 item 5): internal/audit reads history rather than the working tree, so it cannot take a Corpus, but it can share the parser and the frontmatter schema, which is where the duplication actually was.

found reports whether frontmatter was present at all, which is the tri-state the audit needs: absent frontmatter is a legitimate empty status, while present-but-unparseable is an error. name is the ADR's base filename, from which Filename and Number are derived; Path is left empty, since a blob-sourced record has no working-tree path.

func ParseDir

func ParseDir(dir string) ([]ADR, error)

ParseDir scans dir for ADR records and parses each into an ADR. Every non-reserved `*.md` file is a record: a numbered `NNNN-*.md` file or a pending `<slug>.md` file declaring the current format. Anything else is an error rather than a silent skip.

func ParseRecord added in v0.22.0

func ParseRecord(name string, data []byte) (ADR, error)

ParseRecord routes an ADR by its authored format marker. Marker absence is the sole legacy route; invalid frontmatter and every nonempty unregistered marker are refusals rather than legacy fallbacks.

func ParseV1 added in v0.22.0

func ParseV1(name string, data []byte) (ADR, error)

ParseV1 parses and validates one current-state-v1 ADR. name is the base filename (Number is derived from it); Title comes from the first `# ` heading. It enforces the exact frontmatter, status enum, section order, sequential Decision items, State-changes and Status-history grammar, and the per-ADR lifecycle and digest rules. Cross-ADR facts (sequence contiguity, ID reuse, claim provenance) are validated at the corpus level.

func ParseV2 added in v0.22.0

func ParseV2(name string, data []byte) (ADR, error)

ParseV2 parses and validates one current-state-v2 ADR.

func ParseV3 added in v0.30.0

func ParseV3(name string, data []byte) (ADR, error)

ParseV3 parses and validates one current-state-v3 ADR in either identity form: numbered `NNNN-<slug>.md` with a `# ADR-NNNN: <Title>` heading, or pending `<slug>.md` with a `# ADR-<slug>: <Title>` heading. The record's body rules, history grammar, and digest coverage are V2's exactly; what V3 adds is the mandatory `slug:` key and its agreement with the filename and the heading (ADR-0202 items 1 to 3).

func ParseV4 added in v0.30.0

func ParseV4(name string, data []byte) (ADR, error)

ParseV4 parses a V4 ADR with V3 identity and V2 lifecycle semantics plus stable Decision slugs.

func (ADR) ApplicationBatches added in v0.22.0

func (a ADR) ApplicationBatches() ([]ApplicationBatch, error)

ApplicationBatches projects the application records owned by a governed ADR.

func (ADR) Bucket added in v0.18.0

func (a ADR) Bucket() string

Bucket returns the legacy status group for an ADR. Every superseded ADR folds into one group regardless of the successor its status names.

func (ADR) CanonicalDigest added in v0.30.0

func (a ADR) CanonicalDigest() string

CanonicalDigest answers this record's content-sha256 from its own parsed sections, so a caller outside this package never reads them itself. The value is computed rather than taken from the latest stamped history event: a stamp can sit on an Amended event in the middle of a history whose trailing Applied events carry none, and a record whose latest stamp disagrees with the computed value does not parse, so the two never differ for a record that exists.

The frontmatter and the `# ADR-NNNN:` heading are outside every covered section, which is what leaves this value fixed across a renumber and makes it the key a transition pairs a slugless record on.

func (ADR) DecisionBounds added in v0.30.0

func (a ADR) DecisionBounds() (start, end int, ok bool)

DecisionBounds returns the exact Decision section byte bounds for the three historical migrations that perform surgical source rewrites. General corpus consumers must use semantic queries instead of raw ADR bytes.

func (ADR) DecisionItems added in v0.18.0

func (a ADR) DecisionItems() []int

DecisionItems returns the numbers of the column-0 numbered items of the Decision section, in order of appearance.

func (ADR) DecisionSelectors added in v0.30.0

func (a ADR) DecisionSelectors() []string

DecisionSelectors returns the stable selectors supported by this ADR in sorted order.

func (ADR) Decisions added in v0.30.0

func (a ADR) Decisions() []Decision

Decisions returns every Decision item addressable by this ADR in source order. Amendable pre-V4 records have no stable item identity and therefore return none.

func (ADR) DeclaredSlugs added in v0.18.0

func (a ADR) DeclaredSlugs() []string

DeclaredSlugs returns the invariant slugs a's Invariants section declares, backed and unbacked alike, in declaration order.

func (ADR) HasSameStatus added in v0.18.0

func (a ADR) HasSameStatus(other ADR) bool

HasSameStatus reports exact status equality without exporting literal comparisons to migration consumers.

func (ADR) HasStatus added in v0.18.0

func (a ADR) HasStatus() bool

HasStatus reports whether the record carries a frontmatter status at all. The audit distinguishes an ADR with no status from one with a real status, and that tri-state is what the bytes seam carries (ADR-0130 item 3).

func (ADR) HasV2Semantics added in v0.30.0

func (a ADR) HasV2Semantics() bool

HasV2Semantics reports whether the record uses the V2 heterogeneous history, amendability, and digest rules. V3 inherits them unchanged, so every rule keyed on "V2 or later" asks this rather than enumerating formats.

func (ADR) Identity added in v0.30.0

func (a ADR) Identity() string

Identity returns the record's single identity key: the four-digit number for a numbered record, and the retained slug for a pending V3 record that has not been numbered yet (ADR-0202 item 4).

func (ADR) InvariantDecls added in v0.18.0

func (a ADR) InvariantDecls() []InvariantDecl

InvariantDecls returns the declarations a's Invariants section carries, in declaration order. Status-independent: the ref-validity check and the retirement migration resolve slug anchors against any ADR's declarations, not just Implemented ones (ADR-0120 item 2).

func (ADR) IsAbandoned added in v0.22.0

func (a ADR) IsAbandoned() bool

IsAbandoned reports the current-state-v1 terminal Abandoned state.

func (ADR) IsAccepted added in v0.22.0

func (a ADR) IsAccepted() bool

IsAccepted reports the current-state-v1 Accepted state: the decision is normative only for executing its pending State changes, which never override the topic claims describing current reality (ADR-0135).

func (ADR) IsContentAmendable added in v0.30.0

func (a ADR) IsContentAmendable() bool

IsContentAmendable reports whether the record's digest-covered content may still be amended. A current-state-v2 body stays amendable through Proposed, Accepted, and Implementing and freezes permanently at a terminal status (ADR-0188); every other format keeps the older rule of freezing the moment it leaves Proposed. Callers that report or gate on mutability read this rather than testing the status themselves, so the two formats' rules stay in one place as the lifecycle grows.

func (ADR) IsGoverned added in v0.22.0

func (a ADR) IsGoverned() bool

IsGoverned reports whether the record uses any current-state format.

func (ADR) IsImplemented added in v0.18.0

func (a ADR) IsImplemented() bool

IsImplemented reports whether the ADR's decisions have shipped. Invariant backing and token retirement are both gated on this.

func (ADR) IsImplementing added in v0.22.0

func (a ADR) IsImplementing() bool

IsImplementing reports whether a V2 decision has applied only part of its declared operations.

func (ADR) IsInflight added in v0.18.0

func (a ADR) IsInflight() bool

IsInflight reports a decision still under review or implementation.

func (ADR) IsLegacyShipped added in v0.18.0

func (a ADR) IsLegacyShipped() bool

IsLegacyShipped reports whether a legacy decision shipped, including the historical Superseded state. Migration inventory uses this broader predicate; normal legacy authority continues to use its existing predicates.

func (ADR) IsLive added in v0.18.0

func (a ADR) IsLive() bool

IsLive reports whether the ADR's decisions are current guidance.

func (ADR) IsPending added in v0.30.0

func (a ADR) IsPending() bool

IsPending reports whether the record is a V3 record awaiting its number at integration: slug identity, no number.

func (ADR) IsProposed added in v0.18.0

func (a ADR) IsProposed() bool

IsProposed reports the Proposed state, the one status whose body amends with no history event in either format. It is not the amendability test: since ADR-0188 a V2 body stays amendable past Proposed, so use IsContentAmendable for that question.

func (ADR) IsSuperseded added in v0.18.0

func (a ADR) IsSuperseded() bool

IsSuperseded reports whether the ADR has been retired. The prefix test tolerates the pre-generation-12 suffixed form as well as the bare status ADR-0128 item 4 moves to.

func (ADR) IsV1 added in v0.22.0

func (a ADR) IsV1() bool

IsV1 reports whether the record was parsed as current-state-v1.

func (ADR) IsV2 added in v0.22.0

func (a ADR) IsV2() bool

IsV2 reports whether the record was parsed as current-state-v2.

func (ADR) IsV3 added in v0.30.0

func (a ADR) IsV3() bool

IsV3 reports whether the record was parsed as current-state-v3.

func (ADR) IsV4 added in v0.30.0

func (a ADR) IsV4() bool

IsV4 reports whether the record was parsed as current-state-v4.

func (ADR) LookupDecision added in v0.30.0

func (a ADR) LookupDecision(selector string) (Decision, error)

LookupDecision resolves one compatible selector and preserves its exact Markdown.

func (ADR) OperationProgress added in v0.22.0

func (a ADR) OperationProgress() (OperationProgress, error)

OperationProgress projects declared operations into applied, remaining, and canceled partitions without inferring removal from claim absence.

func (ADR) ReachedAccepted added in v0.22.0

func (a ADR) ReachedAccepted() bool

ReachedAccepted reports whether the ADR's history entered Accepted, including a later transition to a terminal state.

type ApplicationBatch added in v0.22.0

type ApplicationBatch struct {
	Operations   []Operation
	Kind         HistoryEventKind
	HistoryIndex int
	Implicit     bool
}

ApplicationBatch is one implicit or explicit application of declared state operations. Operations retain their authored event order.

type AppliedOperation added in v0.22.0

type AppliedOperation struct {
	Operation  Operation
	BatchIndex int
}

AppliedOperation is one applied declaration and the index of its batch in the owning ADR's history; per-claim cross-ADR order is ascending ADR number (ADR-0191), never derived from batch positions.

type ClaimOperationHistory added in v0.22.0

type ClaimOperationHistory struct {
	Origin         *OperationRecord
	LegacyBaseline bool
	RevisedBy      []OperationRecord
	RemovedBy      *OperationRecord
}

ClaimOperationHistory is the implemented add/update/remove history for one qualified claim identity. LegacyBaseline is true when a retained removal has no recorded add, so the history has an unrecorded pre-operation baseline.

type Corpus added in v0.18.0

type Corpus struct {
	// contains filtered or unexported fields
}

Corpus is the parsed decisions directory: one parse, threaded to every consumer that needs an ADR fact (ADR-0130 item 1). It answers questions rather than exposing fields for a caller to re-derive an answer from (item 2), which is what collapsed the three-way "is live" and the twice-built supersession relation into one place.

The zero value is not useful; construct with NewCorpus.

func LoadCorpus added in v0.18.0

func LoadCorpus(dir string) (Corpus, error)

LoadCorpus parses a decisions directory into the view. It is the single construction seam: adr.ParseDir has no production caller outside this package, so every consumer - the *Project that threads the view to the checks, and the schema migrations, which run before a Project can be opened and so cannot be handed one - enters through here.

func NewCorpus added in v0.18.0

func NewCorpus(adrs []ADR) (Corpus, error)

NewCorpus builds the view over an already-parsed slice, indexing both identity keys: the four-digit number of a numbered record and the retained slug of every slug-carrying record, pending or numbered (ADR-0202 item 3).

A duplicate in either index is a *DuplicateIdentityError. The returned Corpus is still populated, last-wins, so the numbering command can read the pending set out of a colliding corpus to build its refusal; every other caller treats the error as fatal.

func (Corpus) All added in v0.18.0

func (c Corpus) All() []ADR

All returns every parsed ADR in directory order.

func (Corpus) ByIdentity added in v0.30.0

func (c Corpus) ByIdentity(id string) (ADR, bool)

ByIdentity returns the record whose identity key equals id: a four-digit number resolves against the numbered index, anything else against the slug index (ADR-0202 item 4).

func (Corpus) ByNumber added in v0.18.0

func (c Corpus) ByNumber(num string) (ADR, bool)

ByNumber returns the ADR with the given four-digit number.

func (Corpus) BySlug added in v0.30.0

func (c Corpus) BySlug(slug string) (ADR, bool)

BySlug returns the record carrying the given retained slug, pending or numbered.

func (Corpus) ClaimOperationHistory added in v0.22.0

func (c Corpus) ClaimOperationHistory(claimID string) (ClaimOperationHistory, bool)

ClaimOperationHistory returns applied operation history for claimID in ascending ADR-number order. Remaining and canceled operations are excluded, and every returned slice is fresh.

func (Corpus) Has added in v0.18.0

func (c Corpus) Has(num string) bool

Has reports whether the corpus contains an ADR with the given number.

func (Corpus) NextIdentity added in v0.22.0

func (c Corpus) NextIdentity() (int, error)

NextIdentity returns one more than the highest ADR identity, or 1 for an empty corpus. Migration code uses this semantic query rather than adding a raw decisions-directory reader.

func (Corpus) OperationProgress added in v0.22.0

func (c Corpus) OperationProgress(identity string) (OperationProgress, bool, error)

OperationProgress returns the operation partition for one ADR identity. Missing and invalid-present records are deliberately distinct.

func (Corpus) Raw added in v0.18.0

func (c Corpus) Raw(num string) ([]byte, error)

Raw returns the ADR file's bytes. Raw access is enumerated and closed (ADR-0130 item 6): the retirement-token offset surgery, the retired-key frontmatter scan, and the ADR-0191 state-sequence retrofit are the only three legitimate consumers below the semantic layer. A fourth caller means the view is missing a question.

type Decision added in v0.30.0

type Decision struct {
	Key         string
	ADRIdentity string
	Title       string
	Status      string
	Markdown    string
}

Decision is one resolved ADR Decision item. Markdown retains its exact source.

type DecisionSelectorError added in v0.30.0

type DecisionSelectorError struct {
	Selector  string
	Available []string
	// contains filtered or unexported fields
}

DecisionSelectorError describes a typed Decision lookup failure. Available is sorted and contains every selector currently supported by the ADR.

func (*DecisionSelectorError) Error added in v0.30.0

func (e *DecisionSelectorError) Error() string

func (*DecisionSelectorError) Unwrap added in v0.30.0

func (e *DecisionSelectorError) Unwrap() error

type DuplicateIdentityError added in v0.30.0

type DuplicateIdentityError struct {
	Numbers []string
	Slugs   []string
}

DuplicateIdentityError reports corpus identity keys declared by more than one file. It is typed because exactly one consumer needs the detail rather than the message: the numbering command refuses on a duplicate-number corpus and hints the reset-remake recipe (ADR-0202 item 12). Every other consumer treats it as fatal.

func (*DuplicateIdentityError) Error added in v0.30.0

func (e *DuplicateIdentityError) Error() string

type Format added in v0.22.0

type Format int

Format distinguishes legacy, current-state-v1, and current-state-v2 ADRs.

const (
	// Legacy is a pre-cutover ADR: identity, status, and date only.
	Legacy Format = iota
	// CurrentStateV1 is a `format: current-state-v1` ADR with State changes and
	// status-only history.
	CurrentStateV1
	// CurrentStateV2 is a `format: current-state-v2` ADR with heterogeneous
	// status and application history.
	CurrentStateV2
	// CurrentStateV3 is a `format: current-state-v3` ADR: V2 semantics exactly,
	// plus the mandatory retained slug identity and the pending record form
	// (ADR-0202 item 1).
	CurrentStateV3
	// CurrentStateV4 adds stable Decision item slugs while retaining V3 identity
	// and V2 lifecycle semantics.
	CurrentStateV4
)

func CurrentFormat added in v0.30.0

func CurrentFormat() Format

CurrentFormat returns the format newly authored ADRs use.

func FormatAtGeneration added in v0.30.0

func FormatAtGeneration(generation int) (Format, bool)

FormatAtGeneration returns the format active at generation. It reports false before the first governed format activation.

type HistoryEvent added in v0.22.0

type HistoryEvent struct {
	Kind           HistoryEventKind
	Date           string
	Status         string
	Digest         string
	LegacySequence bool
	Rationale      string
	Operations     []Operation
}

HistoryEvent is one parsed `## Status history` line. LegacySequence records that a retired state-sequence segment was tolerated and discarded, so the check layer can direct the project to awf upgrade (ADR-0191).

type HistoryEventKind added in v0.22.0

type HistoryEventKind uint8

HistoryEventKind distinguishes lifecycle events from operation-application events in current-state-v2 Status history.

const (
	HistoryStatus HistoryEventKind = iota + 1
	HistoryApplied
	HistoryReapplied
	HistoryAmended
)

type InvariantDecl added in v0.18.0

type InvariantDecl struct {
	Slug     string
	Unbacked bool
	Bullet   string
}

InvariantDecl is one invariant declaration in an ADR's Invariants section. The grammar lives here rather than in internal/invariants because ADR-0130 item 2 makes declared slugs a question the corpus view answers, and corpus-owns-field-reads forbids any other package reading ADR.Sections to re-derive it. Bullet carries the whole declaration - lead line plus wrapped continuation lines - so a consumer can scan it for the `Verify:` note without a second pass over the section.

type OpVerb added in v0.22.0

type OpVerb string

OpVerb is a current-state-v1 State-changes verb.

const (
	// OpAdd introduces a new claim.
	OpAdd OpVerb = "add"
	// OpUpdate revises an existing claim.
	OpUpdate OpVerb = "update"
	// OpRemove retires an existing claim.
	OpRemove OpVerb = "remove"
)

type Operation added in v0.22.0

type Operation struct {
	Verb OpVerb
	ID   string // qualified claim ID
	Slug string // local slug component of ID
}

Operation is one parsed `## State changes` entry: a verb over a qualified claim ID `<domain>/<topic>:<local-slug>` (ADR-0135 item 3).

type OperationProgress added in v0.22.0

type OperationProgress struct {
	Applied   []AppliedOperation
	Remaining []Operation
	Canceled  []Operation
}

OperationProgress partitions an ADR's declarations by application state.

type OperationRecord added in v0.22.0

type OperationRecord struct {
	Identity string
	Title    string
	Status   Status
}

OperationRecord is the ADR identity for one claim operation: the number for a numbered record and the slug for a pending one. Ascending ADR number is the per-claim provenance order (ADR-0191), with pending records after every number (ADR-0202 item 10).

type Status added in v0.22.0

type Status = string

Status is an ADR lifecycle status as presented by semantic corpus queries.

type StatusEntry added in v0.22.0

type StatusEntry = HistoryEvent

StatusEntry preserves the source-compatible V1 name while ADR.History uses the common event representation.

Jump to

Keyboard shortcuts

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