fix: flush all native providers on shutdown to prevent data loss

Shutdown/close/flush now properly flushes all 4 components in parallel:
metadataIndex, graphIndex, HNSW dirty nodes, and storage counts. Previously
only counts were flushed, causing native provider data loss on restart.

Also:
- Wire roaring, msgpack, entityIdMapper provider consumption from plugins
- Fix allOf filter O(n²) intersection → O(n) Set-based
- Fix ne/exists negation filter to use Set-based exclusion
- Add setMsgpackImplementation() swap in SSTable for native msgpack
- Add setRoaringImplementation() swap for native CRoaring bitmaps
- Add getAllIntIds() to EntityIdMapper for bitmap operations
- Remove TypeAwareHNSWIndex from default index creation path
- Export memory detection utilities from internals
- Clean up 26 permanently-skipped dead tests
This commit is contained in:
David Snelling 2026-02-01 16:23:49 -08:00
parent b87426409d
commit 773c5171c3
24 changed files with 297 additions and 1268 deletions

View file

@ -459,29 +459,8 @@ describe('Brainy.add()', () => {
)
})
it.skip('should handle batch adds efficiently', async () => {
// NOTE: Flaky performance test - depends on system load
// Arrange
const count = 100
const params = Array.from({ length: count }, (_, i) =>
createAddParams({
data: `Batch entity ${i}`,
type: 'thing'
})
)
// Act
const start = performance.now()
const ids = await Promise.all(params.map(p => brain.add(p)))
const duration = performance.now() - start
// Assert
expect(ids).toHaveLength(count)
const opsPerSecond = (count / duration) * 1000
expect(opsPerSecond).toBeGreaterThan(100) // At least 100 ops/second
})
})
describe('caching behavior', () => {
it('should retrieve consistent entities', async () => {
// Arrange (v5.1.0: use valid UUID format)