Support Postgres branches in BranchInfrastructure#324
Merged
Conversation
dgraham
approved these changes
Jul 8, 2026
37b1b45 to
dbbb6b6
Compare
The branch infrastructure API now serves Postgres branches with a Postgres-native shape: nodes and bouncers instead of pods, since Postgres infrastructure has no per-container pod detail. BranchInfrastructure becomes a discriminated union: the response's type field selects which engine-specific struct (Vitess or Postgres) is decoded, so exactly one of the two is set and consumers branch on the populated engine rather than picking through a merged field bag. The endpoint is feature-gated with no stability guarantee.
dbbb6b6 to
6092874
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The branch infrastructure endpoint (
GET .../branches/:branch/infrastructure) now serves Postgres branches. This adds the Postgres response shape to the SDK so consumers (e.g. the CLI) can show infrastructure for Postgres databases.Changes
BranchInfrastructurebecomes a discriminated union with per-engine sub-structs:Typeplus exactly one ofVitess(Ready,Pods— unchanged fields) orPostgres(State,PrimaryName,Nodes,Bouncers, volume/promotion metadata). A customUnmarshalJSONselects the engine struct from the response'stypefield.PostgresInfraNode(instance name, role, AZ, cluster size, volume usage/capacity, region, pending disk replacement) andPostgresInfraBouncer(PgBouncer deployment with its SKU).Why
Rather than forcing Postgres data into the Vitess
podsshape (which has per-container ready/restart detail that doesn't apply to Postgres instances), the API returns an engine-native shape per database kind. Modeling that as one struct-per-engine keeps each engine's fields together and makes consumer code branch once on the populated engine instead of guessing which of a flat struct's fields are meaningful. This restructures the existingBranchInfrastructuretype, but the endpoint is feature-gated with no stability guarantee.