brainy/tests/unit/brainy
David Snelling c2a84c9d1f feat(8.0): brain.graph.export() + noun-walk cursor + noun visibility hydration
brain.graph.export() streams the WHOLE graph in one O(N+E) pass — node chunks
then edge chunks, async-iterable — the right primitive for visualizing all data
(vs. paging per node). Native snapshot-consistent graphCursor when present, else
a TS cursor walk over nouns + verbs. Building it surfaced two latent noun bugs,
both fixed here (each a correctness win beyond export):

- getNounsWithPagination IGNORED its cursor ('offset-based, cursor planned') —
  the noun mirror of the verb bug fixed in the cursor-pagination commit. Latent
  because the only multi-page consumer (aggregate backfill) uses one big page; a
  small chunkSize needed page 2 and, trusting the returned-but-ignored nextCursor,
  re-fetched page 0 forever (infinite loop). Ported the proven verb cursor:
  opaque cn1:<shard>:<id> token, stable within-shard id order, resume-after,
  O(N) at any chunk size. (Generalized verbIdFromVectorPath → idFromVectorPath.)
- hydrateNounWithMetadata DROPPED 'visibility' (noun mirror of the Fix #1 verb
  hydration bug) — so getNouns-fed visibility filters saw nothing and leaked
  system (VFS root) / internal nodes. Now hydrated.

- New: GraphApi.export + GraphExportOptions (chunkSize, includeInternal/System,
  includeNodes/Edges). hydrateNativeSubgraph extracted + shared by subgraph+export.

Test: graph-export.test.ts — full-graph completeness incl. isolated nodes,
default-hides-internal, node/edge include toggles, chunkSize chunking (the
case that exposed the cursor hang). Full gate green.
2026-06-21 10:22:12 -07:00
..
add.test.ts fix: flush all native providers on shutdown to prevent data loss 2026-02-01 16:23:49 -08:00
batch-operations.test.ts feat(8.0): upsert + FindParams.includeVectors + removeMany adaptive chunking 2026-06-20 16:34:20 -07:00
counts-by-type-fix.test.ts fix: recalibrate find({ limit }) cap + two-tier enforcement + caller location 2026-06-08 12:49:43 -07:00
fill-subtypes.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
find-agg-edge-cases.test.ts fix(8.0): distinctCount aggregates distinct values of any type + edge-case regression tests 2026-06-17 12:03:06 -07:00
find-include-vectors.test.ts feat(8.0): upsert + FindParams.includeVectors + removeMany adaptive chunking 2026-06-20 16:34:20 -07:00
find.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
get.test.ts test(8.0): get() resolves null for absent custom ids instead of throwing 2026-06-16 10:47:10 -07:00
graph-export.test.ts feat(8.0): brain.graph.export() + noun-walk cursor + noun visibility hydration 2026-06-21 10:22:12 -07:00
graph-subgraph.test.ts feat(8.0): brain.graph.subgraph() + native-provider routing 2026-06-21 09:23:33 -07:00
hybrid-search.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
relate-duplicate-optimization.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
relate.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
related-node-bidirectional.test.ts feat(8.0): related({ node }) — one-call both-direction incident edges 2026-06-21 08:43:55 -07:00
related-visibility-fast-path.test.ts perf(8.0): visibility-aware fast adjacency — related() stays O(degree) under default visibility 2026-06-20 16:34:32 -07:00
reserved-field-policy.test.ts feat(8.0): reserved-field enforcement — reservedFieldPolicy defaults to throw 2026-06-20 15:37:21 -07:00
similar-threshold.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
update-reserved-metadata-remap.test.ts feat(8.0): reserved-field enforcement — reservedFieldPolicy defaults to throw 2026-06-20 15:37:21 -07:00
update.test.ts feat(8.0): full query surface at historical generations via ephemeral index materialization 2026-06-11 08:12:11 -07:00
upsert.test.ts feat(8.0): upsert + FindParams.includeVectors + removeMany adaptive chunking 2026-06-20 16:34:20 -07:00
visibility.test.ts feat(8.0): reserved-field enforcement — reservedFieldPolicy defaults to throw 2026-06-20 15:37:21 -07:00