brainy/tests/unit/storage
David Snelling 732d23bd2a fix: resolve v5.7.x race condition with write-through cache (v5.7.2)
Fixes critical bug where brain.add() → brain.relate() would fail with
"Source entity not found" error. The issue occurred because entities
written asynchronously weren't immediately queryable.

Solution: Write-through cache at storage layer (baseStorage.ts)
- Cache data during async writes (synchronous operation)
- Check cache before disk reads (guarantees read-after-write consistency)
- Self-cleaning (cache clears after write completes)
- Zero-config, automatic for all 8 storage adapters

Impact:
- Fixes PDF import failures in v5.7.0/v5.7.1
- Maintains 12-24x import speedup from v5.7.0
- Production-ready for billion-scale deployments

Test coverage:
- 8 unit tests (write-through cache behavior)
- 7 integration tests (brain.add → brain.relate scenarios)
- 74 regression tests verified passing

Resolves: Import failures, VFS structure generation errors
2025-11-12 09:32:52 -08:00
..
cow fix: resolve BlobStorage metadata prefix inconsistency 2025-11-05 09:16:26 -08:00
writeThroughCache.test.ts fix: resolve v5.7.x race condition with write-through cache (v5.7.2) 2025-11-12 09:32:52 -08:00