Foundation Audit: Exactly What We Stand On
1,788 words4 subsections3 tablesA design document: it describes the 1.0 target, not what runs today.
On this page4
This section is the result of a full review of the three repositories. It maps specific existing assets to specific FrankenGraphDB subsystems, because the leapfrog claim is only credible if the reuse plan is concrete.
2.1 asupersync (~580 KLOC): the operating system
| Asset (module) | What it gives us | Used by |
|---|---|---|
Region tree, obligations, Outcome lattice, three-lane scheduler (cancel/EDF/ready), fibers/tasks/actors |
Structured concurrency: no orphan tasks; region close ⇒ quiescence; bounded-cleanup cancellation protocol; work-stealing parallelism with priority lanes | Every background service (compactor, checkpointer, GC, replicator) and every parallel query (§8.7): a query is a region; cancelling it drains morsels deterministically and frees its region heap |
Cx capability contexts + capability narrowing |
Deadline/cancellation/authority threading | Whole codebase (constraint #3) |
| Lab runtime: virtual time, seeded deterministic scheduling, DPOR/Mazurkiewicz schedule exploration, chaos injection, futurelock detection, trace capture/replay, crashpacks | The verification substrate for B5 | fgdb-sim (§15) |
| Formal layer: Lean-checked invariants, TLA+ export discipline, proof-lane manifests | The house style for formal claims | Commit protocol + visibility invariants (§15.5) |
src/raptorq/: RFC 6330 systematic RaptorQ, GF(256) SIMD kernels, decode proofs, per-symbol authentication, deterministic decode planner |
Fountain coding for prepared/Raft payload closures, immutable objects, and replication | Chronicle (§5), Aegis (§14) — we do not reimplement RaptorQ; frankensqlite's "RaptorQ everywhere" doctrine is executed with asupersync's implementation and scoped by §5.7's tiered repair law: every sole-source authoritative object owes the full repair budget, a Chronicle-reconstructible object may carry a registered reduced-repair fec_profile only under the §5.7 checkpoint-fold recode law, and ScratchStore (§6.7) was never inside the coded domain — the tiering names an already-scoped boundary rather than widening one, and B1's RaptorQ-protected commit mechanism stays literally true because every commit-mechanism object keeps the full budget |
ATP transport (src/net/atp/), bonded multi-donor pulls, transport router, multipath aggregator with dedup/reorder |
Symbol-oriented bulk transfer over lossy paths, pulling one object from N donors | Replica seeding, backup/restore, anchor shipping (§14.5) |
| Networking: TCP, UDP, QUIC (native), HTTP/1.1, HTTP/2 (HPACK, flow control), HTTP/3, WebSocket, TLS (rustls-backed), DNS, gRPC | The entire server surface | Fabric (§13) — FrankenGraphDB writes zero protocol plumbing below the graph wire format |
| Channels (two-phase reserve/commit MPSC, oneshot, broadcast, watch, session), sync primitives, combinators (quorum, hedge, circuit-breaker, bulkhead, rate-limit, map_reduce, pipeline) | Cancel-correct internal plumbing; the write-coordinator mailbox; subscription fan-out; admission control | Txn engine (§7.6), Ripple fan-out (§9.5), server QoS (§13.6) |
| Spork/OTP: supervision topologies, gen_server, monitors, name-lease registry | Service lifecycle for the ~12 long-lived database actors | §16.1 process tree |
remote.rs: leases, idempotency store, session-typed protocols, sagas, logical clocks; distributed consistent hashing, snapshots, vector clocks |
Consensus/replication building blocks | Aegis (§14) |
| Security: macaroons, authenticated types; per-symbol auth on RaptorQ planes | Capability tokens with caveats | Warden (§12) |
| fs + VFS + io_uring reactor; region heaps with generational handles; epoch reclamation; bytes/codec (length-delimited framing); observability (metrics, OTel export, spectral wait-graph health) | Storage I/O, query-scoped memory, EBR for lock-free readers, wire framing, ops | Buffer manager (§6.7), executor memory (§6.7, §8.7), everything |
Statistical governance machinery: e-process/test-supermartingale monitors (obligation/eprocess), conformal calibration + exploration budgets (lab), the decision-contract runtime with Bayesian regime posterior and Lyapunov governor, deterministic no-regret (EXP3/Hedge) scheduler adaptation, Freedman/Azuma drain-progress evidence |
Reusable estimators/controllers whose guarantees remain conditional on their registered filtration, model, and integration; deterministic implementation does not make their assumptions true | Sextant (§15.0), decision cards (§6.6), optimizer intervals (§8.5), production sentinels (§15.2), governed cancellation (§16) |
| Distributed protocol machines: SWIM+Lifeguard membership with gossip + lease reactor, Merkle-range anti-entropy, fountain-coded symbol distribution, CRDT obligation ledgers, hybrid-logical-clock mode, distributed epoch coordination, choreographic/session-typed protocol tooling, authenticated value types | Valuable membership, transfer, convergence, and protocol-building machinery; not FrankenGraphDB's Raft safety, payload-availability, reconfiguration, GC, or sharding proof | Aegis (§14), after database-specific state machines and failure-model tests |
| Verification & forensics tooling: lineage-driven fault injection (LDFI), hierarchical delta-debugging + replay minimization + divergence diagnostics, dual-run lab-vs-live differential harness, TLA+ trace export, a ~24-oracle suite (determinism, priority-inversion, ambient-authority, region/task-leak, …), trace certificates + refinement firewall, redaction-contracted incident bundles, deterministic NUMA projection, deadlock radar + deterministic benchmark harness | Targeted falsification, automatic repro shrinking, model-vs-implementation bridging, and production-safe diagnostics | fgdb-sim (§15), observability (§16) |
| Plan-layer scaffolding: e-graph extraction with lawful-rewrite certificates and a (min,+)/tropical latency algebra for compositional worst-case envelopes | Certified rewrite plumbing and compositional latency bounds the optimizer would otherwise reinvent | Loom certificates & envelopes (§8.5–8.6), Ripple staleness composition (§9.4) |
The deep synergy: asupersync is not "an async runtime we happen to use." Its obligations model maps exactly onto database invariants (a CommittedEffectCapsule publication is a two-phase obligation; a checkpoint lease is a lease obligation; an un-acked subscription delivery is a send permit). Its lab runtime turns MVCC interleaving bugs into seed-replayable test failures. Its region heaps make query memory accounting and cancellation-time reclamation structural. FrankenGraphDB is, in a precise sense, a database written in the asupersync programming model, the way FoundationDB is a database written in Flow.
2.2 franken_networkx (~247 KLOC, 12 crates): the algorithm brain and the semantics doctrine
| Asset | What it gives us | Used by |
|---|---|---|
fnx-algorithms: 550+ functions across 25+ families (shortest paths, centrality, communities, flow, matching, isomorphism/VF2++, planarity, spectral, k-core/k-truss, link prediction, DAG ops, …) |
A large source catalog and semantics oracle; in-database exposure is staged by projection compatibility, authorization, larger-than-memory execution, and differential gates—not promised on day one | Prism (§11): registered calls such as CALL fnx.pagerank(...) |
GraphView trait (in fnx-algorithms): string access + integer-index rows (neighbors_indices(&self, idx) -> Option<&[usize]>, in_neighbors_indices) |
A compatibility target, not a zero-copy match today: Strata stores compressed u32/u64 ordinals and a typed directed multigraph, while the current trait borrows flat usize simple-graph rows. Prism therefore needs an explicit projection and either a cached usize materialization or an upstream borrowed-neighbor-cursor/GAT extension. |
§11.2 and W8; no zero-copy claim survives unless the upstream interface and physical representation actually permit it |
CGSE: 13 TieBreakPolicy variants, ComplexityWitness { n, m, dominant_term, observed_count, policy, seed, decision_path_blake3 }, WitnessLedger, Strict/Hardened modes, per-algorithm policy registry |
The determinism doctrine (B5) generalized from algorithms to queries: FrankenGraphDB adopts tie-break policies as part of the query contract and emits plan certificates containing witnesses | §8.6, §15.2 |
fnx-readwrite: fuzz-hardened native parsers/writers for edgelist, adjlist, GraphML, GML, JSON node-link, Pajek, GEXF (+ graph6/sparse6 composition) |
Import/export for the whole legacy graph ecosystem | Formats layer (§13.7); bulk loader feeds Strata's sealed-run builder directly |
fnx-generators (SBM, Barabási–Albert, Watts–Strogatz, LFR, lattices, social datasets) |
Deterministic synthetic workloads for benchmarks and sim tests | §15, §17 |
fnx-durability (RaptorQ sidecars, integrity scrub, decode proofs) |
Precedent + shared artifact conventions for scrubbing | Chronicle scrubber (§5.7) |
fnx-classes (IndexMap adjacency, insertion-order semantics), fnx-views (borrowed/cached snapshot views) |
The compatibility semantics reference (NetworkX-parity ordering) and small-graph materialization path | §11.4 (when an algorithm needs a mutable working copy) |
2.3 frankensqlite (~1.28 MLOC): the architectural donor
frankensqlite is inspiration-by-dissection: we adopt its designs, re-instantiate them for graph objects, and where a module is genuinely object-agnostic we fork it into an fgdb-* crate (attribution preserved) rather than depending on fsqlite-* and dragging SQLite's page/B-tree world along.
| frankensqlite design | Verbatim lesson | FrankenGraphDB instantiation |
|---|---|---|
Page-granularity MVCC: version chains in a bump arena, Snapshot { high: CommitSeq }, O(1) current-line visibility fast path, EBR reclamation, and local chain/lock invariants |
Choose the versioning granule to match the storage granule, while treating branch ancestry as semantic visibility rather than forcing a donor's integer-only rule | Block-granularity MVCC on Strata adjacency blocks and property chunks (§7.1); applicable chain/lock rules become FG-INV-02/03, while durable transaction idempotency replaces a non-load-bearing monotone TxnId rule |
| SSI (page-Cahill/Fekete) + first-committer-wins + eager locking | Conservative dangerous-structure detection at storage granularity is a useful donor pattern; deadlock freedom and SSI soundness do not transfer by analogy | Graph-SSI plus logical predicate witnesses (§7.3); final physical/constraint locks use the independently modeled canonical/no-wait protocol in §7.1 |
| Intent logs + deterministic rebase merge ladder (semantic replay → structured patch → abort) | Same-granule conflicts can sometimes be semantically reconcilable; eligibility depends on reads, constraints, authority, and the operation algebra | Context-derived graph rebase and explicit-base branch merge (§7.4, §5.6), with hit rate measured rather than assumed |
Native mode / ECS: content-addressed objects, SymbolRecord envelopes, root publication, capsules/markers, and mark-and-compact with leases |
The architectural starting point, not a verbatim format contract | Chronicle (§5) re-specifies the root protocol, full-digest identity, encoding variants, final-capsule ordering, branch/global ancestry, and replicated payload availability; graph durability does not inherit correctness merely by analogy |
| WriteCoordinator: centralized final validation/order with group durability | A useful ordering shape, not a promise that final-effect regeneration, authorization, payload availability, or consensus is off the critical path | §5.2/§7.6; the complete D1/D2/Raft path is benchmarked and failure-tested |
| ARC buffer pool, MVCC-aware; cache-line-padded sharded lock/siread tables; aligned direct-I/O buffers; prefetch on descent | Mechanical sympathy checklist | Buffer manager (§6.7) |
Time travel (FOR SYSTEM_TIME AS OF, snapshot ring today, VersionStore design) + checkpoint+delta thinking |
Temporal support should ride the MVCC machinery, not duplicate it | Chronicle retention tiers (§5.4); history is queryable for the configured retention contract, never described as unbounded when policy permits reclamation |
| Encryption: Argon2id KEK hierarchy, per-object protection, encrypt-then-code | A design starting point whose nonce, AAD, per-encoding DEK, symbol-MAC, rewrap, and KMS/HSM details must be respecified | The exact §5.1/§12.5/App. A composition; no correctness is inherited merely from the donor |
| Verification posture: conformance corpora, differential harnesses vs. reference engines, feature-universe ledgers, exit-criteria contracts, metamorphic tests | The QA house style | §15 throughout |
2.4 What the foundations do not provide (and we therefore build)
Columnar graph storage, adjacency compression codecs, a query language front end, a cost-based optimizer, a vectorized/factorized executor, WCOJ machinery, a Z-set incremental engine, secondary/FTS/vector indexes, graph statistics sketches, the wire protocol's graph payloads, the calibration plane's graph-specific scores and ledgers (fgdb-calibrate wraps the runtime's e-process/conformal machinery rather than reimplementing it), the verifiability accumulator (Merkle Mountain Range + transparency checkpoints), and the replication state machine (Raft sequencing itself — though membership, anti-entropy, coded fan-out, and convergent metadata are compositions of existing protocol machines per §2.1, not new construction). That is the actual FrankenGraphDB codebase, estimated 275–440 KLOC of new Rust — large, but smaller than frankensqlite, on a foundation that already absorbed the hardest systems problems (scheduling, cancellation, networking, fountain coding, deterministic testing, sequential statistics). The complete build-it-ourselves inventory is §18.