data

package
v0.139.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeInvalid     = "invalid_input"
	CodeDenied      = "denied"
	CodeConflict    = "fingerprint_conflict"
	CodeBusy        = "busy"
	CodeStale       = "stale_generation"
	CodeUnavailable = "unavailable"
	CodeCanceled    = "canceled"
	CodeRecovery    = "recovery_required"
	CodeLeaseLost   = "lease_lost"
	CodeGone        = "gone"
	CodeProvider    = "provider_failed"
)
View Source
const (
	CheckPassed      = "passed"
	CheckFailed      = "failed"
	CheckPlanned     = "planned"
	CheckUnavailable = "unavailable"
)
View Source
const (
	CoveredEmpty     = "covered_empty"
	Uncovered        = "uncovered"
	Partial          = "partial"
	PolicySuppressed = "policy_suppressed"
	Unavailable      = "unavailable"
)
View Source
const MaxWireCounter uint64 = 1<<53 - 1
View Source
const WireVersion = "v1"

WireVersion freezes the lifecycle wire contract independently of host routes.

Variables

This section is empty.

Functions

func Error added in v0.139.0

func Error(code string) error

func ErrorCode added in v0.139.0

func ErrorCode(err error) string

func SafeErrorCode added in v0.139.1

func SafeErrorCode(err error) (string, bool)

SafeErrorCode finds a recognized lifecycle error through dispatcher wrappers and joined causes. The boolean distinguishes an explicit safe provider failure from an unknown error, which must retain the host's ordinary error handling.

func TranslationAssignmentMigrations added in v0.25.0

func TranslationAssignmentMigrations() fs.FS

TranslationAssignmentMigrations returns the legacy queue assignment migration set.

func TranslationFlowMigrations added in v0.27.0

func TranslationFlowMigrations() fs.FS

TranslationFlowMigrations returns the translation-flow migration set.

func TranslationFlowSQLiteMigrations added in v0.27.0

func TranslationFlowSQLiteMigrations() fs.FS

TranslationFlowSQLiteMigrations returns the sqlite-specific translation-flow migrations for local runtimes.

func UISchemas

func UISchemas() fs.FS

UISchemas returns the embedded UI schema filesystem.

func WorkflowRuntimeMigrations added in v0.75.0

func WorkflowRuntimeMigrations() fs.FS

WorkflowRuntimeMigrations returns the workflow runtime migration set.

Types

type AccessRequest added in v0.139.0

type AccessRequest struct {
	Action    string
	Target    TargetKey
	Operation *Operation
	Receipt   *PreparationReceipt
	Artifact  *ArtifactRef
}

type ActivateRequest added in v0.139.0

type ActivateRequest struct{ Input }

func (ActivateRequest) OperationInput added in v0.139.0

func (m ActivateRequest) OperationInput() Input

func (ActivateRequest) OperationKind added in v0.139.0

func (ActivateRequest) OperationKind() Kind

func (ActivateRequest) Type added in v0.139.0

func (ActivateRequest) Type() string

func (ActivateRequest) Validate added in v0.139.0

func (m ActivateRequest) Validate() error

type Activation added in v0.139.0

type Activation struct {
	ReceiptID  string `json:"receipt_id,omitempty"`
	Generation uint64 `json:"generation"`
	Ready      bool   `json:"ready"`
}

type ActiveState added in v0.139.0

type ActiveState struct {
	Target             TargetKey  `json:"target"`
	Activation         Activation `json:"activation"`
	Transitioning      bool       `json:"transitioning"`
	RecoveryRequired   bool       `json:"recovery_required"`
	PendingOperationID string     `json:"pending_operation_id,omitempty"`
	PendingReceiptID   string     `json:"pending_receipt_id,omitempty"`
}

ActiveState is the safe read model; physical intent IDs and fence/delegation metadata remain in OperationStore. Transitioning never claims a ready route.

type ArtifactProvider added in v0.139.0

type ArtifactProvider interface {
	LookupArtifact(context.Context, Principal, ArtifactRef) (any, error)
}

ArtifactProvider resolves opaque references after current service and domain policy checks. Never return a public URL or an implicit PII/export grant.

type ArtifactRef added in v0.139.0

type ArtifactRef struct {
	Provider    string    `json:"provider"`
	ID          string    `json:"id"`
	Target      TargetKey `json:"target"`
	Generation  uint64    `json:"generation"`
	RequesterID string    `json:"requester_id"`
	ExpiresAt   time.Time `json:"expires_at"`
}

type CancelRequest added in v0.139.0

type CancelRequest struct{ Input }

func (CancelRequest) OperationInput added in v0.139.0

func (m CancelRequest) OperationInput() Input

func (CancelRequest) OperationKind added in v0.139.0

func (CancelRequest) OperationKind() Kind

func (CancelRequest) Type added in v0.139.0

func (CancelRequest) Type() string

func (CancelRequest) Validate added in v0.139.0

func (m CancelRequest) Validate() error

type Capability added in v0.139.0

type Capability struct {
	Supported bool   `json:"supported"`
	Permitted bool   `json:"permitted"`
	Reason    string `json:"reason,omitempty"`
}

type CatalogProvider added in v0.139.0

type CatalogProvider interface {
	Catalog(context.Context, Principal, TargetKey, int) ([]DatasetRef, error)
}

CatalogProvider returns bounded references already filtered by application domain policy. The service rechecks each descriptor before disclosing it. Absence means catalog discovery is unsupported; exact Describe remains usable.

type Check added in v0.139.0

type Check struct {
	ID          string `json:"id"`
	Status      string `json:"status"`
	Expected    string `json:"expected,omitempty"`
	Actual      string `json:"actual,omitempty"`
	EvidenceRef string `json:"evidence_ref,omitempty"`
}

type Claim added in v0.139.0

type Claim struct {
	Operation Operation
	Replay    bool
}

type Command added in v0.139.0

type Command[T Message] struct{ Service *Service }

Command adapts each distinct typed message to the shared lifecycle service.

func (*Command[T]) Execute added in v0.139.0

func (c *Command[T]) Execute(ctx context.Context, msg T) error

func (*Command[T]) Run added in v0.139.0

func (c *Command[T]) Run(ctx context.Context, msg T) (Result, error)

type Component added in v0.139.0

type Component struct {
	Path   string `json:"path"`
	Digest string `json:"digest"`
}

type Coverage added in v0.139.0

type Coverage struct {
	Status string       `json:"status"`
	Sample SamplePeriod `json:"sample"`
}

type DatasetRef added in v0.139.0

type DatasetRef struct {
	Provider string `json:"provider"`
	ID       string `json:"id"`
	Version  string `json:"version"`
	Digest   string `json:"digest"`
}

func (DatasetRef) Valid added in v0.139.0

func (r DatasetRef) Valid() bool

type Descriptor added in v0.139.0

type Descriptor struct {
	Dataset               DatasetRef          `json:"dataset"`
	Components            []Component         `json:"components"`
	SourceContractHash    string              `json:"source_contract_hash"`
	SourceContractVersion string              `json:"source_contract_version"`
	PolicyHash            string              `json:"policy_hash"`
	AudienceHashes        map[string]string   `json:"audience_hashes"`
	Attribution           []string            `json:"attribution"`
	Timezone              string              `json:"timezone"`
	Samples               []SamplePeriod      `json:"samples"`
	GeneratorVersion      string              `json:"generator_version,omitempty"`
	Seed                  string              `json:"seed,omitempty"`
	GeneratorOptions      map[string]string   `json:"generator_options,omitempty"`
	Synthetic             bool                `json:"synthetic"`
	Counts                map[string]uint64   `json:"counts"`
	Prerequisites         []string            `json:"prerequisites"`
	Scenarios             []ScenarioRef       `json:"scenarios"`
	Capabilities          map[Kind]Capability `json:"capabilities"`
}

func (Descriptor) CompositeDigest added in v0.139.0

func (d Descriptor) CompositeDigest() (string, error)

CompositeDigest canonicalizes path order and JSON map keys. Digest, scenario back-references and current permission/capability discovery are excluded. Counts, evidence, samples and source/policy/generator metadata remain bound.

func (Descriptor) ValidateIdentity added in v0.139.0

func (d Descriptor) ValidateIdentity() error

type Failure added in v0.139.0

type Failure struct {
	Code   string            `json:"code"`
	Fields map[string]string `json:"fields,omitempty"`
}

Failure contains only safe codes; provider errors are never serialized verbatim.

type GenerateRequest added in v0.139.0

type GenerateRequest struct{ Input }

func (GenerateRequest) OperationInput added in v0.139.0

func (m GenerateRequest) OperationInput() Input

func (GenerateRequest) OperationKind added in v0.139.0

func (GenerateRequest) OperationKind() Kind

func (GenerateRequest) Type added in v0.139.0

func (GenerateRequest) Type() string

func (GenerateRequest) Validate added in v0.139.0

func (m GenerateRequest) Validate() error

type Generator added in v0.139.0

type Generator interface {
	Generate(context.Context, Work) (DatasetRef, error)
}

type Input added in v0.139.0

type Input struct {
	Dataset            DatasetRef  `json:"dataset"`
	Scenario           ScenarioRef `json:"scenario"`
	TargetID           string      `json:"target_id"`
	IdempotencyKey     string      `json:"idempotency_key"`
	ReceiptID          string      `json:"receipt_id,omitempty"`
	ExpectedGeneration *uint64     `json:"expected_generation,omitempty"`
	OperationID        string      `json:"operation_id,omitempty"`
	DryRun             bool        `json:"dry_run"`
	BatchLimit         int         `json:"batch_limit"`
	PageLimit          int         `json:"page_limit"`
	TimeoutSeconds     int         `json:"timeout_seconds"`
}

Input is shared by UI, CLI, jobs and schedules. It deliberately has no actor, scope, principal, filesystem or credential fields. Zero generation is meaningful.

func (Input) Fingerprint added in v0.139.0

func (in Input) Fingerprint(k Kind) (string, error)

func (Input) Normalize added in v0.139.0

func (in Input) Normalize() Input

func (Input) Validate added in v0.139.0

func (in Input) Validate(k Kind) error

type Intent added in v0.139.0

type Intent struct {
	ID          string              `json:"id"`
	OperationID string              `json:"operation_id"`
	Target      TargetKey           `json:"target"`
	Kind        Kind                `json:"kind"`
	Prior       Activation          `json:"prior"`
	Next        Activation          `json:"next"`
	Receipt     *PreparationReceipt `json:"receipt,omitempty"`
	Fence       uint64              `json:"fence"`
}

type IntentObservation added in v0.139.0

type IntentObservation string
const (
	RoutingPrior   IntentObservation = "prior"
	RoutingNext    IntentObservation = "next"
	RoutingUnknown IntentObservation = "unknown"
)

type Kind added in v0.139.0

type Kind string
const (
	Validate Kind = "validate"
	Prepare  Kind = "prepare"
	Refresh  Kind = "refresh"
	Verify   Kind = "verify"
	Activate Kind = "activate"
	Reset    Kind = "reset"
	Generate Kind = "generate"
	Cancel   Kind = "cancel"
	// Recover reconciles an existing operation; it never claims new provider work.
	Recover Kind = "recover"
)

func (Kind) CommandID added in v0.139.0

func (k Kind) CommandID() string

func (Kind) Valid added in v0.139.0

func (k Kind) Valid() bool

func (Kind) Writes added in v0.139.0

func (k Kind) Writes() bool

type Lease added in v0.139.0

type Lease struct {
	OperationID string
	Target      TargetKey
	Fence       uint64
	ExpiresAt   time.Time
}

type ManagedTarget added in v0.139.0

type ManagedTarget interface {
	Capabilities() TargetCapabilities
	Allocate(context.Context, Work) error
	InspectReceipt(context.Context, PreparationReceipt) error
	Commit(context.Context, Work, Intent) error
	InspectIntent(context.Context, Intent) (Observation, error)
	DrainCleanup(context.Context, Work, string) error
}

Allocate uses the persisted Work.StageID and is idempotent by operation/stage. ManagedTarget implements physical effects, not operation/generation authority. Commit is idempotent by intent.ID and fenced: durable routing identifies the intent even across restart. An ambiguous error must be inspected, never undone blindly. InspectReceipt is read-only and checks stage/content/checkpoint identity. DrainCleanup fences and drains all stage writers before deletion; it is forbidden for active, retained rollback or pending-intent receipts.

type Message added in v0.139.0

type Message interface {
	Type() string
	Validate() error
	OperationKind() Kind
	OperationInput() Input
}

type Observation added in v0.139.0

type Observation struct {
	Routing IntentObservation
	// Ready means the observed physical routing is safe and healthy, including
	// a safely deactivated target. It is distinct from Activation.Ready, which
	// reports an active prepared dataset. An unready prior route cannot settle
	// an intent any more than an unready next route can.
	Ready bool
}

func (Observation) AuthoritativeRouting added in v0.139.0

func (o Observation) AuthoritativeRouting() IntentObservation

AuthoritativeRouting keeps reconciliation and store validation on the same authority rule. Known routing without readiness still requires recovery.

type Operation added in v0.139.0

type Operation struct {
	Result            Result     `json:"result"`
	Target            TargetKey  `json:"target"`
	Principal         Principal  `json:"principal"`
	Input             Input      `json:"input"`
	Fingerprint       string     `json:"fingerprint"`
	CreatedAt         time.Time  `json:"created_at"`
	UpdatedAt         time.Time  `json:"updated_at"`
	RecoveryPrincipal *Principal `json:"recovery_principal,omitempty"`
	StageID           string     `json:"stage_id,omitempty"`
	CancelRequested   bool       `json:"cancel_requested"`
}

type OperationStore added in v0.139.0

type OperationStore interface {
	Capabilities() StoreCapabilities
	Claim(context.Context, Operation) (Claim, error)
	// LookupRequest returns found=true for a live claim, including a tombstone
	// whose operation was pruned (CodeGone). An expired/absent claim is not found.
	LookupRequest(context.Context, RequestKey) (Operation, bool, error)
	GetOperation(context.Context, string) (Operation, error)
	ListOperations(context.Context, TargetKey, int) ([]Operation, error)
	Acquire(context.Context, string, TargetKey, time.Duration) (Lease, error)
	AcquireRecovery(context.Context, string, TargetKey, time.Duration) (Lease, error)
	Renew(context.Context, Lease, time.Duration) (Lease, error)
	CheckLease(context.Context, Lease) error
	// CheckCleanup rejects active, pending or retained receipts under the lease.
	CheckCleanup(context.Context, Lease, string) error
	Release(context.Context, Lease) error
	Save(context.Context, Operation, uint64, *Lease) (Operation, error)
	RequestCancel(context.Context, string, uint64) (Operation, error)
	PutReceipt(context.Context, Lease, PreparationReceipt) error
	GetReceipt(context.Context, string) (PreparationReceipt, error)
	ListReceipts(context.Context, TargetKey, ReceiptQuery) (ReceiptPage, error)
	// GetArtifact loads original metadata by provider and opaque ID; caller
	// claims about requester, scope, expiry or generation are never authoritative.
	GetArtifact(context.Context, string, string) (ArtifactRef, error)
	PutVerification(context.Context, Lease, string, uint64, VerificationResult) (PreparationReceipt, error)
	Target(context.Context, TargetKey) (TargetState, error)
	BeginIntent(context.Context, Lease, Intent, uint64) error
	ResolveIntent(context.Context, Lease, Intent, Observation, Operation, uint64) (Operation, error)
}

OperationStore owns durable atomicity. Every mutator must reject expired or stale leases, and stale operation revisions. Claims have a unique compound key (actor, scope, target, command version, caller key) and immutable fingerprint. Target keys include scope. No callback may perform physical effects in a DB tx. Lease time uses authoritative store time. Tokens monotonically increase and never reset when a claim expires/releases. Acquire rejects pending intents and recovery_required; AcquireRecovery fences all prior workers and binds the operation and any pending intent; it requires the previous lease to expire. Save increments Revision atomically; progress/cancel also participate in CAS. Persist receipt/verification before events, never overwrite receipt content. BeginIntent atomically checks lease, generation, receipt/content and operation revision. ResolveIntent atomically finalizes activation, intent and operation; routing-next increments generation exactly once; routing-prior retains it. Both known routes require Observation.Ready (physical safety/health); an unready route follows AuthoritativeRouting's unknown/recovery rule and cannot finalize a terminal outcome or clear pending evidence. Unknown preserves intent, blocks writes and persists recovering, not failed. Retention preserves idempotency tombstones for its advertised retry window, active/pending/rollback receipts, artifacts and all recovery evidence. Hosts must configure bounded lease, retry, retention and artifact durations before writes.

type Policy added in v0.139.0

type Policy interface {
	Authorize(context.Context, Principal, AccessRequest) error
}

type PreparationReceipt added in v0.139.0

type PreparationReceipt struct {
	ID                string              `json:"id"`
	Target            TargetKey           `json:"target"`
	StageID           string              `json:"stage_id"`
	Dataset           DatasetRef          `json:"dataset"`
	Scenario          ScenarioRef         `json:"scenario"`
	ModuleHash        string              `json:"module_hash"`
	PolicyHash        string              `json:"policy_hash"`
	PermissionHash    string              `json:"permission_hash"`
	ContentRevision   uint64              `json:"content_revision"`
	SourceCheckpoint  string              `json:"source_checkpoint"`
	DerivedCheckpoint string              `json:"derived_checkpoint"`
	RequesterID       string              `json:"requester_id"`
	Verification      *VerificationResult `json:"verification,omitempty"`
}

type PrepareRequest added in v0.139.0

type PrepareRequest struct{ Input }

func (PrepareRequest) OperationInput added in v0.139.0

func (m PrepareRequest) OperationInput() Input

func (PrepareRequest) OperationKind added in v0.139.0

func (PrepareRequest) OperationKind() Kind

func (PrepareRequest) Type added in v0.139.0

func (PrepareRequest) Type() string

func (PrepareRequest) Validate added in v0.139.0

func (m PrepareRequest) Validate() error

type Principal added in v0.139.0

type Principal struct {
	ActorID        string `json:"actor_id"`
	ScopeKey       string `json:"scope_key"`
	ExecutionID    string `json:"execution_id"`
	CorrelationID  string `json:"correlation_id,omitempty"`
	ModuleHash     string `json:"module_hash"`
	PolicyHash     string `json:"policy_hash"`
	PermissionHash string `json:"permission_hash"`
}

Principal is supplied by a host resolver consulting current trusted state. It is not embedded in Input or accepted from JSON.

func (Principal) Valid added in v0.139.0

func (p Principal) Valid() bool

type Progress added in v0.139.0

type Progress struct {
	Stage     string `json:"stage"`
	Completed uint64 `json:"completed"`
	Total     uint64 `json:"total"`
}

type Provider added in v0.139.0

Provider uses application commands/services for domain work. Validate and Plan are read-only, including artifact effects. Plan checks say planned/unavailable. Prepare and Refresh only write the supplied owned stage. A receipt is immutable; changing its content requires a new receipt and fresh verification.

type ReceiptPage added in v0.139.1

type ReceiptPage struct {
	Receipts   []PreparationReceipt `json:"receipts"`
	NextCursor string               `json:"next_cursor,omitempty"`
}

type ReceiptQuery added in v0.139.1

type ReceiptQuery struct {
	Limit  int
	Cursor string
}

ReceiptQuery pages authoritative receipts independently of operation history. Cursor is store-owned and opaque to callers; a page contains at most 100 rows.

type RecoverRequest added in v0.139.1

type RecoverRequest struct {
	TargetID    string `json:"target_id"`
	OperationID string `json:"operation_id"`
}

RecoverRequest references durable work and has no new-work request key or editable provider inputs. Recovery is authorized and audited as a supervisor.

func (RecoverRequest) OperationInput added in v0.139.1

func (m RecoverRequest) OperationInput() Input

func (RecoverRequest) OperationKind added in v0.139.1

func (RecoverRequest) OperationKind() Kind

func (RecoverRequest) Type added in v0.139.1

func (RecoverRequest) Type() string

func (RecoverRequest) Validate added in v0.139.1

func (m RecoverRequest) Validate() error

type RefreshRequest added in v0.139.0

type RefreshRequest struct{ Input }

func (RefreshRequest) OperationInput added in v0.139.0

func (m RefreshRequest) OperationInput() Input

func (RefreshRequest) OperationKind added in v0.139.0

func (RefreshRequest) OperationKind() Kind

func (RefreshRequest) Type added in v0.139.0

func (RefreshRequest) Type() string

func (RefreshRequest) Validate added in v0.139.0

func (m RefreshRequest) Validate() error

type RequestKey added in v0.139.1

type RequestKey struct {
	ActorID        string
	Target         TargetKey
	Kind           Kind
	IdempotencyKey string
}

RequestKey identifies the durable request claim without disclosing another actor's work. Lookup is read-only; Claim still decides replay atomically.

type ResetRequest added in v0.139.0

type ResetRequest struct{ Input }

func (ResetRequest) OperationInput added in v0.139.0

func (m ResetRequest) OperationInput() Input

func (ResetRequest) OperationKind added in v0.139.0

func (ResetRequest) OperationKind() Kind

func (ResetRequest) Type added in v0.139.0

func (ResetRequest) Type() string

func (ResetRequest) Validate added in v0.139.0

func (m ResetRequest) Validate() error

type Result added in v0.139.0

type Result struct {
	OperationID  string              `json:"operation_id"`
	Kind         Kind                `json:"kind"`
	State        State               `json:"state"`
	Revision     uint64              `json:"revision"`
	Phase        string              `json:"phase"`
	DryRun       bool                `json:"dry_run"`
	Active       bool                `json:"active"`
	Receipt      *PreparationReceipt `json:"receipt,omitempty"`
	Verification *VerificationResult `json:"verification,omitempty"`
	Activation   *Activation         `json:"activation,omitempty"`
	Checks       []Check             `json:"checks,omitempty"`
	Progress     Progress            `json:"progress"`
	Dataset      *DatasetRef         `json:"dataset,omitempty"`
	Failure      *Failure            `json:"failure,omitempty"`
}

func (Result) CommandResultFailure added in v0.139.0

func (r Result) CommandResultFailure() error

type SamplePeriod added in v0.139.0

type SamplePeriod struct {
	LocalDay    string `json:"local_day"`
	Timezone    string `json:"timezone"`
	EvidenceRef string `json:"evidence_ref"`
}

type ScenarioRef added in v0.139.0

type ScenarioRef struct {
	Dataset     DatasetRef `json:"dataset"`
	ID          string     `json:"id"`
	Version     string     `json:"version"`
	ProfileHash string     `json:"profile_hash"`
}

func (ScenarioRef) Valid added in v0.139.0

func (r ScenarioRef) Valid() bool

type Service added in v0.139.0

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

func NewService added in v0.139.0

func NewService(cfg ServiceConfig) (*Service, error)

func (*Service) Active added in v0.139.0

func (s *Service) Active(ctx context.Context, targetID string) (ActiveState, error)

func (*Service) AuthorizeAction added in v0.139.1

func (s *Service) AuthorizeAction(ctx context.Context, kind Kind, targetID string) error

AuthorizeAction rechecks current target grants without loading lifecycle records. It filters already declared controls; AuthorizeInput and Run still enforce ownership, selected input and capabilities before dispatch/effects.

func (*Service) AuthorizeInput added in v0.139.0

func (s *Service) AuthorizeInput(ctx context.Context, kind Kind, input Input) error

AuthorizeInput performs no effects. Named factories use it before dispatch; typed handlers still enforce policy again at the service boundary.

func (*Service) AuthorizeView added in v0.139.1

func (s *Service) AuthorizeView(ctx context.Context, targetID string) error

AuthorizeView rechecks current target read grants without loading lifecycle state. It is suitable for delivery of projections already loaded by the service.

func (*Service) Catalog added in v0.139.0

func (s *Service) Catalog(ctx context.Context, targetID string, limit int) ([]Descriptor, error)

func (*Service) Describe added in v0.139.0

func (s *Service) Describe(ctx context.Context, ref DatasetRef, targetID string) (Descriptor, error)

func (*Service) LookupArtifact added in v0.139.0

func (s *Service) LookupArtifact(ctx context.Context, providerID, artifactID string) (any, error)

func (*Service) LookupOperation added in v0.139.0

func (s *Service) LookupOperation(ctx context.Context, id string) (Operation, error)

func (*Service) LookupReceipt added in v0.139.1

func (s *Service) LookupReceipt(ctx context.Context, targetID, id string) (PreparationReceipt, error)

LookupReceipt reads the current authoritative receipt, including its latest verification, rather than an immutable historical operation result.

func (*Service) Operations added in v0.139.0

func (s *Service) Operations(ctx context.Context, targetID string, limit int) ([]Operation, error)

func (*Service) Receipts added in v0.139.1

func (s *Service) Receipts(ctx context.Context, targetID string, query ReceiptQuery) (ReceiptPage, error)

Receipts exposes bounded, current-policy pages independent of operation history. Filtering does not alter the store cursor; denied rows stay omitted.

func (*Service) Recover added in v0.139.0

func (s *Service) Recover(ctx context.Context, operationID string) (Result, error)

Recover is an explicit authorized supervisor operation, never an implicit UI retry. It waits for lease expiry through the store, fences old workers and inspects routing. Unknown authority retains the intent and blocks new writes.

func (*Service) ResolveRequestGeneration added in v0.139.1

func (s *Service) ResolveRequestGeneration(ctx context.Context, kind Kind, input Input) (Input, error)

ResolveRequestGeneration binds an adapter's generation precondition to the first durable request using the same actor/target/command/key. A refreshed form may observe a newer generation, but a retry must preserve the original one. All other inputs must match. New requests retain their submitted generation; Run's atomic claim and generation CAS remain the final authority. Direct typed Run callers keep strict fingerprint semantics.

func (*Service) Run added in v0.139.0

func (s *Service) Run(ctx context.Context, kind Kind, input Input) (Result, error)

Run executes bounded work inline. Transport acceptance is distinct from Result: only the latter reports preparation/verification/activation. Queued transports dispatch these same messages; they must propagate a trusted bounded principal.

type ServiceConfig added in v0.139.0

type ServiceConfig struct {
	Providers map[string]Provider
	Target    ManagedTarget
	Store     OperationStore
	Policy    Policy
	// Resolve must consult current trusted state, including revocation, on every
	// invocation. It must not read actor/scope/delegation from Input.
	Resolve        func(context.Context) (Principal, error)
	LeaseDuration  time.Duration
	CleanupTimeout time.Duration
	// WritesEnabled is the host's explicit conformance gate (T05). Durable capability
	// flags are additionally required; they are not themselves conformance evidence.
	WritesEnabled bool
}

type State added in v0.139.0

type State string
const (
	Queued    State = "queued"
	Running   State = "running"
	Succeeded State = "succeeded"
	Failed    State = "failed"
	Canceled  State = "canceled"
)

func (State) Terminal added in v0.139.0

func (s State) Terminal() bool

type StoreCapabilities added in v0.139.0

type StoreCapabilities struct {
	Durable              bool
	AtomicClaims         bool
	Fencing              bool
	AtomicIntentFinalize bool
	ProtectedRetention   bool
}

func (StoreCapabilities) WriteReady added in v0.139.0

func (c StoreCapabilities) WriteReady() bool

type TargetCapabilities added in v0.139.0

type TargetCapabilities struct {
	Recovery     bool
	Fencing      bool
	SafeReset    bool
	Cancellation bool
}

type TargetKey added in v0.139.0

type TargetKey struct {
	ScopeKey string `json:"scope_key"`
	TargetID string `json:"target_id"`
}

type TargetState added in v0.139.0

type TargetState struct {
	Activation       Activation
	Pending          *Intent
	RecoveryRequired bool
}

type ValidateRequest added in v0.139.0

type ValidateRequest struct{ Input }

func (ValidateRequest) OperationInput added in v0.139.0

func (m ValidateRequest) OperationInput() Input

func (ValidateRequest) OperationKind added in v0.139.0

func (ValidateRequest) OperationKind() Kind

func (ValidateRequest) Type added in v0.139.0

func (ValidateRequest) Type() string

func (ValidateRequest) Validate added in v0.139.0

func (m ValidateRequest) Validate() error

type VerificationResult added in v0.139.0

type VerificationResult struct {
	ID              string        `json:"id"`
	ContentRevision uint64        `json:"content_revision"`
	Checks          []Check       `json:"checks"`
	Coverage        []Coverage    `json:"coverage"`
	Artifacts       []ArtifactRef `json:"artifacts,omitempty"`
}

func (VerificationResult) Passed added in v0.139.0

func (v VerificationResult) Passed() bool

type VerifyRequest added in v0.139.0

type VerifyRequest struct{ Input }

func (VerifyRequest) OperationInput added in v0.139.0

func (m VerifyRequest) OperationInput() Input

func (VerifyRequest) OperationKind added in v0.139.0

func (VerifyRequest) OperationKind() Kind

func (VerifyRequest) Type added in v0.139.0

func (VerifyRequest) Type() string

func (VerifyRequest) Validate added in v0.139.0

func (m VerifyRequest) Validate() error

type Work added in v0.139.0

type Work struct {
	OperationID   string
	Principal     Principal
	Input         Input
	Lease         Lease
	StageID       string
	BeforeEffects func(context.Context) error
	Progress      func(context.Context, Progress) error
}

Work is created by the lifecycle service. BeforeEffects must be called between bounded batches and immediately before each effect; targets/domain services must reject stale Fence values. Request cancellation alone is not a fencing protocol.

Directories

Path Synopsis
examples
sqlitestore
Package sqlitestore is a small file-backed reference adapter for lifecycle conformance and host examples.
Package sqlitestore is a small file-backed reference adapter for lifecycle conformance and host examples.

Jump to

Keyboard shortcuts

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