Skip to content

fix(cli): resolve network-bans project ref before validating --db-unban-ip#5769

Open
Coly010 wants to merge 1 commit into
developfrom
columferry/cli-1856-network-bans-remove-resolve-project-ref-before-validating-db
Open

fix(cli): resolve network-bans project ref before validating --db-unban-ip#5769
Coly010 wants to merge 1 commit into
developfrom
columferry/cli-1856-network-bans-remove-resolve-project-ref-before-validating-db

Conversation

@Coly010

@Coly010 Coly010 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Current Behavior

supabase network-bans remove --project-ref <bad-ref> --db-unban-ip <bad-ip> surfaces the invalid-IP error first, because the TS handler validated --db-unban-ip before resolving the project ref.

Expected Behavior

Go resolves the project ref in PersistentPreRunE, which cobra always runs before RunE's IP validation (cmd/root.go:108-114 vs internal/bans/update/update.go:12-25). So an invalid ref must surface before an invalid IP, matching Go. The handler now resolves the ref first, and the IP validation loop runs inside the same Effect.ensuring(linkedProjectCache.cache(ref)) scope that Go's ensureProjectGroupsCached mirrors.

Added regression tests covering both the unresolved-ref (no linked project) and invalid-ref (--project-ref BADREF) cases combined with an invalid --db-unban-ip, asserting the ref error wins and no API call is made.

Fixes CLI-1856

Go resolves the project ref in PersistentPreRunE, which cobra runs
before RunE's IP validation ever executes (cmd/root.go:108-114 vs
internal/bans/update/update.go:12-25). The TS port validated IPs
first, so an invalid ref combined with an invalid IP surfaced the
wrong error compared to Go.

Fixes CLI-1856
@Coly010 Coly010 self-assigned this Jul 2, 2026
@Coly010

Coly010 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Coly010 Coly010 marked this pull request as ready for review July 2, 2026 14:05
@Coly010 Coly010 requested a review from a team as a code owner July 2, 2026 14:05
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@37543143a9ea1fef1ca221222162e235be421253

Preview package for commit 3754314.

@Coly010

Coly010 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant