feat(cli): port ssl-enforcement to native TypeScript#5340
Merged
Conversation
Replace the Phase-0 Go-binary proxies for `ssl-enforcement get` and
`ssl-enforcement update` with native Effect handlers. Byte-identical
to the Go CLI: text status lines, all five `--output {pretty,json,
yaml,toml,env}` encoders, error message templates, exit codes, and
linked-project + telemetry side effects.
Hoist three artifacts from the backups command family to a new
`src/legacy/shared/` directory because they are now reused across
families: the Management-API runtime layer composition, the
HTTP-error → tagged-error mapper, and the Go-compatible JSON / YAML
/ TOML / env encoders. Refactor the backups list/restore call sites
in the same change.
Refs CLI-1297
jgoux
approved these changes
May 22, 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.
Replaces the Phase-0 Go-binary proxies for
supabase ssl-enforcement getandsupabase ssl-enforcement updatewith native Effect handlers. Output, error messages, exit codes, and filesystem side effects are byte-identical to the Go CLI.What changed
ssl-enforcement get/updateare now native TS — both handlers call the typed Management API client directly, withwithCommandInstrumentation+withJsonErrorHandlingmiddleware, and honour all five Go--output {pretty,json,yaml,toml,env}encoders as well as the TS--output-format {text,json,stream-json}.apps/cli/src/legacy/commands/backups/to a newapps/cli/src/legacy/shared/directory because they are now reused across command families:legacyManagementApiRuntimeLayer(waslegacyBackupsRuntimeLayer)mapLegacyHttpError(wasmapLegacyBackupHttpError) — generic over the network/status error class pairencodeGoJson/encodeYaml/encodeToml/encodeEnv—encodeGoJsonnow takes an optionalnullForEmptyArraysoption so backups can preserve its PITR-only"backups": nullshape while ssl-enforcement omits itReviewer-relevant context
updatehandler validates the mutually-exclusive--enable-db-ssl-enforcement/--disable-db-ssl-enforcementflags at handler entry — Effect CLI has no cobra-equivalentMarkFlagsMutuallyExclusive. Validation error messages are verbatim cobra strings for parity with the Go binary.Effect.ensuringnesting in both handlers mirrors Go'sPersistentPostRun:telemetryState.flushwraps the entire body (so it flushes even on ref-resolution failure), whilelinkedProjectCache.cache(ref)only wraps the post-resolution sub-effect (it requires a resolved ref).SIDE_EFFECTS.mdfiles were previously stubs with wrong API paths (/v1/projects/{ref}/config/ssl-enforcement) and wrong response shapes ({enforced, override_enabled}). Both are rewritten with the correct path (/v1/projects/{ref}/ssl-enforcement) and response ({currentConfig: {database}, appliedSuccessfully}).encodeEnvwas hardened to escape\n/\r/\t(Go%qparity). Latent bug — boolean-only ssl-enforcement schema never triggered it, but fixing it now in the shared encoder prevents future ported commands with string fields from injecting newlines into env output that a downstreameval/sourcewould treat as separate KEY=VALUE assignments.docs/go-cli-porting-status.mdflips both ssl-enforcement rows fromwrappedtoported.Closes CLI-1297