Repository navigation
fix(fleet-config): reject dispatch-test threshold = 0 (#6603) - #6692
Merged
Merged
Conversation
The #6412 zero rule covered the three scalar numerics that existed then; the [dispatch-test] threshold landed later (#6580) and was never added, so threshold = 0 loaded cleanly and made every execution home permanently ineligible (active < 0 is always false). Config::validate now rejects it naming [dispatch-test] threshold and the default (40), and parse_threshold rejects --threshold 0 as a usage error (exit 2). Tests pin both refusals; omitted still yields 40, positive values unchanged.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Fixes #6603.
What
The #6412 zero rule in
fleet-configrejects a configured0for scalar numeric settings, but the[dispatch-test] thresholdlanded later (#6580) and was never added —threshold = 0loaded cleanly, and since eligibility isactive < threshold,active < 0made every execution home permanently ineligible with no hint the threshold itself was the cause. The CLI path had the same hole (--threshold 0passedparse_threshold).Config::validatenow rejects[dispatch-test] threshold = 0with the existing message shape:[dispatch-test] threshold must not be 0; omit the field for the default (40).parse_thresholdrejects--threshold 0as a usage error (exit 2):--threshold must not be 0; omit --threshold for the configured threshold. The parse-failure wording changes from "non-negative" to "positive" accordingly.Tests
fleet-config:zero_scalar_numerics_are_a_loud_errorgains the[dispatch-test] threshold = 0case; omitted threshold still resolves to 40 andthreshold = 7loads as 7.fleet-dispatch-test: newthreshold_zero_is_a_usage_errorpins exit code 2 + message forSome("0"), and thatSome("7")/None(default 40) pass unchanged.cargo test -p fleet-config -p fleet-dispatch-test— 17 + 14 passed.Oracle: the #6412 rule's own behavior for the original three fields (same error shape, same load path), plus the documented default (40) for the omitted case.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.