Documentation
¶
Overview ¶
Package faultfixture validates fault response source before normalization. It does not enable public sequence execution or provide runtime evidence.
Index ¶
- Constants
- Variables
- func NativeReference(manifest *models.EvidenceManifest, origin models.EvidenceOrigin, ...) (models.EvidenceReference, error)
- func ValidateCommandResponse(data []byte, format Format, enclosingVersion string) error
- func ValidateMCPResponse(data []byte, format Format, enclosingVersion string) error
- type CommandAdapter
- type CommandOutput
- type Envelope
- type Format
- type Fragment
- type MCPAdapter
- type Observer
- type PendingMCPCall
- type Transition
Constants ¶
const ( JSON = models.FaultSourceJSON YAML = models.FaultSourceYAML )
Variables ¶
var ErrUnmatched = errors.New("configured fault has no matching response; arguments omitted")
Functions ¶
func NativeReference ¶
func NativeReference(manifest *models.EvidenceManifest, origin models.EvidenceOrigin, artifact string, ordinal int, content []byte, requireComplete, requireUnredacted bool) (models.EvidenceReference, error)
NativeReference verifies an actual captured array ordinal. The native caller must supply its own association; this helper never joins by name or matcher. Successful verification is not a grader, enforcement or integration verdict.
func ValidateCommandResponse ¶
ValidateCommandResponse checks a CLI matcher and any finite source sequence. Sequence eligibility requires the explicit enclosing scenario version.
Types ¶
type CommandAdapter ¶
type CommandAdapter struct {
// contains filtered or unexported fields
}
CommandAdapter owns an immutable, task-private command response configuration.
func NewCommandAdapter ¶
func NewCommandAdapter(envelope Envelope, root, workspace string) (*CommandAdapter, error)
NewCommandAdapter builds every matcher and output before binding any state. Referenced fixtures must already be present in the private envelope. An empty workspace inherits the envelope's workspace when one is configured.
func (*CommandAdapter) Configuration ¶
func (adapter *CommandAdapter) Configuration() ([]byte, error)
Configuration returns a fresh private JSON envelope for subprocess recompilation.
func (*CommandAdapter) Invoke ¶
func (adapter *CommandAdapter) Invoke(ctx context.Context, args []string, cwd string, observer Observer, deliver func(CommandOutput) error) error
Invoke selects the first matching response, even when its sequence is exhausted. Undelivered responses never call deliver, and reservation is irreversible. The synchronous delivery callback must implement cancellation of native I/O.
type CommandOutput ¶
CommandOutput is delivered only after a configured response is ready.
type Envelope ¶
type Envelope struct {
Eval []byte `json:"eval"`
Kind string `json:"kind"`
Name string `json:"name"`
Tool string `json:"tool,omitempty"`
Workspace string `json:"workspace,omitempty"`
Responses []Fragment `json:"responses"`
Fixtures map[string][]byte `json:"fixtures,omitempty"`
}
Envelope is private adapter configuration, not a public eval or evidence schema. Eval is used only for canonical scenario eligibility, not whole-eval validation.
func DecodeEnvelope ¶
type Format ¶
type Format = models.FaultSourceFormat
type MCPAdapter ¶
type MCPAdapter struct {
// contains filtered or unexported fields
}
MCPAdapter is unregistered private dispatch for one server/tool owner.
func NewMCPAdapter ¶
func NewMCPAdapter(envelope Envelope, root string) (*MCPAdapter, error)
func (*MCPAdapter) Configuration ¶
func (adapter *MCPAdapter) Configuration() ([]byte, error)
func (*MCPAdapter) Invoke ¶
func (adapter *MCPAdapter) Invoke(ctx context.Context, request *jsonrpc.Request, observer Observer, deliver func(*jsonrpc.Response) error) error
Invoke delivers configured fixture errors as payloads. Operational failures never become success-shaped tool results or trigger another matcher. The synchronous delivery callback must implement cancellation of native I/O.
func (*MCPAdapter) Prepare ¶
func (adapter *MCPAdapter) Prepare(ctx context.Context, request *jsonrpc.Request, observer Observer) (*PendingMCPCall, error)
Prepare validates and reserves synchronously so a native admission reader can allocate in request order before running cancellable delivery concurrently. Observer callbacks must be prompt or cooperate with the caller's cancellation.
type Observer ¶
type Observer func(matcher, step int, transition Transition) error
Observer closures bind only identities actually available at the native call site. The adapter never invents identities or associates SDK and MCP IDs. A step of -1 means no finite allocation; callbacks receive no argument payloads. Callbacks are synchronous; the native caller owns cancellation of callback I/O.
type PendingMCPCall ¶
type PendingMCPCall struct {
// contains filtered or unexported fields
}
PendingMCPCall owns an irreversible allocation admitted by Prepare. Deliver may run once; copying a pointer does not permit another delivery.
type Transition ¶
type Transition string
const ( Reserved Transition = "reserved" Delivered Transition = "delivered" Canceled Transition = "canceled" Failed Transition = "failed" )