Skip to content

fix(cli): CSV-split sso and postgres-config StringSlice flags#5764

Merged
Coly010 merged 1 commit into
developfrom
columferry/cli-1853-sso-postgres-config-comma-separated-list-flags-dont-split
Jul 2, 2026
Merged

fix(cli): CSV-split sso and postgres-config StringSlice flags#5764
Coly010 merged 1 commit into
developfrom
columferry/cli-1853-sso-postgres-config-comma-separated-list-flags-dont-split

Conversation

@Coly010

@Coly010 Coly010 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Current Behavior

Go registers sso add/update --domains/--add-domains/--remove-domains and postgres-config update/delete --config as pflag StringSliceVar, which CSV-splits each occurrence (via encoding/csv) and accumulates across repeats. The legacy TS port only supported flag repetition (Flag.atLeast(0)), so a single comma-separated value like --domains a.com,b.com produced one malformed string ("a.com,b.com") instead of two domains — sent to the API as-is, or (for postgres-config) failing the key=value split validation.

Fixes #CLI-1853

Expected Behavior

--domains a.com,b.com (and --config foo=bar,baz=qux) now CSV-split per-occurrence and accumulate across repeats, matching Go's pflag.StringSliceVar/encoding/csv semantics exactly — including quoted-comma handling ('"a,b",c'["a,b", "c"]) and Go's csv.Reader malformed-input error messages.

The CSV-parsing algorithm already existed for --schema flags (gen types, db lint, db dump, db pull, db diff, db schema {generate,sync}) in legacy-schema-flags.ts. This extracts the generic algorithm into a new shared legacy-string-slice-flag.ts module (legacyParseStringSliceFlag) so the four newly-fixed flags reuse it instead of duplicating it; legacy-schema-flags.ts now delegates to the shared module while keeping its schema-specific CSV re-encoder (legacySchemaToCsvField) untouched.

Out of scope: the ticket's "bonus" item (aligning sso update's domains mutex error message with cobra's group-error template) is deferred — it depends on the separate functions-mutex-template fix (CLI-1860), which hasn't landed yet.

CLOSES CLI-1853

Go registers `sso add/update --domains/--add-domains/--remove-domains`
and `postgres-config update/delete --config` as pflag StringSliceVar,
which CSV-splits each occurrence via encoding/csv and accumulates
across repeats. The legacy TS port only supported repetition, so
`--domains a.com,b.com` produced a single malformed value instead of
two domains.

Adds a shared `legacyParseStringSliceFlag` helper (extracted from the
existing --schema CSV parser, which now delegates to it) and wires it
into the four affected flag definitions via Flag.mapTryCatch, matching
the pattern already used for --schema flags.
@Coly010 Coly010 self-assigned this Jul 2, 2026
@Coly010

Coly010 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 101d51fe8e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@Coly010 Coly010 marked this pull request as ready for review July 2, 2026 10:17
@Coly010 Coly010 requested a review from a team as a code owner July 2, 2026 10:17
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@101d51fe8e0c5fb69256a5156cc0132ab2a9d775

Preview package for commit 101d51f.

@Coly010 Coly010 added this pull request to the merge queue Jul 2, 2026
Merged via the queue into develop with commit 957566d Jul 2, 2026
28 checks passed
@Coly010 Coly010 deleted the columferry/cli-1853-sso-postgres-config-comma-separated-list-flags-dont-split branch July 2, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants