Skip to content

QdrantVectorStore: blocks event loop, ignores metadata_filter, id-collision on reconnect, deprecated API — hidden by MagicMock #836

Closed

Description

@AmitoVrito

Summary

QdrantVectorStore (src/synapsekit/retrieval/qdrant.py), previously only MagicMock-tested, has several real bugs found via a real qdrant/qdrant testcontainer (epic #829).

Bugs

  1. Blocks the event loop (async violation) — add/search call the synchronous QdrantClient (get_collection, create_collection, upsert, search) directly inside async def, with no run_in_executor/to_thread. This stalls the event loop; SynapseKit is async-first and every other store offloads blocking IO.
  2. metadata_filter silently ignored — search() accepts metadata_filter but never applies it, so filtered searches return unfiltered results.
  3. ID collision / overwrite on reconnect — point ids come from a per-instance self._count starting at 0, so a fresh instance (or a second writer) re-adds ids 0,1,2… and overwrites existing points instead of appending.
  4. search before add raises — a missing collection raises instead of returning [] (all other stores return []).
  5. Deprecated .search() API — replaced by query_points in qdrant-client ≥1.10.
  6. No len(metadata) == len(texts) validation (other stores raise ValueError).

Fix

  • Offload all client calls via asyncio.to_thread(...), preserving async.
  • Apply a native qdrant Filter/FieldCondition/MatchValue for metadata_filter.
  • Use uuid4 point ids (no collision, safe reconnect/append).
  • Return [] when the collection doesn't exist; use collection_exists + query_points.
  • Validate metadata length.

Test

Real qdrant/qdrant testcontainer: true nearest-neighbour ranking, metadata filter, top_k, persistence across reconnect (append, not overwrite), empty/negative, and an async-contract assertion. Replaces the MagicMock test; runs in the CI integration job.

Part of epic #829.

Activity

  1. added this to the v2.0.1 milestone on Jul 21, 2026
  2. added
    bug
    retrieval
    v2.0.1
    on Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugretrievalv2.0.1

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions