refactor(memory): enforce VectorStore search clamp via template method#6627
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 21, 2026 00:46
Convert VectorStore::search from a single required method into a template-method pair: search is now trait-provided and clamps limit before delegating to a new required search_clamped method that implementors supply. Closes the gap flagged in #6623, where the clamp added in #6622 relied on every implementor remembering to call clamp_search_limit itself — a convention a 4th implementor (the FailingSearchStore test mock) had already silently skipped. Migrates QdrantOps, DbVectorStore, InMemoryVectorStore, and FailingSearchStore to the new contract. Public search API and behavior are unchanged for all callers. Closes #6623
bug-ops
force-pushed
the
fix/6623-vectorstore-clamp-structural
branch
from
July 21, 2026 00:47
e641e5f to
7d58019
Compare
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
VectorStore::searchfrom a single required trait method into a template-method pair:searchis now trait-provided (clampslimit, then delegates), and a new requiredsearch_clampedis what implementors supply.QdrantOps,DbVectorStore,InMemoryVectorStore, and theFailingSearchStoretest mock) to the new contract, removing their per-impl clamp calls.MAX_SEARCH_LIMITclamp (added in fix(memory): clamp VectorStore::search trait method directly #6622 for zeph-memory: raw VectorStore::search trait method still has no limit clamp #6616/Low: four hardening observations in zeph-memory Qdrant search / zeph-a2a trust defaults #6553) structurally reached by every call path throughsearch, instead of relying on each implementor remembering to callclamp_search_limit— the exact convention gap flagged in zeph-memory: VectorStore search clamp is convention-based per-impl, not structurally enforced #6623 (theFailingSearchStoretest mock had already silently skipped it).searchAPI and behavior are unchanged for all ~10 external callers.Closes #6623
Test plan
cargo nextest run --config-file .github/nextest.toml -p zeph-memory— 1702 passed, 31 skipped, 0 failed (includes 2 new clamp-enforcement tests)cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 15033 passed, 36 skipped, 0 failedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"cargo test --doc -p zeph-memory— 61 passedgitleaks protect --staged