Skip to content

fix: reject zero query limits - #2151

Open
linhongyu510 wants to merge 1 commit into
weaviate:mainfrom
linhongyu510:fix/2150
Open

fix: reject zero query limits#2151
linhongyu510 wants to merge 1 commit into
weaviate:mainfrom
linhongyu510:fix/2150

Conversation

@linhongyu510

Copy link
Copy Markdown

Summary

Fixes #2150.

Passing limit=0 currently 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=0 when client-side argument validation is enabled. It preserves the existing low-level wire behavior when validation is explicitly disabled.

Tests

Added regression coverage for:

  • rejecting limit=0 with argument validation enabled;
  • accepting limit=None and positive limits;
  • preserving limit=0 and omitted-limit serialization when validation is disabled.

Validation performed:

  • pytest test/collection/test_queries.py test/collection/test_bm25_operator.py -q — 8 passed
  • Ruff lint and format checks — passed
  • Flake8 — passed
  • git diff --check — passed

Compatibility

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.

@orca-security-eu orca-security-eu 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.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@linhongyu510
linhongyu510 marked this pull request as draft August 30, 2026 03:47
@weaviate-git-bot

Copy link
Copy Markdown

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.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@linhongyu510
linhongyu510 marked this pull request as ready for review August 30, 2026 11:16
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.

fetch_objects(limit=0) returns a default page of objects instead of none

2 participants