How we check correctness of the extracted native binary (Lean ahead-of-time / AOT build) and pure proofs. This is not a marketing checklist: each gate either fails the build or documents a real failure mode.
Related: BENCHMARKS.md (timing), SYSTEMS.md (machine use and privacy), RELEASE.md (human land), GAPS.md (open work).
# Full continuous-integration-style suite (local; slow first time)
nix flake check
# Named wrapper for product/functional CI-safe gates (Workstream B / G21)
# Builds: namecheck, no-sorry, demo, bench, crash-suite, swmr-smoke, mwmr-smoke,
# struct-smoke, layout-smoke, horizon2-5, host-probe.
# Does **not** run profile-cpu / profile-mem / ffi-smoke (those stay under full
# `nix flake check` / packages - see gate table).
# Subset of `nix flake check` (see note below the gate table).
nix run .#test-suite
# Single gates
nix build .#namecheck --no-link
nix build .#beastdb --no-link
nix build .#checks.x86_64-linux.no-sorry --no-link
nix build .#checks.x86_64-linux.demo --no-link
nix build .#checks.x86_64-linux.bench --no-link
nix build .#checks.x86_64-linux.crash-suite --no-link
nix build .#checks.x86_64-linux.swmr-smoke --no-link
nix build .#checks.x86_64-linux.mwmr-smoke --no-link
nix build .#checks.x86_64-linux.struct-smoke --no-link
nix build .#checks.x86_64-linux.layout-smoke --no-link
nix build .#checks.x86_64-linux.ffi-smoke --no-link
nix build .#checks.x86_64-linux.beastdb-export-spike --no-link # P6-EXPORT PR0 link spike
nix build .#checks.x86_64-linux.beastdb-rust-smoke --no-link
nix build .#checks.x86_64-linux.beastdb-rust-t0 --no-link
nix build .#checks.x86_64-linux.beastdb-rust-t1 --no-link
nix build .#checks.x86_64-linux.beastdb-rust-t2 --no-link
nix build .#checks.x86_64-linux.horizon2 --no-link
# ... horizon3, horizon4, horizon5 similarly
nix build .#checks.x86_64-linux.horizon3 --no-link
nix build .#checks.x86_64-linux.horizon4 --no-link
nix build .#checks.x86_64-linux.horizon5 --no-link
nix build .#checks.x86_64-linux.host-probe --no-link
# Freestanding parked spine (when systems-lean input available; not in test-suite)
nix build .#libbeastdb --no-link
nix build .#checks.x86_64-linux.freestanding-gate --no-link
nix run .#freestanding-gate # same smoke + no Lean runtime NEEDED
# Optional local measure (not part of flake check / test-suite)
nix run .#host-probe
nix run .#profile-cpu -- 50
nix run .#profile-mem
# Freestanding thr A/B only under TMPDIR - never commit dumps (not a flake check)
# nix run .#libbeastdb-thr -- 10000
# Comprehensive power-labeled suite (metrics.tsv + charts; optional --archive) - see BENCHMARKS.md
# nix run .#suite-report -- --quick --profile balanced
# Daily deep measure suite (G24 closed / Workstream L; not gates - see BENCHMARKS.md)
# 1) quick CPU then deep call-graph (soft-degrade tools)
nix run .#deep-cpu -- --n 5
# 2) Massif heap timeline (soft-degrade tools)
nix run .#deep-mem
# 3) reverse-debug rr for hard bugs (soft-degrade tools)
nix run .#deep-rr -- --n 5
# 4) value-assessment matrix (fail-closed on product/ABI)
nix run .#value-assess -- --only V4 --n-grid 1,5
# 5) ASan/UBSan demo smoke in dev (fail-closed on sanitizer fire; not product ASan clean)
nix run .#asan-smoke
# Optional: build Phase A / Phase B packages only
# nix build .#beastdb-ffi-c-asan
# nix build .#beastdb-ffi-c-asan-cli
# Privacy: keep artifacts under TMPDIR; never commit host dumps or profilesOn other systems, replace x86_64-linux with your flake system
(for example aarch64-darwin).
| Gate | Kind | What it checks |
|---|---|---|
| namecheck | Policy | Product name is only lowercase beastdb in first-party files (build-time ripgrep over a top-level readDir + lib.fileset of first-party roots; skips ref/ / result*; fail-closed on tool errors; spaced beast+whitespace+db rejected) |
| beastdb / beastdb-release | Build | Proofs typecheck; binary extracts; release strip succeeds |
| no-sorry | Proof hygiene | No sorry in product Lean under beastdb/ |
| demo | Functional | Default CLI demo greps (durability, multi-file, single-writer multi-reader / SWMR, closed multi-file put/endWrite/compact(non-leaf)/exportSnapshot/sync/beginWrite -> validation; Next-5 / R16 classifyIO taxonomy: concurrent/validation/corrupt/io order locked; bounds, crypto models, horizons) |
| bench | Performance smoke | Small-N put/get (misses=0) + multi-shard compact_schedule / mode=sequential + get_post_reopen with greppable keysUnique=all (Tier B cold-open re-detect; fails if residual not unique-tagged) + LMDB microbench completes |
| crash-suite | Durability (simulated) | Multi-file recovery / fail-closed windows + per-leaf write-ahead log (WAL) multi-put prefix / corrupt header + foreign put + compact sibling keep + single-file corrupt/torn/mid-body/trailing junk + mid-migrate source intact / dest fail closed + Track 4 production temps (single-file .beastdb-tmp, LIFECYCLE.tmp, per-leaf WAL .tmp - orphan temps ignored on open) + corrupt LIFECYCLE (fail closed) + compact-on-publish empty WAL + mid-checkpoint WAL re-apply get-equal + orphan future shard epoch - cooperative simulated only (Tier D1/D2). Not hardware power-loss. Not kill -9 mid-put / mid-sync under CI (residual; human offline recipe below) |
| swmr-smoke | Concurrency | Second process writer fails closed while global LOCK held; reader get without exclusive lock |
| mwmr-smoke | Concurrency (G22) | Disjoint multi-process puts both succeed; same-leaf / global LOCK fail closed; foreign put + double sync keeps sibling data (handle refresh); AOT multi-process |
| struct-smoke | Concurrency (Track 3) | Two processes race generation-fenced split-reconcile -> one wins, one concurrent; reopen coherent; stale free-copy structural -> concurrent; short cooperative LOCK required (Next-4 / R3: not lock-free dual publishers; dual-publisher north-star deferred pending SYSTEMS §4 P1-P6) |
| ffi-smoke | Foreign ABI (deeper partial / R7) | C/C++/Rust via beastdb-lib durable put->sync->get; torn MANIFEST open fail closed; value fidelity; length-prefixed binary put/get; bulk multi-put; contains; delete; cursor open/next/DONE/prefix; atomic batch put+put+del (API v7); reverse/range/first/last/neighbor (API v8); D1 len/clear/delete_range (API v9); dual-backend - demos + export probe exercise export package default; CLI emergency + CLI cursor + CLI atomic + CLI range + CLI D1 under BEASTDB_USE_CLI=1; not LMDB wire/lmdb.h / free-page reclaim; R7 deeper partial. In full nix flake check; not in test-suite subset |
| beastdb-export-spike | P6-EXPORT PR0 (link harness) | Lean @[export beastdb_lean_api_version] linked into test shared object + harness; prints version 9 (spike asserts the version constant only; production surface is C ABI v9). Production dual-backend is beastdb-lib (PR2 export default + P6-CURSOR + P6-ACID + P6-RANGE + D1); recipe EXPORT-LINK.md. In full nix flake check; not in test-suite subset |
| beastdb-rust-smoke | Foreign crate v0 (Phase 3+) | Heed-shaped beastdb library smoke at ffi/rust/beastdb: Mode A immediate + Mode B batch put/commit -> reopen get (Mode B flush uses product atomic batch); Mode B flush-policy (size/count + time max_delay); binary Bytes; missing key; contains present/missing; delete put->delete->missing; iter / prefix_iter; P6-ACID Mode B unlimited commit + abort; P6-RANGE greps rev_iter_pairs= / first_last_ok=1 / range_pairs=; D1 greps clear_len_ok=1; corrupt open fail-closed. Not an upstream heed/heed3 port. Package beastdb-rust. In full nix flake check; not in test-suite subset |
| beastdb-rust-t0 | Foreign crate T0 (Phase 4+) | Selective heed-shaped beastdb required suite (tests/t0.rs, 8 tests): durable put/get, missing key, Mode B batch commit, corrupt open fail-closed, contains present+missing, delete roundtrip, P6-ACID Mode B unlimited abort, D1 len/clear. Not upstream heed cargo test; heed3: zero tests pulled. Residual R17 closed. Skip matrix + thin-v0 completeness: HEED-MAP.md §6 / §8.1. In full nix flake check; not in test-suite subset |
| beastdb-rust-t1 | Foreign crate T1 (Phase 4+) | Frozen selective heed-shaped beastdb suite T1-01...T1-12 + Phase 6 growth (tests/t1.rs, 26 tests incl. Mode A/B splits + auto-flush size/count/time abort/commit + contains + delete + P6-ACID multi-key commit/abort + cursor iter/prefix + P6-RANGE rev/range/first-last + D1 len/clear/delete_range) - beastdb semantics under heed-inspired intents. Not full heed suite green; heed3: zero tests. Port/Adapt/Skip + skip matrix + completeness honesty: HEED-MAP.md §6-§8.1. R17 closed. In full nix flake check; not in test-suite subset |
| beastdb-rust-t2 | Foreign crate T2 (D2) | Selective heed-shaped beastdb expansion (tests/t2.rs, 8 tests): RoTxn get + point-get honesty, range exclusive/unbounded edges (internal-key order), clear-then-put, len/tombstone/unflushed, multi-env isolation, Mode A vs Mode B abort edges, U32BE/U64BE + corrupt open. Not full heed suite; heed3: zero tests. Migration cookbook: MIGRATE-HEED.md. In full nix flake check; not in test-suite subset |
| layout-smoke | Layout pure + product (G23 + Next-5) | Pure encode/decode + bad magic/trailer fail closed; product init/put/sync/open/get; corrupt/truncated open -> Error.corrupt; stale free-copy syncImage -> Error.concurrent; put/sync/compact after close -> Error.validation; migrate multi-file↔single-file store (CLI image-*) preserves get; honesty greps for library putImage vs CLI image-put + migrate partial dest residual |
| horizon2...horizon5 | Feature demos | Pure models and product honesty strings; horizon2 includes Workstream F1 product compact schedule ≡ pure gets and Workstream J pure Structural concurrent publish model (generation fence; product path is Track 3 struct-smoke); default demo also greps Structural/F1/J honesty substrings (same AOT path) + lock-efficiency strings; horizon3 greps Workstream I scalar residual honesty |
| host-probe | Host capability smoke | Logical CPU counts + optional vector flags (first /proc/cpuinfo flags line only); greps fixed strings including complete line; must not emit identity labels |
| freestanding-gate | Freestanding spine park (R7-RT open) | When Systems Lean input is available: build packages.libbeastdb, run beastdb-smoke (put/get/delete/index/dir->DATA), require beastdb-demo + libbeastdb.a, fail closed if readelf -d NEEDED names match Lean runtime (libleanshared / Init_shared / leanshared) - not "libc only". In full nix flake check when present; not in test-suite subset; not C5 Embed TCB close |
| pre-commit / pre-push / verify-signatures | Git policy | Hook packages build under nix flake check (install with install-hooks) - not run by test-suite |
Proofs are part of nix build of the Lean package: if a theorem fails, the
binary does not build.
nix run .#test-suite runs the product/functional continuous-integration-safe
subset: namecheck, no-sorry, demo, bench, crash-suite, swmr-smoke,
mwmr-smoke, struct-smoke, layout-smoke, horizon2...horizon5,
host-probe. It is intentionally a subset of full nix flake check / land
prep: full check also builds beastdb, beastdb-release, ffi-smoke
(foreign C ABI bridge), beastdb-rust-smoke / beastdb-rust-t0 /
beastdb-rust-t1 / beastdb-rust-t2 (heed-shaped beastdb crate +
selective T0/T1/T2; not upstream heed/heed3 port; heed3 tests: zero;
R17 closed Phases 3-5 + D2 - see HEED-MAP.md),
freestanding-gate when Systems Lean is available (parked libbeastdb spine;
no Lean runtime NEEDED; not C5 / R7-RT still open),
and git-policy packages (pre-commit, pre-push, verify-signatures). Long
CPU/memory profile sessions stay under profile-cpu / profile-mem and optional
deep-cpu / deep-mem / deep-rr / value-assess / asan-smoke
(G24 closed / Workstream L deep call-graph, Massif heap timeline, rr reverse-debug
record, value-assessment matrix, and sanitizer Phase A smoke; deep-* soft-degrade
tools; value-assess fail-closed on product/ABI; asan-smoke fail-closed on
sanitizer fire - Phase A instruments demo only, not product ASan clean;
not LMDB parity; artifacts under TMPDIR) - they are not default flake
checks and not in test-suite. Freestanding thr (nix run .#libbeastdb-thr)
is measure-only under TMPDIR - never commit thr dumps; not a flake check.
- Machine-checked pure core - Lean theorems (routing, compact, codec, cost models).
- Extracted binary behavior - demo, crash-suite, swmr-smoke, mwmr-smoke,
struct-smoke, layout-smoke, horizon CLIs; full
nix flake checkalso runsffi-smoke(foreign C ABI thin bridge viabeastdb-lib- not intest-suite). - Wall-clock measurement -
beastdb bench,nix run .#bench(environment-dependent). - Deep profiling (optional; G24 closed) - shallow G21 (
profile-cpu/profile-mem) plus Workstream L deep suite:deep-cpu(perf record± flamegraph),deep-mem(valgrind Massif heap timeline; defaultshort-putget; optionalabi-*via value-assess harness),deep-rr(rr record/replay recipe; defaultaot-bench),value-assess(fixed scenario matrix; fail-closed on product/ABI), andasan-smoke/beastdb-ffi-c-asan(ASan/UBSan on demo Phase A mixed-link; optional Phase B CLI bridge package; not product ASan clean; fail-closed on sanitizer fire; not LMDB parity; not in test-suite); daily workflow in BENCHMARKS.md. Not required for CI. - Embed depth sample (D3 / M2) - historical ephemeral export vs CLI put/get/scan
tables in BENCHMARKS.md; re-run via
nix run .#value-assess(V4-V8 class; not a flake check; suite counts unchanged; R7 stays deeper partial).
Missing features must fail closed or use a documented soft degrade - never silent wrong answers (SYSTEMS.md).
What CI proves: beastdb crash-suite / checks.crash-suite exercises
cooperative simulated file-window fixtures under IO.FS.withTempDir
(truncated WAL, corrupt headers, orphan production temps ignored on open,
corrupt control plane fail closed - do not conflate, single-file tears,
mid-migrate residual, compact-on-publish empty WAL, mid-checkpoint re-apply).
That is the durable recovery evidence bar for default continuous integration.
What is not claimed (Next-6 settled - honesty residual, not product work to ship next):
| Residual | Status |
|---|---|
Process kill -9 mid-put / mid-sync under CI (R9) |
Not claimed / closed residual as cooperative-only (D1). Hermetic flake races + non-reproducible timing. Soft reopen only with hermetic stable CI story + fixtures; never a flaky kill-9 gate without design. |
| Hardware power loss / disk pull / kernel crash injection (R10) | Not claimed (D2). Lab-only if ever; do not market power-fail safety. Soft reopen only with lab instrumentation + honesty; never marketing without product. |
Local lab exploration only - not part of nix flake check,
nix run .#test-suite, or any greppable CI gate. Results are environment-
dependent; do not promote a green local run into a product claim.
Default paste path prefers cooperative fixtures (same class as CI
crash-suite: orphan production temps ignored on open). A process kill -9
mid-put loop is optional and fully commented below - timing often misses
the mid-write window; a local kill run does not prove CI coverage.
# 1) Build the AOT binary once
nix build .#beastdb
EXE=./result/bin/beastdb
DB=$(mktemp -d /tmp/beastdb-kill-lab.XXXXXX)
# 2) Init + a few durable puts
"$EXE" init "$DB"
"$EXE" put "$DB" k1 v1
"$EXE" put "$DB" k2 v2
"$EXE" sync "$DB"
# --- Prefer cooperative residual fixtures (what crash-suite already covers) ---
# Leave junk production temps beside a published store and reopen.
printf 'partial-junk' > "$DB/MANIFEST.tmp"
"$EXE" get "$DB" k1 # expect v1 - orphan MANIFEST.tmp ignored
# Corrupt control plane still fails closed (do not treat as empty):
# printf 'not-a-manifest' > "$DB/MANIFEST"
# "$EXE" get "$DB" k1 # expect non-zero / corrupt open
# --- Optional lab only: kill -9 mid-put (commented; not CI; not claimed) ---
# Timing is the whole residual - often misses the mid-write window.
# (
# i=0
# while true; do
# "$EXE" put "$DB" "loop$i" "v$i" || true
# i=$((i+1))
# done
# ) &
# PID=$!
# sleep 0.05
# kill -9 "$PID" || true
# wait "$PID" 2>/dev/null || true
# "$EXE" get "$DB" k1 || true # reopen after kill - lab observation only
# Always re-run the hermetic suite for a real gate:
"$EXE" crash-suite
rm -rf "$DB"Operator takeaway: trust temp+rename + cooperative crash-suite windows for recovery honesty. Treat kill-mid-write (R9) and power-fail (R10) as not-claimed lab residuals (Next-6 settled; optional offline exploration only), not green CI stories and not marketed product claims. See LIMITS.md Horizon 1 / Track 4 crash honesty table and GAPS.md residual list (soft reopen criteria).
nix run .#host-probePrints logical CPU counts and optional vector-extension presence flags (for planning only). Output is ephemeral terminal text.
Never commit probe dumps or any output that identifies a machine (serials,
UUIDs, hostnames, MAC addresses, full garuda-inxi / inxi dumps). See
AGENTS.md and SYSTEMS.md privacy rules. The flake check greps that the tool
does not emit common identity labels.
- Prefer a flake check that runs the AOT binary and greps for fail/success strings.
- Keep CI checks fast (small N, no root, no long
perfsessions). - Put heavy profiling under
nix run .#profile-cpu/profile-mem/deep-cpu/deep-mem/deep-rr/value-assess/asan-smoke, not defaultflake checkortest-suite. Sanitizer packages are local only (never default gates). - Update this file and release notes when adding a gate.