Skip to content

LocalVectorStoreDriver namespace match accuracy#2244

Merged
cjkindel merged 3 commits into
mainfrom
fix/2241
Jul 13, 2026
Merged

LocalVectorStoreDriver namespace match accuracy#2244
cjkindel merged 3 commits into
mainfrom
fix/2241

Conversation

@cjkindel

Copy link
Copy Markdown
Contributor

Describe your changes

Summary
Fixed issue #2241: LocalVectorStoreDriver.query_vector() leaking entries across namespaces sharing a hyphenated prefix.

Root cause: query_vector() filtered entries with a key-prefix check k.startswith(f"{namespace}-") against the derived storage key (f"{namespace}-{vector_id}"). Since namespaces can contain hyphens, a query for "foo" also matched entries in "foo-bar".

Fix in local_vector_store_driver.py:101: swapped the prefix check for the exact-match filter v.namespace == namespace, matching the semantics already used by the sibling load_entries() method.

Regression test added in test_local_vector_store_driver.py reproducing the issue's scenario ("foo" vs "foo-bar").

Both query_vector tests pass.

Issue ticket number and link

Closes #2241

@cjkindel
cjkindel requested a review from collindutter July 13, 2026 19:44
@cjkindel cjkindel self-assigned this Jul 13, 2026
@cjkindel
cjkindel enabled auto-merge July 13, 2026 19:44
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cjkindel
cjkindel added this pull request to the merge queue Jul 13, 2026
@cjkindel
cjkindel removed this pull request from the merge queue due to a manual request Jul 13, 2026
@cjkindel
cjkindel enabled auto-merge July 13, 2026 19:51
@cjkindel
cjkindel added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit 6bccc12 Jul 13, 2026
17 checks passed
@cjkindel
cjkindel deleted the fix/2241 branch July 13, 2026 20:04
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.

LocalVectorStoreDriver.query_vector() leaks entries across namespaces that share a hyphenated prefix

2 participants