Package agent/storetest
Go module github.com/bide-ai/bide; all packages.
github.com/bide-ai/bide/agent/storetest · pkg.go.dev · Stability: core
Package storetest checks that an agent.Store meets the requirements the journal builds on (A1 to A8, documented on agent.Store), that a Journal over it writes and checks the journal format header, and that records round-trip byte for byte.
Functions
func CheckWrapper(t testing.TB, wrap func(agent.Store) agent.Store, ctxs ...context.Context): CheckWrapper checks a store wrapper against the rules for wrappers (see agent.Store): its mapping of run IDs and names to stored entries does not depend on the context (A1), and it may expose the capabilities of the store it wraps through Unwrap only if it passes run IDs and names through unchanged.func Holder(t *testing.T, open func(t *testing.T) agent.Store): Holder checks agent.Holder on a store that implements it, with the store's Redactor: that a hold is kept and listed, that placing a duplicate or a malformed hold is refused, that a store refuses to replace a record of a run a hold covers (a run named by it, or with Tree a sub-agent run below one), and that lifting the hold lets the erasure go ahead.func Redactor(t *testing.T, open func(t *testing.T) agent.Store): Redactor checks agent.Redactor on a store that implements it: that a redaction replaces one entry's bytes with a tombstone and nothing else (position, name and every other entry unchanged), and that it refuses, writing nothing, a run that is not over, a run with a live lease, a protected record, a tombstone that does not keep the bytes' leaf hash, an entry that is not the one the caller read, and an entry the run does not hold.func Run(t *testing.T, open func(t *testing.T) agent.Store): Run runs the whole suite: the store requirements (A1 to A8), the Lister contract when the store implements agent.Lister (with RunFilter.LeaseLapsed over its leases, or over none without agent.Leaser, and Leaser.ReapLeases when it has both), the journal header checks, the Journal's shared in-flight steps and claims, and the record-fidelity suite over a Journal on the store.
type Case
go
type Case struct {
Name string
Record agent.Record
Want json.RawMessage
}Case is one record the suite round-trips.
Constructors and functions
func Cases() []Case: Cases returns the records the suite round-trips, for stores that want to run further checks (such as comparing the bytes they persisted) on the same inputs.