Repository navigation
feat(cli): accept a repeated --rack as well as a comma list - #217
Merged
Merged
Conversation
--rack was a plain string flag, so a repeated flag kept only its last value with no warning: `deploy-approval approve --rack us --rack eu` approved EU alone and left the US request pending. --rack now adds each repeated value to the list. `--rack us --rack eu`, `--rack us,eu` and mixes like `--rack staging --rack us,eu` select the same racks, in the order given, with repeats dropped. Deploy approval commands (approve, list, show, wait) act on each one, and `all` mixed with other racks is refused instead of failing as an unknown rack named "all". Commands that use one rack now refuse several (from --rack or RACK_GATEWAY_RACK) rather than quietly using one of them, and login refuses rack names with commas, which --rack could never select.
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Nov 8, 2026 5:16a.m. | Review ↗ | |
| Go | Nov 8, 2026 5:16a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
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.
Problem
--rackwas a plain string flag, so repeating it kept only the last value, with no warning.deploy-approval approve --app web --commit <sha> --rack us --rack euapproved EU alone and left the US request pending. The help only showed the comma form (--rack us,eu), so nothing told the user the first rack had been dropped.Change
--rackcollects repeated values (rackFlagValueininternal/cli/rack_flag.go).--rack us --rack eu,--rack us,eu,-r us --rack=euand mixes like--rack staging --rack us,euall select the same racks, in the order given. Repeats count once.approve,list,show,wait) act on every rack in the list.allmixed with rack names (--rack all --rack us,--rack all,eu) is now refused with a clear message. It used to fail withNo rack found with name "all".--rack all --rack allstill means all.ps,run,env,deploy-approval requestand the rest) now refuse several racks, from--rackorRACK_GATEWAY_RACK:this command uses one rack, but several were selected: us, eu. Before, a repeated--rackquietly used the last rack, and a comma list failed as an unknown rack namedus,eu. Naming one rack twice (--rack us --rack us) is still fine.--rackcould never select them.approve,list,show,waitand the global flag shows both forms. So do the CLI docs (commands, multi-rack, deploy approvals) andinternal/cli/AGENTS.md.Executenow builds the root command throughnewRootCommand(), so tests parse the real global flags.Tests
internal/cli/rack_flag_test.goparses through the root command's own flags. It covers repeated, short and long, comma, mixed, order, duplicates, blank values, repeatedall,allmixed with other racks, single-rack refusal (flag and env), one rack named twice, and login with a comma.Each test was mutation-checked by breaking the code and watching the test fail. The breaks were: the root flag back to
StringVarP, no de-duplication,SelectedRacktaking a list,allmixed with other racks allowed, and the login check removed.go test ./internal/cli/...passes. I also checked a built CLI by hand:ps --rack us --rack eurefuses with the message above.deploy-approval list --rack staging --rack us,eureads all three racks.--rack all --rack usgets the new error.Includes the version bump to v0.1.34.