storetest

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 47 Imported by: 0

Documentation

Overview

Package storetest is a backend-agnostic conformance suite for store.Store implementations. Postgres, sqlite, and mongo each hand-write the same scope predicate/upsert logic independently — Conformance exists so the contract that logic has to satisfy is defined exactly once and run against all three, instead of three parallel hand-maintained test files that can silently drift out of sync with each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A2AAskResolutionTransactions

func A2AAskResolutionTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

A2AAskResolutionTransactions tests native rollback and ambiguous acknowledgments.

func A2AHeldReleaseTransactions

func A2AHeldReleaseTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

A2AHeldReleaseTransactions checks rollback and lost commit acknowledgments.

func A2AReplyTransactions

func A2AReplyTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

A2AReplyTransactions checks native rollback and ambiguous commit recovery.

func A2ARoutingUpgrade

func A2ARoutingUpgrade(t *testing.T, s store.Store, legacy func())

A2ARoutingUpgrade checks legacy records after removing their routing fields.

func A2ASQLRoutingUpgrade

func A2ASQLRoutingUpgrade(t *testing.T, s store.Store, exec func(string) error)

A2ASQLRoutingUpgrade recreates the schema before routing partitions, then replays an unrecorded migration after its columns and indexes already exist.

func AcceptedLessonFixture

func AcceptedLessonFixture(t *testing.T, s store.Store) (context.Context, learning.AcceptRequest)

AcceptedLessonFixture provides a durable accepted result and lesson proposal.

func ArtifactBoard

func ArtifactBoard(t *testing.T, s store.Store)

ArtifactBoard exercises accepted resource conflicts without rewriting results.

func ArtifactBoardTransactions

func ArtifactBoardTransactions(t *testing.T, s store.Store, driver assurance.Driver)

ArtifactBoardTransactions covers atomic intent rollback and lost acknowledgments.

func ArtifactPublication

func ArtifactPublication(t *testing.T, s store.Store)

ArtifactPublication verifies actual managed publication, restart and drainage.

func AssignmentTransactions

func AssignmentTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

AssignmentTransactions exercises rollback, ambiguous acknowledgements and serialization with a separate plan writer against each actual database.

func BudgetTransactions

func BudgetTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

BudgetTransactions exercises shared accounting over real plan transactions.

func BudgetedClaimTransactions

func BudgetedClaimTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

BudgetedClaimTransactions checks atomic ownership and accounting on real stores.

func CaptureIntentRestart

func CaptureIntentRestart(t *testing.T, s store.Store, reopen func() store.Store)

CaptureIntentRestart recovers pre-generation policy from reopened storage.

func CaptureIntentRollback

func CaptureIntentRollback(t *testing.T, s store.Store, driver assurance.Driver)

CaptureIntentRollback proves registration and later capture use real transactions.

func CheckpointSweep added in v1.10.0

func CheckpointSweep(t *testing.T, newStore func(t *testing.T) store.Store)

CheckpointSweep proves the sweeper's listing of pending checkpoints: every scope, pending only, in id order, resumable after any id.

func ClaimTransactions

func ClaimTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

ClaimTransactions exercises ownership recovery against the backend's real plan transaction. It never starts an agent or an external effect.

func Conformance

func Conformance(t *testing.T, newStore func(t *testing.T) store.Store)

Conformance runs the full scope-isolation contract against any backend. newStore must return a freshly migrated, empty store; Conformance calls it once per subtest so tests never see another subtest's rows.

func ConversationIntegrity

func ConversationIntegrity(t *testing.T, st store.Store, corrupt func(context.Context, string, string) error)

ConversationIntegrity checks that malformed persisted messages cannot silently disappear from context. Corrupt changes this agent's conversation content only.

func CoordinationEvents

func CoordinationEvents(t *testing.T, s store.Store)

CoordinationEvents verifies durable import, stable delivery identities and current authority using actual accepted artifacts and their source journals.

func CreateRunDuplicateID added in v1.10.0

func CreateRunDuplicateID(t *testing.T, newStore func(t *testing.T) store.Store)

CreateRunDuplicateID proves a second CreateRun with an id that already exists is refused with cortex.ErrAlreadyExists and leaves the first run as it was. The engine relies on it to make a host's pre-assigned run id idempotent: a retried start must not run the same work twice.

func CurrentTaskAcceptanceRead

func CurrentTaskAcceptanceRead(t *testing.T, s store.Store)

CurrentTaskAcceptanceRead checks operator projections against the same live evidence rules used by dependent task admission, including later withdrawal.

func EffectContinuationExecution

func EffectContinuationExecution(t *testing.T, backend store.Store, driver assurance.Driver)

EffectContinuationExecution verifies durable attempts against each backend. Provider fixtures do not qualify installed authority or idempotency guarantees.

func LeasedClaims added in v1.10.0

func LeasedClaims(t *testing.T, newStore func(t *testing.T) store.Store)

LeasedClaims proves the claims that take a run's lease, and write its first progress snapshot, in the transaction that moves it to running: a claimer that dies right after leaves a lease that lapses and a snapshot to continue from, never a running run nobody owns.

func OrchestrationContinuationUpgrade

func OrchestrationContinuationUpgrade(t *testing.T, s store.Store, legacy func())

OrchestrationContinuationUpgrade preserves legacy teams without granting resume authority.

func OrchestrationRevisionUpgrade

func OrchestrationRevisionUpgrade(t *testing.T, s store.Store, legacy func())

OrchestrationRevisionUpgrade preserves historical children through upgrade.

func OrchestrationSQLContinuationUpgrade

func OrchestrationSQLContinuationUpgrade(t *testing.T, s store.Store, exec func(string) error)

OrchestrationSQLContinuationUpgrade also replays a schema change whose acknowledgment was lost.

func OrchestrationSQLRevisionUpgrade

func OrchestrationSQLRevisionUpgrade(t *testing.T, s store.Store, exec func(string) error)

OrchestrationSQLRevisionUpgrade also replays an unrecorded schema change.

func PlanReplanExecution

func PlanReplanExecution(t *testing.T, newStore func(*testing.T) store.Store)

PlanReplanExecution exercises durable model admission, failure debt and guarded graph transitions in every backend, without claiming host proof qualification.

func PlanReplanRecovery

func PlanReplanRecovery(t *testing.T, backend store.Store, driver assurance.Driver)

PlanReplanRecovery verifies proof-bound commits against real retained claims, journals and accounting, including transaction rollback and uncertain admission.

func PrivateCandidateRestart

func PrivateCandidateRestart(t *testing.T, s store.Store, reopen func() store.Store)

PrivateCandidateRestart recovers capture and publishes only after fresh commit.

func PrivateCandidateRollback

func PrivateCandidateRollback(t *testing.T, s store.Store, driver assurance.Driver)

PrivateCandidateRollback verifies capture and publication using real transactions.

func QualifiedLearning

func QualifiedLearning(t *testing.T, newStore func(*testing.T) store.Store)

QualifiedLearning verifies accepted evidence, durable outboxes and local withdrawal.

func QualifiedLearningGuard

func QualifiedLearningGuard(t *testing.T, s store.Store)

QualifiedLearningGuard checks withdrawal and grants around content hydration.

func QualifiedLearningRetentionRace

func QualifiedLearningRetentionRace(t *testing.T, s store.Store, driver assurance.Driver)

QualifiedLearningRetentionRace checks a cross-run correction against a stale deletion observation, then inspects every historical payload in real storage.

func ReadyClaimTransactions

func ReadyClaimTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

ReadyClaimTransactions exercises prerequisite admission and atomic ownership, accounting and event retention against each real database driver.

func ReflectionExecution

func ReflectionExecution(t *testing.T, newStore func(*testing.T) store.Store)

ReflectionExecution covers atomic decisions, stale authority inputs and recovery.

func ReportObservations

func ReportObservations(t *testing.T, newStore func(*testing.T) store.Store)

ReportObservations checks dynamic supervisor evidence at save, commit and read.

func ResultSnapshotBoundaries

func ResultSnapshotBoundaries(t *testing.T, s store.Store, driver assurance.Driver)

ResultSnapshotBoundaries checks expiry and failures at transaction boundaries.

func ResumeAdmissionTransactions

func ResumeAdmissionTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

ResumeAdmissionTransactions verifies rollback and ambiguous acknowledgments at both durable boundaries using each backend's native transaction implementation.

func ResumeClosureTransactions

func ResumeClosureTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

ResumeClosureTransactions checks incomplete closure against native drivers.

func ResumeExpiryTransactions

func ResumeExpiryTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

ResumeExpiryTransactions exercises expiry against each native transaction driver.

func ReviewTransactions

func ReviewTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

ReviewTransactions checks commit uncertainty and evidence freshness using the same backend transaction faults exercised by assignment submission tests.

func RunCallTransactions

func RunCallTransactions(t *testing.T, driver assurance.Driver)

RunCallTransactions verifies real rollback, ambiguous commits and legacy rows through each backend's transaction driver, without an external provider call.

func RunCallTransactionsUnavailable

func RunCallTransactionsUnavailable(t *testing.T, s execution.RunCallSealStore)

RunCallTransactionsUnavailable verifies that a store without usable transactions cannot admit calls or acknowledge closure, including after creating its anchor.

func RunCandidateLease added in v1.10.0

func RunCandidateLease(t *testing.T, s store.Store, driver assurance.RunDriver)

RunCandidateLease proves that SetRunCandidate, the run write behind suspension claims, resume closure and private candidates, keeps a lease only on a running run. A run it moves out of running loses its lease, so the sweeper never lists it as lapsed; a run it leaves running keeps the lease its worker holds.

func RunContinuation added in v1.10.0

func RunContinuation(t *testing.T, newStore func(t *testing.T) store.Store)

RunContinuation proves the store half of non-blocking resume. A decision or an answer moves a paused run to ready, any replica claims it once, and a worker's lease on a running run either holds, hands off, or lapses into reclaimable for the sweeper to give to someone else.

func RunPrincipal added in v1.10.0

func RunPrincipal(t *testing.T, newStore func(t *testing.T) store.Store)

RunPrincipal proves a run keeps the codec bytes it was created with. A resume decodes them to put the original caller back on the context, so a store that dropped them on any read, or on the update that pauses the run, would resume every run under nobody.

The bytes never reach JSON: a run is served to API clients as JSON, and what a host's codec wrote is the host's business.

func RunProgress added in v1.10.0

func RunProgress(t *testing.T, newStore func(t *testing.T) store.Store)

RunProgress proves the store half of continuing a run after its worker dies. A worker saves the run's progress at each durable boundary, only while it still holds the run's lease, and a replica that reclaims the run reads that snapshot back exactly as it was written.

func RunProgressCascade added in v1.10.0

func RunProgressCascade(t *testing.T, s store.Store, deleteRun func(context.Context, id.AgentRunID) error)

RunProgressCascade proves that a run's progress row goes when the run does. Stores have no method that deletes a run, so the backend passes deleteRun, which removes the run row the way an operator would. Mongo has no foreign keys and does not run it.

func RunRecoveryTransactions

func RunRecoveryTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

RunRecoveryTransactions checks evidence revalidation inside the real plan transaction. These storage fixtures do not authenticate proof or adopt tasks.

func RunReplyRoute added in v1.10.0

func RunReplyRoute(t *testing.T, newStore func(t *testing.T) store.Store)

RunReplyRoute proves a run keeps the reply route it was created with, and never serializes it. The engine writes a directive run's route, the asker's reply token included, so that whichever replica finishes the run can answer; a run is served to API clients as JSON, and the token must not reach them.

func SubmissionTransactions

func SubmissionTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

SubmissionTransactions verifies that evidence and run fences survive until the assignment observation commits, and that uncertainty preserves history.

func SuspensionVersionTransactions

func SuspensionVersionTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

SuspensionVersionTransactions verifies rollback and ambiguous claim commits.

func TaskAcceptanceTransactions

func TaskAcceptanceTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

TaskAcceptanceTransactions checks rollback and time fences on real backends.

func TaskAdjudication

func TaskAdjudication(t *testing.T, newStore func(*testing.T) store.Store)

TaskAdjudication exercises required review, retained evidence and atomic acceptance.

func TaskAdoptionProcessCrash

func TaskAdoptionProcessCrash(t *testing.T, open func(*testing.T, string) (store.Store, assurance.Driver))

TaskAdoptionProcessCrash kills a test-owned coordinator at the real backend's commit boundary, then reopens its database. The opener must use the supplied path so every child resource remains owned by the parent test directory. Fixture authority qualifies persistence and lifecycle, not remote quiescence.

func TaskCompletionAbandonment

func TaskCompletionAbandonment(t *testing.T, newStore func(*testing.T) store.Store)

TaskCompletionAbandonment tests permanent closure, conservative accounting and current authority. These fixture attestations do not qualify a live host fence.

func TaskCompletionAdmission

func TaskCompletionAdmission(t *testing.T, newStore func(*testing.T) store.Store)

TaskCompletionAdmission checks that review identity and capacity are atomic.

func TaskCompletionLifecycle

func TaskCompletionLifecycle(t *testing.T, newStore func(*testing.T) store.Store)

TaskCompletionLifecycle checks restart recovery and uncertain dispatch boundaries.

func TaskDispatchTransactions

func TaskDispatchTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

TaskDispatchTransactions verifies readiness, ownership and assignment changes commit together without invoking a worker or treating a retry as permission.

func TaskRecoveryAdoption

func TaskRecoveryAdoption(t *testing.T, backend store.Store, driver assurance.Driver)

TaskRecoveryAdoption exercises recovery against real durable verifier and ownership records. Fixture proof references do not qualify a host authenticator.

func TaskRetirement

func TaskRetirement(t *testing.T, backend store.Store, driver assurance.Driver)

TaskRetirement verifies durable retirement, replacement and historical retries. Fixture attestations exercise storage contracts, not installed host authority.

func TaskRunTransactions

func TaskRunTransactions(t *testing.T, backend store.Store, driver assurance.Driver)

TaskRunTransactions tests atomic reserved child creation and capture policy.

func TerminalEventRollback

func TerminalEventRollback(t *testing.T, s store.Store, driver assurance.Driver)

TerminalEventRollback proves terminal state, receipt and replay share rollback.

func VerificationCallRecovery

func VerificationCallRecovery(t *testing.T, s store.Store, driver assurance.Driver)

VerificationCallRecovery preserves dispatch across takeover and transaction failure.

func VerificationCallRestart

func VerificationCallRestart(t *testing.T, s store.Store, reopen func() store.Store)

VerificationCallRestart proves a lost dispatch acknowledgement is not replayable.

func VerificationCaptureRestart

func VerificationCaptureRestart(t *testing.T, s store.Store, reopen func() store.Store)

VerificationCaptureRestart recovers the same capture after reopening storage.

func VerificationCaptureRollback

func VerificationCaptureRollback(t *testing.T, s store.Store, driver assurance.Driver)

VerificationCaptureRollback checks every capture write inside a real transaction.

func VerificationExecutorRestart

func VerificationExecutorRestart(t *testing.T, s store.Store, reopen func() store.Store)

VerificationExecutorRestart recovers a retained provider outcome after the database is closed and reopened, without a second evaluator invocation.

func VerificationJobConcurrentClaims

func VerificationJobConcurrentClaims(t *testing.T, s store.Store)

VerificationJobConcurrentClaims permits one worker generation per live lease.

func VerificationJobLeases

func VerificationJobLeases(t *testing.T, s store.Store, driver assurance.Driver)

VerificationJobLeases exercises persisted ownership using deterministic host time.

func VerificationJobRestart

func VerificationJobRestart(t *testing.T, s store.Store, reopen func() store.Store)

VerificationJobRestart preserves partial reports and claim identity after closing and reopening the database. It never invokes generation or tools.

func VerificationJobRollback

func VerificationJobRollback(t *testing.T, s store.Store, driver assurance.Driver)

VerificationJobRollback injects failure after enqueue, report and final commit writes, then proves each operation can be retried without partial progress.

func VerificationJobTermination

func VerificationJobTermination(t *testing.T, s store.Store, driver assurance.Driver)

VerificationJobTermination checks deadlines, attempt limits, cancellation and failed checks without assigning a successful verification status to the run.

func VerifiedResultRestart

func VerifiedResultRestart(t *testing.T, s store.Store, reopen func() store.Store)

VerifiedResultRestart checks that reopening storage preserves the original receipt and event ID and that a lost acknowledgement can be retried safely.

func VerifiedResultRevocation

func VerifiedResultRevocation(t *testing.T, s store.Store, driver assurance.Driver)

VerifiedResultRevocation checks a deletion after the initial transaction reads. Use this for row-locking or snapshot backends. SQLite holds a database write lock from the start, so a competing delete cannot reach this window there.

func VerifiedResultRollback

func VerifiedResultRollback(t *testing.T, s store.Store, driver assurance.Driver)

VerifiedResultRollback injects failure after both writes in a real transaction. It also proves a retry can succeed without an orphan result or advanced run.

Types

type TaskCompletionFixture

type TaskCompletionFixture struct {
	Context            context.Context
	Request            coordination.TaskCompletionRequest
	Acceptance         coordination.TaskAcceptanceRequest
	Review             coordination.Review
	Submission         coordination.Submission
	ProducerAssignment coordination.Assignment
	Plan               planning.Plan
	Contract           verification.Contract
}

TaskCompletionFixture supplies real retained producer evidence for runtime integration tests. Request identities may be replaced before admission.

func NewTaskCompletionFixture

func NewTaskCompletionFixture(t *testing.T, backend store.Store, deferred bool) TaskCompletionFixture

NewTaskCompletionFixture commits a verified producer result. When deferred is true, the assignment remains working so the completion service must submit it.

Source Files

Jump to

Keyboard shortcuts

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