manifest

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package manifest reads and writes the .awf/awf.lock and detects drift between rendered output and its sources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(b []byte) string

func WriteFileAtomic added in v0.11.0

func WriteFileAtomic(path string, data []byte) error

WriteFileAtomic writes data to path via a same-directory temp file renamed into place, so a crash can never leave a truncated file at path. Mode is 0o644 (CreateTemp's 0o600 is widened before the rename). On error the temp file is best-effort removed. Rename-only durability - no fsync - per ADR-0076 Decision 1; Go's os.Rename replaces an existing destination on every supported OS including Windows. touches-invariant: lock-atomic-save - atomic temp-file+rename write site; proof in manifest_test.go

Types

type BridgeAttestation added in v0.18.0

type BridgeAttestation struct {
	Version         int    `json:"version"`
	PreparedHead    string `json:"preparedHead"`
	TreeDigest      string `json:"treeDigest"`
	ADRFormatV1From int    `json:"adrFormatV1From"`
	LegacyADRGaps   []int  `json:"legacyADRGaps"`
}

BridgeAttestation records the sealed identity of a current-state upgrade attestation: the format Version, the clean PreparedHead commit it was computed against, the TreeDigest over the post-normalization prepared inputs, the ADRFormatV1From cutoff (highest ADR number plus one), and the sorted absent lower ADR numbers in LegacyADRGaps.

type Drift

type Drift struct{ Path, Kind, Detail string }

type Entry

type Entry struct {
	TemplateID   string `json:"templateId"`
	TemplateHash string `json:"templateHash"`
	ConfigHash   string `json:"configHash"`
	OutputHash   string `json:"outputHash"`
	// RegenChecked marks an entry whose drift is checked by regeneration rather
	// than by the frozen OutputHash - the generated indexes (ACTIVE.md, per-domain
	// docs, the config reference) and in-place-editable files (ADR-0100). Omitted
	// when false so a plain entry's serialization is unchanged.
	RegenChecked bool `json:"regenChecked,omitempty"`
}

type Lock

type Lock struct {
	AWFVersion    string           `json:"awfVersion"`
	SchemaVersion int              `json:"schemaVersion"`
	Files         map[string]Entry `json:"files"`
	// BridgeAttestation seals a completed current-state upgrade attestation. It
	// is optional (omitted when absent) so a lock written before the bridge
	// tranche parses unchanged with a nil pointer.
	BridgeAttestation *BridgeAttestation `json:"bridgeAttestation,omitempty"`
}

func Load

func Load(path string) (*Lock, error)

func LoadOptional added in v0.11.0

func LoadOptional(path string) (*Lock, bool, error)

LoadOptional is the corrupt-lock policy choke point (ADR-0076 Decision 2): a missing lock reports found=false with no error so callers keep their no-lock semantics; a present-but-unreadable lock is a hard error carrying the one recovery hint. invariant: corrupt-lock-refuses

func (*Lock) Marshal added in v0.18.0

func (l *Lock) Marshal() ([]byte, error)

Marshal returns the canonical lock serialization Save writes: indented JSON with a trailing newline. Attestation reuses it so the sealed lock bytes match what a subsequent Load/Save round-trips.

func (*Lock) Save

func (l *Lock) Save(path string) error

Jump to

Keyboard shortcuts

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