Uh oh!
There was an error while loading. Please reload this page.
fix(cli): surface db connection-failure detail and fix connect suggestion classifiers - #5948
Conversation
…tion classifiers (CLI-1976)
Coly010
commented
Jul 24, 2026
@codex review |
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:3c57c4e250
ℹ️ 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".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@42cbd82c6437b1ea6c44ed85525bc5b2844e39eaPreview package for commit |
…tch Go (review: IPv6 aggregate thread)
…ike pgconn (review: TLS codes thread)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:e58b751013
ℹ️ 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".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…e pgconn (review: parent aggregate code thread)
…n (review: pre-handshake reset thread)
Coly010
commented
Jul 27, 2026
@codex review |
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
Uh oh!
There was an error while loading. Please reload this page.
What changed
Every legacy db command's connection failure previously rendered as
— host, user, database, and the underlying driver cause were all lost, on every
db push/db pull/db reset/db diff --linked/inspect/migrationconnection failure. The Go CLI renders pgconn's full detail:This PR ports pgconn's
connectErrorrendering (errors.go:66-72, wrapped bypkg/pgxv5/connect.go:33) into the legacy connection layer, and fixes thelegacyConnectSuggestionclassifier branches that could never fire on real node-postgres error shapes.Message rendering (
legacyConnectFailureMessage)toConnectErrorinlegacy-db-connection.sql-pg.layer.tsnow rendersfailed to connect to postgres: failed to connect to \host=… user=… database=…`: ` using the config-level identity (host/user/database — never the password), exactly like pgconn.SqlError → ConnectionError → driver errorchain (and throughAggregateError.errors[], taking the LAST attempt — pgconn's fallback loop also surfaces the last attempt's error).server error (SEVERITY: message (SQLSTATE code))(byte-parity with pgconn'sPgErrorrendering),hostname resolving error (…),dial error (…),tls error (…).Classifier fixes (
legacyConnectSuggestion)Branch-by-branch verification against real driver shapes (captured empirically under Bun, the CLI's runtime):
connect: connection refused/ allow_list → network-restrictions hintECONNREFUSEDcode / server textSqlErrortests)SSL connection is required+--debugSCRAM exchange: Wrong password/failed SASL auth→SUPABASE_DB_PASSWORDhintDatabaseError28P01password authentication failedEHOSTUNREACH/EADDRNOTAVAIL/ENETUNREACHwith an IPv6addressfieldlegacyHasIPv6DialCause)connect: no route to host→ wrong-profile hintconnect EHOSTUNREACH <ip>:<port>EHOSTUNREACH, after the IPv6 branch, matching Go's branch orderTenant or user not found→ wrong-profile hintNODE_ENETUNREACH_PATTERNnow also tolerates a closing paren after the port, since the new message format parenthesizes the driver cause.CLI-1942 guard (no accidental divergence)
Go has no suggestion branch for the session-pooler EOF drop (
unexpected EOF); node-postgres' equivalent isConnection terminated unexpectedly. Tests pin that this shape stays unclassified (generic--debugfallback) and that the message still carries the fullhost=… user=…identity plus the cause verbatim.Residual driver-text differences (impossible to byte-match)
The inner cause text comes from the driver, so exact byte parity with Go is impossible where the drivers word things differently — the structure (
failed to connect to postgres:prefix +host=… user=… database=…+ cause) and the stage labels match:connect ECONNREFUSED 1.2.3.4:5432vs Godial tcp 1.2.3.4:5432: connect: connection refused.failed SASL auth (…)), which node-postgres does not expose, so TS rendersserver error (…)— the innerFATAL: password authentication failed for user "postgres" (SQLSTATE 28P01)bytes and the fired hint are identical.failed to receive message (unexpected EOF)— no stage is guessed rather than fabricating a wrong one.server error (SEVERITY: message (SQLSTATE code))) are byte-identical to Go given the same server bytes.Review findings deliberately left open
Five-perspective review (architect / engineer / security / DX / go-parity-auditor) all approved. Non-blocking items noted for follow-up rather than churned here:
ENETUNREACHgets no suggestion in TS while Go's over-broadnetwork is unreachabletext match would show the IPv6 hint even for IPv4 — the TS IPv6-literal gate is deliberate and pre-existing.password authentication failedas a wrong-password disjunct would also classify a theoretical non-SCRAM 28P01 that Go leaves unclassified; Supabase auth is always SCRAM.Related: this PR does not touch
output.layer.ts(PR #5946 / CLI-1973 territory) — the change is confined to the SqlError mapping and the classifier module.Fixes CLI-1976