fix: avoid bool-checking query namespace vectors#667
Open
pragnyanramtha wants to merge 1 commit into
Open
Conversation
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
query_namespaces()validationquery()unchangedValidation
uv run --no-sync pytest tests/unit/test_query_namespaces.py tests/unit/test_async_query_namespaces.py tests/unit/async_client/test_async_index_query_namespaces.py -q(34 passed)uv run --no-sync ruff check pinecone/index/__init__.py pinecone/async_client/async_index.py tests/unit/test_query_namespaces.py tests/unit/test_async_query_namespaces.pyuv run --no-sync ruff format --check pinecone/index/__init__.py pinecone/async_client/async_index.py tests/unit/test_query_namespaces.py tests/unit/test_async_query_namespaces.pyuv run --no-sync mypy --strict pinecone/index/__init__.py pinecone/async_client/async_index.pygit diff --checkNote: a full editable project build was not run locally because this machine does not have
protoc; CI installsprotocbefore building the Rust extension.Note
Low Risk
Low risk: small validation tweak in
query_namespaces()to treat onlyNone/empty dense vectors as missing while avoiding__bool__evaluation; covered by new sync/async regression tests.Overview
Fixes
Index.query_namespaces()andAsyncIndex.query_namespaces()validation to stop boolean-coercing the provided densevector, checking explicitly forNoneorlen(vector)==0instead.Adds sync and async unit tests using a sequence-like vector with an ambiguous truth value to ensure the vector is accepted and forwarded through to
query()unchanged, while preserving the existing empty-vector error behavior.Reviewed by Cursor Bugbot for commit 46e94fb. Bugbot is set up for automated code reviews on this repo. Configure here.