fix(cli): resolve network-bans project ref before validating --db-unban-ip#5769
Open
Coly010 wants to merge 1 commit into
Open
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
Contributor
Author
|
@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 |
Contributor
Author
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
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