acceptance

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package acceptance runs explicitly requested acceptance cases through an already started Client. It never owns a Node or changes controller defaults.

Index

Constants

View Source
const (
	MaxRecordingFrames = 256
	MaxRecordingBytes  = 16 * 1024 * 1024
)

Variables

This section is empty.

Functions

func Archive

func Archive(ctx context.Context, controller *client.Client, directory string, sessions []protocol.SessionID) error

Archive finishes and records only the requested test-owned sessions. It uses an independent bounded context per session, including after caller cancellation. Archiving leaves canonical history available for diagnosis and replay while removing the fixture from the ordinary conversation list.

func CaptureRecording

func CaptureRecording(ctx context.Context, controller *client.Client, directory string, session protocol.SessionID) error

CaptureRecording reads only an explicitly owned conversation. Missing entry pages are completed against the captured history revision before removal. Tool details are read through Client's revision-checked public API.

func Execute

func Execute(ctx context.Context, controller *client.Client, directory string, command protocol.Command) (protocol.Output, error)

Execute journals a durable acceptance command before sending it. Unknown admission is inspected by its original identity, never replayed. Successful session creation and backup ownership are published atomically with settling that identity. This also covers a lost creation response before Own is called.

func ImportReportOwnership

func ImportReportOwnership(directory string, node protocol.NodeID) error

ImportReportOwnership merges old reports from fixed acceptance paths and explicit UUID fields before the caller replaces latest.json. Titles, global Node snapshots and filesystem scans never grant ownership.

func Own

func Own(directory string, node protocol.NodeID, session protocol.SessionID) error

Own durably records an explicitly created acceptance session before any further work. It merges with previous runs, including removal tombstones.

func OwnedSessions

func OwnedSessions(directory string, node protocol.NodeID) ([]protocol.SessionID, error)

OwnedSessions returns only explicitly recorded sessions that have not been confirmed removed. A runner uses it after a child exits before reporting its created sessions; result rows never establish cleanup ownership.

func PackageToolAlias

func PackageToolAlias(owner, name string) string

PackageToolAlias returns the canonical identity defined by the package tool naming contract: the first eight BLAKE3 bytes of the owner name. Callers must verify the declared tool against the turn's captured package version; an arbitrary tool with a matching suffix is never accepted.

func RecordingPath

func RecordingPath(directory string, session protocol.SessionID) string

func SelectConfig

func SelectConfig(snapshot protocol.Snapshot, requested *protocol.SessionConfig) (protocol.SessionConfig, error)

SelectConfig resolves the enabled acceptance model and its default effort without changing Node defaults or retaining a resource or assistant binding.

Types

type CaseResult

type CaseResult struct {
	ID            string        `json:"id"`
	Group         string        `json:"group"`
	Title         string        `json:"title"`
	Status        string        `json:"status"`
	Detail        string        `json:"detail"`
	Duration      time.Duration `json:"duration"`
	Session       string        `json:"session,omitempty"`
	OwnedSessions []string      `json:"owned_sessions,omitempty"`
	Turns         []string      `json:"turns"`
	Evidence      []Evidence    `json:"evidence"`
	Uncertain     bool          `json:"uncertain,omitempty"`
}

func ListBackendCases

func ListBackendCases(suite string) ([]CaseResult, error)

ListBackendCases describes the explicit suite without accessing a Client.

type Evidence

type Evidence struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

type Options

type Options struct {
	Suite           string                  `json:"suite"`
	Config          *protocol.SessionConfig `json:"config,omitempty"`
	Cases           []string                `json:"cases,omitempty"`
	CaseTimeout     time.Duration           `json:"case_timeout,omitempty"`
	ReportDirectory string                  `json:"report_directory,omitempty"`
}

type Recorder

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

Recorder aggregates copied frames in memory. Flush merges them with any canonical capture already on disk. Append does no filesystem work.

func NewRecorder

func NewRecorder(directory string, node protocol.NodeID, session protocol.SessionID) (*Recorder, error)

func (*Recorder) Append

func (recorder *Recorder) Append(frame RecordingFrame) error

func (*Recorder) Flush

func (recorder *Recorder) Flush() error

type RecordingFrame

type RecordingFrame struct {
	At       time.Duration                 `json:"at"`
	Snapshot protocol.ConversationSnapshot `json:"snapshot"`
}

type RecordingSession

type RecordingSession struct {
	Version       int                          `json:"version"`
	Node          protocol.NodeID              `json:"node"`
	Session       protocol.SessionID           `json:"session"`
	Captured      time.Time                    `json:"captured"`
	History       protocol.ConversationHistory `json:"history"`
	Tools         []RecordingTool              `json:"tools"`
	Frames        []RecordingFrame             `json:"frames"`
	Truncated     bool                         `json:"truncated"`
	DroppedFrames int                          `json:"dropped_frames"`
}

RecordingSession contains only a test-owned conversation's public history, snapshots and original tool details. It never serializes a Node snapshot, SessionConfig, turn capture, provider settings or credential configuration. Truncated includes omitted history, tool details and frames. A replay must expose that flag rather than claim to reproduce the entire live run.

func ReadRecording

func ReadRecording(directory string, session protocol.SessionID) (RecordingSession, error)

type RecordingTool

type RecordingTool struct {
	Reference protocol.ToolDetailReference `json:"reference"`
	Detail    *protocol.ToolDetail         `json:"detail,omitempty"`
	Error     string                       `json:"error,omitempty"`
}

type Report

type Report struct {
	Version  int              `json:"version"`
	Node     protocol.NodeID  `json:"node,omitempty"`
	Suite    string           `json:"suite"`
	Started  time.Time        `json:"started"`
	Finished time.Time        `json:"finished"`
	Provider string           `json:"provider"`
	Model    string           `json:"model"`
	Effort   *protocol.Effort `json:"effort,omitempty"`
	Cases    []CaseResult     `json:"cases"`
}

func Cleanup

func Cleanup(ctx context.Context, controller *client.Client, directory string, emit func(CaseResult)) (report Report, resultErr error)

Cleanup imports only explicit identities from this directory's ledger and previous reports. It preserves bounded recordings before revision-checked removal. Failed or unknown operations remain recorded for another inspection; no title-based discovery or user-session scan is used to grant ownership.

func RunBackend

func RunBackend(ctx context.Context, controller *client.Client, options Options, emit func(CaseResult)) (report Report, resultErr error)

RunBackend is opt-in: ordinary tests never call it with a real model. Each case creates only unassigned sessions and confines its fixtures to their workspaces. The caller retains ownership of the already started Client.

func (Report) OK

func (report Report) OK() bool

OK requires an actual passing case and rejects incomplete execution.

type ReportPaths

type ReportPaths struct {
	JSON string `json:"json"`
	HTML string `json:"html"`
}

func WriteReport

func WriteReport(directory string, report Report) (ReportPaths, error)

WriteReport publishes private, complete files at fixed paths. The report contains test-owned evidence; HTML always treats that evidence as plain text.

Jump to

Keyboard shortcuts

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