Redesign SDK for v2 platform API: services, typed errors, iter, streaming#19
Redesign SDK for v2 platform API: services, typed errors, iter, streaming#19chrisghill wants to merge 12 commits into
Conversation
|
@claude review |
|
Claude finished @chrisghill's task in 2m 52s —— View job Code Review: Redesign SDK for v2 platform API
This is a well-designed, idiomatic Go SDK with strong documentation, sensible abstractions, and thorough test coverage. The review below separates bugs from suggestions. Bugs / Correctness Issues1.
|
Summary
Full v2 redesign of the Go SDK. Replaces the WIP stub on main with a receiver-based, idiomatic Go API that tracks the platform's GraphQL v2 surface. Highlights:
*massdriver.Clientaggregates a*Serviceper domain (c.Projects,c.Deployments,c.Resources,c.Groups, etc.). Functional options for construction (WithAPIKey,WithOrganizationID,WithBaseURL,WithProfile,WithGQLClient,WithTimeout).gql(ErrNotFound,ErrUnauthenticated,ErrForbidden) classifiable witherrors.Is. Mutation validation surfaced as*gql.MutationFailedwith per-field messages.Itermethods returniter.Seq2[T, error](Go 1.23 range-over-func) for unbounded queries;Listauto-follows cursors and returns a slice for bounded ones.Deployments.StreamLogs/TailLogsover an Absinthe websocket subscription.massdriver/platformis the GraphQL public SDK (PAT / service-account auth).massdriver/provisioningis the deployment-token-only REST surface used from inside provisioner runs (xo CLI, Terraform provider). READMEs in both dirs spell this out.*_integration_test.goper package, plus a cross-package scenario test undermassdriver/test. Run on demand viamake test-integrationagainst a real sandbox.Tooling
help,build,vet,lint,test,test-integration,check,schema,generatetargets.make schemacurls the public schema fromapi.massdriver.cloud/graphql/v2/schema.graphql;make generateruns genqlient.Notes for reviewers
massdriver/internal/gen/zz_generated.go) and the schema; SDK-authored code is a fraction of the total. Filter:!massdriver/internal/gen/*to focus the diff.-p 1) because they share a single sandbox org and the platform's custom-attribute schema validation makes parallel package runs flake. Documented in the Makefile.massdriver/provisioning/was renamed frommassdriver/services/to free theServicename for the per-package service receivers.