brainy/tests/unit/storage
David Snelling 3f8e0971a2 fix: query-cap memory misread (MemAvailable + floor) + rootDirectory getter for native mmap fast-path
Two platform-wide production fixes for consumers on bare VMs / mmap-filesystem storage.

BUG A — auto maxQueryLimit collapsed to ~1000 on healthy VMs → 500s on legitimate
queries. getAvailableMemory() read os.freemem() (kernel MemFree, which excludes
reclaimable page cache and reads as tens of MB on a page-cache-heavy mmap box).
Now reads /proc/meminfo MemAvailable (the `free -h` figure), falling back to
os.freemem() only off-Linux; auto-detected caps (container/free branches) are floored
at 10k so a misread can't collapse them. Explicit maxQueryLimit/reservedQueryMemory
are honored as-is.

BUG B — native mmap vector fast-path never engaged (per-entity reads → 57s cold start
on a 283MB brain). FileSystemStorage now exposes a public `rootDirectory` getter; the
native vector provider feature-detects it to enable its memory-mapped graph path.
brainy stored it as the protected `rootDir`, so the gate silently failed. Self-heals
after the first post-upgrade flush writes the mmap file.

Regression tests: auto-cap floor (container/free/explicit-override) + the rootDirectory
getter. Build clean; full suite 1483 green.
2026-06-16 08:46:39 -07:00
..
cow feat: content-type-aware compression policy in COW BlobStorage (2.5.0 #32) 2026-05-28 11:55:10 -07:00
binaryBlob.test.ts feat(storage): add raw binary-blob primitive to every storage adapter 2026-05-27 11:50:04 -07:00
fileSystemStorage-rootDirectory.test.ts fix: query-cap memory misread (MemAvailable + floor) + rootDirectory getter for native mmap fast-path 2026-06-16 08:46:39 -07:00
vfs-mkdir-bug.test.ts fix(vfs): resolve two critical VFS bugs causing directory listing corruption 2025-12-04 11:22:30 -08:00