Repository navigation
Closed
Description
Problem
Four Rust tests in the embedding service were failing with assertion errors:
test_chunking_strategy_smalltest_chunking_strategy_mediumtest_chunking_strategy_largetest_re_embed_container
Location: packages/core/src/services/embedding_service_test.rs
Error Details
All failures showed assertion mismatches where expected values didn't match actual values:
assertion \`left == right\` failed
left: Null
right: "complete_container" (or "container_summary")
Root Causes Identified
-
JSON Metadata Storage Bug (3 tests)
store_embeddingmethod was passing metadata as a string tojson_set()- SQLite's
json_set()requires JSON type, not string type - This caused
properties["embedding_metadata"]["type"]to beNullinstead of expected values
-
Database Transaction Isolation Issue (1 test)
test_re_embed_containerheld a database connection across content update and re-embedding- This caused embeddings to appear identical when they should have been different
- The second embedding was reading stale data from the open transaction
Solution
Fixed in PR #358:
- Added
json()wrapper tojson_set()call inembedding_service.rs:678 - Refactored test connection management to use scoped blocks with fresh connections
- Added comprehensive inline documentation to prevent future regressions
Impact
- Test Results: 212 passing, 4 failing (98.2% pass rate)
- Commands Affected:
bun run rust:test,bun run test:all,bun run test:all:db - Development Impact: Rust test suite shows failures
Acceptance Criteria
- All 4 embedding service tests pass
- Test expectations match current embedding service behavior
-
cargo testcompletes with 0 failures -
bun run test:allpasses completely
Additional Context
These were pre-existing failures discovered during TEST_USE_DATABASE feature implementation (PR #337). They were unrelated to frontend test changes but blocked clean test:all runs.
Test Command:
cargo test --lib embedding_serviceResolved: All tests now pass. Fix merged in PR #358.
Activity
Fix: Resolve failing Rust embedding service tests (issue #343)
Docs: Add explanatory comments for embedding service fix (issue #343)
Fix failing Rust embedding service tests (#358)
Fix failing Rust embedding service tests (#358)
Fix failing Rust embedding service tests (#358)
Fix failing Rust embedding service tests (#358)