harnesstest

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Overview

Package harnesstest is TEST SUPPORT over the released harness runtime: a real harness session store, a real rig with one loop, and a recording inference client that answers every turn. It exists so that Host's tests about what a launch does to a DURABLE CONVERSATION — create, release, restore — run against harness's own journal rather than a fake that can only agree with itself.

Nothing in a production path imports it. It names github.com/looprig/inference only because harness's loop.WithInference takes an inference.Client, which is the one seam a test must supply to run a turn without a model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backend

func Backend(tb testing.TB) *storage.Composite

Backend is one in-memory storage composite. Tests that need two harness stores sharing a ledger but not a catalog build them from two Backends' parts with Compose.

func Compose

func Compose(tb testing.TB, ledger, kv *storage.Composite) *storage.Composite

Compose assembles a composite from another composite's ledger and a second one's KV, so a store opened over it reads one journal and a DIFFERENT catalog. Leases, blobs and the ordered index come from the ledger's side.

func CountSessionStarted

func CountSessionStarted(tb testing.TB, store *harnessstore.Store, id uuid.UUID) int

CountSessionStarted counts the SessionStarted records filed under id. A conversation that was restored has exactly one; one that was silently restarted has two.

func Events

func Events(tb testing.TB, store *harnessstore.Store, id uuid.UUID) []event.Event

Events replays every event filed under id, in order. A stream that cannot be opened is reported as a failure rather than as an empty history.

func Rig

func Rig(tb testing.TB, store *harnessstore.Store, llm inference.Client) *rig.Rig

Rig defines a real rig with one primer loop over store, answered by llm.

func Store

func Store(tb testing.TB, backend *storage.Composite, tenant sessionwire.TenantID) *harnessstore.Store

Store opens a harness session store for one tenant over backend.

Types

type RecordingLLM

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

RecordingLLM answers every turn with the text "ok" and records every request, so a test can read back the conversation a turn was run over.

func (*RecordingLLM) Invoke

Invoke is unused by a streaming loop and refuses.

func (*RecordingLLM) Requests

func (l *RecordingLLM) Requests() []inference.Request

Requests returns every request recorded so far.

func (*RecordingLLM) Stream

Stream records the request and streams one text chunk.

type RigLauncher

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

RigLauncher launches a real rig's sessions under a caller-named identity.

func Launcher

func Launcher(r *rig.Rig) RigLauncher

Launcher wraps a real rig.

func (RigLauncher) NewSessionUnder

func (l RigLauncher) NewSessionUnder(ctx context.Context, id uuid.UUID) (session.SessionController, error)

NewSessionUnder launches a new session under id with rig.WithSessionID.

Jump to

Keyboard shortcuts

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