brainy/tests/unit
David Snelling 2ba69eccdc fix(vfs): resolve two critical VFS bugs causing directory listing corruption
Bug 1: verbCountsByType optimization skipping requested verb types
- After restart, stale statistics could cause VerbType.Contains to be skipped
- readdir() would return empty/incomplete results
- Fixed by never skipping verb types explicitly requested in filter
- Added fast path for sourceId + verbType combo (common VFS pattern)
- Save statistics on first entity of each type (not just every 100th)

Bug 2: UnifiedCache not invalidated on path deletion
- rmdir() cleared local caches but NOT the global UnifiedCache
- When folder recreated, resolve() returned stale entity ID
- Caused "Source entity not found" errors
- Fixed by adding deleteByPrefix() to UnifiedCache
- Fixed invalidatePath() to also clear UnifiedCache entries

Files modified:
- src/storage/baseStorage.ts (verbCountsByType fix + fast path)
- src/utils/unifiedCache.ts (deleteByPrefix method)
- src/vfs/PathResolver.ts (cache invalidation fix)

Tests added:
- tests/unit/storage/vfs-mkdir-bug.test.ts (7 tests)

Reported by: Soulcraft Workshop team

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 11:22:30 -08:00
..
augmentations fix: resolve VFS tree corruption from blob errors (v5.8.0) 2025-11-14 11:27:35 -08:00
brainy fix(counts): counts.byType({ excludeVFS: true }) now returns correct type counts 2025-11-26 12:07:53 -08:00
graph feat: add v5.8.0 features - transactions, pagination, and comprehensive docs 2025-11-14 10:26:23 -08:00
import fix: binary file corruption in brain.import() with preserveSource 2025-11-03 10:00:55 -08:00
neural fix: resolve HNSW race condition and verb weight extraction (v5.4.0) 2025-11-05 17:05:07 -08:00
storage fix(vfs): resolve two critical VFS bugs causing directory listing corruption 2025-12-04 11:22:30 -08:00
types fix: update tests for Stage 3 CANONICAL taxonomy (42 nouns, 127 verbs) 2025-11-11 10:09:01 -08:00
utils feat: COW always-on architecture + cloud storage clear() fix (v5.11.0) 2025-11-18 13:44:02 -08:00
versioning fix: resolve critical COW ref resolution and versioning bugs 2025-11-04 13:05:59 -08:00
vfs feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) 2025-11-03 14:06:17 -08:00
brainy-core.unit.test.ts test: update fake ID in test (00000000... is now VFS root) 2025-11-14 12:56:29 -08:00
brainy-get-optimization.test.ts feat: brain.get() metadata-only optimization - Phase 2 (testing) 2025-11-18 15:41:57 -08:00
create-entities-default.test.ts fix: createEntities defaults to true, enable AI features by default 2025-10-23 16:54:40 -07:00
fieldTypeInference.test.ts feat: production-ready value-based temporal field detection 2025-10-16 13:58:57 -07:00
type-filtering.unit.test.ts fix: update tests for v5.1.0 API changes (VFS auto-init + property access) 2025-11-02 11:38:12 -08:00
type-matching.unit.test.ts fix: update all Stage 2 references to Stage 3 CANONICAL type counts 2025-11-06 09:40:33 -08:00
workshop-vfs-diagnostic.test.ts fix: update tests for v5.1.0 API changes (VFS auto-init + property access) 2025-11-02 11:38:12 -08:00