mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-10-09 03:20:54 +00:00
fix(file_store): preserve verified recovery without chunks
This commit is contained in:
parent
5acd82dddd
commit
78535424f6
2 changed files with 34 additions and 6 deletions
|
|
@ -272,12 +272,6 @@ class LocalFileStore(BaseFileStore):
|
|||
f"elapsed={time.monotonic() - started_at:.3f}s",
|
||||
)
|
||||
return
|
||||
if not self.file_chunks:
|
||||
self.logger.info(
|
||||
f"{self.name}: embedding backfill skipped: reason=no_chunks, "
|
||||
f"elapsed={time.monotonic() - started_at:.3f}s",
|
||||
)
|
||||
return
|
||||
if self._embedding_backfill_task is not None and not self._embedding_backfill_task.done():
|
||||
pending_verified = skip_health_check or bool(
|
||||
self._embedding_backfill_pending and self._embedding_backfill_pending[0],
|
||||
|
|
@ -292,6 +286,12 @@ class LocalFileStore(BaseFileStore):
|
|||
f"elapsed={time.monotonic() - started_at:.3f}s",
|
||||
)
|
||||
return
|
||||
if not self.file_chunks:
|
||||
self.logger.info(
|
||||
f"{self.name}: embedding backfill skipped: reason=no_chunks, "
|
||||
f"elapsed={time.monotonic() - started_at:.3f}s",
|
||||
)
|
||||
return
|
||||
self._embedding_backfill_task = asyncio.create_task(
|
||||
self._run_embedding_backfill(skip_health_check=skip_health_check, rebuild=rebuild),
|
||||
name=f"embedding-backfill:{self.name}",
|
||||
|
|
|
|||
|
|
@ -724,6 +724,34 @@ def test_verified_resume_supersedes_inflight_startup_health_check():
|
|||
run(go())
|
||||
|
||||
|
||||
def test_verified_resume_without_chunks_supersedes_inflight_health_check():
|
||||
"""A newer verified state survives a stale probe even after chunks are cleared."""
|
||||
|
||||
async def go():
|
||||
with tempfile.TemporaryDirectory() as tmp, temp_chdir(tmp):
|
||||
store = _new_local_store("t_embedding_empty_verified_resume_race")
|
||||
await store.start()
|
||||
await set_chunks_with_graph(store, {"a": chunk("a", "a.md", "alpha text")})
|
||||
fake = CancellationResistantHealthStore()
|
||||
store.embedding_store = fake
|
||||
store._start_embedding_backfill()
|
||||
startup_task = store._embedding_backfill_task
|
||||
await fake.health_started.wait()
|
||||
|
||||
await store.clear()
|
||||
assert await store.resume_embedding(verified=True) is True
|
||||
assert store._embedding_backfill_pending == (True, False)
|
||||
fake.release_health.set()
|
||||
|
||||
await startup_task
|
||||
assert fake.is_healthy is True
|
||||
assert not fake.node_embedding_calls
|
||||
assert store._embedding_backfill_task is None
|
||||
await store.close()
|
||||
|
||||
run(go())
|
||||
|
||||
|
||||
@pytest.mark.parametrize("store_factory", [_new_local_store, _new_faiss_store, _new_zvec_store])
|
||||
def test_verified_rebuild_discards_same_dimension_vectors_before_backfill(store_factory):
|
||||
"""A changed vector space never searches compatible-shaped stale vectors."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue