adapters: openai is a static-key vendor
One registry line — `"openai": StaticKey`. The generic static-key adapter
already serves any vendor (accept is the vendor-independent seal, deliver is the
value unchanged, and refresh/identity/usage are not implemented), so a second
static-key vendor is data, not code. The shape-selection test now asserts
For("openai") reports static-key.
Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
This commit is contained in:
@@ -167,6 +167,7 @@ type UsageRow struct {
|
|||||||
var registry = map[string]Shape{
|
var registry = map[string]Shape{
|
||||||
"anthropic": RefreshableGrant,
|
"anthropic": RefreshableGrant,
|
||||||
"anthropic-api-key": StaticKey,
|
"anthropic-api-key": StaticKey,
|
||||||
|
"openai": StaticKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
// For returns the adapter for a vendor, refusing an unknown one clearly.
|
// For returns the adapter for a vendor, refusing an unknown one clearly.
|
||||||
|
|||||||
@@ -22,6 +22,16 @@ func TestTheTwoShapesAreSelectedByVendor(t *testing.T) {
|
|||||||
if grant.Shape() != RefreshableGrant {
|
if grant.Shape() != RefreshableGrant {
|
||||||
t.Fatalf("anthropic is %q, expected refreshable-grant", grant.Shape())
|
t.Fatalf("anthropic is %q, expected refreshable-grant", grant.Shape())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// openai is a second static-key vendor, served by the same generic adapter — the registry line is
|
||||||
|
// the whole of its integration, and it reports the static-key shape like any other.
|
||||||
|
openai, err := For("openai")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if openai.Shape() != StaticKey {
|
||||||
|
t.Fatalf("openai is %q, expected static-key", openai.Shape())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The type assertion is what gates the carve-out: a static key is not a Refresher, so it can never
|
// The type assertion is what gates the carve-out: a static key is not a Refresher, so it can never
|
||||||
|
|||||||
Reference in New Issue
Block a user