Documentation
¶
Overview ¶
Package fakeprovider provides a deterministic scripted ReviewProvider for tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNilContext reports an invocation made without a context. ErrNilContext = errors.New("fake provider: nil context") // ErrNilProvider reports an invocation on a nil Provider. ErrNilProvider = errors.New("fake provider: nil provider") )
Functions ¶
This section is empty.
Types ¶
type CallSummary ¶
type CallSummary struct {
ProviderInstance string
Role domain.Role
Purpose ports.ProviderInvocationPurpose
AttemptID domain.AttemptID
SourceInvocationID string
ExecutionInvocationID string
CompleteStdinSHA256 string
StdinByteLength int
}
CallSummary is a redacted provider-call transcript entry. It deliberately excludes raw stdin, stdout, and scripted error messages.
type ExpectedCall ¶
type ExpectedCall struct {
ProviderInstance string
Role domain.Role
Purpose ports.ProviderInvocationPurpose
AttemptID domain.AttemptID
SourceInvocationID string
ExecutionInvocationID string
Stdin []byte
Result Result
}
ExpectedCall describes one expected provider invocation in script order. New validates Stdin against the invocation contract, records only its integrity metadata, and does not retain the raw bytes.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements ports.ReviewProvider by consuming a fixed ordered script.
func New ¶
func New(script []ExpectedCall) (*Provider, error)
New constructs a deterministic provider from an ordered script. It validates every expected identity and defensively copies mutable fixtures.
func (*Provider) Invoke ¶
func (provider *Provider) Invoke(ctx context.Context, invocation ports.ProviderInvocation) (ports.ProviderResult, error)
Invoke verifies and consumes exactly the next scripted call. A canceled context is returned before any script entry is consumed.
func (*Provider) Transcript ¶
func (provider *Provider) Transcript() []CallSummary
Transcript returns caller-owned redacted summaries of calls consumed in invocation order.
type Result ¶
type Result struct {
Stdout []byte
Error *ScriptError
}
Result configures either stdout or a typed error for one expected call. Stdout and Error are mutually exclusive when Error is non-nil.
type ScriptError ¶
ScriptError is a typed, immutable-by-provider error returned by a scripted call.
func (*ScriptError) Error ¶
func (err *ScriptError) Error() string
type UnexpectedCallError ¶
type UnexpectedCallError struct {
// contains filtered or unexported fields
}
UnexpectedCallError reports an extra, out-of-order, or mismatched call. Its summaries remain redacted and cannot mutate Provider state.
func (*UnexpectedCallError) Actual ¶
func (err *UnexpectedCallError) Actual() CallSummary
Actual returns the redacted call that did not match the script.
func (*UnexpectedCallError) Error ¶
func (err *UnexpectedCallError) Error() string
func (*UnexpectedCallError) Expected ¶
func (err *UnexpectedCallError) Expected() (CallSummary, bool)
Expected returns the next scripted call that rejected Actual. It reports false for an extra call after the script was exhausted.