Repository navigation
fix(cli): reject negative rule flags given on their own - #506
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
The has-rule-flags checks in validateRules only counted values > 0, so a lone negative --rule-delay, --rule-deduplicate-window, --rule-retry-count or --rule-retry-interval skipped validation and was silently ignored. Count any non-zero value so the existing errors fire. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Follow-up to #498 (validate rule flags in
connection update).validateRulesdecides whether a rule is being configured withRuleDelay > 0,RuleDeduplicateWindow > 0,RuleRetryCount > 0andRuleRetryInterval > 0. A negative value therefore never counts as "set", and themust be a positive integerchecks further down (< 0) are only reachable when some other flag in the same rule is also given. On its own,--rule-delay -5is silently ignored: the command succeeds and sends no rule. The same goes for--rule-deduplicate-window -5and for a lone negative retry count/interval.Fix. Use
!= 0in those four "has flags" checks, so the existing validation errors fire. Valid (positive) values and unset flags behave as before; this matches the!= 0checksconnection upsertalready uses to detect rule flags.Test.
TestConnectionUpdateRejectsNegativeRuleFlagscovers each flag on its own (and negative retry count/interval with and without--rule-retry-strategy); it fails on main (no error returned) and passes with the change.go test ./pkg/cmd/passes.Reproduction.
hookdeck gateway connection update <id> --rule-delay -5exits successfully without applying or rejecting anything.This PR was prepared with AI assistance (Claude Code) and the contributor is responsible for the change.