Documentation
¶
Overview ¶
Package subscription contains provider-neutral, fixture-only contracts for credential-backed subscription transports. It deliberately knows no real provider origin, OAuth registration, account identity, or model catalogue.
Package subscription provides provider-neutral, fixture-only certification contracts for credential-backed subscription transports.
An enabled OpenAI or Anthropic subscription package must add a package test that constructs a Witness with its explicit Constructor and Contract, then calls Witness.Run against NewServer(t). The witness is deliberately fail-closed: no constructor, provider endpoint, client ID, account selector, or model-discovery behavior can be inferred by this package. Registration gates that are unavailable must not fabricate a witness or provider client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunContract ¶
RunContract is a descriptive alias for Run.
func ValidateContract ¶
ValidateContract checks the bounded, explicit inputs needed by Run. It does not perform network I/O or infer an endpoint, credential, or model.
Types ¶
type Constructor ¶
Constructor builds one provider-bound client for a model and fixture source. The fixture server is passed explicitly so a provider test can provide its TLS roots and any transport-only test options without the contract runner knowing provider constructor details.
type Contract ¶
type Contract struct {
Provider string
Transport string
Issuer string
Scheme credentials.Scheme
Usage credentials.UsageClass
Formats []model.APIFormat
ModelName string
NewSource SourceFactory
Constructor Constructor
}
Contract describes one provider-neutral subscription transport matrix. The values are caller-supplied identity metadata; no provider defaults are embedded here.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a loopback-only TLS provider fixture. The handler and request capture are owned by the contract runner; callers only use URL and RootCAs when adapting a provider constructor.
func NewServer ¶
NewServer starts a loopback TLS fixture. httptest's generated certificate is the only root exposed by RootCAs; callers must opt into it explicitly.
type SourceFactory ¶
type SourceFactory func(credentials.Descriptor) (credentials.Source, error)
SourceFactory creates the explicit credential source used for one contract case. Tests normally return a deterministic fixture source; production credential stores and provider account selection are intentionally outside this package.
type Witness ¶
type Witness struct {
// contains filtered or unexported fields
}
Witness is the fail-closed certification handle for an enabled subscription constructor. Provider package tests should construct one with their explicit contract and call Run; a provider is not contract-certified merely because its constructor compiles.
func NewWitness ¶
NewWitness validates the explicit contract that a provider package test intends to certify. It never supplies provider identity, endpoints, or model defaults.