Skip to content

Reject dequeue batch_size < 1 - #8

Open
janbjorge wants to merge 2 commits into
claude/code-review-bugs-vokwlk-05-release-orphaned-claimsfrom
claude/code-review-bugs-vokwlk-06-validate-batch-size
Open

janbjorge wants to merge 2 commits into
claude/code-review-bugs-vokwlk-05-release-orphaned-claimsfrom
claude/code-review-bugs-vokwlk-06-validate-batch-size

Conversation

@janbjorge

@janbjorge janbjorge commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Stack 6/9, base #7.

A negative batch_size sliced from the end: -1 claimed all but one job. Now batch_size < 1 raises ValueError before any I/O.

Tests: test_claim_rejects_non_positive_batch_size, test_dequeue_rejects_non_positive_batch_size fail on base; test_claim_batch_size_one_claims_one, test_dequeue_batch_size_larger_than_queue_is_accepted pass on both.

claim() sliced queued_jobs(...)[:batch_size] without validating it, so
batch_size=-1 claimed every queued job except the last, and other
negative values claimed similarly surprising amounts. batch_size=0 did a
full read/write round trip to claim nothing.

Add check_batch_size() and raise ValueError for batch_size < 1 from
StateQueries.claim and, before any I/O, from DirectQueue.dequeue and
GroupCommitLoop.dequeue (and so BrokerQueue.dequeue).

This branch has not been deployed

No deployments
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.

1 participant