Skip to content

fix(ai): run SET CLUSTER SETTING outside ensure_table transaction; release 0.1.2 - #7

Merged
felipeg48 merged 1 commit into
mainfrom
fix/8-ai-vector-set-cluster-setting
Nov 19, 2026
Merged

felipeg48 merged 1 commit into
mainfrom
fix/8-ai-vector-set-cluster-setting

Conversation

@felipeg48

Copy link
Copy Markdown
Contributor

Problem

CockroachDBVectorStore.ensure_table() ran SET CLUSTER SETTING feature.vector_index.enabled = true on the same psycopg3 connection as CREATE TABLE / CREATE VECTOR INDEX. Those run in one implicit transaction, and CockroachDB rejects SET CLUSTER SETTING cannot be used inside a multi-statement transaction — so ensure_table() failed. Caught by the Ideas Board semantic integration test.

Fix

  • Enable the vector-index feature on its own autocommit=True connection, then run the table + index DDL in the normal transaction. No other behaviour changes; the mocked tests/test_ai_vector_store.py suite (21 tests) still passes.
  • Make the semantic example IT deterministic: default CRDB_VECTOR_IMAGE to cockroachdb/cockroach:latest-v26.2 (CREATE VECTOR INDEX is v26.2+), and broaden the skip guard to treat unimplemented feature errors as a graceful skip.
  • Bump cockroachdb-ai 0.1.1 -> 0.1.2 (publishes via the PEP 503 Pages feed on merge to main).

Validation

Repo CI (ruff format/check, mypy, pytest). The published 0.1.2 is then validated end-to-end by the example-IT workflow (PR #6).

ensure_table() issued `SET CLUSTER SETTING feature.vector_index.enabled`
on the same connection as CREATE TABLE / CREATE VECTOR INDEX. psycopg3
wraps those statements in one transaction, and CockroachDB rejects
`SET CLUSTER SETTING cannot be used inside a multi-statement transaction`,
so ensure_table() failed before the table was ever created.

Enable the feature on its own autocommit connection first, then run the
table + index DDL in the normal transaction. Behaviour is otherwise
unchanged; the mocked vector_store tests still pass.

Also make the semantic example IT deterministic: default CRDB_VECTOR_IMAGE
to a vector-index-capable image (latest-v26.2) so CREATE VECTOR INDEX
actually runs, and broaden the skip guard to also treat "unimplemented"
feature errors as a graceful skip.

Bump cockroachdb-ai to 0.1.2.
@felipeg48
felipeg48 merged commit ff13703 into main Nov 19, 2026
3 checks passed
@felipeg48
felipeg48 deleted the fix/8-ai-vector-set-cluster-setting branch November 19, 2026 18:55
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