fix(state): finalize empty FTS rebuild markers

Clear zero-row rebuild markers so empty databases can finish teardown and
stamp the new layout. Extend the migration regression through close/reopen
recovery for both empty and populated databases.
This commit is contained in:
Andrew Wikel
2026-08-20 23:18:30 -05:00
committed by kshitij
parent 5a7bee0fa8
commit 46bcad0c24
2 changed files with 53 additions and 36 deletions
+3 -1
View File
@@ -348,7 +348,9 @@ class SessionSearchMixin:
return True # transient (lock contention) — caller retries
if more is False:
status = self.fts_rebuild_status()
if status is not None and status["indexed"] >= status["total"]:
if high_water <= 0 or (
status is not None and status["indexed"] >= status["total"]
):
self._fts_rebuild_finish()
return False
return bool(more)