Skip to content

chore(cli): define error taxonomy - #6132

Merged
jgoux merged 2 commits into
supabase:developfrom
7ttp:feat/cli-error-taxonomy-1560
Aug 10, 2026
Merged

chore(cli): define error taxonomy#6132
jgoux merged 2 commits into
supabase:developfrom
7ttp:feat/cli-error-taxonomy-1560

Conversation

@7ttp

@7ttp 7ttp commented Aug 9, 2026

Copy link
Copy Markdown
Member

TL;DR

Defines a shared, CLI error taxonomy for KPI reporting..

What's introduced?

  • A shared taxonomy for describing why a CLI command failed, whether the failure is actionable, and how the user can recover.
  • Consistent classifications across known CLI errors, backed by automated coverage that prevents new errors from going unclassified.
  • Stable error fingerprints and precise definitions for measuring recovery, repeat failures, and internal or unknown CLI bugs.

Why is it needed?

cli_command_executed tells 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

jgoux and others added 2 commits August 9, 2026 20:03
@7ttp
7ttp requested a review from a team as a code owner August 9, 2026 14:57
@7ttp 7ttp self-assigned this Aug 9, 2026

@jgoux jgoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgoux
jgoux added this pull request to the merge queue Aug 10, 2026
Merged via the queue into supabase:develop with commit 069da15 Aug 10, 2026
29 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants