Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

Commit f24c273

Browse files
z23ccclaude
andcommitted
fix(db): use BLOB for embedding column, graceful vector index degradation
- schema.sql: F32_BLOB(384) → BLOB (F32_BLOB requires libSQL server extensions) - pool.rs: try-create vector index separately with graceful fallback - Fixes "no such column: embedding" error on DB creation in embedded/core mode - Update TOML test expectations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c493542 commit f24c273

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

flowctl/crates/flowctl-db/src/pool.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ async fn apply_schema(conn: &Connection) -> Result<(), DbError> {
8989
conn.execute_batch(SCHEMA_SQL)
9090
.await
9191
.map_err(|e| DbError::Schema(format!("schema apply failed: {e}")))?;
92+
93+
// Try to create the vector index (requires libSQL server extensions).
94+
// Gracefully degrade if not available (embedded/core mode).
95+
let _ = conn
96+
.execute(
97+
"CREATE INDEX IF NOT EXISTS memory_emb_idx ON memory(libsql_vector_idx(embedding))",
98+
(),
99+
)
100+
.await;
101+
92102
Ok(())
93103
}
94104

flowctl/crates/flowctl-db/src/schema.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ CREATE TABLE IF NOT EXISTS memory (
192192
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
193193
last_verified TEXT,
194194
refs INTEGER NOT NULL DEFAULT 0,
195-
embedding F32_BLOB(384)
195+
embedding BLOB
196196
);
197197

198198
-- ── Indexes ─────────────────────────────────────────────────────────
@@ -211,7 +211,9 @@ CREATE INDEX IF NOT EXISTS idx_memory_track ON memory(track);
211211
CREATE INDEX IF NOT EXISTS idx_memory_severity ON memory(severity);
212212

213213
-- Native libSQL vector index for semantic memory search
214-
CREATE INDEX IF NOT EXISTS memory_emb_idx ON memory(libsql_vector_idx(embedding));
214+
-- NOTE: libsql_vector_idx requires libSQL server extensions (not available in core/embedded mode).
215+
-- Applied separately in pool.rs with graceful degradation.
216+
-- CREATE INDEX IF NOT EXISTS memory_emb_idx ON memory(libsql_vector_idx(embedding));
215217

216218
-- ── Auto-aggregation trigger ────────────────────────────────────────
217219

flowctl/tests/cmd/next_json.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
bin.name = "flowctl"
22
args = ["--json", "next"]
3-
status.code = 1
4-
stdout = ""
3+
stdout = """
4+
{"epic":null,"reason":"none","status":"none","task":null}
5+
"""
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
bin.name = "flowctl"
22
args = ["--json", "validate", "--all"]
3-
status.code = 1
43
stdout = "..."

0 commit comments

Comments
 (0)