Skip to content

Real testcontainers tests for Cassandra 5.0 (fixes ANN vector path) — #829 - #843

Merged
AmitoVrito merged 4 commits into
mainfrom
feat/issue-829-testcontainers-cassandra
Jul 21, 2026
Merged

AmitoVrito merged 4 commits into
mainfrom
feat/issue-829-testcontainers-cassandra

Conversation

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Summary

Next in epic #829: Cassandra (cassandra-driver mode, real Cassandra 5.0). The store already offloaded via run_in_executor (async fine), but the vector path was broken (#842).

Bugs found & fixed

  • list<float> instead of vector<float, dim> + no SAI index → ORDER BY embedding ANN OF ... failed on real Cassandra 5.0. Now creates a typed vector column + cosine StorageAttachedIndex.
  • score hardcoded to 1.0 → now the real similarity_cosine(embedding, <vec>).
  • No reconnect persistence → search returned [] on a fresh instance; now returns [] only on a genuine missing-table InvalidRequest.

Verification (real data)

7/7 pass against cassandra:5 (an address-translator handles the testcontainers port mapping): real ANN vector search, real cosine scores, native metadata filter, reconnect via a second cluster/session, async contract. Wired into the CI integration job.

Commits

  • fix(retrieval): fix CassandraVectorStore against real Cassandra 5.0 (#842)
  • ci(test): add cassandra-driver to the integration group and CI job (#829)
  • style: ...

Part of #829.

…842)

The cassandra-driver path was only MagicMock-tested, which hid that it created the
embedding column as list<float> with no StorageAttachedIndex — so the ANN vector
search (ORDER BY embedding ANN OF ...) failed on real Cassandra 5.0 — hardcoded
score to 1.0, and returned [] after a reconnect.

Create a vector<float, dim> column plus a cosine StorageAttachedIndex, return the
real similarity_cosine score, and drop the reconnect guard (search returns [] on a
missing-table InvalidRequest, covering search-before-add too). Adds real cassandra:5
testcontainers tests (an address-translator handles the mapped port) and removes the
MagicMock test. (This store already offloaded via run_in_executor — async was fine.)

Part of #829. Closes #842.
…842)

The InvalidRequest handling and real similarity_cosine score must not require
cassandra-driver at call time — the #785/#789 CQL query-building tests drive
_cass_search_sync with a fake session and no driver installed. Import
InvalidRequest optionally (empty tuple when absent) and read the score via getattr
so fake rows without a score field still work.
@AmitoVrito
AmitoVrito merged commit 0e36c2b into main Jul 21, 2026
6 checks passed
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.

1 participant