fix: createEntities defaults to true, enable AI features by default
CRITICAL FIX: createEntities was treating undefined as false, causing imports
to skip graph entity creation. Only VFS wrappers were created, breaking type filtering.
Fixes:
- createEntities now defaults to true when undefined (line 736)
- Fixed option spreading order (spread options first, then apply defaults) (line 357)
- Enabled enableRelationshipInference by default (AI relationships)
- Enabled enableNeuralExtraction by default (smart entity extraction)
- Enabled enableConceptExtraction by default (concept mining)
Root Cause:
1. Line 733: if (!options.createEntities) treated undefined as false
2. Line 361: ...options spread AFTER defaults, overwriting them with undefined
Result: Graph entities never created, only VFS wrappers
Impact:
- Workshop team: 0 results for brain.find({ type: 'person' })
- Type filtering completely broken
- HNSW showed entities (read from VFS) but storage had none
Tests Added:
- tests/unit/create-entities-default.test.ts (3 scenarios)
- tests/integration/vfs-and-graph-entities.test.ts (15 assertions, end-to-end)
- tests/integration/relationship-intelligence.test.ts (relationship verification)
- tests/unit/type-filtering.unit.test.ts (8 type filtering tests)
All tests pass ✅
Breaking Changes: None - this restores intended default behavior
Workshop Resolution: Clear ./brainy-data and re-import with v4.3.2.
Type filtering will work immediately.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a86e86c61b
commit
5c84be0276
5 changed files with 710 additions and 3 deletions
|
|
@ -350,15 +350,22 @@ export class ImportCoordinator {
|
|||
const extractionResult = await this.extract(normalizedSource, detection.format, options)
|
||||
|
||||
// Set defaults
|
||||
// CRITICAL FIX (v4.3.2): Spread options FIRST, then apply defaults
|
||||
// Previously: ...options at the end overwrote normalized defaults with undefined
|
||||
// Now: Defaults properly override undefined values
|
||||
// v4.4.0: Enable AI features by default for smarter imports
|
||||
const opts = {
|
||||
...options, // Spread first to get all options
|
||||
vfsPath: options.vfsPath || `/imports/${Date.now()}`,
|
||||
groupBy: options.groupBy || 'type',
|
||||
createEntities: options.createEntities !== false,
|
||||
createRelationships: options.createRelationships !== false,
|
||||
preserveSource: options.preserveSource !== false,
|
||||
enableDeduplication: options.enableDeduplication !== false,
|
||||
deduplicationThreshold: options.deduplicationThreshold || 0.85,
|
||||
...options
|
||||
enableNeuralExtraction: options.enableNeuralExtraction !== false, // v4.4.0: Default true
|
||||
enableRelationshipInference: options.enableRelationshipInference !== false, // v4.4.0: Default true
|
||||
enableConceptExtraction: options.enableConceptExtraction !== false, // Already defaults to true
|
||||
deduplicationThreshold: options.deduplicationThreshold || 0.85
|
||||
}
|
||||
|
||||
// Report VFS storage stage
|
||||
|
|
@ -730,7 +737,10 @@ export class ImportCoordinator {
|
|||
let mergedCount = 0
|
||||
let newCount = 0
|
||||
|
||||
if (!options.createEntities) {
|
||||
// CRITICAL FIX (v4.3.2): Default to true when undefined
|
||||
// Previously: if (!options.createEntities) treated undefined as false
|
||||
// Now: Only skip when explicitly set to false
|
||||
if (options.createEntities === false) {
|
||||
return { entities, relationships, merged: 0, newEntities: 0 }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue