• v6.5.0 c1deb7a623

    v6.5.0 Stable

    dpsifr released this 2025-12-11 22:27:45 +01:00 | 497 commits to main since this release

    What's Changed

    Bug Fixes

    • fix(vfs): prevent race condition in bulkWrite by ordering operations
      • Process mkdir operations sequentially first (sorted by path depth)
      • Then process write/delete/update operations in parallel batches
      • Prevents duplicate directory entities when mkdir and write for related paths are in the same batch

    Documentation

    • Updated API documentation for accuracy
    • Added comprehensive bulkWrite documentation to VFS_CORE.md
    • Fixed incorrect API signatures in docs/README.md, docs/guides/neural-api.md

    Tests

    • Added comprehensive tests for bulkWrite race condition scenarios

    Full Changelog: https://github.com/soulcraftlabs/brainy/compare/v6.4.0...v6.5.0

    Downloads
  • v6.4.0 ec6fe0c039

    dpsifr released this 2025-12-11 17:41:14 +01:00 | 499 commits to main since this release

    Downloads
  • v6.3.2 f0270cc568

    dpsifr released this 2025-12-10 01:17:45 +01:00 | 501 commits to main since this release

    Bug Fixes

    VFS File Versioning Fix

    VFS files now correctly version their actual blob content instead of stale embedding text.

    Problem: When versioning VFS files, all versions had identical data because VersionManager was capturing the stale entity.data (embedding text) instead of actual file content from BlobStorage.

    Fix:

    • VersionManager.save() now reads fresh content via vfs.readFile() for VFS files
    • VersionManager.restore() writes content back via vfs.writeFile()
    • Text files stored as UTF-8, binary files as base64

    Documentation

    • Added VFS file versioning example to API docs
    • Updated API docs for v6.3.2

    Testing

    • Added comprehensive VFS versioning test suite (10 tests)
    Downloads
  • v6.3.1 f3765afb9e

    dpsifr released this 2025-12-09 18:38:05 +01:00 | 503 commits to main since this release

    Downloads
  • v6.3.0 292be1b9cd

    dpsifr released this 2025-12-04 21:55:35 +01:00 | 505 commits to main since this release

    Critical Architecture Fix: Singleton GraphAdjacencyIndex

    This release fixes the root cause of the VFS tree corruption bug reported by the Soulcraft Workshop team.

    🐛 Bug Fixed

    VFS tree structure returns 0 children after file writes - Previously, calling vfs.mkdir() or vfs.writeFile() could corrupt the VFS index, causing readdir('/') to return incomplete results. Data was NOT lost - it existed in storage but wasn't queryable.

    🔧 Root Cause

    The bug was caused by dual ownership of GraphAdjacencyIndex:

    1. Storage.graphIndex (created in BaseStorage.init())
    2. Brainy.graphIndex (created in Brainy.init())

    When verbs were saved, both instances were updated. But if Storage's graphIndex was recreated (via ensureInitialized()), the new instance had an empty verbIdSet. Queries filtered through this empty verbIdSet returned nothing.

    Fix Summary

    1. GraphAdjacencyIndex Singleton Pattern

      • Brainy now uses storage.getGraphIndex() instead of creating its own
      • Single source of truth - no more dual ownership
      • Added invalidateGraphIndex() for branch switches
    2. Auto-rebuild verbIdSet Defense

      • If LSM-trees have data but verbIdSet is empty, automatically populate it
      • Safety net for edge cases
    3. Removed Double-Add Bug

      • Graph index updates now happen ONLY via transaction system
      • Prevents duplicate counting in relationshipCountsByType
    4. PathResolver Cache Invalidation

      • Added invalidateAllCaches() method
      • checkout() now clears VFS caches before recreating VFS

    📦 Upgrade

    npm install @soulcraft/brainy@6.3.0
    
    • Workshop Bug Report: VFS tree corruption after mkdir/writeFile
    • Previous patches (v6.2.8-v6.2.9) addressed symptoms, this fixes the root cause

    🤖 Generated with Claude Code

    Downloads
  • v6.2.9 810b75647c

    dpsifr released this 2025-12-04 20:22:41 +01:00 | 507 commits to main since this release

    Critical Bug Fixes

    This release fixes two critical VFS bugs that caused directory listing corruption, reported by the Soulcraft Workshop team.

    Bug 1: verbCountsByType Optimization Skipping Requested Types

    • Symptom: vfs.readdir('/') returned empty or incomplete results after app restart
    • Root Cause: getVerbs() optimization skipped verb types with count 0, but statistics were stale after restart
    • Fix: Never skip verb types explicitly requested in the filter; added fast path for sourceId + verbType combo

    Bug 2: UnifiedCache Not Invalidated on Path Deletion

    • Symptom: "Source entity not found" errors when recreating deleted folders
    • Root Cause: invalidatePath() cleared local caches but NOT the global UnifiedCache
    • Fix: Added deleteByPrefix() to UnifiedCache; fixed invalidatePath() to clear all cache layers

    Files Changed

    • src/storage/baseStorage.ts - verbCountsByType fix + fast path
    • src/utils/unifiedCache.ts - deleteByPrefix method
    • src/vfs/PathResolver.ts - cache invalidation fix

    Tests Added

    • 7 new unit tests covering both bugs and edge cases
    • Delete/recreate cycle tests verified working

    Full Changelog: https://github.com/soulcraftlabs/brainy/compare/v6.2.8...v6.2.9

    Downloads
  • v6.2.5 e4bbd7fb0e

    dpsifr released this 2025-12-02 20:45:22 +01:00 | 515 commits to main since this release

    Bug Fix

    Critical fix for brain.counts.byType() returning inflated/incorrect values

    Problem

    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:

    1. 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)
      
    2. MetadataIndex.rebuild() and GraphAdjacencyIndex.rebuild() - Did not clear count Maps before rebuilding

    Fix

    • Clear totalEntitiesByType, entityCountsByTypeFixed, verbCountsByTypeFixed at start of lazyLoadCounts()
    • Clear counts in MetadataIndex.rebuild() before rebuilding
    • Clear relationshipCountsByType in GraphAdjacencyIndex.rebuild()

    Affected Features

    • brain.counts.byType() Fixed
    • brain.counts.entities() Fixed
    • brain.counts.byRelationshipType() Fixed
    • All storage adapters (Memory, FileSystem, S3, GCS, R2, Azure, OPFS) Fixed

    Upgrade

    npm install @soulcraft/brainy@6.2.5
    

    After upgrading, counts will be correct on next restart - no manual action needed.


    Reported by: Soulcraft Workshop Team

    🤖 Generated with Claude Code

    Downloads
  • v6.2.4 ea53c11fea

    dpsifr released this 2025-12-02 20:22:17 +01:00 | 517 commits to main since this release

    Bug Fix

    Critical fix for asOf() time-travel queries

    Problem

    brain.asOf(commitId) was failing with:

    Historical storage requires underlying storage to have COW enabled.
    Call brain.init() first to initialize COW.
    

    This occurred even when COW was properly initialized.

    Root Cause

    Property name mismatch in HistoricalStorageAdapter:

    • Was looking for: _commitLog, _blobStorage, _treeObject (with underscores)
    • Actually set as: commitLog, blobStorage (no underscores, no treeObject)

    Fix

    • Corrected property access to use commitLog and blobStorage
    • Removed unused treeObject property (TreeObject is dynamically imported)
    • Removed unused static import

    Affected Features

    • brain.asOf(commitId) - Time-travel queries Fixed
    • brain.fork() - Already working correctly
    • brain.commit() - Already working correctly
    • brain.getHistory() - Already working correctly

    Upgrade

    npm install @soulcraft/brainy@6.2.4
    

    Reported by: Soulcraft Workshop Team

    🤖 Generated with Claude Code

    Downloads
  • v6.2.3 0ba6da405e

    dpsifr released this 2025-11-26 21:08:04 +01:00 | 519 commits to main since this release

    Bug Fix

    Fixed: counts.byType({ excludeVFS: true }) now returns correct type counts

    Root Cause

    lazyLoadCounts() was reading from stats.nounCount (SERVICE-keyed data like {"brainy": 100}) instead of the sparse index (TYPE-keyed data like {"person": 17, "concept": 22}). Additionally, it had a race condition (not awaited in constructor).

    Changes

    • Fix lazyLoadCounts() to compute counts from 'noun' sparse index (correct source)
    • Move lazyLoadCounts() call from constructor to init() (properly awaited)
    • Add getNounCountsByType()/getVerbCountsByType() getters to BaseStorage
    • Add regression tests (7 tests)

    Impact

    • Fixes Workshop bug where counts.byType({ excludeVFS: true }) returned {} even when 48 entities existed
    • VFS statistics APIs now work correctly
    • HNSW, MetadataIndexManager, and storage now agree on counts

    Upgrade

    npm update @soulcraft/brainy
    

    🤖 Generated with Claude Code

    Downloads
  • v6.2.2 e4ca3839e0

    dpsifr released this 2025-11-26 00:41:12 +01:00 | 521 commits to main since this release

    Downloads