brainy/tests/unit/utils
David Snelling b26d3d42b3 fix(8.0): drive query-cap off MemAvailable + floor auto-detected caps
The auto-detected query-limit cap was computed from os.freemem() (MemFree),
which excludes reclaimable page cache. On hosts that memory-map large index
files the cache holding those pages dominates RAM, so MemFree collapses to a
sliver and the cap cratered to its floor on perfectly healthy machines,
rejecting legitimate find() calls.

- getAvailableMemory() now prefers /proc/meminfo MemAvailable (counts
  reclaimable cache), falling back to os.freemem() off-Linux, then a 2 GB
  constant where no OS module is available.
- Auto-detected caps (container + free-memory tiers) are floored at
  MIN_AUTO_QUERY_LIMIT (10_000); a transient low reading can never throttle
  queries to a near-useless ceiling. Consumer-supplied maxQueryLimit /
  reservedQueryMemory bypass the floor — an explicit caller knows their box.

Also scrubs two stale comments referencing the removed cloud storage
adapters and the retired mmap-vector backend: 8.0's native vector provider
persists its own .dkann file via getBinaryBlobPath, so the old rootDirectory
hook does not apply on this line.

Tests: memoryLimits 26/26 (4 new floor regressions), unit 1398/1398,
find-limits + db-mvcc + api-parameter-validation 37/37.
2026-06-16 09:01:45 -07:00
..
collation.test.ts fix: deterministic code-point string collation for column store + aggregation 2026-05-26 17:35:18 -07:00
contentExtractor.test.ts feat: expand ContentCategory to universal 6-category set for highlight() 2026-01-27 13:44:58 -08:00
entity-id-mapper-stability.test.ts chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
entity-id-mapper-u32-ceiling.test.ts feat(8.0): EntityIdMapper U32 ceiling + EntityIdSpaceExceeded error 2026-06-02 10:20:01 -07:00
memoryLimits.test.ts fix(8.0): drive query-cap off MemAvailable + floor auto-detected caps 2026-06-16 09:01:45 -07:00
metadataIndex-text-indexing.test.ts feat: add structured content extraction and batch embedding optimization to highlight() 2026-01-27 10:27:22 -08:00
metadataIndex-type-aware.test.ts chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
mutex.test.ts chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase 2026-06-11 14:51:00 -07:00
paramValidation.test.ts fix: recalibrate find({ limit }) cap + two-tier enforcement + caller location 2026-06-08 12:49:43 -07:00
resultRanking.test.ts feat(8.0)!: flip requireSubtype default to true (BRAINY-8.0-SUBTYPE-CONTRACT § C-1) 2026-06-09 14:58:25 -07:00
roaring-bitmap-integration.test.ts fix: migrate from roaring (native C++) to roaring-wasm for universal compatibility 2025-10-14 10:24:59 -07:00
unifiedCache-eviction.test.ts refactor(8.0): final cleanup — drop HnswProvider alias + config.hnsw + 'hnsw' surface (scaffold step 6) 2026-06-09 13:28:53 -07:00