brainy/tests/integration
David Snelling 4d0b64f455 fix(8.0): restore() reloads a native entity-id mapper before graphIndex.rebuild()
A logical snapshot restore could silently lose graph edges on a brain backed by
a native provider: the graph adjacency keys on the shared id-mapper's interned
ints (sourceInt/targetInt), which are derived + never persisted, and restore()
never reloaded the mapper — so a native graph rebuild resolved verb endpoints
against a stale/empty mapper and dropped edges.

restore() now calls entityIdMapper.rebuild() — a new OPTIONAL method on the
EntityIdMapperProvider contract — BEFORE rebuilding the indexes, so a native
mapper reloads its int<->uuid from the restored binary KV first and the graph
resolves endpoints correctly. The JS mapper deliberately has NO rebuild() and
needs none: MetadataIndex.rebuild() re-derives it from the restored entities via
append-only getOrAssign, consistently with the bitmaps it builds — forcing a
reload there would blank a still-referenced mapping and break find() after a
same-instance restore.

Contract: graphIndex.rebuild() resolves sourceId/targetId -> ints through the
shared mapper itself (brainy does not re-feed resolved endpoints); brainy's only
job is to ensure the mapper is reloaded first.

Test: relationships survive a snapshot round-trip (db-mvcc.test.ts). 84
generation/temporal/visibility tests green; tsc clean.
2026-06-23 12:02:17 -07:00
..
advanced-apis-regression.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
aggregation-delete.test.ts feat(8.0): id-normalization (#18) + aggregation min/max delete-safety + RC-safe release 2026-06-20 14:46:40 -07:00
aggregation.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
all-apis-comprehensive.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
api-parameter-validation.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
batchImportWithRelations.test.ts feat(8.0): reserved-field enforcement — reservedFieldPolicy defaults to throw 2026-06-20 15:37:21 -07:00
brainy-complete.integration.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
brainy-core.integration.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
brainy-phase1c-integration.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
bun-compile-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
clear-persistence.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
clear-vfs.test.ts docs(8.0): consistency-model concept + snapshots guide — Db API replaces branching docs 2026-06-11 08:37:26 -07:00
cortex-compat.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
count-synchronization.test.ts test(8.0): close brains in afterEach (count-sync, get-relations teardown) 2026-06-16 13:18:14 -07:00
db-mvcc.test.ts fix(8.0): restore() reloads a native entity-id mapper before graphIndex.rebuild() 2026-06-23 12:02:17 -07:00
db-temporal.test.ts feat(8.0): Model-B per-write generation-stamping + adaptive retention knob 2026-06-22 15:19:58 -07:00
entity-confidence-weight.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
find-limits.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
find-triple-composition.test.ts test(8.0): asOf() error-path spot-checks + find() triple-composition correctness + scale-bench harness 2026-06-15 11:55:26 -07:00
find-unified-integration.test.ts feat(8.0): id-normalization (#18) + aggregation min/max delete-safety + RC-safe release 2026-06-20 14:46:40 -07:00
find-where-zero.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
get-relations-fix.test.ts test(8.0): close brains in afterEach (count-sync, get-relations teardown) 2026-06-16 13:18:14 -07:00
graphIndex-pagination.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
hnsw-rebuild.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
hybrid-search-vfs.test.ts feat(8.0)!: delete fork/branch/commit/history/versions — superseded by the Db API 2026-06-10 15:22:47 -07:00
id-normalization.test.ts feat(8.0): id-normalization (#18) + aggregation min/max delete-safety + RC-safe release 2026-06-20 14:46:40 -07:00
memory-enhancements-v5.11.0.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
metadata-only-comprehensive.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
metadata-vector-exclusion.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
migration-7x-to-8x.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
migration.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
multi-process-safety.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
orderby-sort-bug.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
readAfterWrite.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
relationship-intelligence.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
remaining-apis.test.ts feat(8.0): reserved-field enforcement — reservedFieldPolicy defaults to throw 2026-06-20 15:37:21 -07:00
rev-and-ifabsent.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
savebinaryblob-concurrent-rename.test.ts fix: saveBinaryBlob unique tmp suffix + ENOENT swallow on rename 2026-06-09 10:36:02 -07:00
smart-import.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
storage-batch-operations.test.ts feat(8.0)!: delete fork/branch/commit/history/versions — superseded by the Db API 2026-06-10 15:22:47 -07:00
strict-mode-self-test.test.ts feat(8.0): brain.fillSubtypes migration helper + pre-RC1 gap closure 2026-06-11 10:53:55 -07:00
subtype-and-facets.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
update-asymmetry.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
vector-recall.test.ts test(8.0): A/B benchmark harness (open leg) — generic corpus+metrics lib, brainy-alone scaling bench, boundary guard, real-embedding recall guard 2026-06-15 15:51:17 -07:00
verb-subtype-and-enforcement.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
vfs-and-graph-entities.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
vfs-api-wiring.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
vfs-debug.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
vfs-import-verification.test.ts test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening) 2026-06-17 13:11:41 -07:00
vfs-knowledge-separation.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
vfs-performance-v5.11.1.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
wasm-embeddings.test.ts feat: migrate embeddings to Candle WASM + remove semantic type inference 2026-01-06 12:52:34 -08:00