You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WeaviateVectorStore broken against real Weaviate (v4 insert/search API, event-loop block, no collection create) — hidden by MagicMock #838
WeaviateVectorStore (src/synapsekit/retrieval/weaviate.py), previously only MagicMock-tested, is broken end-to-end against a real Weaviate (v4 client). Found via a real weaviate testcontainer (epic #829).
Bugs (all hidden by the mock)
Blocks the event loop — add/search call the synchronous weaviate v4 client (insert_many, near_vector, aggregate, collections.*) directly inside async def, with no to_thread.
insert_many API misuse — calls insert_many(data_objects=..., vectors=...); v4 takes a list of DataObject(properties=, vector=) and has no vectors= kwarg, so vectors are never attached → vector search can't work.
Collection never created — collections.get(name) in v4 returns a handle without raising for a missing collection, so the try/except never calls create; should use collections.exists(name).
return_metadata=["distance", "score"] — v4 expects MetadataQuery(distance=True), not a list of strings.
Score always 0 — near_vector results have no score (that's for bm25/hybrid); obj.metadata.score is None → every result scores 0.0. Should derive from distance.
Metadata dropped + filter broken — return_properties=["content"] returns only content, so obj.properties has no metadata; the Python metadata_filter then never matches.
v4 connection missing gRPC — connect_to_custom is called without grpc_host/grpc_port, which v4 requires.
No len(metadata) == len(texts) validation.
Fix
Offload via asyncio.to_thread; insert DataObject(properties, vector); use collections.exists; MetadataQuery(distance=True) with score = 1 - distance; return all properties and apply a native Filter; add gRPC defaults to connect_to_custom; validate metadata length.
Test
Real weaviate testcontainer (http + gRPC): true nearest-neighbour ranking, metadata filter, top_k, reconnect persistence, empty/negative, async contract. Replaces the MagicMock test; runs in the CI integration job.
Activity
fix(retrieval): fix WeaviateVectorStore against a real Weaviate v4 (S…