From abefdcdd4120dc498c236d9a4323a7cfc74775b5 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Fri, 5 Jun 2026 10:55:38 +0300 Subject: [PATCH] Test vector_dim mismatch raises in read-only mode --- tests/test_settings.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_settings.py b/tests/test_settings.py index 050356a9..b4e1f478 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -216,3 +216,25 @@ class TestValidateConfigCompatibility: assert "vector dimension" in str(exc_info.value) assert "9999" in str(exc_info.value) + + @pytest.mark.asyncio + async def test_vector_dim_mismatch_raises_error_read_only(self, temp_db_path): + """vector_dim mismatch raises even read-only — search cannot work.""" + from haiku.rag.store.engine import Store + from haiku.rag.store.repositories.settings import SettingsRepository + + async with Store(temp_db_path, create=True): + pass + + new_config = AppConfig() + new_config.embeddings.model.vector_dim = 9999 + + async with Store( + temp_db_path, config=new_config, skip_validation=True, read_only=True + ) as store2: + settings_repo = SettingsRepository(store2) + + with pytest.raises(ConfigMismatchError) as exc_info: + await settings_repo.validate_config_compatibility() + + assert "9999" in str(exc_info.value)