fault

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0, AGPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fault defines the transport-neutral failure values consumed by transfer settlement policy.

Fault intentionally excludes native errors and diagnostic context. Keeping those details at the boundary that observed them prevents wrapping topology from becoming lifecycle or retirement authority.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFault = errors.New("transfer fault is invalid")

Functions

func BoundaryCancellation

func BoundaryCancellation(err error) error

BoundaryCancellation returns a standard cancellation sentinel only for an unclassified collaborator result. A classified fault owns its outcome; its diagnostics cannot grant cancellation authority. Callers check their own context first, independently of the collaborator's result.

func Compare

func Compare(left, right Fault) int

Compare establishes a total order for deterministic reduction. Domain and code break equal-severity ties only; their order does not grant extra policy authority to one collaborator.

func ReduceBoundaryErrorSet

func ReduceBoundaryErrorSet(candidates ...error) error

ReduceBoundaryErrorSet joins already-completed sibling results when no operation context exists. It preserves explicit cancellation outside the fault lattice and applies the same total Fault join as the context-aware form.

func ReduceBoundaryErrors

func ReduceBoundaryErrors(ctx context.Context, candidates ...error) error

ReduceBoundaryErrors combines immediate sibling collaborator results without deriving policy from their aggregate error topology. Each candidate is normalized once, Fault values use the total deterministic join, and any cancellation remains outside the fault lattice.

func Wrap

func Wrap(fault Fault, cause error) error

Types

type BoundaryError

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

BoundaryError is the standard typed handoff from a collaborator adapter. Its cause remains available at that immediate boundary for diagnostics only.

func (*BoundaryError) Error

func (failure *BoundaryError) Error() string

func (*BoundaryError) Fault

func (failure *BoundaryError) Fault() Fault

func (*BoundaryError) Unwrap

func (failure *BoundaryError) Unwrap() error

type BoundaryResult

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

BoundaryResult is a closed normalization result. It cannot carry the raw cause, so settlement code receives no error graph to reinterpret.

func NormalizeBoundary

func NormalizeBoundary(ctx context.Context, err error) BoundaryResult

NormalizeBoundary checks caller cancellation before accepting a typed collaborator fault. An unknown error is a local dependency-contract breach and therefore pauses output authority rather than acquiring file isolation or retirement authority.

func NormalizeBoundaryError

func NormalizeBoundaryError(err error) BoundaryResult

NormalizeBoundaryError is the context-free form for a completed collaborator result. Keeping it separate prevents locked invariant and trace paths from inventing a context while retaining unclassified collaborator cancellation.

func (BoundaryResult) Fault

func (result BoundaryResult) Fault() (Fault, bool)

func (BoundaryResult) Kind

func (result BoundaryResult) Kind() BoundaryResultKind

type BoundaryResultKind

type BoundaryResultKind uint8
const (
	BoundarySuccess BoundaryResultKind = iota
	BoundaryCanceled
	BoundaryFailed
)

type CatalogCode

type CatalogCode uint16
const (
	CatalogUnavailable CatalogCode = iota + 1
	CatalogDirectoryStale
	CatalogInvalidGeneration
)

func (CatalogCode) String

func (code CatalogCode) String() string

type CheckpointCode

type CheckpointCode uint16
const (
	CheckpointBusy CheckpointCode = iota + 1
	CheckpointCorruptRecord
	CheckpointUnsafeInstall
	CheckpointOwnershipMismatch
	CheckpointStateIO
)

func (CheckpointCode) String

func (code CheckpointCode) String() string

type Domain

type Domain uint8

Domain identifies the collaborator whose contract produced a fault.

const (
	DomainSource Domain = iota + 1
	DomainCatalog
	DomainSession
	DomainOutput
	DomainCheckpoint
)

func (Domain) String

func (domain Domain) String() string

type Fault

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

Fault is an immutable, comparable policy value. Scope is deliberately not inferred from Code: the stable-cut evidence at a boundary decides whether an otherwise identical failure is isolated or requires pausing wider authority.

func DependencyContractFault

func DependencyContractFault() Fault

func Join

func Join(faults ...Fault) Fault

Join returns the maximum normalized fault and treats the zero value as the identity. Constructors are the only way external packages can create a non-zero Fault, so invalid values cannot silently enter policy reduction.

func NewCatalog

func NewCatalog(scope Scope, code CatalogCode) (Fault, error)

func NewCheckpoint

func NewCheckpoint(scope Scope, code CheckpointCode) (Fault, error)

func NewOutput

func NewOutput(scope Scope, code OutputCode) (Fault, error)

func NewSession

func NewSession(scope Scope, code SessionCode) (Fault, error)

func NewSource

func NewSource(scope Scope, code SourceCode) (Fault, error)

func (Fault) CatalogCode

func (fault Fault) CatalogCode() (CatalogCode, bool)

func (Fault) CheckpointCode

func (fault Fault) CheckpointCode() (CheckpointCode, bool)

func (Fault) Code

func (fault Fault) Code() uint16

func (Fault) Domain

func (fault Fault) Domain() Domain

func (Fault) IsZero

func (fault Fault) IsZero() bool

func (Fault) OutputCode

func (fault Fault) OutputCode() (OutputCode, bool)

func (Fault) Scope

func (fault Fault) Scope() Scope

func (Fault) SessionCode

func (fault Fault) SessionCode() (SessionCode, bool)

func (Fault) SourceCode

func (fault Fault) SourceCode() (SourceCode, bool)

func (Fault) String

func (fault Fault) String() string

func (Fault) Valid

func (fault Fault) Valid() bool

type OutputCode

type OutputCode uint16
const (
	OutputStateIO OutputCode = iota + 1
	OutputOwnership
	OutputNamespaceUnsafe
	OutputUnsupportedFilesystem
	OutputDirectoryBinding
	OutputDirectoryMetadata
	OutputFileAlreadyActive
	OutputResourceBudget
	OutputMutationAmbiguous
	OutputContract
)

func (OutputCode) String

func (code OutputCode) String() string

type Retirement

type Retirement uint8
const (
	RetirementPermanentSource Retirement = iota + 1
	RetirementInvalidatedRevision
)

func RetirementFor

func RetirementFor(fault Fault) (Retirement, bool)

RetirementFor is an explicit allowlist. Severity alone never permits state deletion, and the file-local check prevents a wider source failure from being repurposed as authority over one file.

type Scope

type Scope uint8

Scope is also the severity order used by Join. The numeric order is frozen so Go and browser runtimes reduce sibling failures identically.

const (
	ScopeFileLocal Scope = iota + 1
	ScopeDirectoryLocal
	ScopeOutputPause
	ScopeSessionTerminal
)

func (Scope) String

func (scope Scope) String() string

type SessionCode

type SessionCode uint16
const (
	SessionTransport SessionCode = iota + 1
	SessionProtocol
	SessionResourceBudget
	SessionDependencyContract
)

func (SessionCode) String

func (code SessionCode) String() string

type SourceCode

type SourceCode uint16
const (
	SourceUnavailable SourceCode = iota + 1
	SourceRevisionChanged
	SourceRevisionInvalidated
	SourcePermanent
)

func (SourceCode) String

func (code SourceCode) String() string

Jump to

Keyboard shortcuts

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