From 0308220769e6ac1830b609bd0c2f0f1505da2eec Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Fri, 24 Jul 2026 12:14:31 +0300 Subject: [PATCH] Read verbs skip the embeddings config-compatibility check --- CHANGELOG.md | 4 +++ haiku_rag_slim/haiku/rag/app.py | 3 ++ tests/store/test_read_only.py | 56 +++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e55ead1..146020b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog ## [Unreleased] +### Fixed + +- `list`, `get`, and `visualize` no longer require an embeddings config matching the database. + ## [0.67.3] - 2026-07-23 ### Changed diff --git a/haiku_rag_slim/haiku/rag/app.py b/haiku_rag_slim/haiku/rag/app.py index 2b0401db..ab7edec1 100644 --- a/haiku_rag_slim/haiku/rag/app.py +++ b/haiku_rag_slim/haiku/rag/app.py @@ -431,6 +431,7 @@ class HaikuRAGApp: # pragma: no cover db_path=self.db_path, config=self.config, read_only=True, + skip_validation=True, ) as self.client: documents = await self.client.list_documents(filter=filter) for doc in documents: @@ -480,6 +481,7 @@ class HaikuRAGApp: # pragma: no cover db_path=self.db_path, config=self.config, read_only=True, + skip_validation=True, ) as self.client: doc = await self.client.get_document_by_id(doc_id) if doc is None: @@ -557,6 +559,7 @@ class HaikuRAGApp: # pragma: no cover db_path=self.db_path, config=self.config, read_only=True, + skip_validation=True, ) as self.client: chunk = await self.client.get_chunk_by_id(chunk_id) if not chunk: diff --git a/tests/store/test_read_only.py b/tests/store/test_read_only.py index df2fa2cc..18ee29d1 100644 --- a/tests/store/test_read_only.py +++ b/tests/store/test_read_only.py @@ -331,6 +331,62 @@ class TestAppReadVerbsDoNotWrite: assert stored_name_after == stored_name_before assert version_after == version_before + @pytest.mark.asyncio + async def test_list_works_with_mismatched_embeddings_config(self, temp_db_path): + """list skips the embeddings compatibility check and never writes.""" + from haiku.rag.app import HaikuRAGApp + from haiku.rag.config import AppConfig + + async with Store(temp_db_path, create=True) as store: + await DocumentRepository(store).create(Document(content="test content")) + settings_before = await SettingsRepository(store).get_current_settings() + + drift = AppConfig() + drift.embeddings.model.name = "different-model" + drift.embeddings.model.vector_dim = 4096 + + app = HaikuRAGApp(db_path=temp_db_path, config=drift) + await app.list_documents() + + async with Store(temp_db_path, skip_validation=True, read_only=True) as store: + settings_after = await SettingsRepository(store).get_current_settings() + assert settings_after == settings_before + + @pytest.mark.asyncio + async def test_get_works_with_mismatched_embeddings_config(self, temp_db_path): + """get skips the embeddings compatibility check.""" + from haiku.rag.app import HaikuRAGApp + from haiku.rag.config import AppConfig + + async with Store(temp_db_path, create=True) as store: + doc = await DocumentRepository(store).create( + Document(content="test content") + ) + + drift = AppConfig() + drift.embeddings.model.vector_dim = 4096 + + app = HaikuRAGApp(db_path=temp_db_path, config=drift) + assert doc.id is not None + await app.get_document(doc.id) + + @pytest.mark.asyncio + async def test_visualize_works_with_mismatched_embeddings_config( + self, temp_db_path + ): + """visualize skips the embeddings compatibility check.""" + from haiku.rag.app import HaikuRAGApp + from haiku.rag.config import AppConfig + + async with Store(temp_db_path, create=True): + pass + + drift = AppConfig() + drift.embeddings.model.vector_dim = 4096 + + app = HaikuRAGApp(db_path=temp_db_path, config=drift) + await app.visualize_chunk("missing-chunk-id") + @pytest.mark.asyncio async def test_write_verb_raises_on_drift_without_writing(self, temp_db_path): """A write CLI verb opens writable: drift raises before any write."""