From 2c82a30b16fae9b5568e3da2e578f2832a7175d1 Mon Sep 17 00:00:00 2001 From: giveen Date: Mon, 19 Jan 2026 10:33:38 -0700 Subject: [PATCH] test(rag): assert persisted index is loaded (mtime unchanged) --- tests/test_rag_workspace_integration.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_rag_workspace_integration.py b/tests/test_rag_workspace_integration.py index 1848fca..bcfeb14 100644 --- a/tests/test_rag_workspace_integration.py +++ b/tests/test_rag_workspace_integration.py @@ -40,8 +40,14 @@ def test_rag_and_indexer_use_workspace(tmp_path, monkeypatch): assert rag.get_chunk_count() >= 1 assert rag.get_document_count() >= 1 - # Now create a new RAGEngine and ensure it loads persisted index automatically + # Now create a new RAGEngine and ensure it loads the persisted index instead of re-indexing + # Record the persisted index mtime so we can assert it is not overwritten by a re-index + mtime_before = emb_path.stat().st_mtime + rag2 = RAGEngine(use_local_embeddings=True) - # If load-on-init doesn't run, calling index() should load from saved file + # If load-on-init doesn't run, calling index() would re-index and rewrite the file rag2.index() assert rag2.get_chunk_count() >= 1 + + mtime_after = emb_path.stat().st_mtime + assert mtime_after == mtime_before, "Expected persisted index to be loaded, not re-written"