Skip to content

fix(search): reject out-of-range limit and prefetch_limit before query - #19

Merged
royalpinto007 merged 2 commits into
AgentPostmortem:mainfrom
sharadvc:fix/search-limit-guard
Sep 18, 2026
Merged

royalpinto007 merged 2 commits into
AgentPostmortem:mainfrom
sharadvc:fix/search-limit-guard

Conversation

@sharadvc

Copy link
Copy Markdown
Contributor

What

Closes #10. search() accepted negative, zero, and huge limit / prefetch_limit values with no guard, passing them straight to the query client.

Changes

  • src/tenantq/search.py: validate limit (1–1000) and prefetch_limit (1–10000) up front, raising a clear ValueError before any client call.
  • tests/test_search.py: parametrized regression tests for out-of-range values across both params, asserting the client is never called.

Checklist

Authored with AI assistance; rebased onto current main and verified locally.

search() passed limit=-1 or limit=10_000 straight into query_points.
Guard both limit and prefetch_limit to 1-1000 and raise a descriptive
ValueError before any embed or query work happens.

Closes AgentPostmortem#10
@royalpinto007

Copy link
Copy Markdown
Member

Thanks! One mismatch: the code caps prefetch_limit at 1000 but the PR description says 1-10000. Please raise the cap to 10000 to match (prefetch-over-fetch semantics favor the larger cap).

@sharadvc

Copy link
Copy Markdown
Contributor Author

Fixed — prefetch_limit cap raised 1000 → 10000 to match the PR description (validation + error message + tests). Bounda checked: prefetch_limit=10000 accepted, 10001 rejected. 21 tests pass, ruff clean.

@royalpinto007
royalpinto007 merged commit bd418b7 into AgentPostmortem:main Sep 18, 2026
1 check passed
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.

search() accepts negative/huge limit and prefetch_limit with no guard

2 participants