chore(cli): define error taxonomy - #6132
Merged
Merged
Conversation
Co-authored-by: 7ttp <117663341+7ttp@users.noreply.github.com>
7ttp
pushed a commit
to 7ttp/cli
that referenced
this pull request
Aug 10, 2026
…upabase#6027) ## What changed Ports the shadow-database provisioning used by `db diff`/`db pull` (create → health-wait → connect → setup/migrate → remove) from the hidden Go `db __shadow` seam to native TypeScript, and removes that seam from `apps/cli-go/cmd/db.go`. This was the last local-container orchestration `db diff`/`db pull`'s native engines still delegated to Go for. New shared primitives live in `legacy/shared/db-bootstrap/shadow-database.ts` (create/connect/setup/migrate/remove — kept as separate composable pieces rather than one monolithic function, since the two known future callers need different subsets: `migration squash` (CLI-1969) needs create → health-wait → connect → setup only, while `db diff --use-pgadmin` (CLI-1968) needs create → health-wait → migrate). `legacy/commands/db/shared/legacy-shadow-source.ts` composes these for `db diff`/`db pull`'s `--target-local` declarative branch, which also needs pg-delta. `legacy-pgdelta.apply.ts` is a from-scratch port of Go's `pgdelta.ApplyDeclarative`. Hoisted a shared `legacyResolveDbSetupPrelude` (`db-setup.ts`) so fresh-db setup and shadow setup stop duplicating the same JWKS/image-pull resolution, per this repo's "Hoist Before You Duplicate" rule. ## Why Part of the M9 milestone (Go removal) — this and the three PRs below it in the stack (supabase#6021 CLI-1953, supabase#6022 CLI-1954, supabase#6026 CLI-1955) progressively remove the Go delegations that anchor the bundled Go binary. This PR removes the last one blocking `db diff`/`db pull`'s native engines. ## Reviewer-relevant context - The parent stack PRs (supabase#6021, supabase#6022, supabase#6026) have all merged, so this diff is now standalone. - An earlier revision described a "randomized per-invocation staged secret dir" for the shadow container; review showed that machinery was dead — secrets are delivered straight into the container via `docker cp` and nothing ever creates a staged dir on disk — so it was deleted outright. `legacyRemoveShadowDatabase` is now just `(spawner, containerId)`. - Neither `db diff` nor `db pull` wires the `LegacyDeclarativeSeam` layer any more — `db diff --use-pgadmin`/`--use-pg-schema` proxy the whole invocation to the bundled Go binary rather than going through the seam. The seam now serves only `db schema declarative generate`/`sync`'s baseline/declarative catalog modes (the remaining CLI-1959 scope). - A deep-review fix batch is included on top of the port (observable `db diff`/`db pull` behavior is unchanged except where noted): shared project-id resolution at every pg-delta site (fixes `supabase_edge_runtime_:` volume binds under env-only project ids), Go's `PGDELTA_DEBUG` shadow-catalog export in `db diff`, config validation before the "Creating shadow database..." banner, the relative path in the declarative-dir-not-found error, Go `int64` bounds in the apply-output decoder, byte-ordered (Go `fs.WalkDir`) SQL-file walking, remote-override gating for ~20 more config keys, `DEBUG` resolution through the merged project env like viper, Go's exact unhealthy-container line format, `%q`/`TrimSpace`-exact apply-failure rendering, percent-round-tripping of special-character shadow DB passwords, and a rename of the apply-side error class that shared its `Data.TaggedError` tag with `declarative.errors.ts`'s. - New shadow/apply error classes declare the error-actionability taxonomy metadata that landed on develop meanwhile (supabase#6132), and `db diff`/`db pull`'s SIDE_EFFECTS.md now document the in-process shadow bring-up (dotenv/TLS/roles.sql reads and the `SUPABASE_*` override family). - The shadow container honors a config.toml `[db] password` — a deliberate TS extension carried over from develop's `--local` handling (Go rejects that key at config load and always uses `postgres`); documented at the builder, with the strict-rejection question tracked as a follow-up. Fixes CLI-1956 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

TL;DR
Defines a shared, CLI error taxonomy for KPI reporting..
What's introduced?
Why is it needed?
cli_command_executedtells us that a command failed, but not whether it was user-actionable, caused by an external service, or a CLI bug.This establishes that distinction without capturing raw error text or user-specific data &
lays the foundation for CLI-1561 (completed locally, will push once this lands in) to add these fields to telemetry...
ref