Skip to content

Real testcontainers tests for ClickHouse (fixes top_k injection + reconnect) — #829 - #845

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

AmitoVrito merged 2 commits into
mainfrom
feat/issue-829-testcontainers-clickhouse

Conversation

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Summary

Next in epic #829: ClickHouse. The store already offloaded via run_in_executor (async fine), but real testing (#844) found two bugs.

Bugs found & fixed

  • top_k SQL-interpolated into LIMIT unvalidated — now cast to a positive int; a payload like "5; DROP TABLE ..." raises ValueError before hitting the DB.
  • No reconnect persistence — search() returned [] on a fresh instance; now _search_sync checks EXISTS TABLE.

Verification (real data)

8/8 pass against real clickhouse-server: real L2Distance ranking, metadata filter, top_k, reconnect persistence, injection rejection, async contract. Wired into the CI integration job.

Part of #829.

…x reconnect (#844)

Only MagicMock-tested, which hid two bugs found against a real clickhouse-server:
top_k was interpolated into the LIMIT clause without validation, and search()
returned [] after a reconnect (short-circuited on a local table-created flag).

Cast top_k to a positive int (a non-int payload now raises ValueError before
touching the DB) and check EXISTS TABLE in _search_sync, so a reconnected instance
finds persisted rows. Adds real clickhouse-server testcontainers tests and removes
the MagicMock test. (This store already offloaded via run_in_executor.)

Part of #829. Closes #844.
@AmitoVrito
AmitoVrito merged commit 276bd5e into main Jul 21, 2026
15 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