stackspecintent

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 9 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 IsCanonicalSHA256

func IsCanonicalSHA256(value string) bool

Types

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