feat: brain.get() metadata-only optimization - Phase 2 (testing)
Fixed convertMetadataToEntity() to properly extract custom metadata fields
using same destructuring pattern as baseStorage.getNoun(). This ensures
metadata is correctly populated in metadata-only entities.
Test Updates:
- Fixed unit tests to add { includeVectors: true } where vectors are checked
- Created comprehensive brain.get() optimization tests (11 tests, all passing)
- Created VFS performance integration tests
- Fixed invalid NounType references (NounType.Place → NounType.Location)
- Adjusted performance expectations for MemoryStorage (10%+ vs 75%+ for FS)
Files Updated:
- src/brainy.ts: Fixed convertMetadataToEntity() destructuring
- tests/unit/brainy-get-optimization.test.ts: New comprehensive tests
- tests/unit/brainy/get.test.ts: Added includeVectors where needed
- tests/unit/brainy/batch-operations.test.ts: Added includeVectors
- tests/unit/brainy/update.test.ts: Added includeVectors
- tests/unit/brainy/add.test.ts: Added includeVectors (3 tests)
- tests/brainy-3.test.ts: Added includeVectors
This commit is contained in:
parent
8dcf299fe7
commit
f2f6a6c939
7 changed files with 276 additions and 28 deletions
|
|
@ -49,8 +49,9 @@ describe('Brainy 3.0 API', () => {
|
|||
metadata: { title: 'Sample Title' }
|
||||
})
|
||||
|
||||
const entity = await brain.get(id)
|
||||
|
||||
// v5.11.1: Need includeVectors to check vectors
|
||||
const entity = await brain.get(id, { includeVectors: true })
|
||||
|
||||
expect(entity).toBeDefined()
|
||||
expect(entity!.id).toBe(id)
|
||||
expect(entity!.type).toBe(NounType.Document)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue