• v5.7.7 5199da9737

    dpsifr released this 2025-11-13 19:11:58 +01:00 | 568 commits to main since this release

    v5.7.7: Production-Scale Lazy Loading + Documentation Updates

    Critical Bug Fix

    Fixed critical bug where disableAutoRebuild: true left indexes empty forever, causing brain.find() to return 0 results even when 1,000+ entities existed in storage.

    New Features

    Production-Scale Lazy Loading (v5.7.7)

    • ensureIndexesLoaded() helper with concurrency control
    • Mutex prevents duplicate rebuilds from concurrent queries
    • Zero-config: works automatically, no code changes needed
    • Performance: 0-10ms init, 50-200ms first query, 0ms subsequent queries

    Concurrency Safety:

    • 100 concurrent queries = 1 rebuild (~60ms total)
    • Mutex-based coordination prevents race conditions

    Documentation Updates

    Index Architecture Clarification:

    • 3 main indexes + ~50+ sub-indexes accurately documented
    • Added TypeAwareHNSWIndex with 42 type-specific indexes
    • Documented MetadataIndexManager sub-components
    • Documented GraphAdjacencyIndex with 4 LSM-trees

    Lazy Loading Documentation:

    • Mode 1 (Auto-Rebuild) vs Mode 2 (Lazy Loading) comparison
    • Use cases for each mode (serverless, development, large datasets)
    • Performance characteristics and benchmarks

    Use Cases

    Lazy Loading Benefits:

    • Serverless/Edge: Minimize cold start time (0-10ms init)
    • Development: Faster restarts during development
    • Large datasets: Defer index loading until needed
    • Read-heavy workloads: Writes don't wait for index rebuild

    Workshop Team

    This release specifically addresses the bug reported by the Workshop team where brain.find({ limit: 900 }) returned 0-5 results despite 1,173 entities in storage.

    Upgrade:

    npm install @soulcraft/brainy@5.7.7
    

    No code changes needed - existing code will work automatically!

    Full Changelog: https://github.com/soulcraftlabs/brainy/compare/v5.7.6...v5.7.7

    Downloads