FrankenGraphDB

Determinism, Calibration & Verification Doctrine (Bet B5)

2,300 words8 subsectionsA design document: it describes the 1.0 target, not what runs today.

On this page8
15.0 Sextant: the calibration discipline within B515.1 Simulation-first development (fgdb-sim)15.2 Consistency oracles15.3 Fault & recovery torture15.4 Differential & conformance testing15.5 Formal anchors (scoped, honest — the asupersync posture)15.6 Performance regression apparatus15.7 Publish the design

This is not a QA appendix; it is a design pillar with its own budget. It opens with the runtime stratum (§15.0 — the calibration plane that governs the live system), then the verification stack from cheapest to strongest.

15.0 Sextant: the calibration discipline within B5

Sextant supplies e-processes, conformal predictors, sequential tests, robust estimators, regime/change detectors, and propensity/OPE tooling as deterministic transformations of logged inputs. It governs performance and operational choices; it never upgrades assumption-bearing evidence into exact correctness.

Every evidence envelope carries ClaimClass:

  • SafetyInvariant: must hold on every execution; failure is a correctness defect.
  • FormalModelClaim: theorem or model-check result with abstraction, bounds, and refinement status.
  • StatisticalClaim: population, sampling/selection rule, alpha, power/effective sample size, and assumptions.
  • ConfigurationModelClaim: model version, fitted inputs, sensitivity, and validity domain.
  • EmpiricalGate: fixture, machine/profile, sample count, variance budget, and comparison rule.

invariants.toml contains only exact safety/liveness obligations. evidence.toml contains FG-CAL-* and FG-EVID-*; slo.toml contains FG-CFG-*, performance, durability-model, and controller targets. E-processes may be anytime-valid under their named filtration/null assumptions; conformal coverage is marginal under its named exchangeability or online-validity conditions; drift alarms do not retroactively preserve a broken assumption; OPE requires positivity/overlap and sufficient effective sample size. A monitor that drives no named decision is dead code, but binding it to a decision does not make it an invariant.

Every adaptive policy retains a deterministic fallback valid without the statistical model. Answer-affecting execution policies are bound to the AnswerRequirement, plan, result contract, and replay closure; canonical-state-affecting promotions are logical-command-sequenced and replay-pinned; only proved answer-preserving physical policies may remain local. Calibration windows, selection policy, strata, propensity support, regime epochs, fallback, and failure behavior are immutable evidence identities. This is how B5 makes adaptation inspectable without confusing “well measured” with “proved safe.”

15.1 Simulation-first development (fgdb-sim)

The entire database runs under asupersync's lab runtime with virtual time/network/disk, seeded scheduling, chaos, and deterministic pressure models. DPOR is exhaustive only within the declared bounded scenario/state model and the soundness of its independence relation; broader campaigns remain falsification, not proof of bug absence. Every failure still becomes a replayable seed/crashpack, which is the practical value.

Five force multipliers on the same substrate:

  • Targeted falsification (LDFI). Random chaos asks “what if something fails?”; lineage-driven fault injection derives minimal fault hypotheses from successful-run dependencies. It targets every file/directory action in D1/D2 and every ordered, certificate, external-CAS, or physical side-effect boundary in dual-root publication; attempt generation/ticket claim/statement-workspace publication and delivery; checkpoint install/provisional-cut activation; prepared ownership and Raft; remote release; key stage/activate/zero/destroy/physical completion; GC preflight/authorization/quarantine/member completion; backup pin/copy/reopen/publish/release; restore reservation/transform/reconciliation/hidden activation/visibility/service preparation/continuity-plus-catalog receipt/finalize/open/reopen/completion; and Local-to-W12 seal/activation/authority-transfer/retirement. It is a high-yield falsification tool, while residual random chaos guards lineage blind spots.
  • A model-qualified stopping heuristic. Novelty estimates and coverage maximization prioritize finite CI time under a named sampling model. They may stop a campaign according to policy; they never certify that no unexplored bug remains. Deterministic bounded-state completion is reported separately from statistical/heuristic stopping.
  • Failing runs shrink themselves. Hierarchical delta debugging + replay minimization reduce every failing seed (schedule + workload trace) to a minimal reproducer before filing, and divergence diagnostics explain exactly where a replay departed from its recording. Crashpacks arrive pre-shrunk; the bug report writes itself.
  • Lab-vs-live dual runs. The same scenario, same seed, runs under the lab and against the live build, and the traces are diffed — closing the classic simulation-testing loophole ("we verified the simulator, not the system"). This is the runtime-behavior counterpart of the fgdb-reference semantics differential.
  • Production incident replay is graded. Production retains bounded mediated nondeterminism records under a fail-closed redaction contract. Each bundle carries the explicit ReplayCompleteness grade Replayable | StructuralReplay{reproduced_classes[],omitted_classes[]} | VerifiableIfArtifactsSupplied{missing_classes[]} | AuditOnly{missing_or_redacted_classes[]}. Crypto entropy is never recorded. Full internal forensic bundles may be exact when policy permits; customer-safe bundles never overclaim byte identity.

Every failing sim, live differential, integration, or E2E run emits one secret-redacted structured artifact containing {seed,schedule,crashpoint,role,group,configuration,topology,incarnation,service_visibility_epoch,logical/commit/Raft/applied/visible/audit-visible positions,attempt/generation/statement/workspace/backup/restore/GC/key identifiers,object/spec/result/certificate/grant/floor identities,expected,actual,replay_command}. Contract tests require every applicable field and execute the replay command; human prose is supplemental. Coverage includes lost BEGIN_ACCEPTED, duplicate/conflicting begin keys, denial/abandonment before registration, workspace-zero recovery, successor Registered-outcome rooting, cancel with prior results/workspace/grants, terminal/autocommit ACK/release races, every TerminalPending missing-postcondition combination, and status before/during/after compaction and detail reclamation.

Two registered decision rows bound what this apparatus may ever expose. Replay-artifact exposure: which replay artifacts may become customer-facing — ReplayManifests, crashpacks, seeds/schedules — is a registered G0 decision row, and any artifact so exposed first receives a registered stability classification; nothing here is implicitly public. The customer-facing agent-replay product is the SessionReplayBundle: the ordered per-statement ReplayManifests of a session plus its FGP frame transcript, graded with the existing ReplayCompleteness vocabulary — time-travel debugging of the database's recorded work for that agent — and whole-agent byte-identity is never claimed for customer code not threaded through the lab. Chaos packaging: any customer-facing surface over fgdb-sim's fault machinery ships behind an fgdb-owned facade crate with its own stability classification, never as a direct dependency on the foundation lab runtime; its reports are claim-typed falsification-only — structurally incapable of asserting “verified fault-free” — and chaos/fault-injection capabilities are absent from production Cx profiles by construction, a lab-only capability rather than a runtime flag.

15.2 Consistency oracles

In-sim checkers include snapshot/branch visibility, an SSI dependency oracle, obligation/quiescence, root/capsule closure, authorization noninterference, and Elle-class histories. The SSI oracle uses a deliberately independent small Tarjan/SCC implementation over trace-derived logical dependencies; production graph algorithms may be a secondary differential, never the sole checker of their own transaction graph. Every invariant has at least one checker outside the optimized component it checks where practical. The deterministic lab hosts a registered model of every external authority, and Elle-class linearizability/history checking runs over the simulated authorities' CAS chains — identity/allocation continuity, the audit continuity sequencer, archive/grant, reservation, catalog, and the restore dispatch journal's ExternalCasContinuity head — exactly as it runs over database histories: each simulated head must be a linearizable register whose accepted transitions are direct CAS successors under the published predecessor-digest law. Negative campaigns fork and roll back simulated authority chains — two successors installed at one cas_version, a predecessor-digest regression, a resurrected stale head — and require that every lineage no-fork verification consumer (ticket admission, recovery, restore reconciliation, completeness gating) detects the fork and fails closed rather than adopting either branch.

Independent protocol oracles continuously cross-check atomic begin/family/token/attempt/outcome transitions; ticket ownership; statement index, terminal/autocommit delivery frontier, workspace generation and cumulative witness/effect roots; terminal-postcondition bitmaps; decision publication/post-visibility acknowledgements/global-delta frontier; provisional versus activated cut authority; remote release; staged key and GC phases; backup manifest/pin release; restore hidden/service/reopen state; and Local-to-W12 retirement. Security negatives cover raw cross-group references and wrong role/domain/incarnation/configuration/grant/permit projection/claim owner/workspace/service epoch, plus observation or acknowledgement before the required mirror/open state. Detailed and compacted status paths must return byte-identical public outcome bytes.

Production assertions and complete audits can enforce exact invariants; sampled e-processes are statistical sentinels in evidence.toml, not the enforcement column of invariants.toml. Replay uses the complete ReplayManifest in §8.6. Security verification additionally covers cross-capability differential results/plans/errors/timing classes, revocation during streams, cache/view/index isolation, hidden-state constraints/cascades, donor poisoning, key rotation, restore authorization, parser/resource exhaustion, and audit-chain completeness.

15.3 Fault & recovery torture

Crash matrices kill at every D1/D2 filesystem barrier, both root slots, combined inode/incarnation takeover check, post-rebase capsule, marker/root publication, prepared ownership transfer, payload receipt/Raft/apply, audit ticket claim/signer-lock/candidate/external-CAS/mirror, statement workspace/result/delivery transition, and checkpoint install/provisional-cut/activation step. W12 campaigns cover begin reservation and Attempt First/Successor/idempotent/burn races; shard prepare through decision publication, audit projection, post-visibility acknowledgement and global-delta publication; every TerminalPending bit combination; six-stage remote release; key plan/stage/certify/manifest/activate/zero/durable destroy/member-or-KMS completion; and GC preflight/global authorization/current-root quarantine/no-resurrection/member/aggregate completion. Backup/restore campaigns cover exact Local and Sharded barriers, independent archive and target reopen, every release acknowledgement, continuity split-brain, leaves-first readdress/re-encryption, hidden activation/visibility/service preparation, continuity-then-catalog CAS, hidden roll-forward, Meta finalize, shard open/acks, completion and source-lease release. Activation campaigns stop at every Local freeze/seal/certificate/projection/first-entry/authority-transfer/RetiredLocal/finalize/reclamation point. Every scenario declares its filesystem, failure, placement, quorum, external-authority, and fairness model. Additional campaigns cover partial marker tails, full-digest locator collisions, mixed EncodingId symbols, erasures within and beyond every source-block budget, stale writers, uncertain membership, donor poisoning, key loss, and idempotent Unknown/status recovery through scoped capabilities.

15.4 Differential & conformance testing

  • Semantics oracles: an executable reference engine (fgdb-reference) — a deliberately simple, single-threaded, obviously-correct implementation of the full logical semantics (values, visibility, path modes, intents, temporal selectors, branches, multi-statement transaction-error policy, workspace generations/read-your-own-writes, statement publication/delivery, and terminal attempt semantics) over canonical maps, compiled for tests/fuzzing/model-checking only, never shipped, never optimized, so "what should this return" is a program rather than a debate; openCypher TCK; a GQL feature-conformance corpus keyed to ISO feature IDs (published as a matrix); differential vs. Neo4j & Memgraph on a curated corpus (behavior parity where standards align, documented divergence elsewhere); Prism results differential vs. standalone fnx (which is itself NetworkX-parity-locked — a two-hop oracle chain to ground truth). Model-generated histories run against both engines and compare snapshots, results, certificates, and permitted abort outcomes. fgdb-reference carries a registered dependency allowlist — the foundation value/type/claim crates plus the G0-generated registries and golden vectors, nothing else; importing any engine crate (fgdb-txn, fgdb-algebra, fgdb-exec, fgdb-strata, fgdb-chronicle, …) is a CI-rejected boundary violation in the unsafe-boundary-ledger style, so the differential cannot be quietly gutted by code sharing. The parser (fgdb-gql/fgdb-cypher) is the one recorded sharing exception: the TCK and the Neo4j/Memgraph differentials exercise the front end end-to-end, and the grammars are fuzzed separately. The ground-truth hierarchy is explicit — the normative appendices and the G0-generated golden vectors outrank both implementations — so a differential mismatch is triaged against the spec and is never resolved by making the reference imitate the engine.
  • Storage oracles: model-based testing of Strata against an in-memory reference graph (arbitrary op interleavings, equality after every op under every open snapshot); metamorphic suites in the house style (e.g., pattern-match results invariant under compaction, seal, branch-fork, encode/decode round-trips).
  • Fuzzing: parser (GQL/Cypher grammars), FGP frames, every fgdb-formats reader (extending fnx's 8-fuzzer precedent), SymbolRecord decoder.
  • Protocol-state oracles: simple canonical-map reference machines for exact begin/attempt/audit/statement/workspace/delivery/status, provisional/activated cut, local and distributed key, GC, Local/Sharded backup/restore/service/reopen, and activation/retirement/reclamation transitions. Generated traces run against optimized state machines and compare every state, result, refusal, resource release, and log field.

15.5 Formal anchors (scoped, honest — the asupersync posture)

Lean targets the full visibility relation—publication, branch ancestry, create/retire, own writes, and reclamation—not merely three local MVCC facts. SSI work separates: dangerous-structure theorem, lifetime of dependency metadata, soundness of each witness constructor's concretization, refinement preservation of positive/negative/gap/path observations, optimizer transport of witness obligations, and statement-workspace transport plus cumulative-witness preservation. Merge proofs cover the registered algebra in its constraint context. Ripple proofs cover only the explicitly registered operator/annotation subset.

TLA+/TLC models the dual-slot root and generated-complete checkpoint authority transfer, exact writer-lease/takeover/fence-enable sequence, final-capsule commit, marker/global-branch links, fork-time envelope/write-key double rotation, delivery ACK/resume, audit candidate visibility fencing/external reconciliation, stable prepared ownership plus payload availability/Raft, membership reconfiguration floors, branch merge/token/range idempotency, and closed-sequence leases. Separate bounded W12 models cover (a) begin reservation, attempt generation, ticket claim, statement/workspace publication, terminal/autocommit delivery, status, cancellation, and read close; (b) admission, shard prepare, signer-locked terminal candidate, external CAS/mirror, decision publication, shard audit projection/post-visibility acknowledgement and global-delta publication; (c) provisional-cut replacement with inherited absent bytes and later activation; (d) closed-attempt build/attest/publish and detailed/compacted status equivalence; (e) six-stage remote release; (f) staged distributed key activation and physical destruction; (g) GC quarantine/no-resurrection and physical completion; (h) exact backup publication/release; (i) restore reservation, transformation, hidden activation/visibility/service preparation, receipt-first finalize/open/reopen/completion; and (j) Local-to-W12 activation, authority transfer, RetiredLocal finalization, and reclamation. Models include partitions, Meta/shard reconfiguration, conflict-index lifetime, constraint reservations, and topology moves. The generated durable-reference checker separately enforces per-field PriorObject construction annotations and rejects cycles in reachable object instances; recursive persistent-tree types remain legal because every concrete parent points only to already identified children. Neither method is mislabeled as the other. Every model run states bounds. Trace export demonstrates that captured executions are allowed by a spec; it is trace conformance, not an implementation-refinement proof. Runtime monitors detect selected violations but do not inherit model-check completeness. Proof-lane manifests name abstraction, assumptions, bounds, refinement bridge, and exactly what remains unproved.

Appendix F has exactly twenty top-level invariant IDs. G0 materializes each as stable subordinate clauses in invariants.toml; every clause records its exact statement, role/posture/format/feature activation predicate, dependency clauses, resolvable checker entrypoints, negative-test IDs, proof/model scope and bounds or liveness fairness assumptions, owner, first required gate, status, and waiver=forbidden. CI verifies the twenty-ID set and table hash, acyclic dependencies, checker/test symbol existence, and the compiled-plus-negotiated activation closure. Every reachable clause must be live; an unimplemented or dormant clause forces its feature off and cannot count as covered. The plan does not falsely claim the currently absent file already exists.

15.6 Performance regression apparatus

Criterion-style in-house microbench harness + macro suites (§17) with baselines committed, variance-aware gating (the asupersync/fnx baseline artifact discipline), and complexity-witness regression locks: an algorithm or operator whose instrumented operation count exceeds its registered bound on an in-domain fixture fails CI. Correctness, security, durable-format, recovery, authorization, invariant-checker, and required conformance gates are nonwaivable. A public, expiring waiver may cover only a named empirical performance threshold, statistical-evidence threshold, or non-safety coverage budget; it records owner, evidence, reduced claim, expiry, and fallback and cannot weaken an invariant or enable a feature whose safety checker failed.

15.7 Publish the design

Sortledton/Teseo/Kùzu earned trust by publishing. Target six papers/tech-reports from this work: (1) Strata: temperature-tiered transactional adjacency; (2) One Version Universe: unifying MVCC, temporal, branching, and replication over a fountain-coded commit stream; (3) Refinable predicate witnesses: graph serializability with near-zero false conflicts and no per-edge read tracking; (4) Plan certificates & decision cards: deterministic, auditable query execution; (5) The externally verifiable graph database: transparency checkpoints, inclusion-proof changefeeds, and computed durability certificates over a fountain-coded commit stream; (6) Calibrated adaptivity: anytime-valid statistical governance of a self-tuning DBMS. Ambition includes the receipts.