migrationratchet

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 10 Imported by: 0

Documentation

Overview

Package migrationratchet compares immutable migration evidence snapshots. A passing receipt is an incremental no-regression result, not proof of behavioral adequacy or migration completeness.

Index

Constants

View Source
const (
	ProfileSchema  = "corvint-migration-evidence-ratchet/1"
	SnapshotSchema = "corvint-migration-evidence-snapshot/1"
	ReceiptSchema  = "corvint-migration-evidence-ratchet-receipt/1"
	MaxRecords     = 4096
	MaxBytes       = 4 << 20
)

Variables

This section is empty.

Functions

func DeltaDigest

func DeltaDigest(delta Delta) string

func Digest

func Digest(value any) string

func Encode

func Encode(value any) ([]byte, error)

func ExceptionDigest

func ExceptionDigest(exception Exception) string

func PolicyDigest

func PolicyDigest(policy Policy) string

func RecordDigest

func RecordDigest(record Record) string

func RuleDigest

func RuleDigest(rule ComparabilityRule) string

func SnapshotDigest

func SnapshotDigest(snapshot Snapshot) string

func StateDeltaDigest

func StateDeltaDigest(delta StateDelta) string

Types

type Binding

type Binding struct {
	Schema         string            `json:"schema"`
	Repository     RepositoryBinding `json:"repository"`
	PolicyID       string            `json:"policy_id"`
	PolicySHA256   string            `json:"policy_sha256"`
	Provider       ProviderBinding   `json:"provider"`
	ArtifactSHA256 string            `json:"artifact_sha256"`
}

type ComparabilityRule

type ComparabilityRule struct {
	ID                      string            `json:"id"`
	SHA256                  string            `json:"sha256"`
	BaselineArtifactSHA256  string            `json:"baseline_artifact_sha256"`
	CandidateArtifactSHA256 string            `json:"candidate_artifact_sha256"`
	Owner                   string            `json:"owner"`
	Reviewers               []string          `json:"reviewers"`
	Reason                  string            `json:"reason"`
	Allows                  []string          `json:"allows"`
	Mappings                []IdentityMapping `json:"mappings"`
	Selections              []RecordSelection `json:"selections"`
}

type Delta

type Delta struct {
	Kind        string   `json:"kind"`
	BaselineID  string   `json:"baseline_id,omitempty"`
	CandidateID string   `json:"candidate_id,omitempty"`
	Code        string   `json:"code"`
	Details     []string `json:"details,omitempty"`
	ExceptedBy  string   `json:"excepted_by,omitempty"`
}

type Denominator

type Denominator struct {
	Total      int            `json:"total"`
	Unresolved int            `json:"unresolved"`
	ByKind     map[string]int `json:"by_kind"`
	ByState    map[string]int `json:"by_state"`
}

type Exception

type Exception struct {
	ID        string         `json:"id"`
	SHA256    string         `json:"sha256"`
	Scope     ExceptionScope `json:"scope"`
	Owner     string         `json:"owner"`
	Reviewers []string       `json:"reviewers"`
	Reason    string         `json:"reason"`
	ExpiresOn string         `json:"expires_on"`
}

type ExceptionScope

type ExceptionScope struct {
	Delta       string `json:"delta"`
	Kind        string `json:"kind"`
	Identity    string `json:"identity"`
	DeltaSHA256 string `json:"delta_sha256"`
}

type IdentityDelta

type IdentityDelta struct {
	Kind        string   `json:"kind"`
	BaselineID  string   `json:"baseline_id,omitempty"`
	CandidateID string   `json:"candidate_id,omitempty"`
	Changes     []string `json:"changes"`
}

type IdentityMapping

type IdentityMapping struct {
	Kind        string `json:"kind"`
	BaselineID  string `json:"baseline_id"`
	CandidateID string `json:"candidate_id"`
}
type Link struct {
	Relation        string `json:"relation"`
	TargetKind      string `json:"target_kind"`
	TargetID        string `json:"target_id"`
	TargetSHA256    string `json:"target_sha256"`
	ReverseRelation string `json:"reverse_relation"`
}

type Policy

type Policy struct {
	ID                                  string      `json:"id"`
	SHA256                              string      `json:"sha256"`
	States                              []StateRule `json:"states"`
	ForbidNewLegacy                     bool        `json:"forbid_new_legacy"`
	RequireContractForNewOrChangedTests bool        `json:"require_contract_for_new_or_changed_tests"`
	TerminalStatesCannotRegress         bool        `json:"terminal_states_cannot_regress"`
	InvalidateEvidenceOnContentChange   bool        `json:"invalidate_evidence_on_content_change"`
	UnresolvedDenominatorCannotGrow     bool        `json:"unresolved_denominator_cannot_grow"`
}

type Profile

type Profile struct {
	Schema        string             `json:"schema"`
	EvaluatedOn   string             `json:"evaluated_on"`
	Baseline      Snapshot           `json:"baseline"`
	Candidate     Snapshot           `json:"candidate"`
	MigrationRule *ComparabilityRule `json:"migration_rule,omitempty"`
}

func Decode

func Decode(data []byte) (Profile, error)

type ProviderBinding

type ProviderBinding struct {
	ID     string `json:"id"`
	Schema string `json:"schema"`
	SHA256 string `json:"sha256"`
}

type Receipt

type Receipt struct {
	Schema               string          `json:"schema"`
	ProfileSHA256        string          `json:"profile_sha256"`
	EvaluatedOn          string          `json:"evaluated_on"`
	Baseline             Binding         `json:"baseline"`
	Candidate            Binding         `json:"candidate"`
	BaselineDenominator  Denominator     `json:"baseline_denominator"`
	CandidateDenominator Denominator     `json:"candidate_denominator"`
	Additions            []Delta         `json:"additions"`
	Removals             []Delta         `json:"removals"`
	ContentChanges       []Delta         `json:"content_changes"`
	StateChanges         []StateDelta    `json:"state_changes"`
	StaleEvidence        []Delta         `json:"stale_evidence"`
	BrokenReverseLinks   []Delta         `json:"broken_reverse_links"`
	Unknowns             []Delta         `json:"unknowns"`
	Identities           []IdentityDelta `json:"identities"`
	PolicyFailures       []string        `json:"policy_failures"`
	Verdict              string          `json:"verdict"`
	Limitations          []string        `json:"limitations"`
}

func Compare

func Compare(profile Profile) (Receipt, error)

type Record

type Record struct {
	Kind          string `json:"kind"`
	ID            string `json:"id"`
	SHA256        string `json:"sha256"`
	ContentSHA256 string `json:"content_sha256"`
	State         string `json:"state"`
	Links         []Link `json:"links"`
}

type RecordSelection

type RecordSelection struct {
	Side   string `json:"side"`
	Kind   string `json:"kind"`
	ID     string `json:"id"`
	SHA256 string `json:"sha256"`
}

type RepositoryBinding

type RepositoryBinding struct {
	ID       string `json:"id"`
	Revision string `json:"revision"`
	Tree     string `json:"tree"`
}

type Snapshot

type Snapshot struct {
	Schema         string            `json:"schema"`
	Repository     RepositoryBinding `json:"repository"`
	Policy         Policy            `json:"policy"`
	Provider       ProviderBinding   `json:"provider"`
	Complete       bool              `json:"complete"`
	Fresh          bool              `json:"fresh"`
	Records        []Record          `json:"records"`
	Exceptions     []Exception       `json:"exceptions"`
	ArtifactSHA256 string            `json:"artifact_sha256"`
}

type StateDelta

type StateDelta struct {
	Kind        string `json:"kind"`
	BaselineID  string `json:"baseline_id"`
	CandidateID string `json:"candidate_id"`
	From        string `json:"from"`
	To          string `json:"to"`
	Direction   string `json:"direction"`
	ExceptedBy  string `json:"excepted_by,omitempty"`
}

type StateRule

type StateRule struct {
	Name       string `json:"name"`
	Rank       int    `json:"rank"`
	Terminal   bool   `json:"terminal"`
	Unresolved bool   `json:"unresolved"`
}

Jump to

Keyboard shortcuts

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