• v5.1.1 6587b9e98c

    dpsifr released this 2025-11-03 16:59:04 +01:00 | 630 commits to main since this release

    🐛 Critical Bug Fixes

    update() Method - Entities Disappeared on Type Change

    Fixed two critical bugs that caused entities to become unfindable after updating their type:

    Bug #1: Index Type Mismatch

    • Issue: When re-adding to TypeAwareHNSWIndex after type change, code used existing.type instead of newType
    • Impact: Entities were indexed under the wrong type, making them completely unfindable
    • Fix: Use newType when calling index.addItem() (src/brainy.ts:643)

    Bug #2: Metadata/Vector Save Order

    • Issue: saveNoun() was called before saveNounMetadata(), so the type cache wasn't updated
    • Impact: TypeAwareStorage saved entities to the wrong type shard (e.g., saved to thing/ but cache pointed to document/), causing complete data loss
    • Fix: Call saveNounMetadata() FIRST to update type cache before saving vector (src/brainy.ts:676-688)

    Severity: Both bugs caused complete data loss when changing entity types via update(). This is a critical fix for anyone using the update() method with type changes.


    Test Suite Improvements

    Achieved 100% test pass rate (1030/1030 tests passing):

    Fixed Test Issues:

    • 3 augmentation tests - Updated for v5.1.0 stricter UUID validation API
    • 3 add tests - Replaced invalid UUID test data with valid format
    • 1 batch operations test - Increased timeout from 5000ms to 6000ms
    • 3 neural tests - Added proper memory storage configuration

    Results:

    • Before: 1020/1051 passing (97.0%)
    • After: 1030/1030 passing (100%)
    • All critical systems verified: VFS, COW, Core APIs, Batch Operations, Neural

    📦 Files Changed

    Source Code: 1 file

    • src/brainy.ts - Fixed 2 critical bugs in update() method

    Tests: 4 files

    • tests/unit/augmentations/augmentations-simplified.test.ts
    • tests/unit/brainy/add.test.ts
    • tests/unit/brainy/batch-operations.test.ts
    • tests/unit/neural/neural-simplified.test.ts

    🚀 Upgrade

    npm install @soulcraft/brainy@5.1.1
    

    Highly recommended for anyone using update() to change entity types.

    Downloads