From 780fb6444bcf86ec2412b27ecd50693ccd6bff18 Mon Sep 17 00:00:00 2001 From: David Snelling Date: Tue, 9 Jun 2026 14:58:25 -0700 Subject: [PATCH] =?UTF-8?q?feat(8.0)!:=20flip=20requireSubtype=20default?= =?UTF-8?q?=20to=20true=20(BRAINY-8.0-SUBTYPE-CONTRACT=20=C2=A7=20C-1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Brainy 8.0 makes subtype required by default on every public write path (`add`, `addMany`, `update`, `relate`, `relateMany`, `updateRelation`, import). Per the locked C-1 contract, every entity and relation gets a non-empty subtype string by the time the storage layer sees it. OPT-OUT REMAINS FULLY SUPPORTED The runtime flag is still consumer-controlled. Three opt-out paths cover migration / legacy fixtures / typed escape: - `new Brainy({ requireSubtype: false })` — last-resort: turn off the contract entirely. Recommended only for migration windows or test fixtures that legitimately can't supply a subtype. - `new Brainy({ requireSubtype: { except: [NounType.Thing, ...] } })` — per-type allowlist: strict everywhere except the listed types. - `brain.requireSubtype(type, options)` — per-type registration with optional vocabulary. Composes with the brain-wide flag. Default is now `true`. Opt-out is explicit and documented; nothing silently degrades. TEST SWEEP Bulk-applied `requireSubtype: false` to every `new Brainy({...})` call site across 120 test files. Three sed patterns covered the shapes: - `new Brainy({` → `new Brainy({ requireSubtype: false,` - `new Brainy({` → `new Brainy({ requireSubtype: false,` - `new Brainy()` → `new Brainy({ requireSubtype: false })` tests/helpers/test-factory.ts → createTestConfig() defaults `requireSubtype: false` so test files using the helper inherit the opt-out without per-site edits. The test sites that DO exercise subtype semantics (the subtype-and-facets suite, the strict-mode-self-test suite, the verb- subtype-and-enforcement suite, etc.) already pass real subtypes — they were the 7.30.x acceptance tests for this contract. Those tests continue to pass unchanged. CHANGES src/brainy.ts - normalizeConfig() — `requireSubtype` default `false` → `true`. Comment refreshed to document the three opt-out paths. tests/* (120 files) - Bulk-edited brain construction sites. No functional test changes; the opt-out preserves the test author's original intent. tests/helpers/test-factory.ts - createTestConfig() base config gains `requireSubtype: false`. NO-OP for consumers who were already passing subtype on every write. For consumers who weren't, the upgrade path is one of the three opt-out forms above. Migration recipe documented in 8.0 release notes (next commit). VERIFICATION - npx tsc --noEmit: clean - npm test: 1408 / 1409 (same pre-existing race-condition outstanding; no other regressions from the flip) --- src/brainy.ts | 14 +++---- tests/api/batch-operations.test.ts | 2 +- tests/api/crud-operations-enhanced.test.ts | 2 +- tests/api/error-handling.test.ts | 2 +- tests/api/performance-benchmarks.test.ts | 2 +- tests/brainy-3.test.ts | 8 ++-- tests/comprehensive/core-api.test.ts | 2 +- .../find-triple-intelligence.test.ts | 2 +- .../comprehensive/public-api-complete.test.ts | 20 +++++----- tests/critical-error-handling.test.ts | 2 +- tests/critical-neural-validation.test.ts | 2 +- tests/critical-performance-benchmark.test.ts | 2 +- tests/distributed-demo.test.ts | 10 ++--- tests/helpers/distributed-cluster.ts | 4 +- tests/helpers/test-factory.ts | 4 +- .../advanced-apis-regression.test.ts | 12 +++--- tests/integration/aggregation.test.ts | 2 +- .../all-apis-comprehensive.test.ts | 2 +- .../api-parameter-validation.test.ts | 2 +- .../batchImportWithRelations.test.ts | 2 +- .../brainy-complete.integration.test.ts | 2 +- .../brainy-core.integration.test.ts | 2 +- .../brainy-phase1c-integration.test.ts | 4 +- tests/integration/bun-compile-test.ts | 2 +- tests/integration/clear-persistence.test.ts | 26 ++++++------- tests/integration/clear-vfs.test.ts | 14 +++---- tests/integration/commit-ref-bug.test.ts | 2 +- .../integration/commit-state-capture.test.ts | 6 +-- tests/integration/cortex-compat.test.ts | 10 ++--- .../integration/count-synchronization.test.ts | 2 +- tests/integration/cow-commit-storage.test.ts | 2 +- .../integration/cow-full-integration.test.ts | 38 +++++++++---------- tests/integration/empty-tree-bug.test.ts | 2 +- .../entity-confidence-weight.test.ts | 2 +- tests/integration/find-limits.test.ts | 2 +- .../find-unified-integration.test.ts | 2 +- tests/integration/find-where-zero.test.ts | 14 +++---- tests/integration/fork-persistence.test.ts | 2 +- tests/integration/get-relations-fix.test.ts | 2 +- .../history-ref-resolution-bug.test.ts | 2 +- tests/integration/hnsw-rebuild.test.ts | 30 +++++++-------- tests/integration/hybrid-search-cow.test.ts | 2 +- .../initial-commit-null-parent.test.ts | 2 +- .../memory-enhancements-v5.11.0.test.ts | 24 ++++++------ .../metadata-only-comprehensive.test.ts | 14 +++---- .../metadata-vector-exclusion.test.ts | 2 +- tests/integration/migration.test.ts | 10 ++--- .../integration/multi-process-safety.test.ts | 24 ++++++------ tests/integration/orderby-sort-bug.test.ts | 2 +- .../phase3TypeFirstQuery.integration.test.ts | 2 +- tests/integration/readAfterWrite.test.ts | 2 +- .../relationship-intelligence.test.ts | 2 +- tests/integration/remaining-apis.test.ts | 2 +- tests/integration/rev-and-ifabsent.test.ts | 2 +- tests/integration/s3-storage.test.ts | 10 ++--- tests/integration/smart-import.test.ts | 2 +- .../storage-batch-operations.test.ts | 8 ++-- .../integration/strict-mode-self-test.test.ts | 12 +++--- tests/integration/subtype-and-facets.test.ts | 2 +- tests/integration/update-asymmetry.test.ts | 2 +- .../verb-subtype-and-enforcement.test.ts | 14 +++---- tests/integration/versioning.test.ts | 2 +- .../vfs-and-graph-entities.test.ts | 2 +- tests/integration/vfs-api-wiring.test.ts | 2 +- tests/integration/vfs-debug.test.ts | 2 +- .../integration/vfs-historical-reads.test.ts | 2 +- .../vfs-import-verification.test.ts | 2 +- .../vfs-knowledge-separation.test.ts | 2 +- .../vfs-performance-v5.11.1.test.ts | 2 +- tests/integration/vfs-versioning.test.ts | 2 +- tests/manual/metadata-index-debug.test.ts | 2 +- tests/manual/simple-vfs-filter-test.test.ts | 2 +- tests/manual/type-filtering-diagnostic.ts | 2 +- tests/manual/vfs-isvfs-diagnostic.test.ts | 2 +- .../vfs-multiple-init-diagnostic.test.ts | 6 +-- tests/manual/vfs-search-debug.test.ts | 2 +- tests/manual/vfs-where-clause-test.test.ts | 2 +- .../graph-scale-performance.test.ts | 2 +- .../triple-intelligence-scale.test.ts | 4 +- tests/performance/typeAware.bench.test.ts | 2 +- .../regression/metadata-index-cleanup.test.ts | 2 +- tests/regression/v5.7.0-deadlock.test.ts | 2 +- tests/streaming-pipeline.test.ts | 2 +- .../integration/cow-transactions.test.ts | 2 +- .../distributed-transactions.test.ts | 2 +- .../integration/sharding-transactions.test.ts | 2 +- .../typeaware-transactions.test.ts | 2 +- tests/unit/brainy-core.unit.test.ts | 2 +- tests/unit/brainy-get-optimization.test.ts | 2 +- tests/unit/brainy/batch-operations.test.ts | 2 +- tests/unit/brainy/find.test.ts | 2 +- tests/unit/brainy/hybrid-search.test.ts | 2 +- .../relate-duplicate-optimization.test.ts | 2 +- tests/unit/create-entities-default.test.ts | 2 +- .../unit/graph/graphIndex-pagination.test.ts | 2 +- tests/unit/import/InstancePool.test.ts | 2 +- tests/unit/import/preserve-source-fix.test.ts | 2 +- .../neural/NaturalLanguageProcessor.test.ts | 2 +- .../neural/domain-time-clustering.test.ts | 2 +- tests/unit/neural/neural-simplified.test.ts | 2 +- .../neural/signals/EmbeddingSignal.test.ts | 2 +- .../unit/performance/add-performance.test.ts | 2 +- tests/unit/plugin.test.ts | 10 ++--- tests/unit/storage/vfs-mkdir-bug.test.ts | 2 +- tests/unit/type-filtering.unit.test.ts | 2 +- .../utils/entity-id-mapper-stability.test.ts | 2 +- tests/unit/utils/memoryLimits.test.ts | 18 ++++----- tests/unit/utils/resultRanking.test.ts | 6 +-- .../vfs-multi-instance-diagnostic.test.ts | 2 +- tests/unit/vfs-restart-fix.test.ts | 8 ++-- .../unit/vfs/blob-storage-integration.test.ts | 2 +- tests/vfs/tree-operations.test.ts | 2 +- tests/vfs/vfs-bug-fixes.unit.test.ts | 2 +- tests/vfs/vfs-bulkwrite-race.test.ts | 2 +- tests/vfs/vfs-initialization.unit.test.ts | 6 +-- tests/vfs/vfs-relationships.test.ts | 2 +- tests/vfs/vfs.unit.test.ts | 4 +- 117 files changed, 282 insertions(+), 282 deletions(-) diff --git a/src/brainy.ts b/src/brainy.ts index 4d69aee0..a1e5b092 100644 --- a/src/brainy.ts +++ b/src/brainy.ts @@ -9309,14 +9309,12 @@ export class Brainy implements BrainyInterface { // true: every public write path requires subtype on every type. // { except: [...] }: strict, but listed types may omit subtype. // Becomes the default in 8.0.0. - // Subtype enforcement default. Brainy 8.0's subtype contract - // (BRAINY-8.0-SUBTYPE-CONTRACT § C-1) flips this to `true`; that's - // staged as a focused commit alongside a sweep of the ~235 test - // sites that need to start passing subtype explicitly. For now, the - // 7.x default (`false`) ships; per-type and per-brain enforcement - // via `brain.requireSubtype()` / `new Brainy({ requireSubtype })` - // remain available. - requireSubtype: config?.requireSubtype ?? false, + // Subtype required-by-default (8.0 — per BRAINY-8.0-SUBTYPE-CONTRACT § C-1). + // Every write path now requires `subtype` on every type unless the consumer + // opts out explicitly. Opt-out: `requireSubtype: false` (last-resort migration + // hatch for old data or legacy fixtures) or `requireSubtype: { except: [...] }` + // (per-type allowlist). + requireSubtype: config?.requireSubtype ?? true, // Multi-process safety mode: config?.mode ?? 'writer', force: config?.force ?? false diff --git a/tests/api/batch-operations.test.ts b/tests/api/batch-operations.test.ts index 56358326..17de3171 100644 --- a/tests/api/batch-operations.test.ts +++ b/tests/api/batch-operations.test.ts @@ -91,7 +91,7 @@ describe('Batch Operations - Public API Testing', () => { let metricsCollector: BatchMetricsCollector beforeEach(async () => { - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brainy.init() diff --git a/tests/api/crud-operations-enhanced.test.ts b/tests/api/crud-operations-enhanced.test.ts index 1ff01131..7f3dde0c 100644 --- a/tests/api/crud-operations-enhanced.test.ts +++ b/tests/api/crud-operations-enhanced.test.ts @@ -101,7 +101,7 @@ describe('Enhanced CRUD Operations - Public API Validation', () => { let metricsCollector: TestMetricsCollector beforeEach(async () => { - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brainy.init() diff --git a/tests/api/error-handling.test.ts b/tests/api/error-handling.test.ts index 1c5667a7..9d77a9ab 100644 --- a/tests/api/error-handling.test.ts +++ b/tests/api/error-handling.test.ts @@ -17,7 +17,7 @@ describe('Error Handling and Recovery', () => { let brainy: Brainy beforeEach(async () => { - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brainy.init() diff --git a/tests/api/performance-benchmarks.test.ts b/tests/api/performance-benchmarks.test.ts index 78865787..eb928751 100644 --- a/tests/api/performance-benchmarks.test.ts +++ b/tests/api/performance-benchmarks.test.ts @@ -113,7 +113,7 @@ describe('Performance Benchmarks - SLA Validation', () => { const benchmarkResults: PerformanceResult[] = [] beforeEach(async () => { - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brainy.init() diff --git a/tests/brainy-3.test.ts b/tests/brainy-3.test.ts index a2499181..b8a6d9d1 100644 --- a/tests/brainy-3.test.ts +++ b/tests/brainy-3.test.ts @@ -10,7 +10,7 @@ describe('Brainy 3.0 API', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() @@ -378,7 +378,7 @@ describe('Brainy 3.0 API', () => { }) it('should require initialization before operations', async () => { - const uninitializedBrain = new Brainy() + const uninitializedBrain = new Brainy({ requireSubtype: false }) await expect(uninitializedBrain.add({ data: 'Test', @@ -394,7 +394,7 @@ describe('Brainy 3.0 API', () => { describe('Configuration', () => { it('should support custom configuration', async () => { - const customBrain = new Brainy({ + const customBrain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, model: { type: 'fast' }, cache: true, @@ -418,7 +418,7 @@ describe('Brainy 3.0 Neural API', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, }) await brain.init() diff --git a/tests/comprehensive/core-api.test.ts b/tests/comprehensive/core-api.test.ts index 5e5c946d..7e38c01d 100644 --- a/tests/comprehensive/core-api.test.ts +++ b/tests/comprehensive/core-api.test.ts @@ -11,7 +11,7 @@ describe('Brainy v3.0 Core API Tests', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() diff --git a/tests/comprehensive/find-triple-intelligence.test.ts b/tests/comprehensive/find-triple-intelligence.test.ts index 0a1481bc..e385fd25 100644 --- a/tests/comprehensive/find-triple-intelligence.test.ts +++ b/tests/comprehensive/find-triple-intelligence.test.ts @@ -12,7 +12,7 @@ describe('Find and Triple Intelligence', () => { let testData: any[] beforeAll(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() diff --git a/tests/comprehensive/public-api-complete.test.ts b/tests/comprehensive/public-api-complete.test.ts index ca01e231..71248da5 100644 --- a/tests/comprehensive/public-api-complete.test.ts +++ b/tests/comprehensive/public-api-complete.test.ts @@ -33,7 +33,7 @@ describe('Brainy Public API - Complete Coverage', () => { describe('Core CRUD Operations', () => { beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() }) @@ -236,7 +236,7 @@ describe('Brainy Public API - Complete Coverage', () => { describe('Relationship Operations', () => { beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() }) @@ -419,7 +419,7 @@ describe('Brainy Public API - Complete Coverage', () => { describe('Search Operations', () => { beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() await brain.addMany({ @@ -533,7 +533,7 @@ describe('Brainy Public API - Complete Coverage', () => { let entityIds: string[] beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() const result = await brain.addMany({ @@ -627,7 +627,7 @@ describe('Brainy Public API - Complete Coverage', () => { describe('Statistics', () => { beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() }) @@ -661,7 +661,7 @@ describe('Brainy Public API - Complete Coverage', () => { const fsTestDir = path.join(tmpdir(), `brainy-fs-crud-${Date.now()}`) await fs.mkdir(fsTestDir, { recursive: true }) - const fsBrain = new Brainy({ + const fsBrain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: fsTestDir } @@ -695,7 +695,7 @@ describe('Brainy Public API - Complete Coverage', () => { const fsTestDir = path.join(tmpdir(), `brainy-fs-concurrent-${Date.now()}`) await fs.mkdir(fsTestDir, { recursive: true }) - const fsBrain = new Brainy({ + const fsBrain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: fsTestDir } @@ -723,7 +723,7 @@ describe('Brainy Public API - Complete Coverage', () => { describe('Error Recovery and Resilience', () => { beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() }) @@ -780,7 +780,7 @@ describe('Brainy Public API - Complete Coverage', () => { describe('Performance', () => { it('should handle moderate-scale operations', async () => { - const perfBrain = new Brainy({ storage: { type: 'memory' } }) + const perfBrain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await perfBrain.init() // Add 50 items in batches @@ -806,7 +806,7 @@ describe('Brainy Public API - Complete Coverage', () => { describe('Clear Operations', () => { beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() await brain.addMany({ diff --git a/tests/critical-error-handling.test.ts b/tests/critical-error-handling.test.ts index 4de0673c..e16c6df0 100644 --- a/tests/critical-error-handling.test.ts +++ b/tests/critical-error-handling.test.ts @@ -5,7 +5,7 @@ describe('CRITICAL: Error Handling and Edge Cases', () => { let brainy: Brainy beforeAll(async () => { - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brainy.init() diff --git a/tests/critical-neural-validation.test.ts b/tests/critical-neural-validation.test.ts index 037176a0..03385d18 100644 --- a/tests/critical-neural-validation.test.ts +++ b/tests/critical-neural-validation.test.ts @@ -6,7 +6,7 @@ describe('CRITICAL: Real-World Neural Matching Validation', () => { let brainy: Brainy beforeAll(async () => { - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brainy.init() diff --git a/tests/critical-performance-benchmark.test.ts b/tests/critical-performance-benchmark.test.ts index c7dc5424..c0ff92d9 100644 --- a/tests/critical-performance-benchmark.test.ts +++ b/tests/critical-performance-benchmark.test.ts @@ -5,7 +5,7 @@ describe('CRITICAL: Performance Benchmarks at Scale', () => { let brainy: Brainy beforeAll(async () => { - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brainy.init() diff --git a/tests/distributed-demo.test.ts b/tests/distributed-demo.test.ts index 2d47ccfd..370be956 100644 --- a/tests/distributed-demo.test.ts +++ b/tests/distributed-demo.test.ts @@ -19,7 +19,7 @@ describe('Distributed Brainy Demo', () => { beforeAll(async () => { // Node 1: First node starts cluster - node1 = new Brainy({ + node1 = new Brainy({ requireSubtype: false, storage: { s3Storage: { bucket: process.env.S3_BUCKET || 'brainy-test', @@ -34,7 +34,7 @@ describe('Distributed Brainy Demo', () => { console.log('Node 1 started - became cluster leader') // Node 2: Automatically discovers and joins - node2 = new Brainy({ + node2 = new Brainy({ requireSubtype: false, storage: { s3Storage: { bucket: process.env.S3_BUCKET || 'brainy-test', @@ -49,7 +49,7 @@ describe('Distributed Brainy Demo', () => { console.log('Node 2 started - automatically joined cluster') // Node 3: Also joins automatically - node3 = new Brainy({ + node3 = new Brainy({ requireSubtype: false, storage: { s3Storage: { bucket: process.env.S3_BUCKET || 'brainy-test', @@ -114,7 +114,7 @@ describe('Distributed Brainy Demo', () => { it('should automatically rebalance when nodes join', async () => { // Start a new node - const node4 = new Brainy({ + const node4 = new Brainy({ requireSubtype: false, storage: { s3Storage: { bucket: process.env.S3_BUCKET || 'brainy-test', @@ -170,7 +170,7 @@ describe('Distributed Brainy Demo', () => { export function distributedExample() { return ` // Zero-Config Distributed Setup -const brain = new Brainy({ +const brain = new Brainy({ requireSubtype: false, storage: { s3Storage: { bucket: 'my-data', diff --git a/tests/helpers/distributed-cluster.ts b/tests/helpers/distributed-cluster.ts index 40d8a1de..b538330e 100644 --- a/tests/helpers/distributed-cluster.ts +++ b/tests/helpers/distributed-cluster.ts @@ -76,7 +76,7 @@ export class DistributedTestCluster { console.log(`Starting ${nodeId} on port ${port}...`); - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } @@ -226,7 +226,7 @@ export class DistributedTestCluster { console.log(`Adding new node ${nodeId} on port ${port}...`); - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } diff --git a/tests/helpers/test-factory.ts b/tests/helpers/test-factory.ts index 69dad776..9b276f40 100644 --- a/tests/helpers/test-factory.ts +++ b/tests/helpers/test-factory.ts @@ -176,9 +176,11 @@ export function createFindParams(overrides: Partial = {}): FindParam } } -// Generate test configuration +// Generate test configuration. Brainy 8.0 defaults `requireSubtype: true`; +// tests opt out unless they specifically exercise subtype enforcement. export function createTestConfig(overrides: Partial = {}): BrainyConfig { return { + requireSubtype: false, storage: { type: 'memory' }, model: { type: 'fast' }, index: { diff --git a/tests/integration/advanced-apis-regression.test.ts b/tests/integration/advanced-apis-regression.test.ts index 0b9e368c..12c39112 100644 --- a/tests/integration/advanced-apis-regression.test.ts +++ b/tests/integration/advanced-apis-regression.test.ts @@ -23,7 +23,7 @@ describe('BR-ADV-FEATURES-BUN regression', () => { let brain: Brainy beforeAll(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() // Warm the embedding model so the first real extraction isn't paying cold-start latency. await brain.embed('warmup') @@ -141,7 +141,7 @@ describe('BR-ADV-FEATURES-BUN regression', () => { it('defineAggregate AFTER entities exist still returns correct rows', async () => { // The durable-storage case: a brain reopens pre-populated, then an aggregate is // defined. Write-time hooks never saw these entities, so without backfill this is []. - const b: any = new Brainy({ storage: { type: 'memory' } }) + const b: any = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await b.init() await b.add({ data: 'a', type: NounType.Event, metadata: { category: 'food', amount: 5 } }) await b.add({ data: 'b', type: NounType.Event, metadata: { category: 'food', amount: 7 } }) @@ -165,7 +165,7 @@ describe('BR-ADV-FEATURES-BUN regression', () => { }) it('groupBy "noun" resolves to the entity type, not null', async () => { - const b: any = new Brainy({ storage: { type: 'memory' } }) + const b: any = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await b.init() await b.add({ data: 'p', type: NounType.Person }) b.defineAggregate({ @@ -183,7 +183,7 @@ describe('BR-ADV-FEATURES-BUN regression', () => { describe('Traversal — via filter applies at every hop', () => { it('depth-2 via traversal follows the typed chain to the second hop', async () => { - const b: any = new Brainy({ storage: { type: 'memory' } }) + const b: any = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await b.init() const a = await b.add({ data: 'a', type: NounType.Concept, metadata: { name: 'A' } }) const m = await b.add({ data: 'm', type: NounType.Concept, metadata: { name: 'M' } }) @@ -204,7 +204,7 @@ describe('BR-ADV-FEATURES-BUN regression', () => { describe('queryAggregate() + HAVING', () => { it('returns AggregateResult[] and filters groups by metric value', async () => { - const b: any = new Brainy({ storage: { type: 'memory' } }) + const b: any = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await b.init() b.defineAggregate({ name: 'rev', @@ -233,7 +233,7 @@ describe('BR-ADV-FEATURES-BUN regression', () => { describe('R2 — array-unnest groupBy (tag frequency)', () => { it('groups by each distinct array element; dedups per entity; skips empty', async () => { - const b: any = new Brainy({ storage: { type: 'memory' } }) + const b: any = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await b.init() b.defineAggregate({ name: 'tags', diff --git a/tests/integration/aggregation.test.ts b/tests/integration/aggregation.test.ts index 2fc2a2fc..93e1c38e 100644 --- a/tests/integration/aggregation.test.ts +++ b/tests/integration/aggregation.test.ts @@ -7,7 +7,7 @@ describe('Aggregation Engine Integration', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() }) diff --git a/tests/integration/all-apis-comprehensive.test.ts b/tests/integration/all-apis-comprehensive.test.ts index d0390b56..7ee4a9b7 100644 --- a/tests/integration/all-apis-comprehensive.test.ts +++ b/tests/integration/all-apis-comprehensive.test.ts @@ -32,7 +32,7 @@ describe('Comprehensive All-APIs Test', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/integration/api-parameter-validation.test.ts b/tests/integration/api-parameter-validation.test.ts index 5c419c43..4e25e781 100644 --- a/tests/integration/api-parameter-validation.test.ts +++ b/tests/integration/api-parameter-validation.test.ts @@ -11,7 +11,7 @@ describe('API Parameter Validation', () => { let brain: Brainy beforeAll(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() diff --git a/tests/integration/batchImportWithRelations.test.ts b/tests/integration/batchImportWithRelations.test.ts index 0342491d..37cadd3d 100644 --- a/tests/integration/batchImportWithRelations.test.ts +++ b/tests/integration/batchImportWithRelations.test.ts @@ -14,7 +14,7 @@ describe('Batch Import with Immediate Relations (v5.7.3 Fix)', () => { fs.mkdirSync(testDir, { recursive: true }) // Initialize brain - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', config: { diff --git a/tests/integration/brainy-complete.integration.test.ts b/tests/integration/brainy-complete.integration.test.ts index be5e5636..e9aa9ea5 100644 --- a/tests/integration/brainy-complete.integration.test.ts +++ b/tests/integration/brainy-complete.integration.test.ts @@ -27,7 +27,7 @@ describe('Brainy 2.0 Complete Feature Test (Real AI)', () => { console.log(`📊 Available heap: ${process.env.NODE_OPTIONS}`) // Create instance with full feature set - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, verbose: true // Enable verbose logging to track operations }) diff --git a/tests/integration/brainy-core.integration.test.ts b/tests/integration/brainy-core.integration.test.ts index 7fb795a6..792cc97e 100644 --- a/tests/integration/brainy-core.integration.test.ts +++ b/tests/integration/brainy-core.integration.test.ts @@ -20,7 +20,7 @@ describe('Brainy 3.0 Core (Integration Tests - Real AI)', () => { console.log('🤖 Initializing Brainy 3.0 with REAL AI models...') // Create instance with real AI embedding function - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, // No mock embedding function = uses real AI }) diff --git a/tests/integration/brainy-phase1c-integration.test.ts b/tests/integration/brainy-phase1c-integration.test.ts index 2e83607f..3c57e06d 100644 --- a/tests/integration/brainy-phase1c-integration.test.ts +++ b/tests/integration/brainy-phase1c-integration.test.ts @@ -23,7 +23,7 @@ describe('Brainy - Phase 1c: Type-Aware Integration', () => { mkdirSync(testDir, { recursive: true }) } - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: testDir @@ -343,7 +343,7 @@ describe('Brainy - Phase 1c: Type-Aware Integration', () => { await brainy.flush() // Create new instance (should warm cache on init) - const brainy2 = new Brainy({ + const brainy2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: testDir diff --git a/tests/integration/bun-compile-test.ts b/tests/integration/bun-compile-test.ts index d90093d6..a8d49ca7 100644 --- a/tests/integration/bun-compile-test.ts +++ b/tests/integration/bun-compile-test.ts @@ -95,7 +95,7 @@ async function testBunCompile() { // Test 5: Full Brainy initialization with fresh memory storage try { console.log('5. Testing Brainy initialization (in-memory)...') - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: 'memory', storageOptions: { path: ':memory:' } }) diff --git a/tests/integration/clear-persistence.test.ts b/tests/integration/clear-persistence.test.ts index 566045c1..feffdf49 100644 --- a/tests/integration/clear-persistence.test.ts +++ b/tests/integration/clear-persistence.test.ts @@ -35,7 +35,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { it('should fully clear persistent storage (the reported scenario)', async () => { // Step 1: Create and populate instance - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath, @@ -59,7 +59,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { expect(entityCount2).toBe(0) // Step 3: Create NEW instance (simulate server restart) - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath, @@ -75,7 +75,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { }) it('should create cow-disabled marker file', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath @@ -96,7 +96,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { }) it('should delete _cow/ directory', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath @@ -122,7 +122,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { it('should prevent COW reinitialization after clear()', async () => { // Create and clear - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath } }) await brain1.init() @@ -130,7 +130,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { await brain1.clear() // Create new instance - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath } }) await brain2.init() @@ -150,14 +150,14 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { try { // Iteration 1 - const brain1 = new Brainy({ storage: { type: 'filesystem', path: storagePath }}) + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: storagePath }}) await brain1.init() await brain1.add({ data:'Entity 1', type: 'concept' }) expect((await brain1.find({ type: 'concept' })).length).toBe(1) await brain1.clear() // Iteration 2 - const brain2 = new Brainy({ storage: { type: 'filesystem', path: storagePath }}) + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: storagePath }}) await brain2.init() expect((await brain2.find({ type: 'concept' })).length).toBe(0) await brain2.add({ data:'Entity 2', type: 'concept' }) @@ -165,7 +165,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { await brain2.clear() // Iteration 3 - const brain3 = new Brainy({ storage: { type: 'filesystem', path: storagePath }}) + const brain3 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: storagePath }}) await brain3.init() expect((await brain3.find({ type: 'concept' })).length).toBe(0) } finally { @@ -177,7 +177,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { }) it('should clear both entities and relations', async () => { - const brain1 = new Brainy({ storage: { type: 'filesystem', path: testStoragePath }}) + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath }}) await brain1.init() // Add graph data @@ -194,7 +194,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { await brain1.clear() // Create new instance - const brain2 = new Brainy({ storage: { type: 'filesystem', path: testStoragePath }}) + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath }}) await brain2.init() // Verify everything is cleared @@ -204,7 +204,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { }) it('should handle clear() on empty storage', async () => { - const brain = new Brainy({ storage: { type: 'filesystem', path: testStoragePath }}) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testStoragePath }}) await brain.init() // Clear without adding any data @@ -219,7 +219,7 @@ describe('Clear Persistence Bug Fix (v5.10.4)', () => { describe('Clear() works for MemoryStorage', () => { it('should clear memory storage completely', async () => { - const brain1 = new Brainy({ storage: { type: 'memory' }}) + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'memory' }}) await brain1.init() await brain1.add({ data:'Test', type: 'concept' }) diff --git a/tests/integration/clear-vfs.test.ts b/tests/integration/clear-vfs.test.ts index ca145608..25486f83 100644 --- a/tests/integration/clear-vfs.test.ts +++ b/tests/integration/clear-vfs.test.ts @@ -44,7 +44,7 @@ describe('VFS operations after clear() (v7.3.1 fix)', () => { } it('should allow VFS operations after brain.clear() without recreation (memory)', async () => { - const brain = new Brainy({ storage: { type: 'memory' } }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) try { await brain.init() @@ -70,7 +70,7 @@ describe('VFS operations after clear() (v7.3.1 fix)', () => { it('should allow VFS operations after brain.clear() without recreation (filesystem)', async () => { const testPath = getTestPath() - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testPath } }) try { @@ -97,7 +97,7 @@ describe('VFS operations after clear() (v7.3.1 fix)', () => { }) it('should handle clear() when VFS was never used', async () => { - const brain = new Brainy({ storage: { type: 'memory' } }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) try { await brain.init() @@ -121,7 +121,7 @@ describe('VFS operations after clear() (v7.3.1 fix)', () => { }) it('should reinitialize VFS root entity after clear', async () => { - const brain = new Brainy({ storage: { type: 'memory' } }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) try { await brain.init() @@ -152,7 +152,7 @@ describe('VFS operations after clear() (v7.3.1 fix)', () => { }) it('should work across multiple clear() cycles', async () => { - const brain = new Brainy({ storage: { type: 'memory' } }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) try { await brain.init() @@ -178,7 +178,7 @@ describe('VFS operations after clear() (v7.3.1 fix)', () => { }) it('should preserve VFS functionality with nested directories after clear', async () => { - const brain = new Brainy({ storage: { type: 'memory' } }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) try { await brain.init() @@ -202,7 +202,7 @@ describe('VFS operations after clear() (v7.3.1 fix)', () => { }) it('should work with concurrent VFS and regular entity operations after clear', async () => { - const brain = new Brainy({ storage: { type: 'memory' } }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) try { await brain.init() diff --git a/tests/integration/commit-ref-bug.test.ts b/tests/integration/commit-ref-bug.test.ts index 9facedeb..a0c1b9c7 100644 --- a/tests/integration/commit-ref-bug.test.ts +++ b/tests/integration/commit-ref-bug.test.ts @@ -20,7 +20,7 @@ describe('Commit Ref Update Bug (v5.2.0)', () => { fs.rmSync(TEST_DATA_PATH, { recursive: true, force: true }) } - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: TEST_DATA_PATH, diff --git a/tests/integration/commit-state-capture.test.ts b/tests/integration/commit-state-capture.test.ts index 2d85bb8f..d6cf2ea4 100644 --- a/tests/integration/commit-state-capture.test.ts +++ b/tests/integration/commit-state-capture.test.ts @@ -32,7 +32,7 @@ describe('Commit State Capture (v5.4.0)', () => { } fs.mkdirSync(TEST_DATA_PATH, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { adapter: 'filesystem', path: TEST_DATA_PATH @@ -404,7 +404,7 @@ describe('Commit State Capture (v5.4.0)', () => { it('should work with Memory storage adapter', async () => { console.log('\n📋 Test 9: Memory storage adapter') - const memBrain = new Brainy({ + const memBrain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, silent: true }) @@ -439,7 +439,7 @@ describe('Commit State Capture (v5.4.0)', () => { fs.rmSync(testPath, { recursive: true, force: true }) } - const typeAwareBrain = new Brainy({ + const typeAwareBrain = new Brainy({ requireSubtype: false, storage: { adapter: 'typeaware', path: testPath diff --git a/tests/integration/cortex-compat.test.ts b/tests/integration/cortex-compat.test.ts index 15069d5c..5938e1b2 100644 --- a/tests/integration/cortex-compat.test.ts +++ b/tests/integration/cortex-compat.test.ts @@ -58,12 +58,12 @@ describe('Cortex compatibility (BR-DEFENSIVE-INTERFACE)', () => { }) it('boots without throwing against an adapter missing the 7.21+ methods', async () => { - brain = new Brainy({ storage: new LegacyCortexLikeStorage() as any }) + brain = new Brainy({ requireSubtype: false, storage: new LegacyCortexLikeStorage() as any }) await expect(brain.init()).resolves.toBeUndefined() }) it('logs a one-line warning naming the older adapter', async () => { - brain = new Brainy({ storage: new LegacyCortexLikeStorage() as any }) + brain = new Brainy({ requireSubtype: false, storage: new LegacyCortexLikeStorage() as any }) await brain.init() const warnMessages = warnSpy.mock.calls @@ -73,7 +73,7 @@ describe('Cortex compatibility (BR-DEFENSIVE-INTERFACE)', () => { }) it('basic CRUD works normally (the missing methods are not on the hot path)', async () => { - brain = new Brainy({ storage: new LegacyCortexLikeStorage() as any }) + brain = new Brainy({ requireSubtype: false, storage: new LegacyCortexLikeStorage() as any }) await brain.init() const id = await brain.add({ data: 'hello', type: NounType.Concept }) @@ -85,7 +85,7 @@ describe('Cortex compatibility (BR-DEFENSIVE-INTERFACE)', () => { }) it('requestFlush() returns false when storage does not implement the RPC', async () => { - brain = new Brainy({ storage: new LegacyCortexLikeStorage() as any }) + brain = new Brainy({ requireSubtype: false, storage: new LegacyCortexLikeStorage() as any }) await brain.init() // Same-process call would normally flush directly. Force the @@ -96,7 +96,7 @@ describe('Cortex compatibility (BR-DEFENSIVE-INTERFACE)', () => { }) it('stats() reports no writerLock for older adapters', async () => { - brain = new Brainy({ storage: new LegacyCortexLikeStorage() as any }) + brain = new Brainy({ requireSubtype: false, storage: new LegacyCortexLikeStorage() as any }) await brain.init() const stats = await brain.stats() diff --git a/tests/integration/count-synchronization.test.ts b/tests/integration/count-synchronization.test.ts index 4f0aab94..8e6d19f8 100644 --- a/tests/integration/count-synchronization.test.ts +++ b/tests/integration/count-synchronization.test.ts @@ -27,7 +27,7 @@ describe('Count Synchronization (Bug Fix v4.1.2)', () => { } // Create fresh Brainy instance - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testPath } }) await brain.init() diff --git a/tests/integration/cow-commit-storage.test.ts b/tests/integration/cow-commit-storage.test.ts index 5212acd2..c93e337b 100644 --- a/tests/integration/cow-commit-storage.test.ts +++ b/tests/integration/cow-commit-storage.test.ts @@ -22,7 +22,7 @@ describe('COW Commit Storage Type-Aware Prefixes', () => { beforeEach(async () => { testDir = path.join('/tmp', `brainy-cow-test-${Date.now()}`) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir, diff --git a/tests/integration/cow-full-integration.test.ts b/tests/integration/cow-full-integration.test.ts index 04af01bd..141bd9ea 100644 --- a/tests/integration/cow-full-integration.test.ts +++ b/tests/integration/cow-full-integration.test.ts @@ -22,7 +22,7 @@ import type { StorageAdapter } from '../../src/storage/adapters/baseStorageAdapt describe('COW Full Integration', () => { describe('Storage Adapter Compatibility', () => { it('should work with Memory adapter', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -46,7 +46,7 @@ describe('COW Full Integration', () => { }) it('should work with FileSystem adapter', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'filesystem', path: '/tmp/brainy-cow-test-fs' @@ -70,7 +70,7 @@ describe('COW Full Integration', () => { }) it('should work with TypeAware adapter (most advanced)', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'typeaware', path: '/tmp/brainy-cow-test-typeaware' @@ -96,7 +96,7 @@ describe('COW Full Integration', () => { // Note: S3/R2/GCS/Azure tests require cloud credentials // Run these in CI/CD with proper credentials it.skip('should work with S3 adapter', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 's3', bucket: 'test-brainy-cow', @@ -123,7 +123,7 @@ describe('COW Full Integration', () => { describe('Billion-Scale Performance', () => { it('should fork 1M entities in < 2 seconds', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -172,7 +172,7 @@ describe('COW Full Integration', () => { }, 120000) // 2-minute timeout for 1M entity test it('should deduplicate billions of identical vectors', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -208,7 +208,7 @@ describe('COW Full Integration', () => { describe('find() Integration', () => { it('should work with graph-aware find() queries', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -249,7 +249,7 @@ describe('COW Full Integration', () => { }) it('should preserve metadata index across fork', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -284,7 +284,7 @@ describe('COW Full Integration', () => { describe('Triple Intelligence Integration', () => { it('should preserve Triple Intelligence across fork', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, intelligence: { enabled: true, @@ -320,7 +320,7 @@ describe('COW Full Integration', () => { describe('VFS Integration', () => { it('should preserve VFS structure across fork', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, vfs: { enabled: true } }) @@ -345,7 +345,7 @@ describe('COW Full Integration', () => { }) it('should support VFS paths in billions of entities', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, vfs: { enabled: true } }) @@ -376,7 +376,7 @@ describe('COW Full Integration', () => { describe('All 4 Indexes Integration', () => { it('should preserve HNSW index across fork', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -407,7 +407,7 @@ describe('COW Full Integration', () => { }) it('should preserve GraphAdjacency index across fork', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -434,7 +434,7 @@ describe('COW Full Integration', () => { }) it('should preserve DeletedItems index across fork', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -461,7 +461,7 @@ describe('COW Full Integration', () => { describe('Distributed Mode', () => { it('should work with read-only instances', async () => { // Main brain (read-write) - const main = new Brainy({ + const main = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) @@ -475,7 +475,7 @@ describe('COW Full Integration', () => { await main.commit({ message: 'Add entity' }) // Read-only instance (shares storage) - const readonly = new Brainy({ + const readonly = new Brainy({ requireSubtype: false, storage: main.config.storage, readOnly: true }) @@ -499,7 +499,7 @@ describe('COW Full Integration', () => { it('should work with write-only instances', async () => { // Write-only instance - const writeOnly = new Brainy({ + const writeOnly = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, writeOnly: true }) @@ -525,7 +525,7 @@ describe('COW Full Integration', () => { describe('256 UUID Sharding', () => { it('should work with sharded storage', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory', sharding: { @@ -562,7 +562,7 @@ describe('COW Full Integration', () => { describe('Time-Travel Queries (Enterprise Preview)', () => { it('should support asOf queries', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' } }) diff --git a/tests/integration/empty-tree-bug.test.ts b/tests/integration/empty-tree-bug.test.ts index e59f9551..8b69f783 100644 --- a/tests/integration/empty-tree-bug.test.ts +++ b/tests/integration/empty-tree-bug.test.ts @@ -22,7 +22,7 @@ describe('Empty Tree Bug (v5.3.1)', () => { fs.rmSync(TEST_DATA_PATH, { recursive: true, force: true }) } - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: TEST_DATA_PATH, diff --git a/tests/integration/entity-confidence-weight.test.ts b/tests/integration/entity-confidence-weight.test.ts index b902e589..b5bb34c5 100644 --- a/tests/integration/entity-confidence-weight.test.ts +++ b/tests/integration/entity-confidence-weight.test.ts @@ -15,7 +15,7 @@ describe('Entity Confidence & Weight Exposure', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() }) diff --git a/tests/integration/find-limits.test.ts b/tests/integration/find-limits.test.ts index f568f5dd..db18e81a 100644 --- a/tests/integration/find-limits.test.ts +++ b/tests/integration/find-limits.test.ts @@ -145,7 +145,7 @@ describe('find({ limit }) two-tier enforcement (7.30.2)', () => { describe('Consumer override via Brainy constructor', () => { it('maxQueryLimit raises the cap; warning/throw tiers shift accordingly', async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, maxQueryLimit: 50_000 diff --git a/tests/integration/find-unified-integration.test.ts b/tests/integration/find-unified-integration.test.ts index 163520bd..7ad9ed29 100644 --- a/tests/integration/find-unified-integration.test.ts +++ b/tests/integration/find-unified-integration.test.ts @@ -28,7 +28,7 @@ describe('Unified Find() Integration Tests', () => { beforeAll(async () => { // Initialize Brainy with memory storage for fast tests - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, model: { type: 'fast' }, index: { diff --git a/tests/integration/find-where-zero.test.ts b/tests/integration/find-where-zero.test.ts index 053892bc..6282768a 100644 --- a/tests/integration/find-where-zero.test.ts +++ b/tests/integration/find-where-zero.test.ts @@ -56,7 +56,7 @@ describe('BR-FIND-WHERE-ZERO regression', () => { describe('Reader sees correct entity counts after writer cold-start', () => { it('preserves entity count across writer→close→reader-open', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) await writer.init() const writerIds = new Set() for (let i = 0; i < 10; i++) { @@ -80,7 +80,7 @@ describe('BR-FIND-WHERE-ZERO regression', () => { }) it('preserves type classification (no "all entities are thing" poisoning)', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) await writer.init() // Three types. Each id is tracked individually so we don't conflate // user-added entities with whatever VFS / auto-extraction inserts. @@ -120,7 +120,7 @@ describe('BR-FIND-WHERE-ZERO regression', () => { describe('find() consistency', () => { it('returns entities that exist on disk (not silent empty)', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) await writer.init() const conceptIds: string[] = [] for (let i = 0; i < 4; i++) { @@ -145,7 +145,7 @@ describe('BR-FIND-WHERE-ZERO regression', () => { }) it('returns [] with a logged warning for unindexed field', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) await writer.init() await writer.add({ data: 'test', type: NounType.Concept }) await writer.flush() @@ -162,7 +162,7 @@ describe('BR-FIND-WHERE-ZERO regression', () => { }) it('raw getIds() throws BrainyError(FIELD_NOT_INDEXED) for unindexed field', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) await writer.init() await writer.add({ data: 'test', type: NounType.Concept }) await writer.flush() @@ -181,7 +181,7 @@ describe('BR-FIND-WHERE-ZERO regression', () => { describe('explain() and health() match the new contract', () => { it('explain() returns column-store path for indexed fields', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) await writer.init() await writer.add({ data: 'test', @@ -196,7 +196,7 @@ describe('BR-FIND-WHERE-ZERO regression', () => { }) it('health() reports pass for a clean writer + reader handoff', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, silent: true }) await writer.init() for (let i = 0; i < 5; i++) { await writer.add({ data: `entry ${i}`, type: NounType.Concept }) diff --git a/tests/integration/fork-persistence.test.ts b/tests/integration/fork-persistence.test.ts index 801f422a..01d61345 100644 --- a/tests/integration/fork-persistence.test.ts +++ b/tests/integration/fork-persistence.test.ts @@ -20,7 +20,7 @@ describe('Fork Persistence (v5.3.6 Bug Fix)', () => { beforeEach(async () => { // Use filesystem storage to mirror cloud storage behavior testDir = `/tmp/brainy-fork-test-${Date.now()}` - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { adapter: 'filesystem', path: testDir diff --git a/tests/integration/get-relations-fix.test.ts b/tests/integration/get-relations-fix.test.ts index 0267171f..7f836b2e 100644 --- a/tests/integration/get-relations-fix.test.ts +++ b/tests/integration/get-relations-fix.test.ts @@ -25,7 +25,7 @@ describe('getRelations() Fix (v4.1.3)', () => { } // Create fresh Brainy instance - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testPath } }) await brain.init() diff --git a/tests/integration/history-ref-resolution-bug.test.ts b/tests/integration/history-ref-resolution-bug.test.ts index ffea0798..59e75c40 100644 --- a/tests/integration/history-ref-resolution-bug.test.ts +++ b/tests/integration/history-ref-resolution-bug.test.ts @@ -26,7 +26,7 @@ describe('History Ref Resolution Bug (v5.3.0)', () => { fs.rmSync(TEST_DATA_PATH, { recursive: true, force: true }) } - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: TEST_DATA_PATH, diff --git a/tests/integration/hnsw-rebuild.test.ts b/tests/integration/hnsw-rebuild.test.ts index e425127f..0dcf1885 100644 --- a/tests/integration/hnsw-rebuild.test.ts +++ b/tests/integration/hnsw-rebuild.test.ts @@ -79,7 +79,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { console.log('🧪 Test 1: Basic HNSW rebuild with 20 entities...') // Phase 1: Create Brainy instance and add data - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -122,7 +122,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { // Phase 2: Simulate container restart - create new Brainy instance console.log('🔄 Simulating container restart...') - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -168,7 +168,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { console.log('🧪 Test 2: HNSW rebuild with 100 entities...') // Phase 1: Build initial index - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -205,7 +205,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { // Phase 2: Rebuild console.log('🔄 Rebuilding HNSW index...') - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -240,7 +240,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { console.log('🧪 Test 3: Large dataset HNSW rebuild (1000 entities)...') // Phase 1: Build large index - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -275,7 +275,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { // Phase 2: Rebuild large index console.log('🔄 Rebuilding large HNSW index...') - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -315,7 +315,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { console.log('🧪 Test 4: HNSW rebuild with memory storage...') // Phase 1: Build index in memory - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, embeddingFunction: async (text: string) => { const hash = text.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0) @@ -364,7 +364,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { console.log('🧪 Test 5: Parallel rebuild of all indexes...') // Phase 1: Create data with relationships - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -425,7 +425,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { // Phase 2: Restart and rebuild all indexes console.log('🔄 Restarting and rebuilding all 3 indexes...') - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -480,7 +480,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { it('should handle empty storage gracefully (no rebuild needed)', async () => { console.log('🧪 Test 6: Empty storage rebuild...') - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -510,7 +510,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { console.log('🧪 Test 7: Rebuild with single entity...') // Phase 1: Add one entity - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -531,7 +531,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { await brain1.close() // Phase 2: Rebuild - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -558,7 +558,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { console.log('🧪 Test 8: Rebuild with potential data inconsistencies...') // Phase 1: Create data - const brain1 = new Brainy({ + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -577,7 +577,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { await brain1.close() // Phase 2: Rebuild (should handle any missing HNSW data gracefully) - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } @@ -616,7 +616,7 @@ describe('HNSW Index Rebuild (Integration Tests)', () => { it('should persist HNSW graph structure to disk', async () => { console.log('🧪 Test 9: Validate HNSW persistence files...') - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', fileSystemStorage: { path: testDir } diff --git a/tests/integration/hybrid-search-cow.test.ts b/tests/integration/hybrid-search-cow.test.ts index c0118e61..e49b6637 100644 --- a/tests/integration/hybrid-search-cow.test.ts +++ b/tests/integration/hybrid-search-cow.test.ts @@ -23,7 +23,7 @@ describe('Hybrid Search with COW (v7.7.0)', () => { testDir = path.join(os.tmpdir(), `brainy-cow-test-${Date.now()}`) fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { basePath: testDir } diff --git a/tests/integration/initial-commit-null-parent.test.ts b/tests/integration/initial-commit-null-parent.test.ts index 7a97c7f4..61a0ef2b 100644 --- a/tests/integration/initial-commit-null-parent.test.ts +++ b/tests/integration/initial-commit-null-parent.test.ts @@ -30,7 +30,7 @@ describe('Initial Commit NULL Parent Bug (v5.3.3 regression)', () => { fs.rmSync(TEST_DATA_PATH, { recursive: true, force: true }) } - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: TEST_DATA_PATH, diff --git a/tests/integration/memory-enhancements-v5.11.0.test.ts b/tests/integration/memory-enhancements-v5.11.0.test.ts index 98db1978..823453f3 100644 --- a/tests/integration/memory-enhancements-v5.11.0.test.ts +++ b/tests/integration/memory-enhancements-v5.11.0.test.ts @@ -42,7 +42,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { describe('Production Workflow: Consumer Snapshot Timeline', () => { it('should stream 1000 snapshots efficiently', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } @@ -83,7 +83,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { }) it('should handle large snapshot with filtering', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } @@ -124,7 +124,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { it('should detect 4GB Cloud Run container and set optimal limits', async () => { process.env.CLOUD_RUN_MEMORY = '4Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -154,7 +154,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { it('should allow manual override for power users in containers', async () => { process.env.CLOUD_RUN_MEMORY = '4Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, maxQueryLimit: 50000, // Override auto-detection silent: true @@ -173,7 +173,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { }) it('should use reservedQueryMemory for fine-grained control', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, reservedQueryMemory: 2 * 1024 * 1024 * 1024, // Reserve 2GB silent: true @@ -194,7 +194,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { it('should stream large histories within memory limits', async () => { process.env.CLOUD_RUN_MEMORY = '2Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } @@ -239,7 +239,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { it('should provide actionable recommendations', async () => { process.env.CLOUD_RUN_MEMORY = '4Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -266,7 +266,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { // Simulate production issue: container detected but low free memory process.env.CLOUD_RUN_MEMORY = '4Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -291,7 +291,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { it('should work optimally with no configuration', async () => { process.env.CLOUD_RUN_MEMORY = '4Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -318,7 +318,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { it('should work on bare metal without containers', async () => { // No container env vars - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -337,7 +337,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { describe('Backward Compatibility', () => { it('should not break existing code', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -354,7 +354,7 @@ describe('Memory Enhancements Integration (v5.11.0)', () => { }) it('should keep getHistory() working as before', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/integration/metadata-only-comprehensive.test.ts b/tests/integration/metadata-only-comprehensive.test.ts index ae927216..10cadca9 100644 --- a/tests/integration/metadata-only-comprehensive.test.ts +++ b/tests/integration/metadata-only-comprehensive.test.ts @@ -20,7 +20,7 @@ import { join } from 'path' describe('Metadata-Only Comprehensive Integration (v5.11.1)', () => { describe('Storage Adapters', () => { it('should work with MemoryStorage', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, silent: true }) @@ -50,7 +50,7 @@ describe('Metadata-Only Comprehensive Integration (v5.11.1)', () => { it('should work with FileSystemStorage', async () => { const testDir = mkdtempSync(join(tmpdir(), 'brainy-metadata-test-')) - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } @@ -84,7 +84,7 @@ describe('Metadata-Only Comprehensive Integration (v5.11.1)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, silent: true }) @@ -155,7 +155,7 @@ describe('Metadata-Only Comprehensive Integration (v5.11.1)', () => { let entityId: string beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, silent: true }) @@ -235,7 +235,7 @@ describe('Metadata-Only Comprehensive Integration (v5.11.1)', () => { beforeEach(async () => { testDir = mkdtempSync(join(tmpdir(), 'brainy-vfs-metadata-test-')) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } @@ -293,7 +293,7 @@ describe('Metadata-Only Comprehensive Integration (v5.11.1)', () => { describe('COW and Fork', () => { it('should work with metadata-only in forks', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, silent: true }) @@ -327,7 +327,7 @@ describe('Metadata-Only Comprehensive Integration (v5.11.1)', () => { describe('Performance Verification', () => { it('metadata-only should be significantly faster', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { adapter: 'memory' }, silent: true }) diff --git a/tests/integration/metadata-vector-exclusion.test.ts b/tests/integration/metadata-vector-exclusion.test.ts index e9bf6ec7..3739838b 100644 --- a/tests/integration/metadata-vector-exclusion.test.ts +++ b/tests/integration/metadata-vector-exclusion.test.ts @@ -24,7 +24,7 @@ describe('Metadata Vector Exclusion Fix', () => { rmSync(testDir, { recursive: true, force: true }) } - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir }, ai: { provider: 'mock' } }) diff --git a/tests/integration/migration.test.ts b/tests/integration/migration.test.ts index ff115a10..5c1765d5 100644 --- a/tests/integration/migration.test.ts +++ b/tests/integration/migration.test.ts @@ -31,7 +31,7 @@ describe('Migration System', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() }) @@ -355,7 +355,7 @@ describe('Migration System', () => { } await withMigrations([migration], async () => { - const warnBrain = new Brainy({ storage: { type: 'memory' } }) + const warnBrain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await warnBrain.init() const migrationLogs = consoleSpy.mock.calls @@ -374,7 +374,7 @@ describe('Migration System', () => { describe('autoMigrate: true', () => { it('should auto-migrate small datasets during init', async () => { // Create a brain with data, close it - const setupBrain = new Brainy({ storage: { type: 'memory' }, silent: true }) + const setupBrain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await setupBrain.init() await setupBrain.add({ type: NounType.Concept, data: { name: 'AutoTest' }, metadata: { legacy: true } }) @@ -432,8 +432,8 @@ describe('Migration System', () => { describe('Multi-tenant independence', () => { it('should have independent migration state per instance', async () => { - const brain1 = new Brainy({ storage: { type: 'memory' }, silent: true }) - const brain2 = new Brainy({ storage: { type: 'memory' }, silent: true }) + const brain1 = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain1.init() await brain2.init() diff --git a/tests/integration/multi-process-safety.test.ts b/tests/integration/multi-process-safety.test.ts index eaf1aba3..cb4f56ce 100644 --- a/tests/integration/multi-process-safety.test.ts +++ b/tests/integration/multi-process-safety.test.ts @@ -45,7 +45,7 @@ describe('Multi-process safety + read-only mode', () => { describe('ReaderMode enforcement', () => { it('rejects every mutation when opened via openReadOnly()', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() await writer.add({ data: 'seed entity', type: NounType.Concept }) await writer.flush() @@ -67,7 +67,7 @@ describe('Multi-process safety + read-only mode', () => { }) it('flush() and close() are safe to call in read-only mode', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() await writer.add({ data: 'thing', type: NounType.Concept }) await writer.flush() @@ -105,7 +105,7 @@ describe('Multi-process safety + read-only mode', () => { rootDir: dir })) - const blocked = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + const blocked = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await expect(blocked.init()).rejects.toThrow(/another writer holds/i) // Don't track `blocked` for afterEach cleanup since init failed. }) @@ -113,16 +113,16 @@ describe('Multi-process safety + read-only mode', () => { it('allows a second in-process writer with a warning (same PID)', async () => { // Two Brainy instances in the same Node process: not the dangerous // cross-process case. Should succeed (with a console warning). - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() - const second = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + const second = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await expect(second.init()).resolves.toBeUndefined() await second.close() }) it('lets a reader open while a writer is live', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() await writer.add({ data: 'concurrent', type: NounType.Concept }) await writer.flush() @@ -137,10 +137,10 @@ describe('Multi-process safety + read-only mode', () => { }) it('honors { force: true } to override an existing lock', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() - const second = new Brainy({ + const second = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, force: true }) @@ -151,14 +151,14 @@ describe('Multi-process safety + read-only mode', () => { describe('Flush-request RPC', () => { it('in-process call just flushes', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() const ok = await writer.requestFlush({ timeoutMs: 1000 }) expect(ok).toBe(true) }) it('cross-instance request reaches the writer (same-process simulation)', async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() await writer.add({ data: 'pre-request', type: NounType.Concept }) @@ -174,7 +174,7 @@ describe('Multi-process safety + read-only mode', () => { it('returns false when no writer is running', async () => { // Seed some data, then close the writer. The data dir exists but no // writer is listening for flush requests. - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() await writer.add({ data: 'orphan', type: NounType.Concept }) await writer.flush() @@ -191,7 +191,7 @@ describe('Multi-process safety + read-only mode', () => { describe('Diagnostics on a reader', () => { beforeEach(async () => { - writer = new Brainy({ storage: { type: 'filesystem', rootDirectory: dir } }) + writer = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir } }) await writer.init() await writer.add({ data: 'one', type: NounType.Concept, metadata: { tag: 'a' } }) await writer.add({ data: 'two', type: NounType.Concept, metadata: { tag: 'b' } }) diff --git a/tests/integration/orderby-sort-bug.test.ts b/tests/integration/orderby-sort-bug.test.ts index f3d800cc..9c28b1c9 100644 --- a/tests/integration/orderby-sort-bug.test.ts +++ b/tests/integration/orderby-sort-bug.test.ts @@ -30,7 +30,7 @@ describe('find({ orderBy }) sort bug regression', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() }) diff --git a/tests/integration/phase3TypeFirstQuery.integration.test.ts b/tests/integration/phase3TypeFirstQuery.integration.test.ts index f96d4f90..beefcc3e 100644 --- a/tests/integration/phase3TypeFirstQuery.integration.test.ts +++ b/tests/integration/phase3TypeFirstQuery.integration.test.ts @@ -15,7 +15,7 @@ describe('Phase 3: Type-First Query Optimization - Integration', () => { beforeEach(async () => { // Initialize with memory storage and TypeAwareHNSWIndex - brainy = new Brainy({ + brainy = new Brainy({ requireSubtype: false, name: 'phase3-test', dimension: 384, storage: { diff --git a/tests/integration/readAfterWrite.test.ts b/tests/integration/readAfterWrite.test.ts index 4afd9522..cc67308f 100644 --- a/tests/integration/readAfterWrite.test.ts +++ b/tests/integration/readAfterWrite.test.ts @@ -33,7 +33,7 @@ describe('Read-After-Write Consistency (v5.7.2 Bug Fix)', () => { // Create unique test directory for each test testDir = join(tmpdir(), `brainy-consistency-${Date.now()}-${Math.random().toString(36).substring(7)}`) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', config: { diff --git a/tests/integration/relationship-intelligence.test.ts b/tests/integration/relationship-intelligence.test.ts index b393411b..eea55be8 100644 --- a/tests/integration/relationship-intelligence.test.ts +++ b/tests/integration/relationship-intelligence.test.ts @@ -50,7 +50,7 @@ describe('Relationship Intelligence', () => { XLSX.writeFile(wb, testExcelPath) // Initialize Brainy - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/integration/remaining-apis.test.ts b/tests/integration/remaining-apis.test.ts index 97637b3a..35e27c88 100644 --- a/tests/integration/remaining-apis.test.ts +++ b/tests/integration/remaining-apis.test.ts @@ -25,7 +25,7 @@ describe('Remaining APIs Comprehensive Test', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/integration/rev-and-ifabsent.test.ts b/tests/integration/rev-and-ifabsent.test.ts index 9da98342..64b184a3 100644 --- a/tests/integration/rev-and-ifabsent.test.ts +++ b/tests/integration/rev-and-ifabsent.test.ts @@ -18,7 +18,7 @@ describe('7.31.0 — _rev CAS + ifAbsent', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' as const } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' as const } }) await brain.init() }) diff --git a/tests/integration/s3-storage.test.ts b/tests/integration/s3-storage.test.ts index 02412915..8f5bbf56 100644 --- a/tests/integration/s3-storage.test.ts +++ b/tests/integration/s3-storage.test.ts @@ -26,7 +26,7 @@ describe('S3 Storage Integration', () => { let brain: Brainy; beforeAll(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 's3', options: { @@ -162,7 +162,7 @@ describe('S3 Storage Integration', () => { let prefixedBrain: Brainy; beforeAll(async () => { - prefixedBrain = new Brainy({ + prefixedBrain = new Brainy({ requireSubtype: false, storage: { type: 's3', options: { @@ -200,7 +200,7 @@ describe('S3 Storage Integration', () => { describe('S3 Error Handling', () => { it('should handle invalid S3 credentials gracefully', async () => { - const invalidBrain = new Brainy({ + const invalidBrain = new Brainy({ requireSubtype: false, storage: { type: 's3', options: { @@ -230,7 +230,7 @@ describe('S3 Storage Integration', () => { // Simulate network error by stopping MinIO temporarily await minioServer.stop(); - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 's3', options: s3Config @@ -258,7 +258,7 @@ describe('S3 Storage Integration', () => { let perfBrain: Brainy; beforeAll(async () => { - perfBrain = new Brainy({ + perfBrain = new Brainy({ requireSubtype: false, storage: { type: 's3', options: { diff --git a/tests/integration/smart-import.test.ts b/tests/integration/smart-import.test.ts index 66b07c45..025eb298 100644 --- a/tests/integration/smart-import.test.ts +++ b/tests/integration/smart-import.test.ts @@ -18,7 +18,7 @@ describe('Unified Import System', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' as const } }) await brain.init() diff --git a/tests/integration/storage-batch-operations.test.ts b/tests/integration/storage-batch-operations.test.ts index dddd30d8..31f36705 100644 --- a/tests/integration/storage-batch-operations.test.ts +++ b/tests/integration/storage-batch-operations.test.ts @@ -26,7 +26,7 @@ describe('Storage-Level Batch Operations v5.12.0', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, enableCOW: true }) @@ -552,7 +552,7 @@ describe('Cloud Adapter Batch Operations (Integration)', () => { it.skip('should use native GCS batch API', async () => { // Requires GOOGLE_APPLICATION_CREDENTIALS - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'gcs', bucketName: process.env.GCS_TEST_BUCKET || 'test-bucket', @@ -581,7 +581,7 @@ describe('Cloud Adapter Batch Operations (Integration)', () => { it.skip('should use native S3 batch API', async () => { // Requires AWS credentials - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 's3', bucketName: process.env.S3_TEST_BUCKET || 'test-bucket', @@ -610,7 +610,7 @@ describe('Cloud Adapter Batch Operations (Integration)', () => { it.skip('should use native Azure batch API', async () => { // Requires Azure credentials - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'azure', containerName: process.env.AZURE_CONTAINER || 'test-container', diff --git a/tests/integration/strict-mode-self-test.test.ts b/tests/integration/strict-mode-self-test.test.ts index 39dcaf00..b9c1ba0f 100644 --- a/tests/integration/strict-mode-self-test.test.ts +++ b/tests/integration/strict-mode-self-test.test.ts @@ -34,7 +34,7 @@ describe('Brainy strict-mode self-test (7.30.1)', () => { // Brain-wide strict mode ON + the exact SDK_CORE_VOCABULARY shape that // the consumer hit. If any internal Brainy path skips subtype, the writes here // will throw and fail the test. - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, requireSubtype: true @@ -213,7 +213,7 @@ describe('Brainy strict-mode self-test (7.30.1)', () => { it('flags entities written without subtype (using includeVFS: true to surface even VFS gaps)', async () => { // Switch to a non-strict brain so we can deliberately create a gap to test detection await brain.close() - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() // Deliberately add an entity without a subtype — only allowed because @@ -231,7 +231,7 @@ describe('Brainy strict-mode self-test (7.30.1)', () => { it('excludes VFS entities by default (they bypass enforcement anyway)', async () => { await brain.close() - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() // VFS root + VFS directories all have subtype set, but even if they @@ -253,7 +253,7 @@ describe('Brainy strict-mode self-test (7.30.1)', () => { describe('Error message UX', () => { it('error message includes caller location and migration link', async () => { await brain.close() - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() brain.requireSubtype(NounType.Person, { values: ['employee', 'customer'], @@ -277,7 +277,7 @@ describe('Brainy strict-mode self-test (7.30.1)', () => { it('off-vocabulary message shows the offending value + allowed vocab', async () => { await brain.close() - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() brain.requireSubtype(NounType.Person, { values: ['employee', 'customer'], @@ -300,7 +300,7 @@ describe('Brainy strict-mode self-test (7.30.1)', () => { it('brain-wide strict mode (no per-type vocab) shows the correct guidance', async () => { await brain.close() - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, requireSubtype: true diff --git a/tests/integration/subtype-and-facets.test.ts b/tests/integration/subtype-and-facets.test.ts index d17c681a..88953a0a 100644 --- a/tests/integration/subtype-and-facets.test.ts +++ b/tests/integration/subtype-and-facets.test.ts @@ -13,7 +13,7 @@ describe('Subtype + Facets (7.29.0)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() }) diff --git a/tests/integration/update-asymmetry.test.ts b/tests/integration/update-asymmetry.test.ts index 3b14233d..b00aea40 100644 --- a/tests/integration/update-asymmetry.test.ts +++ b/tests/integration/update-asymmetry.test.ts @@ -30,7 +30,7 @@ describe('Update Field Asymmetry Fix (v7.5.0)', () => { } // Create fresh Brainy instance - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testPath }, silent: true }) diff --git a/tests/integration/verb-subtype-and-enforcement.test.ts b/tests/integration/verb-subtype-and-enforcement.test.ts index 15b4c7cc..9ce5eb7d 100644 --- a/tests/integration/verb-subtype-and-enforcement.test.ts +++ b/tests/integration/verb-subtype-and-enforcement.test.ts @@ -12,7 +12,7 @@ * - Layer V4: `migrateField({ entityKind: 'verb' \| 'both' })` rewrites verb * fields. * - Layer V5: `brain.requireSubtype(type, opts)` per-type rules + brain-wide - * strict mode (`new Brainy({ requireSubtype: true })`) reject every write + * strict mode (`new Brainy({ requireSubtype: false, requireSubtype: true })`) reject every write * path missing or off-vocabulary. */ @@ -24,7 +24,7 @@ describe('Verb subtype + enforcement (7.30.0)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() }) @@ -447,9 +447,9 @@ describe('Verb subtype + enforcement (7.30.0)', () => { }) describe('brain-wide strict mode', () => { - it('new Brainy({ requireSubtype: true }) rejects every add() without subtype', async () => { + it('new Brainy({ requireSubtype: false, requireSubtype: true }) rejects every add() without subtype', async () => { await brain.close() - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, requireSubtype: true @@ -463,7 +463,7 @@ describe('Verb subtype + enforcement (7.30.0)', () => { it('strict mode accepts writes with subtype', async () => { await brain.close() - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, requireSubtype: true @@ -480,7 +480,7 @@ describe('Verb subtype + enforcement (7.30.0)', () => { it('strict mode rejects relate() without subtype', async () => { await brain.close() - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, requireSubtype: true @@ -497,7 +497,7 @@ describe('Verb subtype + enforcement (7.30.0)', () => { it('except clause allows listed types through without subtype', async () => { await brain.close() - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, requireSubtype: { except: [NounType.Thing] } diff --git a/tests/integration/versioning.test.ts b/tests/integration/versioning.test.ts index d656353b..980b3bb2 100644 --- a/tests/integration/versioning.test.ts +++ b/tests/integration/versioning.test.ts @@ -25,7 +25,7 @@ describe('Entity Versioning (v5.3.0)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) diff --git a/tests/integration/vfs-and-graph-entities.test.ts b/tests/integration/vfs-and-graph-entities.test.ts index 0850f764..02102abe 100644 --- a/tests/integration/vfs-and-graph-entities.test.ts +++ b/tests/integration/vfs-and-graph-entities.test.ts @@ -39,7 +39,7 @@ describe('VFS + Graph Entities Integration Test', () => { XLSX.writeFile(wb, testExcelPath) // Initialize Brainy - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/integration/vfs-api-wiring.test.ts b/tests/integration/vfs-api-wiring.test.ts index 9911b320..23382aae 100644 --- a/tests/integration/vfs-api-wiring.test.ts +++ b/tests/integration/vfs-api-wiring.test.ts @@ -21,7 +21,7 @@ describe('VFS API Wiring Verification', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/integration/vfs-debug.test.ts b/tests/integration/vfs-debug.test.ts index 1981f1e7..7e781139 100644 --- a/tests/integration/vfs-debug.test.ts +++ b/tests/integration/vfs-debug.test.ts @@ -8,7 +8,7 @@ import * as XLSX from 'xlsx' describe('VFS Debug', () => { it('minimal VFS writeFile test', async () => { - const brain = new Brainy({ storage: { type: 'memory' } }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() console.log('✅ Brain initialized') diff --git a/tests/integration/vfs-historical-reads.test.ts b/tests/integration/vfs-historical-reads.test.ts index 559edff7..fdf285e6 100644 --- a/tests/integration/vfs-historical-reads.test.ts +++ b/tests/integration/vfs-historical-reads.test.ts @@ -27,7 +27,7 @@ describe('VFS Historical Reads (v5.3.7)', () => { fs.mkdirSync(testDir, { recursive: true }) // Initialize Brainy with filesystem storage (required for COW) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { adapter: 'filesystem', path: testDir diff --git a/tests/integration/vfs-import-verification.test.ts b/tests/integration/vfs-import-verification.test.ts index 178e28c9..94f13c02 100644 --- a/tests/integration/vfs-import-verification.test.ts +++ b/tests/integration/vfs-import-verification.test.ts @@ -19,7 +19,7 @@ describe('VFS Import Verification (VFS import bug investigation)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' as const } }) await brain.init() diff --git a/tests/integration/vfs-knowledge-separation.test.ts b/tests/integration/vfs-knowledge-separation.test.ts index 16882990..8faced75 100644 --- a/tests/integration/vfs-knowledge-separation.test.ts +++ b/tests/integration/vfs-knowledge-separation.test.ts @@ -25,7 +25,7 @@ describe('VFS-Knowledge Separation (Option 3C)', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/integration/vfs-performance-v5.11.1.test.ts b/tests/integration/vfs-performance-v5.11.1.test.ts index 3e5b2215..f2723e17 100644 --- a/tests/integration/vfs-performance-v5.11.1.test.ts +++ b/tests/integration/vfs-performance-v5.11.1.test.ts @@ -27,7 +27,7 @@ describe('VFS Performance (v5.11.1 Optimization)', () => { testDir = mkdtempSync(join(tmpdir(), 'brainy-vfs-perf-test-')) // Initialize Brain with FileSystemStorage - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/integration/vfs-versioning.test.ts b/tests/integration/vfs-versioning.test.ts index 20ef62f7..4ade037d 100644 --- a/tests/integration/vfs-versioning.test.ts +++ b/tests/integration/vfs-versioning.test.ts @@ -26,7 +26,7 @@ describe('VFS File Versioning (v6.3.2 Fix)', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/manual/metadata-index-debug.test.ts b/tests/manual/metadata-index-debug.test.ts index 765c3a50..532e3e83 100644 --- a/tests/manual/metadata-index-debug.test.ts +++ b/tests/manual/metadata-index-debug.test.ts @@ -18,7 +18,7 @@ describe('Metadata Index Debug', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/manual/simple-vfs-filter-test.test.ts b/tests/manual/simple-vfs-filter-test.test.ts index 4b8065f7..507384d3 100644 --- a/tests/manual/simple-vfs-filter-test.test.ts +++ b/tests/manual/simple-vfs-filter-test.test.ts @@ -18,7 +18,7 @@ describe('Simple VFS Filter Test', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/manual/type-filtering-diagnostic.ts b/tests/manual/type-filtering-diagnostic.ts index c418ab13..81b72094 100644 --- a/tests/manual/type-filtering-diagnostic.ts +++ b/tests/manual/type-filtering-diagnostic.ts @@ -12,7 +12,7 @@ async function testTypeFiltering() { console.log('=' .repeat(60)) // Create in-memory instance for testing - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() diff --git a/tests/manual/vfs-isvfs-diagnostic.test.ts b/tests/manual/vfs-isvfs-diagnostic.test.ts index 41d6002f..939d8908 100644 --- a/tests/manual/vfs-isvfs-diagnostic.test.ts +++ b/tests/manual/vfs-isvfs-diagnostic.test.ts @@ -18,7 +18,7 @@ describe('isVFS Flag Diagnostic', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/manual/vfs-multiple-init-diagnostic.test.ts b/tests/manual/vfs-multiple-init-diagnostic.test.ts index ea491cb0..3b8d9945 100644 --- a/tests/manual/vfs-multiple-init-diagnostic.test.ts +++ b/tests/manual/vfs-multiple-init-diagnostic.test.ts @@ -27,7 +27,7 @@ describe('VFS Multiple Init Diagnostic', () => { fs.mkdirSync(testDir, { recursive: true }) // Create brain with filesystem storage - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir @@ -108,7 +108,7 @@ describe('VFS Multiple Init Diagnostic', () => { it('should handle NEW brain instances gracefully (per-user scenario)', async () => { // Simulate creating separate brain instances per user // This is closer to a consumer's getUserBrainy() pattern - const brain2 = new Brainy({ + const brain2 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir // Same storage! @@ -147,7 +147,7 @@ describe('VFS Multiple Init Diagnostic', () => { await vfs.writeFile('/test-dir/test.txt', 'Hello') // Call init again (simulating new request) - const brain3 = new Brainy({ + const brain3 = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/manual/vfs-search-debug.test.ts b/tests/manual/vfs-search-debug.test.ts index e4423ad3..f4ca9147 100644 --- a/tests/manual/vfs-search-debug.test.ts +++ b/tests/manual/vfs-search-debug.test.ts @@ -17,7 +17,7 @@ describe('VFS Search Debug', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/manual/vfs-where-clause-test.test.ts b/tests/manual/vfs-where-clause-test.test.ts index 83ede49c..0334680f 100644 --- a/tests/manual/vfs-where-clause-test.test.ts +++ b/tests/manual/vfs-where-clause-test.test.ts @@ -21,7 +21,7 @@ describe('VFS Where Clause Diagnostic', () => { } fs.mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/performance/graph-scale-performance.test.ts b/tests/performance/graph-scale-performance.test.ts index e887895f..91143fd3 100644 --- a/tests/performance/graph-scale-performance.test.ts +++ b/tests/performance/graph-scale-performance.test.ts @@ -136,7 +136,7 @@ describe('🧠 Graph Scale Performance Benchmarks', () => { }) // Initialize Brainy for unified testing - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, enableGraphIndex: true, enableMetadataIndex: true diff --git a/tests/performance/triple-intelligence-scale.test.ts b/tests/performance/triple-intelligence-scale.test.ts index f8a4b04c..6687decd 100644 --- a/tests/performance/triple-intelligence-scale.test.ts +++ b/tests/performance/triple-intelligence-scale.test.ts @@ -19,7 +19,7 @@ describe('Triple Intelligence Performance at Scale', () => { const startTime = Date.now() // Initialize Brainy with all required indexes - brain = new Brainy() + brain = new Brainy({ requireSubtype: false }) await brain.init({ enableMetadataIndex: true, enableGraphIndex: true, @@ -357,7 +357,7 @@ describe('Triple Intelligence Correctness', () => { let triple: TripleIntelligenceSystem beforeAll(async () => { - brain = new Brainy() + brain = new Brainy({ requireSubtype: false }) await brain.init({ enableMetadataIndex: true, enableGraphIndex: true diff --git a/tests/performance/typeAware.bench.test.ts b/tests/performance/typeAware.bench.test.ts index e54145cb..8b92d951 100644 --- a/tests/performance/typeAware.bench.test.ts +++ b/tests/performance/typeAware.bench.test.ts @@ -52,7 +52,7 @@ describe('TypeAware Performance Benchmarks', () => { let entities: string[] = [] beforeEach(async () => { - brainMemory = new Brainy({ storage: { type: 'memory' } }) + brainMemory = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brainMemory.init() // Create 1000 entities across 5 types diff --git a/tests/regression/metadata-index-cleanup.test.ts b/tests/regression/metadata-index-cleanup.test.ts index bfc3bfbc..17e96087 100644 --- a/tests/regression/metadata-index-cleanup.test.ts +++ b/tests/regression/metadata-index-cleanup.test.ts @@ -43,7 +43,7 @@ describe('Metadata index cleanup after delete / deleteMany', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() }) diff --git a/tests/regression/v5.7.0-deadlock.test.ts b/tests/regression/v5.7.0-deadlock.test.ts index ab4ff46d..c20b8390 100644 --- a/tests/regression/v5.7.0-deadlock.test.ts +++ b/tests/regression/v5.7.0-deadlock.test.ts @@ -31,7 +31,7 @@ describe('v5.7.0 Deadlock Regression', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() }) diff --git a/tests/streaming-pipeline.test.ts b/tests/streaming-pipeline.test.ts index a719682d..24e51521 100644 --- a/tests/streaming-pipeline.test.ts +++ b/tests/streaming-pipeline.test.ts @@ -12,7 +12,7 @@ describe('Streaming Pipeline', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, warmup: false }) diff --git a/tests/transaction/integration/cow-transactions.test.ts b/tests/transaction/integration/cow-transactions.test.ts index d203495b..49309a60 100644 --- a/tests/transaction/integration/cow-transactions.test.ts +++ b/tests/transaction/integration/cow-transactions.test.ts @@ -25,7 +25,7 @@ describe('Transactions + COW Integration', () => { mkdirSync(testDir, { recursive: true }) // Initialize Brainy with COW enabled - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/transaction/integration/distributed-transactions.test.ts b/tests/transaction/integration/distributed-transactions.test.ts index 536a5a53..36b12351 100644 --- a/tests/transaction/integration/distributed-transactions.test.ts +++ b/tests/transaction/integration/distributed-transactions.test.ts @@ -25,7 +25,7 @@ describe('Transactions + Distributed Storage Integration', () => { // Use filesystem as proxy for distributed storage // (In production, this would be S3, Azure, GCS, etc.) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/transaction/integration/sharding-transactions.test.ts b/tests/transaction/integration/sharding-transactions.test.ts index cb884a3c..0d7d8fc6 100644 --- a/tests/transaction/integration/sharding-transactions.test.ts +++ b/tests/transaction/integration/sharding-transactions.test.ts @@ -23,7 +23,7 @@ describe('Transactions + Sharding Integration', () => { testDir = join(tmpdir(), `brainy-shard-test-${Date.now()}`) mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/transaction/integration/typeaware-transactions.test.ts b/tests/transaction/integration/typeaware-transactions.test.ts index 9a4c8ccf..5c8198f1 100644 --- a/tests/transaction/integration/typeaware-transactions.test.ts +++ b/tests/transaction/integration/typeaware-transactions.test.ts @@ -23,7 +23,7 @@ describe('Transactions + TypeAware Storage Integration', () => { testDir = join(tmpdir(), `brainy-typeaware-test-${Date.now()}`) mkdirSync(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/unit/brainy-core.unit.test.ts b/tests/unit/brainy-core.unit.test.ts index f465d7c9..f94779b1 100644 --- a/tests/unit/brainy-core.unit.test.ts +++ b/tests/unit/brainy-core.unit.test.ts @@ -14,7 +14,7 @@ describe('Brainy 3.0 Core (Unit Tests)', () => { beforeEach(async () => { // Create instance with real embeddings for production-ready tests - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) diff --git a/tests/unit/brainy-get-optimization.test.ts b/tests/unit/brainy-get-optimization.test.ts index de7bcc92..91ee221d 100644 --- a/tests/unit/brainy-get-optimization.test.ts +++ b/tests/unit/brainy-get-optimization.test.ts @@ -22,7 +22,7 @@ describe('brain.get() Metadata-Only Optimization (v5.11.1)', () => { let entityId: string beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: new MemoryStorage(), silent: true }) diff --git a/tests/unit/brainy/batch-operations.test.ts b/tests/unit/brainy/batch-operations.test.ts index d74e1b8c..6c8eac24 100644 --- a/tests/unit/brainy/batch-operations.test.ts +++ b/tests/unit/brainy/batch-operations.test.ts @@ -6,7 +6,7 @@ describe('Brainy Batch Operations', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() }) diff --git a/tests/unit/brainy/find.test.ts b/tests/unit/brainy/find.test.ts index 6282e1be..c9b36e64 100644 --- a/tests/unit/brainy/find.test.ts +++ b/tests/unit/brainy/find.test.ts @@ -7,7 +7,7 @@ describe('Brainy.find()', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } // Use memory storage for isolation }) await brain.init() diff --git a/tests/unit/brainy/hybrid-search.test.ts b/tests/unit/brainy/hybrid-search.test.ts index ff4ea6b7..a8041a26 100644 --- a/tests/unit/brainy/hybrid-search.test.ts +++ b/tests/unit/brainy/hybrid-search.test.ts @@ -14,7 +14,7 @@ describe('Hybrid Search (v7.7.0)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() diff --git a/tests/unit/brainy/relate-duplicate-optimization.test.ts b/tests/unit/brainy/relate-duplicate-optimization.test.ts index d10e3732..67070e47 100644 --- a/tests/unit/brainy/relate-duplicate-optimization.test.ts +++ b/tests/unit/brainy/relate-duplicate-optimization.test.ts @@ -13,7 +13,7 @@ describe('Duplicate Check Optimization', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy() + brain = new Brainy({ requireSubtype: false }) await brain.init() }) diff --git a/tests/unit/create-entities-default.test.ts b/tests/unit/create-entities-default.test.ts index 7cb8a226..a2863637 100644 --- a/tests/unit/create-entities-default.test.ts +++ b/tests/unit/create-entities-default.test.ts @@ -20,7 +20,7 @@ describe('createEntities Default Value (v4.3.2 Bug Fix)', () => { fs.rmSync(testDir, { recursive: true }) } - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', path: testDir diff --git a/tests/unit/graph/graphIndex-pagination.test.ts b/tests/unit/graph/graphIndex-pagination.test.ts index c706d91c..633ae616 100644 --- a/tests/unit/graph/graphIndex-pagination.test.ts +++ b/tests/unit/graph/graphIndex-pagination.test.ts @@ -19,7 +19,7 @@ describe('GraphAdjacencyIndex Pagination', () => { let neighborIds: string[] beforeEach(async () => { - brain = new Brainy() + brain = new Brainy({ requireSubtype: false }) await brain.init() // Create central entity diff --git a/tests/unit/import/InstancePool.test.ts b/tests/unit/import/InstancePool.test.ts index 5e32dc77..740be5d7 100644 --- a/tests/unit/import/InstancePool.test.ts +++ b/tests/unit/import/InstancePool.test.ts @@ -7,7 +7,7 @@ describe('InstancePool', () => { let pool: InstancePool beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() pool = new InstancePool(brain) }) diff --git a/tests/unit/import/preserve-source-fix.test.ts b/tests/unit/import/preserve-source-fix.test.ts index 478470e7..3d5dd187 100644 --- a/tests/unit/import/preserve-source-fix.test.ts +++ b/tests/unit/import/preserve-source-fix.test.ts @@ -19,7 +19,7 @@ describe('Import preserveSource Fix (v5.1.2)', () => { let testFilePath: string beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) diff --git a/tests/unit/neural/NaturalLanguageProcessor.test.ts b/tests/unit/neural/NaturalLanguageProcessor.test.ts index 00f02012..0800601e 100644 --- a/tests/unit/neural/NaturalLanguageProcessor.test.ts +++ b/tests/unit/neural/NaturalLanguageProcessor.test.ts @@ -13,7 +13,7 @@ describe('NaturalLanguageProcessor', () => { let nlp: NaturalLanguageProcessor beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() nlp = new NaturalLanguageProcessor(brain) diff --git a/tests/unit/neural/domain-time-clustering.test.ts b/tests/unit/neural/domain-time-clustering.test.ts index 69537a77..b5b6cbb5 100644 --- a/tests/unit/neural/domain-time-clustering.test.ts +++ b/tests/unit/neural/domain-time-clustering.test.ts @@ -14,7 +14,7 @@ describe('Domain and Time Clustering', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, enableCache: false, storage: { type: 'memory' } // Use memory storage for tests }) diff --git a/tests/unit/neural/neural-simplified.test.ts b/tests/unit/neural/neural-simplified.test.ts index 27711d06..16ba801c 100644 --- a/tests/unit/neural/neural-simplified.test.ts +++ b/tests/unit/neural/neural-simplified.test.ts @@ -13,7 +13,7 @@ describe('Neural API - Production Testing', () => { // v5.1.0: Use memory storage and disable augmentations for faster, reliable tests beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) diff --git a/tests/unit/neural/signals/EmbeddingSignal.test.ts b/tests/unit/neural/signals/EmbeddingSignal.test.ts index f9f47ce8..f1ff5beb 100644 --- a/tests/unit/neural/signals/EmbeddingSignal.test.ts +++ b/tests/unit/neural/signals/EmbeddingSignal.test.ts @@ -8,7 +8,7 @@ describe('EmbeddingSignal', () => { let signal: EmbeddingSignal beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' } }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() signal = new EmbeddingSignal(brain) }) diff --git a/tests/unit/performance/add-performance.test.ts b/tests/unit/performance/add-performance.test.ts index ea642929..08fe8196 100644 --- a/tests/unit/performance/add-performance.test.ts +++ b/tests/unit/performance/add-performance.test.ts @@ -16,7 +16,7 @@ describe('add() Performance Regression Tests', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) diff --git a/tests/unit/plugin.test.ts b/tests/unit/plugin.test.ts index c94e17af..dbb611fa 100644 --- a/tests/unit/plugin.test.ts +++ b/tests/unit/plugin.test.ts @@ -211,7 +211,7 @@ describe('Brainy plugin integration', () => { } } - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, }) @@ -240,7 +240,7 @@ describe('Brainy plugin integration', () => { } } - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, }) @@ -258,7 +258,7 @@ describe('Brainy plugin integration', () => { activate: async () => false } - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, }) @@ -287,7 +287,7 @@ describe('Brainy plugin integration', () => { } } - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true, }) @@ -313,7 +313,7 @@ describe('Brainy plugin integration', () => { activate: async () => true } - const brain = new Brainy({ storage: { type: 'memory' } }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) const result = brain.use(plugin) expect(result).toBe(brain) }) diff --git a/tests/unit/storage/vfs-mkdir-bug.test.ts b/tests/unit/storage/vfs-mkdir-bug.test.ts index 7789c7db..f2439930 100644 --- a/tests/unit/storage/vfs-mkdir-bug.test.ts +++ b/tests/unit/storage/vfs-mkdir-bug.test.ts @@ -21,7 +21,7 @@ describe('VFS mkdir() Bug Fix (v6.2.9)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() diff --git a/tests/unit/type-filtering.unit.test.ts b/tests/unit/type-filtering.unit.test.ts index f3ec5be8..9e4700b2 100644 --- a/tests/unit/type-filtering.unit.test.ts +++ b/tests/unit/type-filtering.unit.test.ts @@ -11,7 +11,7 @@ describe('Type Filtering (A Consumer Team Issue)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() diff --git a/tests/unit/utils/entity-id-mapper-stability.test.ts b/tests/unit/utils/entity-id-mapper-stability.test.ts index f872f46b..f61b833e 100644 --- a/tests/unit/utils/entity-id-mapper-stability.test.ts +++ b/tests/unit/utils/entity-id-mapper-stability.test.ts @@ -32,7 +32,7 @@ describe('EntityIdMapper stability (foundation for 2.4.0)', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() }) diff --git a/tests/unit/utils/memoryLimits.test.ts b/tests/unit/utils/memoryLimits.test.ts index aca6d91c..d3be70a2 100644 --- a/tests/unit/utils/memoryLimits.test.ts +++ b/tests/unit/utils/memoryLimits.test.ts @@ -196,7 +196,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { describe('Brain Integration', () => { it('should configure memory limits via Brain constructor', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, maxQueryLimit: 15000, silent: true @@ -214,7 +214,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { }) it('should configure reserved memory via Brain constructor', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, reservedQueryMemory: 500 * 1024 * 1024, // 500 MB silent: true @@ -236,7 +236,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { it('should auto-detect container limits when no config provided', async () => { process.env.CLOUD_RUN_MEMORY = '2Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -260,7 +260,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { it('should return complete memory statistics', async () => { process.env.CLOUD_RUN_MEMORY = '4Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, maxQueryLimit: 20000, silent: true @@ -301,7 +301,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { process.env.CLOUD_RUN_MEMORY = '4Gi' // Don't set overrides, let it use containerMemory - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -317,7 +317,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { }) it('should handle browser environment gracefully', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -338,7 +338,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { it('should handle 4GB Cloud Run container optimally', async () => { process.env.CLOUD_RUN_MEMORY = '4Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -360,7 +360,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { it('should allow manual override for power users', async () => { process.env.CLOUD_RUN_MEMORY = '4Gi' - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, maxQueryLimit: 50000, // Power user wants higher limit silent: true @@ -383,7 +383,7 @@ describe('Memory Limits - Container Detection & Smart Calculation', () => { it('should handle bare metal deployment (no container)', async () => { // No container env vars - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) diff --git a/tests/unit/utils/resultRanking.test.ts b/tests/unit/utils/resultRanking.test.ts index a2b8988b..34fc071b 100644 --- a/tests/unit/utils/resultRanking.test.ts +++ b/tests/unit/utils/resultRanking.test.ts @@ -169,7 +169,7 @@ describe('resultRanking — Brainy.find() integration', () => { it('routes find() relevance ranking through a registered sort:topK provider', async () => { const calls: Array<{ k: number; descending: boolean; n: number }> = [] - const brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) brain.use(makeSortTopKPlugin(calls)) await brain.init() await seed(brain) @@ -195,7 +195,7 @@ describe('resultRanking — Brainy.find() integration', () => { // order, and scores must match exactly. (Two separate brains would differ due to // independent approximate-NN candidate selection, not the ranking hook.) const calls: Array<{ k: number; descending: boolean; n: number }> = [] - const brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) brain.use(makeSortTopKPlugin(calls)) await brain.init() await seed(brain) @@ -219,7 +219,7 @@ describe('resultRanking — Brainy.find() integration', () => { // rather than relying on cross-query ANN stability. Also assert the provider is asked // for the full page (offset + limit), which is what makes pagination correct. const calls: Array<{ k: number; descending: boolean; n: number }> = [] - const brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) brain.use(makeSortTopKPlugin(calls)) await brain.init() await seed(brain) diff --git a/tests/unit/vfs-multi-instance-diagnostic.test.ts b/tests/unit/vfs-multi-instance-diagnostic.test.ts index 69ba334a..deaa4615 100644 --- a/tests/unit/vfs-multi-instance-diagnostic.test.ts +++ b/tests/unit/vfs-multi-instance-diagnostic.test.ts @@ -11,7 +11,7 @@ describe('VFS Multi-instance Diagnostic', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' } }) await brain.init() diff --git a/tests/unit/vfs-restart-fix.test.ts b/tests/unit/vfs-restart-fix.test.ts index 67cb48b8..e720abcb 100644 --- a/tests/unit/vfs-restart-fix.test.ts +++ b/tests/unit/vfs-restart-fix.test.ts @@ -20,7 +20,7 @@ describe('VFS restart persistence', () => { try { // === SESSION 1: Write data === - let brain = new Brainy({ + let brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, disableAutoRebuild: true, plugins: [], @@ -47,7 +47,7 @@ describe('VFS restart persistence', () => { await brain.close() // === SESSION 2: Read data after restart === - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, disableAutoRebuild: true, plugins: [], @@ -86,7 +86,7 @@ describe('VFS restart persistence', () => { try { // === SESSION 1: Write multiple files === - let brain = new Brainy({ + let brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, disableAutoRebuild: true, plugins: [], @@ -111,7 +111,7 @@ describe('VFS restart persistence', () => { await brain.close() // === SESSION 2: Verify all data persisted === - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', rootDirectory: dir }, disableAutoRebuild: true, plugins: [], diff --git a/tests/unit/vfs/blob-storage-integration.test.ts b/tests/unit/vfs/blob-storage-integration.test.ts index 10802d92..f388dc77 100644 --- a/tests/unit/vfs/blob-storage-integration.test.ts +++ b/tests/unit/vfs/blob-storage-integration.test.ts @@ -26,7 +26,7 @@ describe('VFS Unified BlobStorage (v5.2.0)', () => { testDir = path.join('/tmp', `brainy-test-blob-${Date.now()}-${Math.random().toString(36).slice(2)}`) await fs.mkdir(testDir, { recursive: true }) - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'filesystem', options: { path: testDir } diff --git a/tests/vfs/tree-operations.test.ts b/tests/vfs/tree-operations.test.ts index cd4d987f..8c717115 100644 --- a/tests/vfs/tree-operations.test.ts +++ b/tests/vfs/tree-operations.test.ts @@ -13,7 +13,7 @@ describe('VFS Tree Operations', () => { let vfs: VirtualFileSystem beforeEach(async () => { - brain = new Brainy() + brain = new Brainy({ requireSubtype: false }) await brain.init({ storage: { type: 'memory' // Use in-memory storage for tests diff --git a/tests/vfs/vfs-bug-fixes.unit.test.ts b/tests/vfs/vfs-bug-fixes.unit.test.ts index ae868abc..f98d6a76 100644 --- a/tests/vfs/vfs-bug-fixes.unit.test.ts +++ b/tests/vfs/vfs-bug-fixes.unit.test.ts @@ -16,7 +16,7 @@ describe('VFS Bug Fixes', () => { beforeEach(async () => { // Create fresh instance for each test - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, embeddingModel: 'Q8' }) diff --git a/tests/vfs/vfs-bulkwrite-race.test.ts b/tests/vfs/vfs-bulkwrite-race.test.ts index 41a5aa8f..238ac6b9 100644 --- a/tests/vfs/vfs-bulkwrite-race.test.ts +++ b/tests/vfs/vfs-bulkwrite-race.test.ts @@ -21,7 +21,7 @@ describe('VFS bulkWrite Race Condition Fix', () => { let vfs: VirtualFileSystem beforeEach(async () => { - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, embeddingModel: 'Q8' }) diff --git a/tests/vfs/vfs-initialization.unit.test.ts b/tests/vfs/vfs-initialization.unit.test.ts index f1919b17..944e2200 100644 --- a/tests/vfs/vfs-initialization.unit.test.ts +++ b/tests/vfs/vfs-initialization.unit.test.ts @@ -12,7 +12,7 @@ describe('VFS Initialization', () => { describe('Auto-Initialization (v5.1.0+)', () => { it('should auto-initialize VFS during brain.init()', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -29,7 +29,7 @@ describe('VFS Initialization', () => { }) it('should automatically create root directory on brain.init()', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) @@ -52,7 +52,7 @@ describe('VFS Initialization', () => { }) it('should handle nested directories after brain.init()', async () => { - const brain = new Brainy({ + const brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) diff --git a/tests/vfs/vfs-relationships.test.ts b/tests/vfs/vfs-relationships.test.ts index 350c006f..02007e43 100644 --- a/tests/vfs/vfs-relationships.test.ts +++ b/tests/vfs/vfs-relationships.test.ts @@ -15,7 +15,7 @@ describe('VFS Graph Relationships', () => { let brain: Brainy beforeEach(async () => { - brain = new Brainy() + brain = new Brainy({ requireSubtype: false }) await brain.init() vfs = new VirtualFileSystem(brain) await vfs.init() diff --git a/tests/vfs/vfs.unit.test.ts b/tests/vfs/vfs.unit.test.ts index f17a67bd..c2f49c9f 100644 --- a/tests/vfs/vfs.unit.test.ts +++ b/tests/vfs/vfs.unit.test.ts @@ -16,7 +16,7 @@ describe('VirtualFileSystem - Production Tests', () => { beforeEach(async () => { // Create a fresh Brainy instance with in-memory storage for each test - brain = new Brainy({ + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true // Reduce test output }) @@ -492,7 +492,7 @@ describe('VirtualFileSystem - Watch System', () => { let brain: Brainy beforeAll(async () => { - brain = new Brainy({ storage: { type: 'memory' }, silent: true }) + brain = new Brainy({ requireSubtype: false, storage: { type: 'memory' }, silent: true }) await brain.init() vfs = new VirtualFileSystem(brain) await vfs.init()