stackspecintent

package
v0.47.9 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package stackspecintent owns the only first-party persistence contract for canonical StackSpec v2 intent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasementDomainMigrationCandidate added in v0.47.7

func BasementDomainMigrationCandidate(raw []byte) ([]byte, error)

BasementDomainMigrationCandidate admits only the retired Basement domain. It changes the domain and explicit route hosts, then validates every field against current CUE. It does not generally admit invalid current intent.

func IsCanonicalSHA256

func IsCanonicalSHA256(value string) bool

func PersistBasementDomainMigration added in v0.47.7

func PersistBasementDomainMigration(workspace, specPath string, before, after []byte) error

PersistBasementDomainMigration is the explicit legacy-domain exception to Persist. The frozen original bytes serve as the CAS token because current CUE deliberately rejects home. The candidate must be exactly the validated narrow transform of those bytes. Interrupted retries accept that same result.

func WithBasementDomainMigrator added in v0.47.7

func WithBasementDomainMigrator(
	workspace string,
	join lifecyclemutation.JoinRequest,
	migrate func(BasementDomainMigrator) error,
) error

WithBasementDomainMigrator holds the lifecycle mutation lock across the complete identity migration and supplies a persistence capability valid only during callback execution. It is the live command boundary; callers that need only StackSpec persistence use PersistBasementDomainMigration instead.

Types

type BasementDomainMigrator added in v0.47.7

type BasementDomainMigrator struct {
	// contains filtered or unexported fields
}

BasementDomainMigrator supplies the CUE and CAS boundary to local identity migration without coupling the runtime identity service to the compiler.

func (BasementDomainMigrator) Candidate added in v0.47.7

func (BasementDomainMigrator) Candidate(raw []byte) ([]byte, error)

func (BasementDomainMigrator) Persist added in v0.47.7

func (m BasementDomainMigrator) Persist(workspace, specPath string, before, after []byte) error

type Error

type Error struct {
	Code              ErrorCode
	CurrentSpecHash   string
	CandidateSpecHash string
	Cause             error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorCode

type ErrorCode string
const (
	ErrInvalidCandidate ErrorCode = "invalid-candidate"
	ErrInvalidExpected  ErrorCode = "invalid-expected-hash"
	ErrCASRequired      ErrorCode = "compare-and-swap-required"
	ErrCASConflict      ErrorCode = "compare-and-swap-conflict"
	ErrMissingTarget    ErrorCode = "compare-and-swap-missing-target"
	ErrInvalidCurrent   ErrorCode = "invalid-current-intent"
)

type Outcome

type Outcome string
const (
	OutcomeCreated        Outcome = "created"
	OutcomeAlreadyApplied Outcome = "already-applied"
	OutcomeReplaced       Outcome = "replaced"
)

type Request

type Request struct {
	WorkspaceRoot    string
	SpecPath         string
	Candidate        []byte
	ExpectedSpecHash string
	BuildVersion     string
	Authority        *architecturev2.Service
}

type Result

type Result struct {
	Outcome          Outcome
	KitProfile       stackspecmigration.KitProfile
	SpecHash         string
	PreviousSpecHash string
	Canonical        []byte
}

func Persist

func Persist(request Request) (result Result, returnErr error)

Persist validates both candidate and current intent through the same embedded CUE authority, then performs a non-blocking exact-hash CAS beneath one held workspace root. It never accepts v1 as current or candidate intent.

Jump to

Keyboard shortcuts

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