brainy/tests/unit/brainy
David Snelling 9b2ff2d4ae fix(counts): counts.byType({ excludeVFS: true }) now returns correct type counts
Root cause: lazyLoadCounts() was reading from stats.nounCount (SERVICE-keyed)
instead of the sparse index (TYPE-keyed), and had a race condition (not awaited).

Changes:
- Fix lazyLoadCounts() to compute counts from 'noun' sparse index
- Move lazyLoadCounts() call from constructor to init() (properly awaited)
- Add getNounCountsByType()/getVerbCountsByType() getters to BaseStorage
- Add regression tests (7 tests)

Fixes Workshop bug where counts.byType({ excludeVFS: true }) returned {}
even when 48 entities existed in the database.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 12:07:53 -08:00
..
add.test.ts feat: brain.get() metadata-only optimization - Phase 2 (testing) 2025-11-18 15:41:57 -08:00
batch-operations.test.ts feat: brain.get() metadata-only optimization - Phase 2 (testing) 2025-11-18 15:41:57 -08:00
counts-by-type-fix.test.ts fix(counts): counts.byType({ excludeVFS: true }) now returns correct type counts 2025-11-26 12:07:53 -08:00
delete.test.ts fix: resolve 13 neural test failures (C++ regex, location patterns, test assertions) 2025-10-30 15:46:22 -07:00
find.test.ts fix: resolve 19 critical test failures for production readiness 2025-10-09 16:58:53 -07:00
get.test.ts feat: brain.get() metadata-only optimization - Phase 2 (testing) 2025-11-18 15:41:57 -08:00
relate-duplicate-optimization.test.ts feat: add v5.8.0 features - transactions, pagination, and comprehensive docs 2025-11-14 10:26:23 -08:00
relate.test.ts test: skip flaky concurrent relationship test (race condition in duplicate detection) 2025-11-11 14:19:46 -08:00
update.test.ts feat: brain.get() metadata-only optimization - Phase 2 (testing) 2025-11-18 15:41:57 -08:00