Uh oh!
There was an error while loading. Please reload this page.
fix(cli): resolve network-bans project ref before validating --db-unban-ip - #5769
Conversation
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
commented
Jul 2, 2026
@codex review |
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@37543143a9ea1fef1ca221222162e235be421253Preview package for commit |
Coly010
commented
Jul 2, 2026
@codex review |
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Coly010
commented
Jul 3, 2026
@codex review |
Codex Review: Didn't find any major issues. Hooray! 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.
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-ipbefore resolving the project ref.Expected Behavior
Go resolves the project ref in
PersistentPreRunE, which cobra always runs beforeRunE's IP validation (cmd/root.go:108-114vsinternal/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 sameEffect.ensuring(linkedProjectCache.cache(ref))scope that Go'sensureProjectGroupsCachedmirrors.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