fix(chroma): write blob-fix marker even when narrowing skips all rows
The narrowed _fix_blob_seq_ids returned early when safe_rows was empty, but #1177's marker contract requires the marker to be written on every successful pass — even no-op — so subsequent opens skip the sqlite3 connection entirely. Without this, palaces that have no genuine 0.6.x BLOBs but DO have sysdb-10-prefixed rows would re-open sqlite3 on every call, defeating the #1090 corruption guard. Restructured the conditional so the marker write is unconditional after a successful sqlite scan, regardless of whether any rows were updated. Surfaced by test_fix_blob_seq_ids_writes_marker_when_already_integer during the develop-rebase of this PR. The author's branch predates the marker contract from #1177 (merged 2026-04-26), so this is a rebase-edge fix-up rather than a logic change to their narrowing behaviour.
This commit is contained in:
@@ -561,9 +561,10 @@ def _fix_blob_seq_ids(palace_path: str) -> None:
|
||||
"Skipped %d sysdb-10-format BLOB seq_id(s) in embeddings (not converting)",
|
||||
skipped,
|
||||
)
|
||||
if not safe_rows:
|
||||
return
|
||||
updates = [(int.from_bytes(blob, byteorder="big"), rowid) for rowid, blob in safe_rows]
|
||||
if safe_rows:
|
||||
updates = [
|
||||
(int.from_bytes(blob, byteorder="big"), rowid) for rowid, blob in safe_rows
|
||||
]
|
||||
conn.executemany("UPDATE embeddings SET seq_id = ? WHERE rowid = ?", updates)
|
||||
logger.info("Fixed %d BLOB seq_ids in embeddings", len(updates))
|
||||
conn.commit()
|
||||
|
||||
@@ -507,6 +507,7 @@ def test_fix_blob_seq_ids_skips_sqlite_when_marker_present(tmp_path):
|
||||
|
||||
mock_connect.assert_not_called()
|
||||
|
||||
|
||||
# ── quarantine_stale_hnsw ─────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user