diff --git a/src/storage/storageFactory.ts b/src/storage/storageFactory.ts index 64b18dc1..46c67f44 100644 --- a/src/storage/storageFactory.ts +++ b/src/storage/storageFactory.ts @@ -154,6 +154,21 @@ export function resolveFilesystemRoot( ) { throwRemovedStorageKey('fileSystemStorage.path') } + // A nested `config` object carrying a path-shaped key is the same hazard in + // a shape nobody ever supported: it used to fall through SILENTLY to the + // shared default root — every instance writing one directory while its + // caller believed each had its own. (Found live: an integration test's + // brains shared one store across a whole single-process run and a health + // probe refused on the foreign edges it sampled.) Loud, with the rename. + const nested = (config as Record).config + if (nested && typeof nested === 'object') { + const pathish = ['path', 'baseDir', 'rootDirectory', 'rootDir', 'dir', 'directory'] + const hit = pathish.find( + (k) => typeof (nested as Record)[k] === 'string' && + ((nested as Record)[k] as string).length > 0 + ) + if (hit) throwRemovedStorageKey(`config.${hit}`) + } // 3. Zero-config default. A `type: 'filesystem'` with no path lands here // intentionally ("persist, default location"). diff --git a/tests/integration/batchImportWithRelations.test.ts b/tests/integration/batchImportWithRelations.test.ts index 7fe8e511..4095b51c 100644 --- a/tests/integration/batchImportWithRelations.test.ts +++ b/tests/integration/batchImportWithRelations.test.ts @@ -15,13 +15,7 @@ describe('Batch Import with Immediate Relations (v5.7.3 Fix)', () => { // Initialize brain brain = new Brainy({ requireSubtype: false, - storage: { - type: 'filesystem', - config: { - baseDir: testDir, - enableCompression: false // Faster tests - } - }, + storage: { type: 'filesystem', path: testDir }, dimensions: 384 }) diff --git a/tests/integration/readAfterWrite.test.ts b/tests/integration/readAfterWrite.test.ts index e0ab5863..cf1dc9ec 100644 --- a/tests/integration/readAfterWrite.test.ts +++ b/tests/integration/readAfterWrite.test.ts @@ -34,13 +34,7 @@ describe('Read-After-Write Consistency (v5.7.2 Bug Fix)', () => { testDir = join(tmpdir(), `brainy-consistency-${Date.now()}-${Math.random().toString(36).substring(7)}`) brain = new Brainy({ requireSubtype: false, - storage: { - type: 'filesystem', - config: { - baseDir: testDir, - enableCompression: false // Faster tests - } - }, + storage: { type: 'filesystem', path: testDir }, dimensions: 384 })