Compare commits

...

1 commit

Author SHA1 Message Date
Yiorgis Gozadinos
a0ca693101
Resolve db_path before handing it to lancedb.connect_async. Closes #355 2026-04-25 09:21:31 +03:00
3 changed files with 19 additions and 2 deletions

View file

@ -1,6 +1,10 @@
# Changelog
## [Unreleased]
### Fixed
- **`Store` and CLI commands accept relative database paths again.** The 0.43 migration to `lancedb.connect_async` started routing the path through LanceDB's async URI sanitizer, which treats anything that doesn't look like an absolute local path as a possibly-cloud URI and demands `api_key`/`region`, surfacing as `ValueError: An api_key is required when connecting to LanceDb Cloud`. The path is now resolved to absolute before being handed to LanceDB.
## [0.43.0] - 2026-04-24
### Changed

View file

@ -70,7 +70,7 @@ async def connect_lancedb(
else:
if db_path is None:
raise ValueError("No lancedb.uri configured and no db_path provided")
return await lancedb.connect_async(db_path)
return await lancedb.connect_async(db_path.resolve())
class DocumentRecord(LanceModel):

View file

@ -49,7 +49,20 @@ class TestConnectLancedb:
"haiku.rag.store.engine.lancedb.connect_async", new_callable=AsyncMock
) as mock_connect:
await connect_lancedb(config, db_path=temp_db_path)
mock_connect.assert_called_once_with(temp_db_path)
mock_connect.assert_called_once_with(temp_db_path.resolve())
@pytest.mark.asyncio
async def test_local_resolves_relative_db_path(self, tmp_path, monkeypatch):
from pathlib import Path
monkeypatch.chdir(tmp_path)
relative = Path("db/rag/rag.lancedb")
config = AppConfig(lancedb=LanceDBConfig(uri=""))
with patch(
"haiku.rag.store.engine.lancedb.connect_async", new_callable=AsyncMock
) as mock_connect:
await connect_lancedb(config, db_path=relative)
mock_connect.assert_called_once_with((tmp_path / relative).resolve())
@pytest.mark.asyncio
async def test_cloud_passes_uri_api_key_region(self):