brainy/src
David Snelling 1694f68419 fix: graph adjacency cold-load consistency guard — no more silent [] on connected
A native graph provider can load its relationship COUNT (manifest) on a cold open
but fail to load the source→target adjacency itself (observed on mmap-filesystem:
the SSTable-segment load is swallowed). The result is find({ connected }),
neighbors(), and related() silently returning [] despite persisted edges — and
staying empty after warm-up. Because it is [] not an error, callers cannot tell
real data is missing.

Brainy now runs a one-time consistency check on the first graph read: if the index
reports relationships exist but a known persisted edge's source resolves to no
neighbors, force a rebuild from storage (which re-scans + repopulates the adjacency);
if even that cannot read the edge, throw the new GraphIndexNotReadyError instead of
serving [] as truth. O(1) probe (one verb + one neighbor lookup), cached per brain,
and a no-op once the adjacency is live — so it self-heals the cold-open case and is
loud when it genuinely can't.

Wired into neighbors() + getRelations() (the graph-read primitives behind
find({ connected })). The underlying cold-open load is a native-provider concern
(addressed upstream); this makes the failure self-healing + loud rather than silent.

Tests: tests/unit/brainy/graph-adjacency-cold-load.test.ts (live → no-op; broken →
rebuild; unfixable → throws; size 0 / no edges → no-op; transient failure → re-checks
without breaking the query). Full unit gate green (1531/1531).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 10:55:12 -07:00
..
aggregation fix: internal subtype consistency + brain.audit() diagnostic + improved enforcement errors 2026-06-08 11:31:47 -07:00
api refactor: rename BackupData → PortableGraph (the type is interchange, not a backup) 2026-06-19 12:30:06 -07:00
cli refactor: rename BackupData → PortableGraph (the type is interchange, not a backup) 2026-06-19 12:30:06 -07:00
config fix: remove dead model config code for true zero-config 2025-12-18 10:31:02 -08:00
critical feat: replace transformers.js with direct ONNX WASM for Bun compatibility 2025-12-17 17:42:37 -08:00
data feat: Phase 3 - Unified Semantic Type Inference (Nouns + Verbs) 2025-10-16 10:59:26 -07:00
distributed feat(v4.0.0): Complete metadata/vector separation architecture with Azure support 2025-10-17 12:29:27 -07:00
embeddings fix: suppress misleading 'Using Q8 WASM' log when Cortex native is active 2026-03-22 14:53:48 -07:00
errors fix: graph adjacency cold-load consistency guard — no more silent [] on connected 2026-06-24 10:55:12 -07:00
graph feat: export provider contracts for the plugin surface brainy consumes 2026-05-27 14:45:40 -07:00
hnsw fix: mmap-vector backend capacity NaN at the provider FFI boundary 2026-06-10 09:29:54 -07:00
import fix: internal subtype consistency + brain.audit() diagnostic + improved enforcement errors 2026-06-08 11:31:47 -07:00
importers fix: internal subtype consistency + brain.audit() diagnostic + improved enforcement errors 2026-06-08 11:31:47 -07:00
indexes/columnStore feat: column-store JS↔native interchange — raw-blob unify (2.4.0 #4) 2026-05-28 10:37:47 -07:00
integrations fix: internal subtype consistency + brain.audit() diagnostic + improved enforcement errors 2026-06-08 11:31:47 -07:00
interfaces fix: exclude __words__ keyword index from corruption detection and getStats() 2026-01-27 15:38:21 -08:00
mcp fix: internal subtype consistency + brain.audit() diagnostic + improved enforcement errors 2026-06-08 11:31:47 -07:00
migration feat: add migration system with error handling, validation, and enterprise hardening 2026-02-09 16:13:14 -08:00
neural fix: recalibrate find({ limit }) cap + two-tier enforcement + caller location 2026-06-08 12:49:43 -07:00
patterns 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00
scripts feat: add node: protocol to all Node.js built-in imports for bundler compatibility 2025-09-17 14:20:21 -07:00
storage fix: getNouns cursor pagination re-scanned the first page forever (permanent CPU loop) 2026-06-22 18:00:01 -07:00
streaming feat: Brainy 3.0 - Production-ready Triple Intelligence database 2025-09-11 16:23:32 -07:00
transaction fix: vfs.rename() issues a metadata-only update + rollback of fresh adds removes them 2026-06-11 14:59:40 -07:00
triple fix: flush all native providers on shutdown to prevent data loss 2026-02-01 16:23:49 -08:00
types feat: visibility tier (public/internal/system) on nouns + verbs 2026-06-19 16:40:35 -07:00
universal fix: prevent fs adapter from throwing on import in browser 2025-09-17 16:22:02 -07:00
utils feat: visibility tier (public/internal/system) on nouns + verbs 2026-06-19 16:40:35 -07:00
versioning fix: exclude __words__ keyword index from corruption detection and getStats() 2026-01-27 15:38:21 -08:00
vfs feat: visibility tier (public/internal/system) on nouns + verbs 2026-06-19 16:40:35 -07:00
brainy.ts fix: graph adjacency cold-load consistency guard — no more silent [] on connected 2026-06-24 10:55:12 -07:00
coreTypes.ts feat: visibility tier (public/internal/system) on nouns + verbs 2026-06-19 16:40:35 -07:00
index.ts refactor: rename BackupData → PortableGraph (the type is interchange, not a backup) 2026-06-19 12:30:06 -07:00
internals.ts feat(8.0): EntityIdMapper U32 ceiling + EntityIdSpaceExceeded error 2026-06-02 10:20:01 -07:00
pipeline.ts refactor: remove augmentation system and semantic type matching 2026-02-01 10:48:56 -08:00
plugin.ts feat(plugin): DiskAnnProvider contract + HNSWConfig.type/diskann knobs 2026-05-28 14:29:12 -07:00
setup.ts fix: exclude __words__ keyword index from corruption detection and getStats() 2026-01-27 15:38:21 -08:00
unified.ts chore: enforce consistent coding style and semicolon removal 2025-09-29 09:50:59 -07:00
worker.ts 🧠 Brainy 2.0.0 - Zero-Configuration AI Database with Triple Intelligence™ 2025-08-26 12:32:21 -07:00