brainy/tests/unit
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
..
aggregation fix: aggregation state adoption on reopen + single-flight backfill + query-cap ratchet removal 2026-07-17 09:20:09 -07:00
brainy 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
db feat: flush() never compacts — history maintenance moves to close() with bounded passes 2026-07-19 12:04:39 -07:00
graph fix: honest index readiness — no silently-empty queries on a cold index 2026-07-13 13:17:56 -07:00
hnsw fix: spine hardening pass 1 (part) — count symmetry, honest partial-load, flush durability, read-fault propagation 2026-07-13 08:50:07 -07:00
import refactor(8.0): remove dead, unreachable, and unwired modules 2026-06-24 15:18:40 -07:00
indexes/columnStore fix: surface segment/entity read faults loudly instead of masking as absent 2026-07-13 09:14:52 -07:00
neural refactor(8.0): remove dead, unreachable, and unwired modules 2026-06-24 15:18:40 -07:00
performance feat(8.0): zero-config finalize + cut JS quantization (config.vector = recall + persistMode) 2026-06-15 10:08:51 -07:00
storage fix: exception-safe aggregation backfill + generation-verified adoption + loud open-path guards 2026-07-17 16:00:11 -07:00
transaction fix: transaction timeouts are a typed no-hot-retry contract; engine-side non-retry pinned; dead transaction path removed 2026-07-24 16:01:41 -07:00
types feat(8.0): reserved-field contract — one canonical location, typed prevention, unified read/write 2026-06-11 13:13:09 -07:00
universal feat(8.0): id-normalization (#18) + aggregation min/max delete-safety + RC-safe release 2026-06-20 14:46:40 -07:00
utils feat: OS-limit detection for pool-scale deployments 2026-07-17 17:51:54 -07:00
vfs feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
boundary-no-native.test.ts refactor(8.0): API-surface + quality polish from the readiness audit 2026-06-29 10:04:19 -07:00
brainy-core.unit.test.ts fix(8.0): stats() per-type counts no longer inflate with HNSW re-saves 2026-06-17 17:07:58 -07:00
brainy-get-optimization.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
cold-open-rebuild-gate.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
create-entities-default.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
fieldTypeInference.test.ts feat: production-ready value-based temporal field detection 2025-10-16 13:58:57 -07:00
get-index-status-readiness.test.ts fix: honest index readiness — no silently-empty queries on a cold index 2026-07-13 13:17:56 -07:00
metadata-cold-read-guard.test.ts fix(8.0): metadata cold-read guard — no more silent [] on cold find({where}) 2026-07-02 10:13:07 -07:00
migration-lock.test.ts fix: full-removal canonical deletes + family-scoped migration gate 2026-07-14 10:11:53 -07:00
plugin-autodetect.test.ts feat: guarded plugin auto-detection — installing @soulcraft/cor is the opt-in 2026-07-02 16:19:55 -07:00
plugin-version-coupling.test.ts fix(8.0): close GA-blocking correctness gaps from the readiness audit 2026-06-29 10:03:38 -07:00
plugin.test.ts feat(8.0): version-coupling guard — a mismatched/failed native plugin fails loud, never silent JS fallback 2026-06-19 10:13:04 -07:00
process-exit-sweep.test.ts fix: no script shape can hang on brainy's internals — unref every maintenance timer + one-shot beforeExit 2026-07-02 17:26:22 -07:00
shutdown-hooks-lifecycle.test.ts fix: a bare script now exits cleanly after close() — release every process keep-alive 2026-07-02 16:39:16 -07:00
test-suite-coverage-guard.test.ts test(8.0): re-home orphaned test files into the gate + guard against recurrence 2026-06-29 11:47:18 -07:00
type-filtering.unit.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
validate-invariants-delegation.test.ts docs: cite the cross-layer integrity contract generically in comments and notes 2026-07-14 10:11:41 -07:00
vector-cold-read-guard.test.ts fix: honest index readiness — no silently-empty queries on a cold index 2026-07-13 13:17:56 -07:00
vfs-multi-instance-diagnostic.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-restart-fix.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
where-operator-validation.test.ts fix: validate where-operators and align the in-memory matcher to the documented set 2026-07-07 12:23:36 -07:00