e2e

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package e2e proves the composed SDK works end to end. The harness holds the shared deterministic tools and recorders; the scenarios in e2e/e2e_test wire real high-level blocks together and assert each run's outputs. See docs/plans/e2e.md.

Index

Constants

This section is empty.

Variables

View Source
var ErrFault = errors.New("e2e: injected fault")

ErrFault is the error every fault decorator wraps on its injected call. A scenario asserts a failing run with errors.Is.

Functions

func NewAgent

func NewAgent(name string, plan *flow.Definition) (*agent.Agent, error)

NewAgent builds an Agent over plan under a fresh identity and a one-capability card, failing only when key generation fails.

Types

type EscalateTool

type EscalateTool struct {
	ToolName string
}

EscalateTool fails every run with an error wrapping agent.ErrEscalated, so a wired Ask round trip can resolve it.

func (EscalateTool) Name

func (t EscalateTool) Name() string

Name returns the registry name.

func (EscalateTool) Run

func (t EscalateTool) Run(ctx context.Context, in tools.InOut) (tools.Out, error)

Run reports that the step needs a human decision.

type FaultCompleter

type FaultCompleter struct {
	// Completer is the wrapped provider. Required.
	Completer provider.Completer
	// FaultOn is the 1-based method call to fail. Zero disables.
	FaultOn int32
	// contains filtered or unexported fields
}

FaultCompleter wraps a provider.Completer and faults one call. The FaultOn-th Chat or ChatStream call returns an error wrapping ErrFault; every other call passes through.

func (*FaultCompleter) Chat

Chat faults on the target call, else passes through.

func (*FaultCompleter) ChatStream

func (f *FaultCompleter) ChatStream(ctx context.Context, req provider.Request) (<-chan provider.Chunk, error)

ChatStream faults on the target call, else passes through.

func (*FaultCompleter) Name

func (f *FaultCompleter) Name() string

Name returns a fixed label; it never faults.

type FaultNotifier

type FaultNotifier struct {
	// Notifier is the wrapped channel. Required.
	Notifier channel.Notifier
	// FaultOn is the 1-based ask to fail. Zero disables faults.
	FaultOn int32
	// contains filtered or unexported fields
}

FaultNotifier wraps a channel.Notifier and faults one call. The FaultOn-th ask returns an error wrapping ErrFault; every other ask passes through.

func (*FaultNotifier) Notify

Notify faults on the target ask, else passes through. It satisfies channel.Notifier, so a caller assigns the method value.

type FaultStore

type FaultStore struct {
	// Store is the wrapped ledger.Store. Required.
	Store ledger.Store
	// FaultOn is the 1-based call to fail. Zero disables faults.
	FaultOn int32
	// HangOn is the 1-based call to block until ctx is done. Zero disables.
	HangOn int32
	// contains filtered or unexported fields
}

FaultStore wraps a ledger.Store and faults one call. The FaultOn-th call returns an error wrapping ErrFault; the HangOn-th call blocks until ctx is done, then returns ctx.Err(); every other call passes through unchanged. Zero on a mode disables it.

func (*FaultStore) CompareAndSwap

func (f *FaultStore) CompareAndSwap(ctx context.Context, key ledger.IdempotencyKey, old, new ledger.TaskState) (bool, error)

CompareAndSwap faults or hangs on its target call, else passes through.

func (*FaultStore) Load

Load faults or hangs on its target call, else passes through.

func (*FaultStore) Range

func (f *FaultStore) Range(ctx context.Context, fn func(ledger.TaskState) bool) error

Range faults or hangs on its target call, else passes through.

type FaultWait

type FaultWait struct {
	// Inner is the wrapped agent.AckWait. Required.
	Inner agent.AckWait
	// FaultOn is the 1-based ack to fail. Zero disables faults.
	FaultOn int32
	// contains filtered or unexported fields
}

FaultWait wraps an agent.AckWait and faults one call. The FaultOn-th ack resolution returns an error wrapping ErrFault; every other call passes through.

func (*FaultWait) Wait

func (f *FaultWait) Wait(ctx context.Context, msg envelope.Message) (envelope.Ack, error)

Wait faults on the target ack, else passes through. It satisfies agent.AckWait, so a caller assigns the method value.

type HangCompleter

type HangCompleter struct{}

HangCompleter is a provider.Completer whose Chat and ChatStream block until ctx is done, then return ctx.Err(). It models a provider whose response never arrives unless the caller cancels, so a scenario asserts a runner with a deadline surfaces the timeout, not a hang.

func (*HangCompleter) Chat

Chat blocks until ctx is done, then returns ctx.Err().

func (*HangCompleter) ChatStream

func (h *HangCompleter) ChatStream(ctx context.Context, _ provider.Request) (<-chan provider.Chunk, error)

ChatStream blocks until ctx is done, then returns ctx.Err().

func (*HangCompleter) Name

func (h *HangCompleter) Name() string

Name returns a fixed label.

type PrefixTool

type PrefixTool struct {
	ToolName string
	Prefix   string
}

PrefixTool returns its prefix joined to the string payload it receives, so each step records a distinct, deterministic result.

func (PrefixTool) Name

func (t PrefixTool) Name() string

Name returns the registry name.

func (PrefixTool) Run

func (t PrefixTool) Run(ctx context.Context, in tools.InOut) (tools.Out, error)

Run returns the prefix joined to the input payload string.

type Recorder

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

Recorder counts every event it observes, in arrival order. It is safe for concurrent use.

func NewRecorder

func NewRecorder() *Recorder

NewRecorder returns an empty Recorder.

func (*Recorder) Handler

func (r *Recorder) Handler() events.Handler

Handler returns the Handler to subscribe on a bus.

func (*Recorder) Names

func (r *Recorder) Names() []events.Name

Names returns every observed event name, in arrival order.

type ThreadCapture

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

ThreadCapture is an agent.AckWait that confirms every step message and records the signed messages for later thread verification.

func NewThreadCapture

func NewThreadCapture() *ThreadCapture

NewThreadCapture returns an empty ThreadCapture.

func (*ThreadCapture) Messages

func (t *ThreadCapture) Messages() []envelope.Message

Messages returns every recorded message, in wait order.

func (*ThreadCapture) Wait

Wait confirms msg and records it.

Jump to

Keyboard shortcuts

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