Skip to content

Commit 0b732f6

Browse files
phernandezclaude
andcommitted
fix(test): include id column in stale search_index INSERT for Postgres
Postgres search_index is a regular table with NOT NULL id constraint, unlike SQLite's FTS5 virtual table where id is UNINDEXED. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent b265c57 commit 0b732f6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/services/test_project_service_embedding_status.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,19 @@ async def test_embedding_status_excludes_stale_entity_ids(
260260
Regression test for #670: after reindex, project info reported missing embeddings
261261
because stale entity_ids in search_index/search_vector_chunks inflated total_indexed_entities.
262262
"""
263-
# Insert a stale search_index row for an entity_id that doesn't exist in the entity table
263+
# Insert a stale search_index row for an entity_id that doesn't exist in the entity table.
264+
# Include 'id' column — required NOT NULL on Postgres (regular table),
265+
# ignored on SQLite (FTS5 virtual table where id is UNINDEXED).
264266
stale_entity_id = 999999
265267
await project_service.repository.execute_query(
266268
text(
267269
"INSERT INTO search_index "
268-
"(entity_id, project_id, type, title, permalink, content_stems, "
270+
"(id, entity_id, project_id, type, title, permalink, content_stems, "
269271
"content_snippet, file_path, metadata) "
270-
"VALUES (:eid, :pid, 'entity', 'Stale Note', 'stale-note', "
272+
"VALUES (:id, :eid, :pid, 'entity', 'Stale Note', 'stale-note', "
271273
"'stale content', 'stale snippet', 'stale.md', '{}')"
272274
),
273-
{"eid": stale_entity_id, "pid": test_project.id},
275+
{"id": stale_entity_id, "eid": stale_entity_id, "pid": test_project.id},
274276
)
275277

276278
with patch.object(

0 commit comments

Comments
 (0)