Constraints and Non-Negotiables
1,071 wordsA design document: it describes the 1.0 target, not what runs today.
- The dependency universe is closed. Allowed:
core/alloc/std, the Rust nightly toolchain (both asupersync and franken_networkx already pin nightly), and the three foundation projects —asupersync(with whatever it vendors internally; its choices are its own), thefnx-*crates offranken_networkx, and design-level reuse offrankensqlite(we fork/adapt specific modules intofgdb-*crates rather than linkingfsqlite-*wholesale, because graph objects are not SQLite pages — see §2.3). Everything else — compression codecs, sketches, ANN indexes, inverted indexes, radix trees, wire protocols, columnar readers — is built in-house (§18 is the complete inventory). No serde, no tokio, no rocksdb, no arrow, no tantivy, no hnswlib. The Python package may consumefnx-pythonas an allowedfnx-*foundation crate and therefore its already-pinned transitive binding runtime, butfgdb-*crates may not add a direct PyO3 dependency; the database engine, server, CLI, and durable formats remain free of that packaging boundary. - Memory safety is structural. Every ordinary crate root and the workspace default use
unsafe_code = "forbid". Rust'sforbidlevel cannot be lowered, so the few raw-pointer implementations (buffer arenas, SIMD kernels, VFS mappings) live in separately namedfgdb-unsafe-*boundary crates whose roots usedeny(unsafe_code)plus narrowly scoped, ledgeredallowsites. Safe-facing crates never relaxforbid. Every unsafe operation gets a ledger row: path, invariant, evidence, scalar or safe fallback, and no-claim boundary; CI rejects an unledgered site. Cxeverywhere. Every function that performs I/O, takes a lock, allocates from a shared arena, or can block accepts&Cx(asupersync's capability context). This is what makes B5 possible: swap theCx, and the entire database runs under the lab runtime with virtual time, deterministic scheduling, and fault injection. It is also what makes cancellation-correct query timeouts, deadline propagation, and capability narrowing (read-only connections cannot express writes) structural rather than conventional.- Deterministic by default, with an explicit domain. The strict contract is: same evidence closure (root object and branch head, normalized query and parameters, semantic/capability/policy epochs, executable artifacts, index generations, numeric profile, and recorded external inputs) ⇒ byte-identical canonical logical-result encoding, including order. Transport chunking is not part of logical identity. Cross-machine strict mode uses the portable numeric profile in §8.6; relaxed floating execution is opt-in and certificate-declared.
- Single artifact, three postures. One codebase produces: (a) an embedded library (
fgdb) usable like Kùzu/DuckDB from Rust and Python; (b) a server binary (fgdbd) speaking the native protocol, HTTP/2, gRPC, WebSocket, and a Bolt-compat subset; (c) a CLI binary (fgdb, implemented by thefgdb-clicrate). Larger-than-memory operation is first-class in all three. - The published recovery root is the source of truth. Before history truncation, logical state is reconstructed from an authoritative checkpoint projection plus the complete contiguous
LogicalCommandRecordstream. Transaction markers and committed effects are the transaction-only subsequence; schema, policy, delivery, accounting, audit, configuration, GC, and other control commands are equally necessary to reconstruct canonical state. After the truncation horizon advances, the newly installed checkpoint and retained logical-command suffix become the authoritative recovery basis; reclaimed capsules are no longer claimed to be available truth. The only published bytes updated in place are the two fixed root-pointer slots in §5.1. Newly created staging files may be written until sealed, but are unreachable and disposable by proved recovery rules; every reachable root object, checkpoint, marker batch, capsule, and derived object is immutable and content addressed. Derived indexes and views never become authoritative for base semantics or constraints. - No JVM, no GC, no mmap-as-durability, no generic KV underlay, no eventual-consistency defaults. These are the fossils we refuse to inherit.
- Narrowed capability contexts. Subsystems receive purpose-typed wrappers over
Cx(QueryCx,TxnCx,CommitCx,MaintCx,ReplCx) exposing only their legal effects as obligations (pin_snapshot,reserve_prepared_bytes,reserve_raft_payload_space,publish_segment, ...). The sharpest instance: the merge ladder's intent-replay evaluator receives aCxwith no clock, entropy, network, or filesystem capability — deterministic rebase is guaranteed by construction, not by review. - Prohibited shortcuts (constitutional). No global-lock "interim" transaction model; no
HashMap<VId, Vec<EId>>presented as storage; no snapshot isolation quietly labeled "ACID"; no parser-interprets-AST engine; no non-durable benchmark mode reported as a result; no serde-derived enum as a durable format; no detached background thread. Early code may implement a subset of each final abstraction — never a substitute for it. - Adaptivity is classified, or it does not ship. Every adaptive decision is exactly one of: answer-preserving physical (cache eviction, prefetch, equivalent kernel selection, local pacing); answer-affecting execution (approximate generation/candidate/fusion/stopping choices represented by the execution's
AnswerRequirement/realizedAnswerContract); or canonical-state-affecting (view/index publication, watermark advancement, security/retention/configuration changes). Answer-affecting choices are legal only inside the requested requirement, are fully pinned in the bound plan/certificate/replay closure, and emit decision cards; a policy-table change that can alter them is stream-sequenced. Canonical-state-affecting choices change only through logical commands under stream-sequencedDecisionPolicyEpochor their own typed epoch. Physical-only choices may adapt locally but still log cards and must pass answer-equivalence tests. Logged propensity supports off-policy evaluation only for candidate actions covered by the logging policy. Statistical promotion evidence isFG-EVID-*, never anFG-INV-*safety proof, and the deterministic fallback remains valid when assumptions fail. - Claims have types. Every load-bearing statement is registered as exactly one of:
invariant(must hold on every execution),proof(theorem within a named formal model),bounded_model(checked only within declared bounds),statistical(confidence statement under named assumptions),slo(empirical operational target), orbenchmark(measured on a pinned fixture). A weaker claim class may inform policy but may not enforce or justify a stronger one.invariants.tomlcontains only exact safety/liveness invariants;evidence.tomlandslo.tomlcarry statistical and empirical claims. - Costs are registered claims. Constraint 11 governs what a statement may assert; this constraint governs what a mechanism may cost. Every operation class has a row in the operation-cost registry (Appendix G) stating its sequenced semantic commands, total Raft log entries, ordered durability barriers with their amortization law and fusion legality, external-authority interactions, and minted durable objects. Every §17 gate must be derivable from that registry — a latency gate must be ≥ its declared class's ordered-barrier count × the benchmark manifest's pinned measured fsync p50, and a gate that a registry row makes arithmetically impossible is a registry error that fails CI, never an ambitious target. Any change that adds sequenced commands, durability barriers, external-authority interactions, or per-object identity structure updates the registry in the same change; CI rejects a divergence. Structure lives in the registry; µs and throughput budgets are
slo.tomlrows and are never invariants.