conformance

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package conformance exercises the implemented Tessera core subset over HTTP. Passing this subset does not establish full protocol or composed-server isolation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCollections added in v0.3.0

func CheckCollections(ctx context.Context, f CollectionFixture) error

CheckCollections verifies collection_access through the wire protocol. The fixture's trusted host supplies grants, which are outside the record protocol.

func CheckContent

func CheckContent(ctx context.Context, f CoreFixture) error

func CheckCore

func CheckCore(ctx context.Context, f CoreFixture) error

CheckCore fails on the first violated contract, without including response bodies, field values or credentials in diagnostics. It accepts any HTTP server.

func CheckCreation

func CheckCreation(ctx context.Context, f CoreFixture) error

CheckCreation exercises dataset creation and the server-scoped receipt that makes a lost creation recoverable. It reads what discovery advertises and runs the matching half: a server offering no dataset_creation must refuse the route, and the refusal is as much the contract as the behaviour is.

Creation leaves datasets behind, so the suite erases what it makes. A server whose creator does not hold erase fails here rather than leaking a dataset per run, because the contract says the caller that asks becomes administrator.

func CheckOptionalReads

func CheckOptionalReads(ctx context.Context, f CoreFixture) error

CheckOptionalReads exercises aggregation, distinct references and text matching, which are required operations rather than capabilities.

They were capabilities, and a client without them compensated: reading rows and folding them, or filtering after reading. Neither compensation is equivalent to the operation it replaces — filtering after reading narrows a result set silently, and a client folding rows invents a bound that means nothing outside its own codebase. A server that finds any of these expensive declares a scan bound and refuses past it, which is what every other required operation already does.

The name is kept so a host calling it keeps calling it.

func CheckPaging

func CheckPaging(ctx context.Context, f CoreFixture) error

CheckPaging tests replay, complete traversal after a deletion, identity uniqueness and sequence release through the public HTTP surface.

func CheckRecovery

func CheckRecovery(ctx context.Context, f CoreFixture) error

CheckRecovery exercises durable-recovery HTTP semantics. The fixture is the same disposable dataset used by CheckCore. Persistence/crash tests additionally belong to the engine's integration suite; an HTTP pass cannot prove durability.

func CheckScopedAttachments added in v0.3.0

func CheckScopedAttachments(ctx context.Context, f ScopedAttachmentFixture) error

CheckScopedAttachments proves the target and principal binding over HTTP.

func CheckSharing

func CheckSharing(ctx context.Context, f CoreFixture) error

CheckSharing exercises the optional sharing capability: read-only guests, exact concrete type grants, and the difference between a record that is absent and one that is merely outside the caller's view.

A server that does not advertise sharing passes trivially. One that does must supply CoreFixture.Share, because grant administration is outside the protocol and without it the capability has no evidence behind it.

func CheckVersionMetadata

func CheckVersionMetadata(document []byte) error

CheckVersionMetadata checks the version fields of a discovery JSON document. Unknown response fields are ignored. Dates already in the past remain valid: a planned sunset does not prove that retirement conditions have been met.

func CheckVersionSelection

func CheckVersionSelection(selectVersion func([]string, []string) (string, error), vectors io.Reader) error

CheckVersionSelection runs portable version-selection vectors against a client implementation. Supply specs/vectors/version-selection.json from the release being qualified. Error cases must return an error and no selected version.

Types

type CollectionFixture added in v0.3.0

type CollectionFixture struct {
	URL, Owner string
	Client     *http.Client
	Set        func(context.Context, string, []store.CollectionScope, []store.CollectionScope, *time.Time) (string, error)
	// SetOwn replaces a named principal's collection reads, inserts, updates and deletes.
	SetOwn func(context.Context, string, []store.CollectionScope, []store.CollectionScope, []store.CollectionScope, []store.CollectionScope) (string, error)
}

CollectionFixture addresses a disposable dataset on a durable server. Set replaces a named fixture principal's grants and returns its stable token.

type CoreFixture

type CoreFixture struct {
	URL, Token, RefusedToken string
	Client                   *http.Client
	// Share installs a read-only guest grant over the named concrete types and
	// returns a token authenticating as that guest. Grant administration is
	// deliberately outside the protocol, so the host has to supply it; a
	// server that advertises sharing and leaves this nil fails CheckSharing
	// rather than skipping it, because then nothing proves the capability.
	Share func(ctx context.Context, types []string) (token string, err error)
	// Contribute installs an insert grant over the named concrete types, with
	// no read, and returns a token authenticating as that contributor. Owed
	// alongside Share, for the same reason: an insert grant is a grant.
	Contribute func(ctx context.Context, types []string) (token string, err error)

	// WithdrawCreation takes the fixture token's create_dataset right away and
	// returns a function restoring it. Server rights are account state, so like
	// grant administration they sit outside the protocol and the host has to
	// supply this; a server advertising dataset_creation and leaving it nil
	// fails CheckCreation rather than skipping, because the interesting promise
	// is what happens to an outcome once the right that produced it is gone.
	WithdrawCreation func(ctx context.Context) (restore func(), err error)

	// DisableCreation stops the deployment offering creation at all and returns
	// a function restoring it. Distinct from WithdrawCreation on purpose: one
	// withdraws this caller's authority, the other withdraws the capability,
	// and a client has to be able to tell the refusals apart while both leave
	// recovery working.
	DisableCreation func(ctx context.Context) (restore func(), err error)
}

CoreFixture addresses a dataset this suite may damage.

**Never point this at a deployment holding records anybody wants.** The suites here are not read-only and are not a health check: they define types, write records, upload content and leave all of it behind. Against a real deployment that is synthetic conformance data written permanently into somebody's storage, and no part of this package removes it.

"Disposable" is the whole requirement and it reads past easily — a consumer building a deployment gate pointed one at a live server, because a gate that exercises the real thing sounds like the more honest gate. It is not: the dataset must be one created for the run and thrown away after it.

Re-running against the same dataset is not supported either. Some suites mint a fresh type per run and some use a fixed identifier, so a second run meets its own leftovers — which is a defect that only ever appears on the second run, and never in a job that starts from nothing.

Token needs read, write and schema; RefusedToken authenticates but has write without read.

type ScopedAttachmentFixture added in v0.3.0

type ScopedAttachmentFixture struct {
	URL, Owner, Contributor, Other string
	Client                         *http.Client
	Grant                          func(context.Context, string, string, bool, bool) error
}

ScopedAttachmentFixture supplies two independent principals and a trusted grant setter. Both guests can read alpha and beta.

Jump to

Keyboard shortcuts

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