releaseidentity

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package releaseidentity defines release-wide claims. Valid structure is not authentication: only releasetrust can establish a verified release.

Index

Constants

View Source
const (
	FreshGenesisV1  = "fresh/v1"
	LegacyGenesisV1 = "legacy/v1"
)
View Source
const (
	SQLite            Engine = "sqlite"
	Postgres          Engine = "postgres"
	MaxMigrations            = 4096
	MaxMigrationBytes        = 4 << 20
)

Variables

This section is empty.

Functions

func CompareUpdateVersions

func CompareUpdateVersions(a, b *semver.Version) int

CompareUpdateVersions orders nightlies after their stable base and its other prereleases: they may contain migrations added after that stable release. All other comparisons retain SemVer ordering. This is eligibility, not migration authorization.

func SafeName

func SafeName(name string) bool

SafeName reports whether name is a single plain path component: no empty name, no dot entries, no traversal and no separators. Every trust, bundle and archive reader validates member names through this one predicate.

func ValidateTarget

func ValidateTarget(profile Profile, version string, sequence uint64, commit string) error

ValidateTarget checks the source-owned fields that can be embedded before the containing artifact and release manifest are built.

Types

type Digest

type Digest string

Digest is the lowercase hexadecimal SHA-256 of exact bytes.

func Hash

func Hash(raw []byte) Digest

func (Digest) Validate

func (d Digest) Validate() error

type Engine

type Engine string

func (Engine) Validate

func (e Engine) Validate() error

type Identity

type Identity struct {
	Profile             Profile `json:"profile"`
	Version             string  `json:"version"`
	Sequence            uint64  `json:"sequence"`
	Commit              string  `json:"commit"`
	CompatibilitySHA256 Digest  `json:"compatibility_sha256"`
	ManifestSHA256      Digest  `json:"manifest_sha256"`
}

Identity deliberately excludes platform and installation identity. Every architecture of one release shares this identity; artifact bytes are bound separately by its verified release manifest.

func (Identity) Validate

func (i Identity) Validate() error

type Migration

type Migration struct {
	Version uint64 `json:"version"`
	SHA256  Digest `json:"sha256"`
}

type MigrationManifest

type MigrationManifest struct {
	Engine  Engine      `json:"engine"`
	Entries []Migration `json:"entries"`
}

MigrationManifest is ordered by strictly increasing goose version. Its digest covers the engine and each exact migration byte digest in that order.

func BuildMigrationManifest

func BuildMigrationManifest(source fs.FS, directory string, engine Engine) (MigrationManifest, error)

BuildMigrationManifest reads the actual source-owned SQL bytes. Callers pass the embedded migration filesystem or an explicit build-time filesystem; this leaf package never imports datastore adapters.

func (MigrationManifest) Clone

func (MigrationManifest) Digest

func (m MigrationManifest) Digest() (Digest, error)

func (MigrationManifest) Validate

func (m MigrationManifest) Validate() error

type Profile

type Profile string
const (
	StableV1  Profile = "stable/v1"
	NightlyV1 Profile = "nightly/v1"
)

func (Profile) Validate

func (p Profile) Validate() error

type SnapshotFloor

type SnapshotFloor struct {
	MetadataSequence       int64  `json:"metadata_sequence"`
	MetadataSHA256         Digest `json:"metadata_sha256"`
	HighestReleaseSequence int64  `json:"highest_release_sequence"`
	CatalogSequence        int64  `json:"catalog_sequence"`
	CatalogSHA256          Digest `json:"catalog_sha256"`
}

SnapshotFloor is an untrusted persisted claim, not signature authority. The verifier authenticates new values; the ledger atomically preserves them.

func (SnapshotFloor) Advance

func (f SnapshotFloor) Advance(next SnapshotFloor) error

Advance refuses counter rollback and equivocation. Root/domain equality is a separate mandatory installation binding owned by the calling ledger.

func (SnapshotFloor) Validate

func (f SnapshotFloor) Validate() error

type Source

type Source struct {
	Genesis string   `json:"genesis,omitempty"`
	Release Identity `json:"release,omitzero"`
}

Source names either an exact release or an explicitly declared fresh/legacy genesis. It is a claim: accepting a genesis still requires F2's independent complete schema/migration inspection. Engine migration and schema digests travel alongside this value, never as an invented release identity.

func (Source) IsRelease

func (s Source) IsRelease() bool

func (Source) Validate

func (s Source) Validate() error

Jump to

Keyboard shortcuts

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