Skip to content

fix(strict-mode): enforce max_query_limit on scroll requests when limit is omitted - #10382

Merged
generall merged 2 commits into
qdrant:devfrom
vjymisal0:fix/strict-mode-scroll-max-query-limit
Aug 30, 2026
Merged

generall merged 2 commits into
qdrant:devfrom
vjymisal0:fix/strict-mode-scroll-max-query-limit

Conversation

@vjymisal0

Copy link
Copy Markdown
Contributor

All Submissions:

  • My PR targets the dev branch (not master) and my branch was created from dev.
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

What does this PR do?

Fixes #10373.

When strict_mode_config.max_query_limit is configured (e.g. max_query_limit: 5), executing a scroll request with an omitted limit would bypass the limit check and return the built-in default of 10 points.

Root Cause:

ScrollRequestInternal's StrictModeVerification implementation was returning self.limit (Option<usize>). When limit was omitted (None), check_limit_opt bypassed validation because None was treated as no limit specified, and the default (10) was only applied downstream during execution.

Solution:

Updated ScrollRequestInternal::query_limit() in lib/collection/src/operations/verification/local_shard.rs to materialize the default limit before strict-mode validation via:

Some(self.limit.unwrap_or_else(ScrollRequestInternal::default_limit))

This aligns scroll with the query / search endpoint families where default limits are checked against max_query_limit.

Tests Added:

  • Added test_scroll_query_limit in lib/collection/src/operations/verification/mod.rs asserting that:
    • Omitted limit (defaulting to 10) is rejected when max_query_limit is 4.
    • Explicit limit exceeding max_query_limit is rejected.
    • Valid limit within max_query_limit succeeds.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 90f0031b-d99f-493c-8b0d-cffe1de28af5

📥 Commits

Reviewing files that changed from the base of the PR and between e036c49 and f58b02a.

📒 Files selected for processing (1)
  • lib/collection/src/operations/verification/local_shard.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/collection/src/operations/verification/local_shard.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The scroll request limit retains its configured-or-default behavior. Strict-mode tests now verify omitted limits, explicit limits above the maximum, and explicit limits at the maximum.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f58b0

The change makes omitted scroll limits respect the configured maximum and adds coverage for default, excessive, and valid limits; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

A rabbit checked the scroll limit gate
The default now meets the configured state
Ten hops are refused
Four hops are approved
Strict-mode keeps the burrow straight

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: enforcing strict-mode max_query_limit for scroll requests with omitted limits.
Description check ✅ Passed The description directly explains the bug, root cause, implementation, linked issue, and added tests.
Linked Issues check ✅ Passed The change satisfies issue #10373 by materializing the scroll default limit before strict-mode validation. Tests verify rejection of omitted and excessive limits and acceptance of a valid limit.
Out of Scope Changes check ✅ Passed The changes are limited to scroll limit validation and focused tests. No unrelated code changes are identified.
  • Fix all pre-merge checks with AI

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

Comment @coderabbitai help to get the list of available commands.

@qdrant-cloud-bot

Copy link
Copy Markdown
Contributor

Fixed the failing lint check: rustfmt wanted query_limit() reformatted. Pushed in f58b02a.

New workflow runs are waiting on maintainer approval (action_required) for this fork PR push — please approve the pending Actions runs so CI can re-run.

@generall
generall merged commit 7c31d2d into qdrant:dev Aug 30, 2026
17 checks passed
timvisee pushed a commit that referenced this pull request Sep 3, 2026
…it is omitted (#10382)

* fix(strict-mode): enforce max_query_limit on scroll requests when limit is omitted (fixes #10373)

* style: rustfmt scroll query_limit for CI lint

---------

Co-authored-by: qdrant-cloud-bot <[email protected]>
@timvisee timvisee mentioned this pull request Sep 3, 2026
Harsh23Kashyap added a commit to Harsh23Kashyap/qdrant that referenced this pull request Sep 9, 2026
Mirror the scroll fix from qdrant#10382 for the two remaining read endpoints
whose strict-mode query_limit() runs on the REST request before the
default limits are resolved:

- facet: an omitted limit now counts as FacetParams::DEFAULT_LIMIT (10)
  instead of skipping the check
- matrix: omitted sample/limit fall back to DEFAULT_SAMPLE /
  DEFAULT_LIMIT_PER_SAMPLE, so the effective sample * limit is checked

The gRPC paths convert to FacetParams/CollectionSearchMatrixRequest
(with defaults applied) before check_strict_mode and already enforce
correctly, so REST and gRPC disagreed.

Adds regression tests next to the existing test_scroll_query_limit.
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.

3 participants