contracttest

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentConnectorFamilyCoverage = []ConnectorFamilyCoverage{
	{ModulePath: "connectors/acp", Family: "acp", Subject: "acp"},
	{ModulePath: "connectors/agycliacp", Family: "acp-derivative", Subject: "agycliacp"},
	{ModulePath: "connectors/cursorcliacp", Family: "acp-derivative", Subject: "cursorcliacp"},
	{ModulePath: "connectors/geminicliacp", Family: "acp-derivative", Subject: "geminicliacp"},
	{ModulePath: "connectors/codex", Family: "codex", Subject: "codex"},
	{ModulePath: "connectors/opencode", Family: "opencode", Subject: "opencode"},
	{ModulePath: "connectors/ollama", Family: "ollama", Subject: "ollama"},
	{ModulePath: "connectors/vllm", Family: "vllm", Subject: "vllm"},
	{ModulePath: "connectors/huggingface", Family: "huggingface", Subject: "huggingface"},
	{ModulePath: "connectors/cloudflare", Family: "openai-compatible", Subject: "cloudflare"},
	{ModulePath: "connectors/azure", Family: "openai-compatible", Subject: "azure-openai"},
	{ModulePath: "connectors/nvidia", Family: "openai-compatible", Subject: "nvidia"},
	{ModulePath: "connectors/openrouter", Family: "openai-compatible", Subject: "openrouter"},
	{ModulePath: "connectors/snowflake", Family: "openai-compatible", Subject: "snowflake-cortex"},
	{ModulePath: "connectors/databricks", Family: "openai-compatible", Subject: "databricks-ai"},
	{ModulePath: "connectors/infomaniak", Family: "openai-compatible", Subject: "infomaniak-ai"},
	{ModulePath: "connectors/cursorsdk", Family: "acp-sdk", Subject: "cursorsdk"},
	{ModulePath: "connectors/llamacpp", Family: "openai-compatible", Subject: "llamacpp"},
	{ModulePath: "connectors/lmstudio", Family: "openai-compatible", Subject: "lmstudio"},
	{ModulePath: "connectors/vertex", Family: "vertex", Subject: "vertex"},
	{ModulePath: "connectors/sagemaker", Family: "sagemaker", Subject: "sagemaker"},
	{ModulePath: "connectors/oci", Family: "oci", Subject: "oci-generative-ai"},
	{ModulePath: "connectors/watsonx", Family: "watsonx", Subject: "watsonx"},
	{ModulePath: "connectors/sapaicore", Family: "sapaicore", Subject: "sapaicore"},
	{ModulePath: "connectors/cohere", Family: "cohere", Subject: "cohere"},
	{ModulePath: "connectors/replicate", Family: "replicate", Subject: "replicate"},
	{ModulePath: "connectors/gitlabduo", Family: "gitlabduo", Subject: "gitlabduo"},
	{ModulePath: "connectors/nousportal", Family: "nousportal", Subject: "nousportal"},
	{ModulePath: "connectors/xaioauth", Family: "xaioauth", Subject: "xaioauth"},
	{ModulePath: "connectors/qwenoauth", Family: "qwenoauth", Subject: "qwenoauth"},
	{ModulePath: "connectors/minimexoauth", Family: "minimax-oauth", Subject: "minimax-oauth"},
	{ModulePath: "connectors/localstub", Family: "test-emulator", Subject: "localstub"},
}

CurrentConnectorFamilyCoverage is the checked-in coverage manifest for the executable connector modules. It is intentionally data-only so external connector authors can audit coverage without importing connector internals.

Functions

This section is empty.

Types

type CertificationResult

type CertificationResult struct {
	PluginID        string                    `json:"plugin_id"`
	Version         string                    `json:"version"`
	Passed          []string                  `json:"passed"`
	Negative        []string                  `json:"negative"`
	Executed        []string                  `json:"executed"`
	Failures        []string                  `json:"failures,omitempty"`
	Negotiated      backendplugin.Negotiation `json:"negotiated"`
	Capabilities    []lipapi.Capability       `json:"capabilities,omitempty"`
	ScenarioResults []ScenarioResult          `json:"scenario_results"`
}

CertificationResult contains connector contract certification evidence.

func Run

func Run(t *testing.T, cfg Config) CertificationResult

Run executes the connector contract test suite against the provided connector configuration.

func (CertificationResult) MarshalJSON

func (r CertificationResult) MarshalJSON() ([]byte, error)

MarshalJSON emits the validated machine-readable certification artifact.

func (*CertificationResult) UnmarshalJSON

func (r *CertificationResult) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts only complete certification artifacts.

func (CertificationResult) Validate

func (r CertificationResult) Validate() error

Validate checks that the artifact is complete and covers the shared SDK corpus exactly once. Connector-specific runners may add stronger wire assertions.

type Config

type Config struct {
	// PluginID identifies the connector plugin under test.
	PluginID string
	// Version is the plugin implementation version.
	Version string
	// Start starts the connector plugin service. It is setup input only; Run
	// never invokes the returned service directly for certification.
	Start func(ctx context.Context) (backendplugin.Service, func(), error)
	// StartHost mounts service behind the supported host adapter and returns the
	// host-facing session used by every certification operation.
	StartHost func(ctx context.Context, service backendplugin.Service) (HostSession, func(), error)
	// Timeout bounds the whole certification run. Each scenario additionally
	// receives its own deadline derived from this budget (or a default when
	// the budget is unset), so one stuck scenario fails fast instead of
	// wedging the corpus until the go test timeout fires.
	Timeout time.Duration
	// FactoryKind and ConfigYAML are passed through the real Configure boundary.
	FactoryKind string
	ConfigYAML  []byte
	Secrets     backendplugin.SecretBundle
}

Config contains configuration options for executing the backend-plugin connector contract test suite.

type ConnectorFamilyCoverage

type ConnectorFamilyCoverage struct {
	ModulePath string `json:"module_path"`
	Family     string `json:"family"`
	Subject    string `json:"subject"`
}

ConnectorFamilyCoverage identifies an executable connector module and the implementation family represented by its host-path contract test.

type HostSession

type HostSession interface {
	Resolve(ctx context.Context, modelID *string) (backendplugin.ResolvedProfile, error)
	Execute(stream backendplugin.ExecuteStream) error
	Cancel(ctx context.Context, invocation backendplugin.Invocation) error
	Close(ctx context.Context) error
	Negotiation() backendplugin.Negotiation
}

HostSession is the host-facing configured connector boundary. Implementations must forward operations through the real host adapter; a direct Service or ConfiguredInstance is not a certification boundary.

type ScenarioExecutor

type ScenarioExecutor interface {
	HostSession
}

ScenarioExecutor is retained as a compatibility name for host-facing test adapters. New runners should implement HostSession.

type ScenarioResult

type ScenarioResult struct {
	ID              string `json:"id"`
	Positive        bool   `json:"positive"`
	Executed        bool   `json:"executed"`
	Resolved        bool   `json:"resolved"`
	FramesValidated int    `json:"frames_validated"`
	Terminal        bool   `json:"terminal"`
	UsageObserved   bool   `json:"usage_observed"`
	ErrorObserved   bool   `json:"error_observed"`
	Rejected        bool   `json:"rejected"`
	Cancelled       bool   `json:"cancelled"`
}

ScenarioResult is validated machine-readable evidence for one shared semantic scenario.

Jump to

Keyboard shortcuts

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