fix(supabase-provision): rewrite transaction/6543 -> session/5432 for new projects (#1301)#1582
Open
0xDevNinja wants to merge 1 commit into
Open
Conversation
… new projects - Single-object pooler API responses default to transaction-mode at 6543, but the shared pooler tenant on new projects only listens on session/5432 - Add a `pool_mode == transaction && db_port == 6543` rewrite + stderr note - Escape hatch via `GSTACK_SUPABASE_TRUST_API_PORT=1` for forward-compat - 5 new tests covering rewrite, no-op shapes, env opt-out, array path Fixes garrytan#1301.
4 tasks
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.
Summary
cmd_pooler_urlinbin/gstack-gbrain-supabase-provisiontrustsdb_portverbatim from the Management API. On a fresh Supabase project the API returns a single transaction-mode entry at port 6543, but the shared pooler tenant for new projects only listens on the session port 5432.gbrain inithangs to TCP timeout (transaction port unreachable), then cascades into "tenant/user not found" / "password auth failed" errors that look like auth bugs. The reporter on /setup-gbrain: provision picks transaction pooler (6543) but new Supabase projects only listen on session pooler (5432) #1301 lost ~30 min to that misdiagnosis loop.This PR adds a narrow rewrite: when the picked entry is
pool_mode == "transaction"ANDdb_port == "6543", swap tosession/5432and print a one-line stderr note. Every other shape (session/6543, transaction/5432, explicit array with a session entry) is untouched.Set
GSTACK_SUPABASE_TRUST_API_PORT=1to disable the rewrite if a future API version starts returning a working transaction port.Fixes #1301.
Why this shape
The reporter posted a verified band-aid in the issue body. I kept it intentionally narrow:
wait— that's a separate fix the reporter also flagged. This PR is the immediate footgun stop; the probe-side work can land independently.Tests
test/gbrain-supabase-provision.test.tsalready mocks the Management API end-to-end viaBun.serve. 5 new cases underdescribe('pooler-url'):rewritingstderr noteGSTACK_SUPABASE_TRUST_API_PORT=1→ rewrite suppressed, 6543 returned verbatimThe 7 pre-existing
gen-skill-docs --dry-run freshness checkfailures on non-Claude hosts reproduce onupstream/mainwith this branch's changes stashed — unrelated to this patch.Out of scope
The reporter flagged two adjacent issues in the same comment which I'm leaving for separate PRs:
waitreturningACTIVE_HEALTHYtoo early before the pooler tenant routes propagate (needs a real TCP-handshake probe).gstack-gbrain-source-wireup --database-url <url>leaking the URL viaps aux(env-var-only intake, separate file).