upgrade

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: 16 Imported by: 0

Documentation

Overview

Package upgrade runs the permanent final current-state upgrade: it verifies only the sealed facts of a bridge attestation and applies the cutover output plan through a recoverable journal. It ships no legacy inventory, approval parser, or cross-schema adapter; the sealed attestation is the sole trust anchor for the legacy adjudication the current-state binary can no longer recompute.

Index

Constants

View Source
const JournalVersion = 1

JournalVersion is the only accepted current-state upgrade journal schema.

Variables

This section is empty.

Functions

func FinalUpgrade

func FinalUpgrade(root string, lock *manifest.Lock, log io.Writer) error

FinalUpgrade consumes a sealed bridge attestation. It verifies only the sealed facts, then journals the cutover output plan: the single deletion of the migration approval file and the lock replacement last, which drops the consumed attestation and promotes the sealed cutoff/gaps into permanent lock fields. The lock replacement is the transaction commit point; a pre-commit failure rolls back, a post-commit failure leaves a recoverable journal.

func JournalPath

func JournalPath(root string) string

JournalPath returns the fixed journal path under root.

func JournalPresent

func JournalPresent(root string) bool

JournalPresent reports whether a journal file exists under root.

func LockRel

func LockRel() string

LockRel is the repo-relative lock path every journal ends on.

func Recover

func Recover(root string, log io.Writer) error

Recover applies the journal recovery decision table. It is the only project mode permitted while a journal exists.

func Verify

func Verify(root string, att *manifest.BridgeAttestation) error

Verify checks only the sealed facts of att: its version, that current HEAD equals the sealed PreparedHead, and that the recomputed tree digest equals the sealed TreeDigest. It reads the tree read-only. The sealed legacy adjudication is trusted through this unchanged seal alone, because the current-state binary ships no inventory, approval parser, or cross-schema adapter to recompute it.

Types

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 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

func LoadJournal(root string) (Journal, error)

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.

func ParseJournal

func ParseJournal(b []byte) (Journal, error)

ParseJournal validates a journal captured from an immutable snapshot. It is the staged-check counterpart of LoadJournal, sharing the exact journal contract without materializing index bytes into the working tree.

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.

Jump to

Keyboard shortcuts

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