Repository navigation
fix(fleet-queue): reject duplicate/contradictory flags in client parser (#5939) - #5941
Conversation
|
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 34 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 SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2bce06fce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| fn duplicate_value_flag_is_a_usage_error() { | ||
| // #5939: last-wins used to silently retarget the invocation. | ||
| let err = parse_args_inner(&pos(&["--queue", "a", "--queue", "b"]), &["queue"], &[]) |
There was a problem hiding this comment.
Cover the parser invariants with property-based tests
The new parser guarantees are covered only by fixed examples, contrary to the root AGENTS.md testing doctrine requiring property tests for meaningful parser invariants and explicitly disallowing examples as their replacement. No existing property-based suite covers this client parser. Add generated checks for duplicate flags across inline/separate spellings and argument positions, rejection of inline boolean values, and numeric parsing, while retaining these examples as smoke coverage.
AGENTS.md reference: AGENTS.md:L41-L45
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8db5b06: added property-based tests for the parser invariants (proptest 1.12 as a dev-dependency, the version pkgs/id uses). The generator covers duplicate flags across inline/separate spellings and argument positions, rejection of any inline boolean value, bare booleans in any position, i64 round-trip and non-numeric rejection for numeric flags, and preservation of distinct flags — with the invariant as the oracle. The fixed examples stay as smoke coverage. cargo test -p fleet-queue --features client --lib: 12 passed.
Fixes #5939
What
The fleet-queue client parser (
pkgs/fleet/crates/fleet-queue/src/client.rs) silently accepted three bad invocation shapes:--queue a --queue bretargeted the invocation),--dry-run=false) was read astrue— a real enqueue silently became a dry run that enqueued nothing and exited 0,--limit abc, read viaget_i64'sparse().ok()) silently fell back to the caller's default.Change
parse_argsis now a thin wrapper over a pureparse_args_innerthat returns the usage error: repeating any value or boolean flag is a usage error naming the flag (exit 2), and a boolean given an inline=valueis a usage error naming the flag. Bare booleans and single well-formed flags are unchanged.get_i64now dies (exit 2) on a non-numeric value viaparse_i64_flag, naming the flag and the value — the same treatmentpos_i64gives positionals.Tests
cargo test -p fleet-queue --features client --libon the laptop: 6 passed, including five new pinning tests — duplicate value flag, duplicate bool, bool with inline value, non-numeric numeric flag, and a well-formed control (list --queue alpharecords queue=alpha, absent--limitstill defaults to 20 at the call site).Queue task 9839 (repo-health-code-pilot), lane code-t.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.