Documentation
¶
Overview ¶
Package invocation preserves execution evidence at a complete model-call boundary. A failed invocation may have consumed resources or produced external work; only FailureNotExecuted proves absence of work. No classification authorizes retry. Compositions own their complete outcome independently of nested causes.
Example ¶
package main
import (
"errors"
"fmt"
"github.com/Tangerg/scope/core/invocation"
)
func main() {
admission := &invocation.Failure{
Kind: invocation.FailureNotExecuted,
Cause: errors.New("unsupported model option"),
}
completedWork := &invocation.Failure{
Kind: invocation.FailureFailed,
Cause: fmt.Errorf("follow-up request: %w", admission),
}
fmt.Println(invocation.ClassifyFailure(admission))
fmt.Println(invocation.ClassifyFailure(completedWork))
fmt.Println(errors.Is(completedWork, admission))
}
Output: not_executed failed true
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFailure = errors.New("invocation: invalid call failure")
Functions ¶
This section is empty.
Types ¶
type Failure ¶
type Failure struct {
Kind FailureKind
Cause error
}
Failure owns evidence for the complete current Call or Stream invocation. Cause remains inspectable through errors.Is and errors.As, but failures inside it belong to nested invocations and cannot override Kind. A composition that already executed work must establish its own boundary, including Unknown when it cannot establish the complete outcome. No kind authorizes a retry.
type FailureKind ¶
type FailureKind string
const ( FailureInvalid FailureKind = "" FailureUnknown FailureKind = "unknown" FailureFailed FailureKind = "failed" FailureNotExecuted FailureKind = "not_executed" )
Failed establishes an unsuccessful invocation, not absence of side effects or token use. Only NotExecuted proves no provider work ran in this invocation.
func ClassifyFailure ¶
func ClassifyFailure(err error) FailureKind
ClassifyFailure is the execution-evidence boundary; errors.Is and errors.As inspect diagnostics, not the outcome of a composite invocation. Transparent wrapping preserves one boundary. Joined independent boundaries require an enclosing owner to classify the whole call, otherwise its outcome is unknown. Nil has no failure; an ordinary or invalid error establishes only Unknown.
func (FailureKind) Valid ¶
func (f FailureKind) Valid() bool