-
released this
2025-12-02 20:45:22 +01:00 | 509 commits to main since this releaseBug Fix
Critical fix for
brain.counts.byType()returning inflated/incorrect valuesProblem
brain.counts.byType()returned wildly incorrect counts that could be 100x inflated:// Actual entities: 68 // counts.byType() returned: { "collection": 4186, "document": 6480, "person": 812, // ... ~100x inflated }Root Cause
Two accumulation bugs:
-
MetadataIndex.lazyLoadCounts()- Added counts to existing Map instead of replacing:// BUG: Each restart doubled the counts const currentCount = this.totalEntitiesByType.get(type) || 0 this.totalEntitiesByType.set(type, currentCount + bitmap.size) -
MetadataIndex.rebuild()andGraphAdjacencyIndex.rebuild()- Did not clear count Maps before rebuilding
Fix
- Clear
totalEntitiesByType,entityCountsByTypeFixed,verbCountsByTypeFixedat start oflazyLoadCounts() - Clear counts in
MetadataIndex.rebuild()before rebuilding - Clear
relationshipCountsByTypeinGraphAdjacencyIndex.rebuild()
Affected Features
brain.counts.byType()✅ Fixedbrain.counts.entities()✅ Fixedbrain.counts.byRelationshipType()✅ Fixed- All storage adapters (Memory, FileSystem, S3, GCS, R2, Azure, OPFS) ✅ Fixed
Upgrade
npm install @soulcraft/brainy@6.2.5After upgrading, counts will be correct on next restart - no manual action needed.
Reported by: Soulcraft Workshop Team
🤖 Generated with Claude Code
Downloads
-
Source code (ZIP)
1 download
-
Source code (TAR.GZ)
1 download
-