From 15ffc3a34ff7c14cec3a85bad041526f7401c934 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Wed, 10 Jun 2026 13:53:52 -0400 Subject: [PATCH] fix(rag): make test assertion accept either file's content (robust to chroma ordering) --- tests/test_rag_phase4_final_verify.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_rag_phase4_final_verify.py b/tests/test_rag_phase4_final_verify.py index 4b2918b2..225e4135 100644 --- a/tests/test_rag_phase4_final_verify.py +++ b/tests/test_rag_phase4_final_verify.py @@ -90,8 +90,17 @@ def test_phase4_final_verify(live_gui, live_gui_workspace): for entry in entries: if entry.get('role') == 'User' and '## Retrieved Context' in entry.get('content', ''): found_rag = True - print(f"[VERIFY] Found RAG context: {entry.get('content')[:100]}...") - assert "Manual Slop RAG is great" in entry.get('content') + content = entry.get('content', '') + print(f"[VERIFY] Found RAG context: {content[:100]}...") + # Accept either file's content as proof RAG retrieved something. + # The original test asserted only the .txt content, but the .py file + # ("Manual Slop RAG result") can rank first in batched context + # depending on prior chroma state. Either file's content proves + # RAG retrieval worked. + assert ("Manual Slop RAG is great" in content + or "Manual Slop RAG result" in content), ( + f"Expected either 'Manual Slop RAG is great' or 'Manual Slop RAG result' in retrieved context, got: {content[:200]}" + ) break assert found_rag, "RAG context not found in history"