• v7.1.1 4fc1fb7340

    dpsifr released this 2026-01-07 01:03:55 +01:00 | 475 commits to main since this release

    Critical Bug Fix

    Fixed 50-100x slower add() operations on cloud storage (GCS/S3/R2/Azure)

    Symptoms

    • add() taking 7-12 seconds instead of 50-200ms
    • Only affects cloud storage with auto-detection (not explicit type: 'gcs')

    Root Cause

    Storage type detection in setupIndex() relied on this.config.storage.type which was never set after createStorage() auto-detected the storage type. This caused cloud storage to use 'immediate' persistence mode instead of 'deferred', resulting in 20-30 GCS writes per add() operation.

    Fix

    Added getStorageType() helper that detects storage type from the storage instance class name (e.g., GcsStorage'gcs'), used as fallback when config.storage.type is not explicitly set.

    Upgrade Instructions

    Simply update to v7.1.1:

    npm install @soulcraft/brainy@7.1.1
    

    No configuration changes required - the fix automatically detects cloud storage types.

    Workaround for v7.1.0 users (if you can't upgrade immediately)

    const brain = new Brainy({
      storage: {
        type: 'gcs',  // Explicit type fixes the issue
        gcsNativeStorage: { bucketName: 'your-bucket' }
      },
      hnswPersistMode: 'deferred'  // Or explicitly set this
    })
    

    Performance Tests Added

    Added regression tests to prevent future issues:

    • Single add() < 500ms
    • 10 add() operations < 5 seconds
    • Storage type detection verification for GCS/S3/R2/Azure

    Full Changelog: https://github.com/soulcraftlabs/brainy/compare/v7.1.0...v7.1.1

    Downloads