Private
Public Access
0
0

fix(test+rag): clean chroma cache pre-test + add INVESTIGATE stderr for RAG init

This commit is contained in:
2026-06-10 17:20:57 -04:00
parent a3abe49ca9
commit 5a9b8d6891
2 changed files with 22 additions and 2 deletions
+3 -1
View File
@@ -1489,8 +1489,10 @@ class AppController:
else:
self._set_rag_status("ready")
except Exception as e:
import traceback as _tb_investigate
self._set_rag_status(f"error: {e}")
sys.stderr.write(f"[DEBUG RAG] Failed to sync engine: {e}\n")
sys.stderr.write(f"[RAG_INVESTIGATE] exception type={type(e).__name__}, module={type(e).__module__}, str={str(e)!r}\n")
sys.stderr.write(f"[RAG_INVESTIGATE] traceback:\n{_tb_investigate.format_exc()}\n")
sys.stderr.flush()
with self._rag_sync_lock:
if not self._rag_sync_dirty:
+19 -1
View File
@@ -16,7 +16,25 @@ from src import api_hook_client
def test_phase4_final_verify(live_gui, live_gui_workspace):
client = api_hook_client.ApiHookClient()
assert client.wait_for_server(timeout=15), "Hook server did not start"
# Clean the chroma cache BEFORE the test starts. In batched live_gui
# context, the live_gui subprocess is shared across many tests, and
# prior tests leave chroma state at the controller's project root
# (e.g. C:\projects\manual_slop\tests\artifacts\.slop_cache\chroma_test_*).
# The dim-mismatch rmtree in rag_engine._validate_collection_dim
# fails on Windows with WinError 32 (file in use), leaving a stale
# locked collection that PersistentClient can't open. Wipe the
# relevant cache dirs proactively so the test starts clean.
_workspace_root = str(live_gui_workspace.parent if live_gui_workspace else Path.cwd())
stale_path = Path(_workspace_root) / ".slop_cache"
if stale_path.exists():
for col_dir in stale_path.iterdir():
if col_dir.is_dir() and col_dir.name.startswith("chroma_"):
try:
shutil.rmtree(col_dir)
except Exception:
pass
# 1. Setup mock project data
workspace_dir = live_gui_workspace
workspace_dir.mkdir(parents=True, exist_ok=True)