fix(cli): always send domains in sso update PUT body to match Go (CLI-1981) - #5973
Open
Coly010 wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Contributor
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@8c21d8de5af36b97bcc599dd39ac6225924af1d9Preview package for commit |
kanadgupta
approved these changes
Jul 28, 2026
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.
What changed
sso updatenow always sendsdomainsin the PUT body, matching the Go CLI.Go's
internal/sso/update/update.go:82-109looks gated —if len(Domains) != 0 { … } else if params.AddDomains != nil || params.RemoveDomains != nil { merge existing → body.Domains }— butcmd/sso.go:171-172declares--add-domains/--remove-domainswith a non-nil[]string{}default and passes them unconditionally, soAddDomains != nilis always true from the CLI. Every Gosso updatetherefore enters the fetch-and-merge branch and setsbody.Domains(the recomputed existing set, or[]).UpdateProviderBody.Domainsis a non-nil*[]stringunderjson:"domains,omitempty", andomitemptynever omits a non-nil pointer, so even the empty set serializes as"domains":[].The TS handler gated the merge on
addDomains.length > 0 || removeDomains.length > 0and omitteddomainsentirely when no domain flags were passed — a different request shape (sso update <id> --metadata-url X: Go sends{"domains":[…existing],"metadata_url":"X"}, TS sent{"metadata_url":"X"}) with potential server-side domain-state drift.update.handler.ts— the merge branch is now the unconditionalelseof the--domainsreplace branch.mergeDomainsseed filter relaxed fromdomain.length > 0totypeof domain === "string"— Go's seed check is nil-ness only (domain.Domain != nil,update.go:89), so an empty-string domain from the GET response is kept.SIDE_EFFECTS.md— PUT body documentsdomainsas always present."domains":[], GET response missingdomainsentirely, explicit empty--domains=falling into the merge, and empty-string-domain retention. All five fail without the fix.Verification level for the Go body shape: live-captured
Built the Go binary from
apps/cli-goand ran it against a local HTTP recorder (SUPABASE_PROFILEYAML pointingapi_urlat the recorder). Captured raw PUT bodies:old1.com,old2.com{"domains":["old1.com","old2.com"]}{"domains":[]}--metadata-urlonly (issue repro){"domains":["old1.com","old2.com"],"metadata_url":"https://example.com"}--domains={"domains":["old2.com","old1.com"]}(merge branch; map-iteration order is nondeterministic)Go's own
update_test.goadditionally pinsbody.Domainsnon-nil for the--domainsand--add/--remove-domainspaths.Review notes (deliberately left open)
sso addhas the same gate class (create.go:60gates on!= nil, TS gates on.length > 0), sosso add --domains=diverges — that is audit §3.10's separatesso additem, intentionally not touched here.Fixes CLI-1981
https://linear.app/supabase/issue/CLI-1981/sso-update-omits-domains-from-the-put-body-where-go-always-sends-it