Skip to main content

internal/conformance/reference.go

internal/conformance · 266 lines · 8 declarations · source

Declarations

type Reference

type Reference struct {
// Each knob, when set, breaks one rule. All false is conformant.
InjectAsRole string // inject memory as this role instead of user
UnmarkedMemory bool // inject memory without the untrusted mark
RecallFatal bool // raise a recall failure to the application
SilentWriteFailure bool // swallow a store failure
StoreOnFailure bool // store the turn even when the model failed
StoreToolTraffic bool // store the tool call and result as memory
StoreSynthetic bool // store a framework-written message as memory
StoreMemoryMessage bool // store the injected memory message as a user message
CompactLocally bool // replace the history with a summary written here instead of the deployment's context
KeepHistory bool // hand the model the history beside the context that replaced it
DropInput bool // hand the model the context and not the person's message
FreshKeyEachRun bool // mint a new idempotency key on every store, so a retry is a second turn
CollapseGroups bool // observe every message under one group ordinal, as though the turn were indivisible
ContextFatal bool // raise a context failure to the application
}

Reference is the smallest adapter that keeps every rule, in this process, over the public contract. It exists for two reasons. It proves the suite can pass, so a failing adapter is failing the rules and not the runner. And its knobs let a test break each rule on purpose and watch the suite name it, which is what makes the suite a proof rather than a checklist: a suite nobody has seen fail has asserted nothing.

It is not a product adapter. It has no framework seam and no filters beyond the defaults the rules require; an adapter in another language reproduces its behaviour, not its code.

source

method Reference.Run

func (r *Reference) Run(ctx context.Context, in Instruction) (Report, error)

source

method Reference.provide

func (r *Reference) provide(ctx context.Context, client *apiClient, in Instruction) (*string, error)

source

method Reference.compact

func (r *Reference) compact(ctx context.Context, client *apiClient, in Instruction) (string, error)

compact asks the deployment for the subject's assembled history and renders it as the one memory message: the watermark, the assembly's cost as the plan, and its arrays unchanged.

source

func summarise

func summarise(history []Message) string

summarise is what a broken adapter does: prose of its own over the history.

source

method Reference.store

func (r *Reference) store(ctx context.Context, client *apiClient, in Instruction, memory *string) (bool, error)

source

func turnKey

func turnKey(subject, run string, messages []message) string

turnKey is a version-5-shaped UUID over the subject, the run and the messages, in that order, each line-terminated so that no arrangement of contents collides with another.

source

type message

type message struct {
GroupOrdinal int `json:"group_ordinal"`
Role string `json:"role"`
Content string `json:"content"`
}

message is one message as the reference stores it: its group, role and content.

source