-
fix: auto-migrate LanceDB on 'contained null values' schema drift (#2702) (#2703)
发布于
2026-04-22 21:50:01 +00:00 Summary
Fixes #2702.
LanceDBAdapter.create_data_pointsonly treated"not found in target schema"as a recoverable schema drift. The inverse case
— old rows lacking a field the current schema now requires to be
non-null — raises"contained null values even though the field is marked non-null"from the Rustlance-filewriter and was not matched,
so theRuntimeErrorescaped and killed the uvicorn worker mid-batch.cognee/infrastructure/databases/vector/lancedb/LanceDBAdapter.py—
extend the message match so both patterns route to the existing
_migrate_collection_schemapath (which rebuilds via Pydantic
validation and fills defaults likefeedback_weight=0.5).
cognee/tests/unit/infrastructure/databases/vector/test_lancedb_schema_migration.py
— addstest_null_in_non_null_field_triggers_migration(patches
merge_insertto raise the Rust-side message once; verifies the row
lands after migration).pyproject.toml/uv.lock— bump1.0.1→1.0.2.
Test plan
pytest cognee/tests/unit/infrastructure/databases/vector/test_lancedb_schema_migration.py -v→ 7 passed (6 prior + 1 new)- New test fails on main without the one-line match extension
(verified locally by stashing the fix and re-running) ruff check/ruff formatclean on changed files
Fixes #2702
🤖 Generated with Claude Code
Summary by CodeRabbit
-
Bug Fixes
-
Enhanced vector database adapter error handling to recover from
additional schema-drift failure scenarios during data operations,
improving overall system reliability. -
Tests
-
Added regression test to validate vector database schema migration and
error recovery behavior. -
Chores
- Version bumped to 1.0.2.
下载附件