Aegis: Replication, HA, and the Distribution Doctrine
2,815 wordsA design document: it describes the 1.0 target, not what runs today.
Doctrine: single-node correctness is the base product; replication adds crash-fault durability, availability, and read scale. Canonical logical effects/digests agree across replicas, but repair ESIs, ciphertext encodings, cache state, and physical placement need not be byte-identical. Horizontal sharding is a post-1.0 protocol workstream, not a configuration toggle.
-
One commit state machine with durable Raft state. §5.2 remains authoritative in one-member and multi-member configurations. Transactions advance through
Draft -> Validated -> FinalPrepared -> PreparedRootDurable -> PayloadAvailable -> Proposed(term,index) -> CommandCommitted -> Applied(logical_command_ref,marker_ref) -> Acknowledged. Consensus commits the normative strongly referencedCommitCommand; the standaloneCommitMarker,LogicalStatePayload,LogicalCommandRecord, and outer state root are deterministically created in that acyclic order afterLogicalCommandSeq/CommitSeq/HLC assignment. Before proposal, each donor has root-published itsPreparedCommitRecord, and the leader collects signed/MACedPayloadReceipts binding stablePreparedOwnershipId, base-closure digest, and exactEncodingId/PlacementIdcoverage in named failure domains. The canonicalPayloadAvailabilityCertificateproves the configured recoverability predicate—including quorum one—and is a strong command edge.Raft persistence obeys the no-extra-mutable-file doctrine. Appendix A's exact role-tagged
RaftLogSegment,RaftHardState,RaftSnapshot,RaftStateRoot, configuration, certificate, prepared-root, and audit-visibility-pipeline formats all carry the database/security-namespace/incarnation/role/group domain; no abbreviated ambient schema is normative here. A node syncs the new closure before vote/append/receipt/durability replies. Recovery reconciles log ownership, validates exact command/payload closure, and idempotently applies committed work. The generated log-to-state verifier proves the exact role-specific root/config/prefix at a cut; no later root pairs with an earlier cut. Truncation stops at visible audit-safe state and waits for the generated-complete floor, including prepared transfers, cursors, replay, external continuities, remote trust/retention, backup, keys, and current/prospective configs. Local Raft publication may advance RootSlot without semantic change. Leader loss yields capability-scopedUnknown, never a guess. The doctrine's marginal cost is priced, not ambient: every append reply or reply batch mints a freshRaftHardState/RaftStateRoot/RootManifestclosure plus one serializedRootSlotpublication — per commit at concurrency one, the embedded hot case — and that cost is a gated §17 number, ordered sync operations per commit and per append batch by posture and audit class, derived from Appendix G. In one-member configurations the append-reply publication and the post-apply D2 publication fuse into one slot update under Appendix G's registered fusion law: recovery cannot observe the intermediate state, and the receipted-but-unordered crash window the fusion leaves is exactly the window §5.2's abandonment arms already govern; multi-member configurations must not fuse, because followers reply before commit. A registeredRaftHardFramebootstrap-frame inhabitant — thebootstrap_frames.tomlregistry already anticipates a future registered frame — is a G0/G1 design spike whose outcome is recorded either way and whose honest scope is stated now: the per-append scalars alone do not stop closure re-minting, because thecertificate_attempt_ledger_root_ref,prepared_order_attempt_root_ref, andaudit_signer_journal_root_refroots churn per commit and their publication cadence must be restructured in the same design, and skipping per-batch root publication makes the retained log tail a bootstrap input — recovery-relevant bytes outside the published root closure — requiring new subordinate clauses under FG-INV-08/FG-INV-10, a changed generated log-to-state verifier, and takeover-protocol coverage, with the frame embedding the same database/security-namespace/incarnation/writer-fence tuple asRootSlot. -
Membership and payload authority. SWIM+Lifeguard supplies suspicion/routing/donor evidence only; it cannot change membership. Appendix A's exact
ConfigurationStateincludes database/security-namespace/incarnation, role/group, epoch, stable-or-joint voters/storage sets, member key epochs/failure domains, quorum/recoverability/GC rules, weak predecessor, and transition nonce; it has no self ID. Joint requires independent old/new consensus quorums and the payload predicate over both sets. One-member is the ordinary stable specialization. Every local signed object uses the exact certificate header; every imported leaf uses the embedded canonical configuration evidence. Numeric epoch or equal member list is never authority.A pre-order
ConfigurationTransitionSpeccarries a nonretaining basis identity, current/prospective configuration refs, the candidate closure proof, and expected prefix. Its appliedConfigPayloadFloordoes not retain the spec, basis root, checkpoint, or checkpoint vector: it stores weak state/checkpoint identities plus basis/closed-through logical-command, commit, and Raft positions; strong current/prospective configuration refs; retained suffix endpoints; a self-contained typed mandatory-inventory root; prepared-root generations/stable ownership IDs; and per-domain receipts/acknowledgements. Inventory entries are explicitlyRetainedStrongfor independently mandatory objects orCurrentCheckpointObservation { checkpoint:WeakCheckpointIdentity, vector_digest:WeakDigest, availability_receipt_refs }; neither the observation nor its receipts become a logical reachability edge to checkpoint/vector/prior-floor bytes. The separately strongLogicalStatePayload.recovery_checkpoint_refowns the current checkpoint/vector, and floor validation requires the weak observation to equal and cover that exact current checkpoint. Every operational checkpoint install atomically supplies the paired refreshed floor through §5.4, whose projection excludes the prior floor. Thus replacingF_ncannot create either a direct or indirectF_n -> Q_n -> F_(n-1)retention chain. If the authoritative prefix or current checkpoint advances during transfer, the candidate floor is extended/recomputed before installation; a stale floor cannot authorize retirement.Reconfiguration is
ProposeJoint -> CatchUpLog -> TransferMandatoryClosure -> VerifyFloorAtBasis -> CommitJoint -> CommitNew -> RefreshFloorThroughCommitNew -> CommitRetirementFloor -> RetireOld.CommitJoint,CommitNew, andCommitRetirementFloorare the typed RaftConfigurationTransitionSpecentries themselves, so each semantic configuration transition incrementsLogicalCommandSeq; heartbeats/no-ops do not. The final retirement floor proves that the prospective durability set can recover through the committedCommitNewtransition and every mandatory retained suffix/object and protected retry/accounting/idempotency closure under the new failure-domain policy. Old members cannot leave, discard payload, or advance GC until that final floor command is committed and acknowledged. Statistical suspicion may tune alerts but never authorizes membership, payload retirement, or GC. -
Read contracts and revocation and audit visibility.
LeaderReadandReadIndexReadprovide linearizable data paths. The soleAuthorizationLeaseschema is the signed{consensus_domain:ConsensusDomain,issuer_id,authority_leader_member_id,authority_raft_term,security_leader_epoch,lease_generation,source_token_or_capability_commitment,token_id,authority_bound_header:AuthorityBoundHeader<Role>,permitted_operation_class:ReadOnly,permitted_snapshot_interval,exact_role_bearing_read_bindings,allowed_query_operator_disclosure_scope,result_answer_contract_ceiling,time_authority_profile_oid,not_before,expires_at,signer_id,signing_key_id,signer_epoch,signature}. The signed transcript includes the complete binding and window; root/service/leader/token/ceiling drift invalidates it.FollowerLeaseReadis separately signed and contains{consensus_domain,authority_bound_header:AuthorityBoundHeader<Role>,follower_member/configuration/term/lease identity,closed semantic positions,visible protocol position,retention lease identity,profiled window,authorization_lease_ref,signer fields,signature}. It is legal only when requested visible state/protocol evidence is closed at the signed cut, all bytes/keys are retained, and both leases validate under fresh time guards. Otherwise it contacts the authority leader or fails closed; data staleness never grants security staleness and hidden candidates never leak. Bounded-staleness exposes only the authorized public position projection below. RYW uses the sole exact replay body and aPublicLogicalPositionProjection, never raw Raft/logical/commit/audit counters; presentation permits only routing/wait for an already committed public position under current same-or-narrower authority. Restore/cutover service-epoch change invalidates old capability/lease bytes before observation. -
Writer-anywhere preparation. Followers may prepare
TxnProposals and candidate physical work, but only the leader/global Raft order validates final effects, builds or approves the final capsule, and publishes. Preparation can scale; ordered commitment remains bounded by validation, payload distribution, and Raft. No near-linear committed-write claim ships without a benchmark separating preparation from ordered publication. -
Transfer, anti-entropy, and safe GC. ATP may fetch compatible symbols from multiple donors. Every symbol is authenticated against the exact logical/encoding identity and §5.1 MAC transcript; donor agreement alone creates no authority. Merkle anti-entropy locates missing encodings and logical-digest divergence. Applied/durable positions may gossip through a CRDT cache, but branch heads derive only from committed head CAS records and GC is
CollectTypedRoots(stable_membership_epoch,config_payload_floor) -> ResolveMarkedPhysicalRealizations -> ProposeSafePoint -> ValidateAllTypedRootsAndCuts(prepared,commands,leases,pins,merge,privacy,replay,keys,backups,audit,transparency) -> CommitGcEpochThroughRaft -> Reclaim. Uncertain membership, incomplete new-configuration payload closure, partition, missing root/prepared-owner acknowledgement, external privacy-continuity mismatch, or unavailable key wrap stops reclamation. Backup/restore follows §16, not a decode-proof shortcut. -
Post-1.0 sharding workstream W12. Sharding preserves B1's single version universe through one database-wide meta-Raft order. It is not a federation of independently committed shard histories and does not switch Chronicle to vector time.
-
One scalar semantic clock. In sharded posture,
LogicalCommandSeq, transaction-onlyCommitSeq, and logical HLC are Meta-issued global aliases, not vector clocks. Every canonical mutation passes through Meta; shard Raft indices order durability/apply only and never move time or heads. Meta computes HLC from the previous value and normalized proposal observations. I/O/group-commit batching of already certified entries is allowed, and same-basis certification is legal exactly and only under the virtual-serial batch certification law below; speculative certification and shard-local visible commit are not. -
Snapshot and prepare. When the audit profile requires it, Meta first mirrors one pending operation ticket; only then may it order the
ReadOnly|ReadWriteregistration with the matching read/mutation permit andOperationAuditAdmission. The registration's own control gate is a validated lifecycle-scaffoldingNotRequiredproof and cannot consume the operation ticket. The registered ReadIndex-fenced global snapshot follows; no shard read precedes ticket visibility or registration. A shard read also proves its active Meta topology/policy/revocation/key/audit projection covers the registration prefix and binds the operation-audit commitment. Read-only closes through its separate routing/witness and meta aggregate authorization records, then resolves that same ticket before releasing output. For writes, post-rebase shard effect bases lead to the deterministic routing/cascade/constraint-owner fixed point, aggregate effect digest, one union authorization decision whose ticket-only gate names the already-admitted operation ticket, then resources/outcome compare state. Meta orders the uniqueGlobalPrepareAdmissionwith immutable participant/reservation set and admission generation; its lifecycle gate is likewise a validated nonterminal scaffolding proof. Only after that record is visible may shards build fragments and order prepares keyed(global_txn_id,registration_generation,admission_generation), after first applying every Meta command through admission. Prepared owners keep local fence epochs outside canonical commands. Certificates bind admission prefix, active projection, config/topology, heads/key material, witnesses/constraints/resources/auth and pending-operation-audit commitment. Commit/abort event and terminal gate are built only after certification chooses the outcome. Any drift requires admitted abort/release plus a new registration generation; digest substitution never recertifies stale work. -
Global certification and decision. Commit requires the unique admission/routing/participant set, current distributed-serialization and constraint certificates, exact prefix/heads/key epochs, one aggregate authorization/resource/outcome basis, and one valid prepare per admitted shard. The final effect digest excludes wrapper/audit objects. Once certification chooses Commit or Abort, Meta builds the concrete matching audit event/resolution/gate. The pre-command availability certificate covers only already-built inputs and excludes itself/future command; a stable prepared-owner successor adds the completed command. Apply assigns sequences/HLC and builds marker (commit only), heads, outcome/conflict/constraint state, payload, record, and root—never future shard batches. After terminal audit visibility advance publication, the quorum creates and Meta publishes the unique decision certificate. Shards can then install decision N, apply its exact audit visibility advance, and only afterward export final visible acknowledgements. Abort is constructible even with no prepare and adopts no effect; shard acks are post-decision cleanup gates, never command inputs. The Meta record alone decides outcome.
-
Distributed serializability, not “local SSI plus hope.” Meta-Raft canonically owns
GlobalConflictIndex. For every registered active or recently completed overlapping serializable transaction—including read-only work—it retains snapshot/start/terminal prefixes, participant set, witness frontier, conservative per-shard read/write summaries, and allwr,ww, andrwedges with proof references until no live transaction can add one. Before commitment, the deterministic certifier replays exactmay_affectin both directions against every overlapping prepared/committed/closed transaction and rejects FCW/uniqueness conflicts or any cycle. V1 forbids speculative semantic certification and replaces the fully serial certify-then-apply reading with the registered virtual-serial batch certification law. A certification batch — commit and read-close certificates alike — names exactly one applied basis prefix and the exact ordered certification frontier of decided-but-unapplied predecessor batches; "fully applied" is pinned against Raft durability — an entry is basis-eligible when its command is quorum-durable and its deterministic apply has executed on the certifier's state machine — and decided predecessors enter through the frontier, so certification never waits on a later fsync of its own batch to begin the next. Candidates are certified in canonical meta registration order: candidate i's complete predicate set — SCC acyclicity, FCW/uniqueness, constraint-aggregate folds, expected-branch-head/key-epoch checks, and drift — is evaluated against the named basis folded with the frontier's and members 1..i−1's decided effects, with meta registration order as the deterministic intra-batch loser/abort priority, so no two candidates ever certify against an identical fold state. An intra-batch member naming a branch head already consumed by an earlier member aborts deterministically under the existing drift rule; head identities are apply-assigned and are never pre-chained into a virtual head. The acyclicity check consumes the complete cross-candidate edge set in both directions, intra-batch and batch-to-frontier. Apply order and Raft proposal order equal canonical certification order, and a batch never orders ahead of a frontier predecessor; a frontier predecessor that fails to order voids every dependent certificate through admitted abort/release and a new registration generation — digest substitution never recertifies stale work. Epoch, projection, topology, configuration, and format-changing controls, and every quiescence-proof-bearing escrow or constraint transition, are batch singletons. Speculation remains forbidden: any basis or fold state not derivable from already-decided outcomes, and any omitted cross-candidate edge, rejects the batch. Escrow custody, sequence/HLC assignment, and audit-event bases are batch-safe by construction — exclusive Held custody precedes certification, counters are assigned only at apply throughMetaOrderAttemptInput, and order supplements are never signed into audit bodies. The batch'sGlobalFinalCertificationReservationbatch arm — a registered generalization of Appendix A's single-candidate schema whose member set carries per-candidate sub-holds, each with its own selection and each consumed only by its member's terminal command; the single-candidate form is the degenerate one-member batch — is the single legal owner of the shared final-certification basis under FG-INV-02's exclusive-ownership clause as scoped by its Appendix F row. This is a batching law inside the existing certifier — explicitly not the §3.4-rejected Calvin-style deterministic transaction lane; no second execution discipline exists. Certification of batch n+1 may overlap application of batch n; the residual ceiling is the per-command Meta apply chain, and the §19 W12 gate publishes the serial and batched ceilings side by side. Missing/stale support, partition, or resource exhaustion waits or aborts conservatively; monotone coarsening may add false positives only. Read-only results return only after orderedReadClose. An independent SCC/history oracle checks every history, including same-I/O-batch and same-basis-batch two-writer, rw-cycle, aggregate-overflow, and same-head cases, and additionally checks batch-vs-serial equivalence: a batched history must produce the same commit/abort outcome set and final state digests as its virtual-serial replay. -
Global constraints and branch authority. Each cross-partition unique/referential/cardinality domain has a canonical
ConstraintOwner = H(topology_epoch, constraint_id, canonical_domain_key)shard or an explicitly meta-owned aggregate. The routing certificate lists every owner. Reservations are acquired in canonical(owner_shard, constraint_id, canonical_key)order with meta registration order as the deterministic loser/abort priority; participant prepare durably reserves exact keys/ranges and reports before/after contributions, and only an explicit meta decision releases them. Meta certification compares all reservations and aggregate state at the same global prefix and installs them atomically with the decision. Cross-shard path/predicate constraints run over the same registered witness algebra and complete participant closure; an unsupported or incomplete exact evaluator rejects the schema/transaction rather than approximating. Meta state alone owns branch heads/manifests/key-envelope and grant epochs, schema/topology/security epochs, merge/import idempotency, ID-range fences, global capability-verifier roots, and resource/privacy/audit outcomes/continuity. A shard cache is never authority. Every participant uses §12.3's exactAuthorizedSnapshot/AuthorizedMutationtypes, and hidden data cannot enter routing, witness, constraint, statistics, or error surfaces. -
Apply, visibility, and Ripple. Participant state is keyed by
(global_txn_id,registration_generation,admission_generation). A published decision certificate installs decision N in order (or a no-prepare abort tombstone) but does not bypass later Meta controls. The shard then applies the exact audit visibility advance so visibility reaches N; only the post-visibility root can produceShardAppliedAck. Irrelevant ranges require exhaustive proofs, while topology/policy/revocation/key/audit/remote effects use typed projections and visibility never decreases. Queries choose one global prefix and wait/fail until every routed shard has applied/proved it and retained that history. Meta buildsGlobalLogicalDeltaBatchonly from the complete post-visibility ack/fragment set and publishes it through one Meta control, which alone advances the global Ripple frontier. Delivery/CDC names that Global batch, never a shard fragment. Client acknowledgement waits for delta publication, participant durability/apply, audit visibility, and durable outcome; loss returns scoped Unknown. -
Recovery and nonblocking impossibility. Prepared closures remain pinned through terminal decision, post-visibility participant acks, overlap/retention floors, and staged GC. No prepared participant times out or guesses; it recovers Meta's decision.
NeverRegisteredFloorremoves only proved staging, whileClosedAttemptCompactionFloorreplaces detailed terminal history only after decision/publication/all admitted acks/overlap close and retains capability-safe summary proofs; neither decides Prepared work. Meta/Shard reconfiguration uses explicit prepared-ownership transfer and remote-config trust/adoption before old retirement. Distributed GC uses certified preflight -> Meta authorization -> per-shard durable apply/ack -> Meta completion, with remote targets released only through the six-stage handshake. Partitions may block; they cannot reverse decisions or reclaim uncertain state. -
Topology and repartitioning. Source-range partitioning is the base edge-cut/vertex-owner scheme; optional hub vertex-cut uses separately versioned replicated-vertex metadata and a single canonical edge owner. Movement uses three separately ordered, evidence-complete commands:
TopologyCopyBeginfixes copy basisF, source checkpoint/suffix inventory, joint configurations, and transfer plan while the old owner remains sole write authority;TopologyCutovernames canonical transfer/catch-up certificates plus the exact active-attempt closure at prefixS, stops old-epoch admission, and switches ownership only atS+1;TopologyRetireOldnames every new-owner/meta/backup/key/retention acknowledgement and the final retirement floor. Apply records only evidence already named by its command. No transaction straddles topology epochs, and old bytes/keys cannot retire before the third command. Allocation ranges are meta-fenced before use. -
Scope and exit. These choices are normative now; only their implementation is post-1.0. W12 cannot ship until the dedicated gate in §19 proves meta/shard reconfiguration, every crash/partition point, distributed SCC/constraint histories, cross-shard branch/merge/key/audit behavior, Ripple frontier atomicity, and topology moves. Until that gate passes, a database advertises
sharding=falseand rejects a topology with more than one data shard rather than weakening any 1.0 guarantee.
-