brainy/src/storage
David Snelling a0fe8f00d2 fix: add atomic writes to ALL file operations to prevent concurrent write corruption
CRITICAL FIX v4.10.3: The v4.10.2 release only fixed VFS initialization but missed the
underlying file corruption bug. During concurrent bulk imports, files were being truncated
because writes were not atomic.

Changes:
1. saveNode() - Added atomic temp+rename pattern for HNSW JSON files (line 252)
2. writeObjectToPath() - Added atomic temp+rename for compressed/uncompressed metadata (line 654)
3. saveEdge() - Added atomic temp+rename for verb JSON files (line 461)

This prevents the Workshop team's reported errors:
- SyntaxError: Unexpected end of JSON input (HNSW files truncated)
- Error: unexpected end of file (compressed metadata truncated)

All file write operations now use atomic temp file + rename sequence:
1. Write to temp file with unique timestamp + random suffix
2. Atomic rename temp → final (OS-level atomicity guarantee)
3. Clean up temp file on error

This matches the atomic pattern already added to saveHNSWData() in v4.10.1,
but now applied consistently across ALL file write operations.
2025-10-29 19:31:00 -07:00
..
adapters fix: add atomic writes to ALL file operations to prevent concurrent write corruption 2025-10-29 19:31:00 -07:00
backwardCompatibility.ts fix(storage): clean directory architecture - FileSystemStorage uses entities/nouns/hnsw and entities/verbs/hnsw 2025-10-27 12:23:00 -07:00
baseStorage.ts fix: v4.8.1 critical bug fixes for update() and clustering 2025-10-27 17:01:37 -07:00
cacheManager.ts feat: add node: protocol to all Node.js built-in imports for bundler compatibility 2025-09-17 14:20:21 -07:00
enhancedCacheManager.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
enhancedClearOperations.ts feat: add node: protocol to all Node.js built-in imports for bundler compatibility 2025-09-17 14:20:21 -07:00
readOnlyOptimizations.ts feat: add distributed architecture with sharding and coordination 2025-09-22 15:45:35 -07:00
sharding.ts fix: implement unified UUID-based sharding for metadata across all storage adapters 2025-10-08 13:26:35 -07:00
storageFactory.ts feat: simplify GCS storage naming and add Cloud Run deployment options 2025-10-20 11:12:32 -07:00