Skip to content

fix(fleet-queue): reject duplicate/contradictory flags in client parser (#5939) - #5941

Merged
dezren39 merged 2 commits into
mainfrom
queue/9839-5939-fleet-queue-parser
Nov 5, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/9839-5939-fleet-queue-parser

Conversation

@dezren39

@dezren39 dezren39 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Fixes #5939

What

The fleet-queue client parser (pkgs/fleet/crates/fleet-queue/src/client.rs) silently accepted three bad invocation shapes:

  • a repeated flag overwrote the earlier value (last wins — --queue a --queue b retargeted the invocation),
  • a boolean flag with an inline value (--dry-run=false) was read as true — a real enqueue silently became a dry run that enqueued nothing and exited 0,
  • a non-numeric value for a numeric flag (--limit abc, read via get_i64's parse().ok()) silently fell back to the caller's default.

Change

  • parse_args is now a thin wrapper over a pure parse_args_inner that 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 =value is a usage error naming the flag. Bare booleans and single well-formed flags are unchanged.
  • get_i64 now dies (exit 2) on a non-numeric value via parse_i64_flag, naming the flag and the value — the same treatment pos_i64 gives positionals.

Tests

cargo test -p fleet-queue --features client --lib on 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 alpha records queue=alpha, absent --limit still defaults to 20 at the call site).

Queue task 9839 (repo-health-code-pilot), lane code-t.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 5, 2026 03:53
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 184d98e1-0a21-443d-a827-e7f9c6feefca
Commits

Reviewing files that changed from the base of the PR and between f8bac9f and 8db5b06.

Files ignored due to path filters: 1

  • pkgs/fleet/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 2

  • pkgs/fleet/crates/fleet-queue/Cargo.toml
  • pkgs/fleet/crates/fleet-queue/src/client.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T04:00:50.050244Z 8db5b06 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1373 to +1375
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"], &[])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet(queue): repo-queue client parser silently overwrites duplicate flags, accepts --dry-run=false as true, and silently defaults a non-numeric --limit

1 participant