fix: reject zero query limits - #2151
Open
linhongyu510 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
linhongyu510
marked this pull request as draft
August 30, 2026 03:47
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
linhongyu510
marked this pull request as ready for review
August 30, 2026 11:16
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.
Summary
Fixes #2150.
Passing
limit=0currently serializes the value correctly, but the server treats it as an omitted limit and returns its default page size. This is surprising because callers explicitly requested zero results.This change rejects
limit=0when client-side argument validation is enabled. It preserves the existing low-level wire behavior when validation is explicitly disabled.Tests
Added regression coverage for:
limit=0with argument validation enabled;limit=Noneand positive limits;limit=0and omitted-limit serialization when validation is disabled.Validation performed:
pytest test/collection/test_queries.py test/collection/test_bm25_operator.py -q— 8 passedgit diff --check— passedCompatibility
This is an explicit validation behavior change only for clients using the default
validate_arguments=True. Clients that disable validation retain the existing request serialization.This change was implemented with AI assistance and validated with the tests listed above.