From 40f905d14b645d653fa32059bd8a80aee7d3f2ad Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 9 Jun 2026 14:50:55 -0400 Subject: [PATCH] test(rag): update dim-mismatch test to assert rmtree behavior The fix in 644d88ab changed the recovery path from client.delete_collection to shutil.rmtree (chromadb 1.5.x delete_collection is broken on corrupted state). The test still asserted the old behavior. --- tests/test_rag_engine.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_rag_engine.py b/tests/test_rag_engine.py index 370d20d5..7256f2c2 100644 --- a/tests/test_rag_engine.py +++ b/tests/test_rag_engine.py @@ -104,8 +104,14 @@ def test_rag_collection_dim_mismatch_recreates_collection(mock_get_chroma, mock_ mock_st.return_value = MagicMock() engine = RAGEngine(config) assert engine.collection == mock_collection - mock_client.delete_collection.assert_called_once_with("test") + # On dim mismatch, the fix wipes the chroma dir via shutil.rmtree + # (not via client.delete_collection which fails on corrupted state + # in chromadb 1.5.x with "RustBindingsAPI object has no attribute + # bindings"). The collection is then re-initialized by the inline + # re-init code, which calls get_or_create_collection once more + # (after the original _init_vector_store call). assert mock_client.get_or_create_collection.call_count == 2 + mock_client.delete_collection.assert_not_called() @patch('src.rag_engine.LocalEmbeddingProvider.embed') @patch('src.rag_engine._get_chromadb')