open-brainy/tests/unit/db
David Snelling 13022c510b
Some checks failed
CI / Node 22 (push) Successful in 12m17s
CI / Node 24 (push) Has been cancelled
CI / Bun (latest) (push) Has been cancelled
fix(log): acked writes survive power loss; rejected writes never silently commit — the kill-matrix goes 11/11 with zero .fails debt
Two release-blocking findings from the durability kill-matrix, both fixed
in the owning layer:

1. LOG-AUTHORITY REPLAY AT OPEN: durable-at-ack fsynced the fact before
   the ack, but open() truncated every fact above the manifest — after a
   power loss that takes the un-fsynced tmp+rename canonical bytes, the
   acked write's ONLY durable copy was discarded. Now: under 'log'
   authority, open() REPLAYS intact facts above the manifest into
   canonical (FactLog.peekFactsAbove — CRC-gated, order-sorted) and
   advances the manifest to cover them; tree-authority brains keep the
   truncate contract they were promised. Pinned end to end: the power-loss
   row constructs the exact disk state (fsynced log, vanished canonical
   rename) and the acked write lives.

2. NO SILENT COMMIT: commitSingleOp buffered the generation BEFORE the
   fact append; an append failure (ENOSPC) rejected the caller but the
   next flush durably committed the generation with NO fact — a permanent
   silent log gap. Now the failure path un-buffers and returns the counter
   reservation: nothing commits, the log stays gap-free, and the canonical
   execute-residue orphan is the documented crash-equivalent.

Plus: the kill-matrix itself (11 rows — every commit-path fault point ×
reopen-as-crash recovery contract, at-ack variants, disk-full row; five
new zero-cost faultPoint sites), the log-authority pin suite (oracle
green/red/state-differs, flip refusal, switch survives reopen, 9/9), and
the group-commit covering pins (5/5).

Gates: unit 2002/2002 (152 files) · integration 785 · conformance 27/27.
2026-08-10 09:29:21 -07:00
..
bounded-chains.test.ts perf(8.0): bound per-id generation history chains (O(W+L) resident, was O(N)) 2026-06-30 10:30:17 -07:00
db-portable-graph.test.ts feat: includeHidden — export carries every visibility tier for migration-grade canon completeness 2026-07-27 11:22:25 -07:00
fact-log-group-sync.test.ts fix(log): acked writes survive power loss; rejected writes never silently commit — the kill-matrix goes 11/11 with zero .fails debt 2026-08-10 09:29:21 -07:00
fact-log.test.ts feat: scanFacts liveness contract — first batch or loud failure within a documented bound 2026-07-19 14:54:36 -07:00
factLogFormat.test.ts feat(log): fact-log format v2 codec — record envelope, type registry, genesis, sector seals; fault-injection shim 2026-08-10 09:29:06 -07:00
fault-injection-shim.test.ts feat(log): fact-log format v2 codec — record envelope, type registry, genesis, sector seals; fault-injection shim 2026-08-10 09:29:06 -07:00
fieldAddressing.test.ts feat(namespace): write-door forgery refusal (user metadata keys may never start 'system.') + refusal messages name both spellings in every branch (the non-colliding case marks system.<f> honestly as NOT valid) — cross-engine message pin alignment 2026-08-03 16:07:27 -07:00
generation-chain.test.ts perf(8.0): bound per-id generation history chains (O(W+L) resident, was O(N)) 2026-06-30 10:30:17 -07:00
generation-segments.test.ts feat: generation-segment store — the D1+D3 packed-tier file format 2026-07-19 15:14:27 -07:00
generationStore.test.ts feat: flush() never compacts — history maintenance moves to close() with bounded passes 2026-07-19 12:04:39 -07:00
pending-flush-durability.test.ts fix: refuse writes when single-op history cannot be made durable 2026-07-13 09:31:25 -07:00
stableEqual.test.ts feat(8.0): temporal range verbs — diff, history, since(gen|Date), asOf{exclusive}, transactionLog window 2026-06-19 13:21:02 -07:00
whereMatcher.test.ts feat(namespace): NO SPECIAL NAMES + storage fidelity — the ruled completion of the field-addressing law 2026-08-03 16:59:32 -07:00