Skip to content

CassandraVectorStore broken against real Cassandra 5.0 (list<float> not vector, no SAI index, score=1.0) — hidden by MagicMock #842

Closed

Description

@AmitoVrito

Summary

CassandraVectorStore's cassandra-driver path (src/synapsekit/retrieval/cassandra_vector.py), previously only MagicMock-tested, is broken against a real Cassandra 5.0. Found via a real cassandra:5 testcontainer (epic #829). (It does correctly offload via run_in_executor — async is fine here.)

Bugs (cassandra-driver mode, hidden by the mock)

  1. Wrong column type — the embedding column is created as list<float>; Cassandra 5.0 ANN vector search requires vector<float, dim>.
  2. No SAI index — ORDER BY embedding ANN OF ... requires a StorageAttachedIndex on the vector column; none is created, so every search fails (InvalidRequest).
  3. Score hardcoded to 1.0 — _cass_search_sync returns score: 1.0 for every row instead of the real similarity.
  4. No reconnect persistence — search() returns [] when not self._table_created and self._dim is None, so a reconnected instance never finds existing rows.

Fix

  • Create embedding vector<float, dim> plus a StorageAttachedIndex (cosine).
  • Return the real score via similarity_cosine(embedding, <vec>).
  • Drop the guard; _cass_search_sync returns [] on a missing-table InvalidRequest (covers search-before-add and reconnect).

Test

Real cassandra:5 testcontainer (cassandra-driver mode, address-translator for the mapped port): true nearest-neighbour ranking, metadata filter, top_k, reconnect persistence, empty/negative, async contract. Replaces the MagicMock test; runs in the CI integration job.

Part of epic #829.

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