brainy/tests/unit/brainy
David Snelling 5b2cbf74e5 fix: warm() metadata surface routes through the active provider (warm hook added to the metadata contract); add maintenanceDebt() observability surface
A production deployment's warm report showed metadata: 'unavailable' under a
native metadata provider. brain.warm()'s metadata leg only duck-typed the
built-in JS manager's hydrateAll() method, which a native provider has no
reason to implement.

- MetadataIndexProvider (src/plugin.ts) gains an optional warm?(): Promise<void>
  hook, mirroring the existing vector and graph provider hooks. brain.warm()
  now checks the active provider's own warm() FIRST, falls back to the JS
  manager's hydrateAll() when absent, and reports 'unavailable' only when
  neither exists -- never init() as a stand-in, since a native provider's
  init() may be a cheap verify rather than a real warm.
- Tests (tests/unit/brainy/warm.test.ts): a live provider instance shaped to
  have warm() reports 'warmed' and the hook called with no hydrateAll
  fallback; shaped to have neither hook reports 'unavailable' (pins the
  honest branch); the unmodified built-in JS manager still reports 'warmed'
  via hydrateAll(), unchanged.

Additive scope agreed mid-flight with the native-provider team: a
maintenance-debt observability seam so an operator sees a grind coming
instead of discovering it as a CPU storm.

- New optional maintenanceDebt?(): Promise<ProviderMaintenanceDebt> hook on
  all three provider contracts (vector, metadata, graph -- the same three
  warm?() lives on). ProviderMaintenanceDebt is fields-all-optional: a
  provider reports only what it truly measures (pendingBytes, pendingItems,
  lastPassCompletedAt, lastPassOutcome, converging), never an estimate
  dressed as fact.
- New public brain.maintenanceDebt(): a pure passthrough -- for each surface
  it calls only the active provider's own hook and reports the payload
  verbatim, or 'unavailable' when absent. No thresholds, no polling, no
  JS-side estimation; the provider owns the numbers, the operator owns the
  policy.
- ProviderMaintenanceDebt, MaintenanceDebtReport, and MaintenanceDebtOutcome
  are exported from the package root.
- Tests (tests/unit/brainy/maintenance-debt.test.ts): hook present reports
  'reported' with the exact payload passed through; hook absent reports
  'unavailable' on every surface; mixed surfaces resolve independently of
  each other.

RELEASES.md gains the 8.10.1 entry covering both fixes above and this
feature, including the no-hot-retry contract from the prior commit.
2026-07-24 16:02:01 -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 fix: one field-resolution law across aggregation hooks, source.where, removeMany, and find() spellings 2026-07-19 10:54:36 -07:00
brain-format-handshake.test.ts feat(8.0): version-handshake marker (formatInfo + indexEpoch) for whole-brain auto-upgrade 2026-06-30 09:53:10 -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
degraded-reads-surfaced.test.ts fix: surface a degraded derived index on reads instead of serving it silently 2026-07-13 09:49:38 -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-complement-operators.test.ts perf(8.0): negation/absence where-operators via roaring-bitmap difference 2026-06-29 11:19:18 -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-index-integrity-guard.test.ts fix(8.0): re-validate find() results against the predicate (index-integrity guard) 2026-06-24 16:25:12 -07:00
find-orderby-pagek.test.ts perf(8.0): bound find({ where, orderBy }) sort to the page (CTX-BR-FIND-ORDERBY) 2026-06-23 15:01:49 -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-analytics.test.ts feat(8.0): graph analytics — brain.graph.rank / communities / path 2026-06-23 12:32:03 -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-native-routing.test.ts fix(8.0): gate native graph analytics on the provider readiness flag 2026-06-24 15:18:50 -07:00
graph-subgraph.test.ts feat(8.0): brain.graph.subgraph(query) query→expand fusion (#61) 2026-06-23 13:30:30 -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
maintenance-debt.test.ts fix: warm() metadata surface routes through the active provider (warm hook added to the metadata contract); add maintenanceDebt() observability surface 2026-07-24 16:02:01 -07:00
metadata-provider-contract.test.ts feat(8.0): wire the two cor-confirmed metadata-provider contract additions 2026-06-29 12:11:00 -07:00
migration-deference.test.ts fix: cold-open no longer re-derives durable indexes — complete the readiness contract for all three providers 2026-07-07 10:39:00 -07:00
migration-gate-family-scoped.test.ts fix: full-removal canonical deletes + family-scoped migration gate 2026-07-14 10:11:53 -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
warm.test.ts fix: warm() metadata surface routes through the active provider (warm hook added to the metadata contract); add maintenanceDebt() observability surface 2026-07-24 16:02:01 -07:00