Repository navigation
Conversation
First step of the provider-neutral request contract. Capabilities declares the request values a provider can honor, and Unavailable lists services it cannot recommend through its API. CheckAvailable returns an UnavailableError (errors.Is ErrUnavailable) for a listed service, so adapters can fail before any cloud call. Closes #389 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
|
|
CodeRabbit reviewed the exact head |
|
Independent adversarial review: CLEAN at Attacked: Non-blocking notes: string-typed Terms/PaymentOptions/etc. match Local verification (macOS, unit evidence, no cloud calls) at the exact head: Gate: CI green on |
Summary
Adds the new package
pkg/reccontract, step G2a of the multi-cloud contract plan. New files only; nothing calls it yet.Capabilitiesdeclares the request values a provider can honor (terms, payment options, lookbacks, default lookback, account scopes, offering classes, SP types) andUnavailable, a map from service to the reason it cannot be recommended through the provider's API. All fields land now so later steps (Normalize/Validate, Filter/Wrap) only add behaviour.UnavailableError{Provider, Service, Reason}matchesErrUnavailableviaerrors.Is.CheckAvailable(c, s)returns nil for an empty service or one not listed (nil map included), else an*UnavailableError.Imports only stdlib and
pkg/common. The first consumer is the GCP adapter marking Cloud SQL and Memorystore unavailable (G7b-1), which pinspkgto this commit after merge.Closes #389
Verification (macOS, Go 1.26.9)
(cd pkg && GOWORK=off go test -race -short -count=1 ./reccontract/): 7 passed. Fullpkgrace suite passed.GOWORK=off go build ./...in all five modules: pass.make build,make vet: pass.pkg: 0 issues. The localmake lintbinary crashes on this Go version, so the pinned version was run instead.Is, dropping the empty-service guard, droppingProviderfrom the error, and inverting the lookup each make a test fail.""); pass 2 found a gofmt alignment issue (fixed). No other findings.This is a pure type/function addition with unit tests; no provider, cloud call or purchase path is involved.
🤖 Generated with Claude Code
Summary by CodeRabbit