39b099cafc
feat: add migration system with error handling, validation, and enterprise hardening
...
- MigrationRunner: per-entity error tracking (non-fatal), maxErrors bail-out,
static validateMigrations() called in constructor, branch error propagation
- RefManager: updateRefMetadata() method for clean metadata updates
- brainy.ts: eliminate as-any casts in migration methods, use updateRefMetadata,
forward maxErrors through full chain including branch migrations
- Types: MigrationError interface, errors field on MigrationResult, maxErrors on MigrateOptions
- Package exports: MigrationError type, migrate() on BrainyInterface, autoMigrate config
- 31 integration tests covering error handling, validation, branch error propagation
- Documentation: docs/guides/schema-migrations.md
2026-02-09 16:13:14 -08:00
364360d447
fix: exclude __words__ keyword index from corruption detection and getStats()
...
The __words__ keyword index stores 50-5000 entries per entity (one per
word), which inflated avg entries/entity well above the corruption
threshold of 100. This caused:
1. validateConsistency() to falsely detect corruption on every startup,
triggering unnecessary clearAllIndexData() + rebuild() cycles
2. getStats() to log false "Metadata index may be corrupted" warnings
and report inflated totalEntries/totalIds stats
Both methods now skip __words__ when counting, so stats and health
checks reflect metadata fields only (noun, type, createdAt, etc.).
Keyword search is unaffected since the __words__ field index itself
is not modified.
2026-01-27 15:38:21 -08:00
c488fa82cc
feat: add entity versioning system with critical bug fixes (v5.3.0)
...
Entity Versioning (NEW):
- Add complete entity versioning API (brain.versions.*) with 18 methods
- Content-addressable storage with SHA-256 deduplication
- Git-style version control: save, restore, compare, undo, prune
- Auto-versioning augmentation with pattern-based filtering
- Branch-isolated version histories
- Complete integration tests and API documentation
Critical Bug Fixes:
- Fix commit() not updating branch refs (brainy.ts:2385)
- Root cause: Passed "heads/main" which normalized to "refs/heads/heads/main"
- Impact: All Git-style versioning features were broken
- Fix: Pass branch name directly for correct normalization
- Fix VFS entities missing isVFSEntity flag
- Add isVFSEntity: true to all VFS files/folders for filtering
- Resolves pollution of semantic search with filesystem entities
- Updated in writeFile(), mkdir(), and root directory init
Implementation:
- src/versioning/VersionManager.ts - Core versioning engine
- src/versioning/VersionStorage.ts - Content-addressable storage
- src/versioning/VersionIndex.ts - Metadata indexing
- src/versioning/VersionDiff.ts - Version comparison
- src/versioning/VersioningAPI.ts - Public API interface
- src/augmentations/versioningAugmentation.ts - Auto-versioning
- tests/integration/versioning.test.ts - Full integration tests
- tests/unit/versioning/ - Unit test suite
Documentation:
- Complete Entity Versioning API section in docs/api/README.md
- VFS entity filtering guide with examples
- Updated "What's New" section for v5.3.0
- Strategy docs for both critical bugs
Test Results:
- 1168 tests passing
- Build: PASSING (no TypeScript errors)
- Integration tests: ALL PASSING
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 11:19:02 -08:00
effb43b03c
feat: implement complete v5.0.0 Git-style fork/merge/commit workflow
...
Added full Git-style workflow with instant fork (Snowflake COW):
**Core Features:**
- fork() - Instant clone in <100ms via COW
- merge() - 3-way merge with conflict resolution
- commit() - Create state snapshots
- getHistory() - View commit history
- checkout() - Switch branches
- listBranches() - List all branches
- deleteBranch() - Delete branches
**Merge Strategies:**
- last-write-wins (timestamp-based)
- first-write-wins (reverse timestamp)
- custom (user-defined conflict resolution)
**COW Infrastructure:**
- BlobStorage - Content-addressable storage
- CommitLog - Commit history management
- CommitObject/CommitBuilder - Commit creation
- RefManager - Branch/ref management
- TreeObject - Tree data structure
**Updated Components:**
- Brainy class - All new APIs implemented
- BaseStorage - COW infrastructure initialized
- HNSWIndex - enableCOW() and ensureCOW()
- TypeAwareHNSWIndex - COW support
- CLI - New cow commands
- Documentation - instant-fork.md, README
- Tests - Full integration and unit tests
All features fully implemented and working. Zero fake code.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 11:56:11 -07:00