Documentation
¶
Overview ¶
Package bridge implements the migration-only current-state readiness adapter.
Index ¶
- Constants
- func CommitTransaction(root string, ops []Operation, log io.Writer) error
- func CutoffFacts(root string) (int, []int, error)
- func Digest(root string, mutations []Mutation) (string, error)
- func JournalPath(root string) string
- func JournalPresent(root string) bool
- func LockRel() string
- func Recover(root string, log io.Writer) error
- func ValidateLegacySnapshot(root string, preparedCorpus adr.Corpus, prepared Inventory, mappings []Mapping, ...) error
- type Adjudication
- type Approval
- type Approvals
- type Finding
- type Image
- type InvariantKey
- type Inventory
- type Journal
- type LegacyInvariant
- type Mapping
- type MigrationHistoryEntry
- type Mutation
- type Operation
- type Report
- type Retirement
Constants ¶
const ApprovalPath = ".awf/current-state-migration.yaml"
const JournalVersion = 1
JournalVersion is the only accepted current-state upgrade journal schema.
Variables ¶
This section is empty.
Functions ¶
func CommitTransaction ¶
CommitTransaction journals ops, makes the journal durable, applies every non-lock replacement, writes the lock last, marks the journal lock-committed, and deletes it. A failure before the lock is written rolls back to the prior images and clears the journal; a failure after leaves the attested lock plus a recoverable journal. It prints one deterministic operation line per applied path.
func CutoffFacts ¶
CutoffFacts returns the ADR-format-v1 cutoff (the highest ADR number plus one) and the sorted absent lower ADR numbers for the corpus under root. Migration normalization never changes an ADR number, so these facts are identical over the legacy HEAD and the prepared tree.
func Digest ¶
Digest computes the stable current-state attestation tree digest over the post-normalization prepared inputs. The universe is exactly the config file, every domain sidecar, every topic input, every ADR, every file matched by the prepared config's marker source globs, and the required migration approval file; no other path enters it. For each universe path the image is the planned mutation's after-image when a normalization mutation targets it, otherwise the current on-disk bytes and permission mode. Terminal output writes and legacy deletions never touch a universe path, so the merged mutation set yields the post-normalization image for every member. Digest is byte-for-byte read-only.
func JournalPath ¶
JournalPath returns the fixed journal path under root.
func JournalPresent ¶
JournalPresent reports whether a journal file exists under root.
func Recover ¶
Recover applies the journal recovery decision table. It is the only project mode permitted while a journal exists.
func ValidateLegacySnapshot ¶
func ValidateLegacySnapshot(root string, preparedCorpus adr.Corpus, prepared Inventory, mappings []Mapping, mutations []Mutation) error
ValidateLegacySnapshot closes the migration-only legacy fact set against HEAD. Authored migration history may change disposition, but declarations, backing classes, carriers, markers, cutoff facts, and identities may not drift.
Types ¶
type Adjudication ¶
type Approvals ¶
func LoadApprovals ¶
type Image ¶
type Image struct {
Present bool `json:"present"`
Mode uint32 `json:"mode"`
Content []byte `json:"content"`
}
Image is one file's exact recorded state: present with an octal permission mode and content, or absent (present:false, mode 0, empty content).
type InvariantKey ¶
type InvariantKey string
type Inventory ¶
type Inventory struct{ Entries []LegacyInvariant }
type Journal ¶
type Journal struct {
Version int `json:"version"`
Phase string `json:"phase"`
FinalLockSHA256 string `json:"finalLockSHA256"`
Operations []Operation `json:"operations"`
}
Journal is the durable transaction record. Version is always 1; Operations are unique, sorted, and end with the lock operation; FinalLockSHA256 is the SHA-256 of the sealed lock content the transaction commits.
func LoadJournal ¶
LoadJournal reads and validates the journal under root. A malformed or contract-violating journal is a hard error naming the Git-restoration escape, so no caller mutates the tree on a journal it cannot trust.
type LegacyInvariant ¶
type LegacyInvariant struct {
Key InvariantKey `json:"-"`
Declarer, Slug string
DeclarerPath string
Backing string
Carrier, CarrierPath string
CarrierDecisionItem int
Active bool
History *MigrationHistoryEntry
}
type Mapping ¶
func ApplyApprovals ¶
type MigrationHistoryEntry ¶
func ParseMigrationHistory ¶
func ParseMigrationHistory(data []byte, adrNumber string, effective map[string]Retirement) ([]MigrationHistoryEntry, error)
ParseMigrationHistory accepts one optional exact section outside Markdown fences.
type Mutation ¶
type Mutation struct {
Path string `json:"path"`
BeforePresent bool `json:"beforePresent"`
BeforeMode uint32 `json:"beforeMode"`
BeforeSHA256 string `json:"beforeSHA256"`
AfterPresent bool `json:"afterPresent"`
AfterMode uint32 `json:"afterMode"`
AfterSHA256 string `json:"afterSHA256"`
Before, After []byte `json:"-"`
}
type Operation ¶
type Operation struct {
Path string `json:"path"`
Prior Image `json:"prior"`
Replacement Image `json:"replacement"`
}
Operation records one path's prior and replacement images. The final journal operation is always the lock replacement.
func OperationsFromMutations ¶
func OperationsFromMutations(root string, mutations []Mutation, lockPrior, lockFinal Image) ([]Operation, error)
OperationsFromMutations converts sorted mutations plus the sealed lock image into journal operations with the lock operation last. It reads each path's current image as the prior so recovery can restore it exactly.
type Report ¶
type Report struct {
Ready bool
Findings []Finding
InvariantAdjudications []Adjudication
PlannedMutations []Mutation
}