backend

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertifyBackend

func CertifyBackend(ctx context.Context, h BackendHarness) (semantic.Certification, error)

CertifyBackend selects and records scenarios for one backend harness.

func RunPromptCacheResidencyTCK

func RunPromptCacheResidencyTCK(t *testing.T, factory func() PromptCacheResidencySubject)

RunPromptCacheResidencyTCK certifies lifecycle, identity, affinity, release, generation-close, accounting, and multi-target behavior without a provider.

Types

type BackendFacts

type BackendFacts struct {
	Capabilities []lipapi.Capability
	Dialects     lipapi.DialectSupport
}

BackendFacts describes effective backend capabilities for a scenario call.

type BackendHarness

type BackendHarness interface {
	Subject() semantic.SubjectDescriptor
	Backend(ctx context.Context) (BackendView, error)
	Upstream() UpstreamProbe
	Reset(ctx context.Context) error
}

BackendHarness provides the test harness interface for backend certification.

type BackendView

type BackendView interface {
	Open(ctx context.Context, call *lipapi.Call) (lipapi.EventStream, error)
	EffectiveCapabilities(ctx context.Context, call *lipapi.Call) BackendFacts
	// Probe executes a positive semantic scenario and reports canonical/upstream evidence.
	Probe(ctx context.Context, scenario semantic.ScenarioDescriptor, probe UpstreamProbe) (semantic.ExecutionEvidence, error)
}

BackendView is a narrow test interface for driving a backend adapter in TCK.

type CapturedRequest

type CapturedRequest struct {
	Method string
	Path   string
	Header map[string][]string
	Body   []byte
}

CapturedRequest captures upstream probe details.

type ExecBackendView

type ExecBackendView struct {
	Backend    execbackend.Backend
	Candidate  routing.AttemptCandidate
	Invocation lipapi.Invocation
}

ExecBackendView drives a real core execbackend.Backend without importing a provider adapter into the TCK runner. The backend's Open function is the actual upstream boundary and candidate admission is the actual pre-network hard-negative path.

func (ExecBackendView) EffectiveCapabilities

func (v ExecBackendView) EffectiveCapabilities(ctx context.Context, call *lipapi.Call) BackendFacts

func (ExecBackendView) Open

func (ExecBackendView) Probe

func (ExecBackendView) Reject

func (ExecBackendView) TCKExecutesBoundary

func (v ExecBackendView) TCKExecutesBoundary() bool

TCKExecutesBoundary marks this adapter as executing Open itself during Probe. The runner uses the marker to avoid a duplicate upstream call in preflight.

func (ExecBackendView) TCKInvocation

func (v ExecBackendView) TCKInvocation() lipapi.Invocation

TCKInvocation exposes the operation metadata used by scenario construction.

type HardNegativeView

type HardNegativeView interface {
	Reject(ctx context.Context, call *lipapi.Call, scenario semantic.ScenarioDescriptor) (semantic.ExecutionEvidence, error)
}

HardNegativeView is implemented by adapters that can run candidate admission without opening upstream work. It is deliberately separate from BackendView so simple backend-family adapters can opt into the proof at their composition edge.

type PromptCacheResidencySubject

type PromptCacheResidencySubject interface {
	promptcache.Controller
	Issue(targetID promptcache.TargetID, generationID promptcache.GenerationID, renewable bool) (promptcache.Observation, error)
	Observations() []promptcache.Observation
	Evict(handle promptcache.Handle) error
	SetAffinityAvailable(bool)
	Close() error
	UpstreamResident(handle promptcache.Handle) bool
}

PromptCacheResidencySubject is the small setup/observation surface used by the residency TCK. Provider implementations keep their own setup semantics; the TCK only observes the stable promptcache.Controller contract.

type ReferenceResidencyController

type ReferenceResidencyController struct {
	// contains filtered or unexported fields
}

ReferenceResidencyController is a bounded in-process controller used by the TCK. It intentionally stores only opaque handles and provider-neutral facts.

func NewReferenceResidencyController

func NewReferenceResidencyController(instanceID, generationID string) *ReferenceResidencyController

func (*ReferenceResidencyController) Close

func (*ReferenceResidencyController) Evict

func (*ReferenceResidencyController) Issue

func (*ReferenceResidencyController) Observations

func (*ReferenceResidencyController) Release

func (*ReferenceResidencyController) Renew

func (*ReferenceResidencyController) SetAffinityAvailable

func (r *ReferenceResidencyController) SetAffinityAvailable(available bool)

func (*ReferenceResidencyController) UpstreamResident

func (r *ReferenceResidencyController) UpstreamResident(handle promptcache.Handle) bool

type UpstreamProbe

type UpstreamProbe interface {
	RequestCount() int
	LastRequest() CapturedRequest
	Reset()
}

UpstreamProbe tracks upstream request counts for zero-upstream proofs.

Jump to

Keyboard shortcuts

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