Read verbs skip the embeddings config-compatibility check
This commit is contained in:
parent
9f49bdde6e
commit
0308220769
3 changed files with 63 additions and 0 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `list`, `get`, and `visualize` no longer require an embeddings config matching the database.
|
||||||
|
|
||||||
## [0.67.3] - 2026-07-23
|
## [0.67.3] - 2026-07-23
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
|
|
@ -431,6 +431,7 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
db_path=self.db_path,
|
db_path=self.db_path,
|
||||||
config=self.config,
|
config=self.config,
|
||||||
read_only=True,
|
read_only=True,
|
||||||
|
skip_validation=True,
|
||||||
) as self.client:
|
) as self.client:
|
||||||
documents = await self.client.list_documents(filter=filter)
|
documents = await self.client.list_documents(filter=filter)
|
||||||
for doc in documents:
|
for doc in documents:
|
||||||
|
|
@ -480,6 +481,7 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
db_path=self.db_path,
|
db_path=self.db_path,
|
||||||
config=self.config,
|
config=self.config,
|
||||||
read_only=True,
|
read_only=True,
|
||||||
|
skip_validation=True,
|
||||||
) as self.client:
|
) as self.client:
|
||||||
doc = await self.client.get_document_by_id(doc_id)
|
doc = await self.client.get_document_by_id(doc_id)
|
||||||
if doc is None:
|
if doc is None:
|
||||||
|
|
@ -557,6 +559,7 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
db_path=self.db_path,
|
db_path=self.db_path,
|
||||||
config=self.config,
|
config=self.config,
|
||||||
read_only=True,
|
read_only=True,
|
||||||
|
skip_validation=True,
|
||||||
) as self.client:
|
) as self.client:
|
||||||
chunk = await self.client.get_chunk_by_id(chunk_id)
|
chunk = await self.client.get_chunk_by_id(chunk_id)
|
||||||
if not chunk:
|
if not chunk:
|
||||||
|
|
|
||||||
|
|
@ -331,6 +331,62 @@ class TestAppReadVerbsDoNotWrite:
|
||||||
assert stored_name_after == stored_name_before
|
assert stored_name_after == stored_name_before
|
||||||
assert version_after == version_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
|
@pytest.mark.asyncio
|
||||||
async def test_write_verb_raises_on_drift_without_writing(self, temp_db_path):
|
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."""
|
"""A write CLI verb opens writable: drift raises before any write."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue