Add --limit to queue flush - #1148
Conversation
There was a problem hiding this comment.
LGTM — small, well-tested CLI addition.
What was reviewed:
--limitvalidation (_positive_int) rejects 0/negative values via argparse error path.- Mutual exclusivity between
--limitand--caller-user-idenforced by an argparse group. - Request params dict construction and the DELETE call for
queue flushare covered by unit tests, including the params sent to the backend.
Extended reasoning...
Overview
This PR adds a --limit option to fal queue flush, letting users cap the number of pending requests flushed instead of flushing everything. It touches only projects/fal/src/fal/cli/queue.py (parser wiring + params dict construction) and adds a matching unit test file. The backend behavior for limit lives in a separate isolate-cloud PR referenced in the description, so this PR is purely the CLI-side plumbing.
Security risks
None. This is a client-side CLI change that builds a query-param dict (caller_user_id, limit) passed through httpx's params=, which handles proper encoding. No auth, crypto, or permission logic is touched.
Level of scrutiny
Low. The change is small, mechanical, and additive — a new optional flag with input validation and a mutually-exclusive constraint, following the exact pattern already used for --caller-user-id. It doesn't touch any critical or shared code paths beyond this single CLI subcommand.
Other factors
New unit tests directly exercise the added behavior: limit parsing/type-checking, the params sent to the DELETE call, rejection of non-positive limits, and rejection of combining --limit with --caller-user-id. The bug-hunting system found no issues, and my own read of the diff didn't surface any correctness or edge-case concerns.
Adds
fal queue flush APP --limit N, validates that N is positive, and sends it to the queue flush endpoint.--limitand--caller-user-idare mutually exclusive.Depends on: https://github.com/fal-ai/isolate-cloud/pull/9377
Linear: https://linear.app/features-and-labels/issue/INFRA-4754/add-a-limit-option-to-queue-flush
Prompted by: Ishaan Mittal