From 6f5b5f91c41b5db94f523ede0146738c63aebb8a Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 12 Jun 2026 20:26:48 -0400 Subject: [PATCH] restore comment --- src/rag_engine.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rag_engine.py b/src/rag_engine.py index 4a6d5249..3504c244 100644 --- a/src/rag_engine.py +++ b/src/rag_engine.py @@ -128,6 +128,18 @@ class RAGEngine: return Result(data=None, errors=[ErrorInfo(kind=ErrorKind.CONFIG, message=f"Unknown vector store provider: {vs_config.provider}", source="rag._init_vector_store")]) def _validate_collection_dim_result(self) -> Result[None]: + """ + Detect dimension mismatch between an existing collection's vectors and + the current embedding provider's output. When mismatched (e.g. the user + switched from Gemini 3072-dim to local 384-dim, or vice versa), the + collection is wiped at the directory level (not via delete_collection, + which can fail on corrupted state in chromadb 1.5.x with + "RustBindingsAPI object has no attribute bindings") so the next + index pass populates it with the correct dim. Prevents silent + corruption that would later surface as a search error + ("Collection expecting embedding with dimension of X, got Y") and + hang live_gui tests. + """ if self.collection is None or self.collection == "mock" or self.embedding_provider is None: return Result(data=None) try: