Normative · Part
Protocol semantics
This page defines how a receiver turns a set of delivered events into materialized state, and why the result does not depend on the order they arrived in.
12. The apply chokepoint
Section titled “12. The apply chokepoint”Every transport MUST deliver received events through one apply path performing these checks in this order:
- Signature verification. COSE_Sign1 verification per
authentication: resolve the protected
kidin the trusted-peer keyring and verify withexternal_aadset to the localmesh_id. An event that fails — unknownkid, invalid signature, or an HLC above the signer’s cutoff, whether retirement or removal pinned it — is dropped and surfaced, never held. Where thekidresolves to a row withremoved_at_hlcset and the verifier holds an active removal closure for that row, step 1 makes one check more, after the signature verifies and the cutoff admits the HLC. If the closure names the event’s(table_schema, table_name)andfloor_hlc <= hlc_physical_ms <= removed_at_hlc, the event passes only if itsevent_idis in that table’sapplied. Otherwise it is dropped and surfaced as not in closure. Every other event of a removedsite_id— no active closure, a table the closure does not name, an HLC below the table’s floor — passes as before. Theevent_idis the one step 4 keys on, derived here from theSig_structurethe signature has just verified over, so it costs one hash and parses nothing. - Clock-skew bound. Reject
hlc_physical_msmore than 300 000 ms in the receiver’s future. - Scope check. Events outside the receiver’s syncable scope are dropped and logged, not raised as errors.
- Idempotent insert keyed on the derived
event_id— BLAKE3 of the event’sSig_structure, which step 1 verified. Duplicates are no-ops, and an event re-signed over the same content is a duplicate. - HLC observe. Merge the event’s HLC into the local clock. An HLC beyond the observe bound is not merged: the event is applied, this step is skipped, and the condition is surfaced.
Order matters at two points. Signature verification is first so that no later check consumes attacker-controlled input it has not authenticated. And step 3 drops rather than raises specifically so that a hostile peer cannot wedge the apply loop by sending one out-of-scope event: an exception there would halt processing of everything behind it, which converts a filtered event into a denial of service.
A single apply path is itself normative. Two paths mean two places for these checks to drift apart, and the checks are the security boundary.
13. Materialization and conflict resolution
Section titled “13. Materialization and conflict resolution”Events are materialized in HLC order, grouped per (site_id, schema, table).
13.1. Per-column last-writer-wins, bounded by the tombstone clock
Section titled “13.1. Per-column last-writer-wins, bounded by the tombstone clock”Each (schema, table, row_key, column) carries a column clock. A column value
is written only if its event’s HLC — including the site_id tiebreak — beats
both the stored column clock and the row’s tombstone clock. Two distinct
events from one site under one HLC, which carry distinct event_ids, are ordered by
their event_id, the final tiebreak of the
total order, and every clock comparison
on this page — column, existence, tombstone and rebuild — uses that full order, never
the HLC and site_id alone.
Column clocks advance only for writes that are actually applied. A rejected write leaves the clock untouched, so a losing event cannot raise the bar for a later legitimate one.
Resolution is per column, not per row. Two nodes editing different columns of the same row while partitioned both keep their edit; whole-row LWW would discard one arbitrarily.
A column value MAY be null, and an upsert carrying an explicit null for a column is
an ordinary write of that column: it is subject to the same two clock
comparisons, and on winning it advances that column’s clock like any other value.
The null form of payload in section
7 is the tombstone encoding and constrains the
payload as a whole; it says nothing about a cell inside a payload map. The two are
not interchangeable. Clearing one column is a write bounded by that column’s clock,
where a delete tombstones the row, moves the tombstone clock, and clears every
column the tombstone clock beats — so a mesh with no way to write a null cell would
have to delete the row to clear a field, discarding concurrent writes to its other
columns and reintroducing exactly the whole-row loss this section exists to prevent.
A null therefore carries no information about which event wrote it, which is why
backfill selects a row’s covering set on the
column clock rather than on the column value.
13.2. Causal-length existence
Section titled “13.2. Causal-length existence”Row existence is tracked separately from column values, and the highest-HLC
existence event wins. A delete tombstones the row; a later, higher-HLC upsert
resurrects it.
This row tombstone is the sync layer’s construct and resurrection is its defined behaviour. It is not the object plane’s permanent identity tombstone, which no later write may resurrect — the two share a word because both mark a deletion, and nothing else (terminology).
A resurrection SHOULD be surfaced to the application rather than applied silently, because a row reappearing is usually either a genuine re-creation or a sign of a clock problem, and the application is the only layer that can tell which.
13.3. The tombstone clock
Section titled “13.3. The tombstone clock”Each row additionally tracks the highest-HLC delete ever applied to it,
independent of whether that delete won existence.
A delete — winning or losing — MUST clear (set to null) every column whose clock it beats, and advances the tombstone clock if it exceeds it.
This is what makes a delete’s column-clearing effect independent of arrival order. A column write below the tombstone is rejected whether it arrives before the delete or after it. Without a separate tombstone clock, “delete then late-arriving write” and “late-arriving write then delete” produce different states, and the protocol loses convergence.
13.4. Resurrection rebuild
Section titled “13.4. Resurrection rebuild”When an upsert resurrects a tombstoned row, the receiver MUST rebuild the row’s columns from its retained event log. For each column, the value is supplied by the highest-HLC upsert that:
- carries that column, and
- beats the tombstone clock, and
- passed the apply checks, and
- is not below the eviction horizon of the stream that authored it.
This restores concurrent post-tombstone writes that arrived while the row was absent. Without the rebuild, a write that arrived during the tombstoned interval is lost even though it causally succeeds the delete — a cross-site delivery-order defect that is invisible in single-node testing and only appears when two peers interleave a delete and a write.
The last bullet is a retention bound, and it is where two nodes holding the same events stop agreeing. A rebuild is complete when the row’s tombstone clock is at or above the highest eviction horizon any stream of its table holds: every candidate, whichever stream authored it, then lies above its stream’s horizon and is still retained. When the tombstone clock is below that horizon, a candidate window has been discarded, the rebuild is partial, and a column whose only surviving evidence lay in that window comes back null. The highest horizon is the bound because a receiver cannot tell which stream wrote an evicted candidate: the event is gone.
A receiver MUST NOT present a partial rebuild as a complete one. It MUST surface the resurrection as partial, naming the row and the horizon that truncated it — the signal 13.2 asks for, raised to a MUST here because the application is not being told that a value is surprising but that a value is missing.
That bound is stated against the horizon, not against which bytes happen to survive. Eviction is lazy in every practical implementation, so a receiver will often still hold events below its own horizon; it MUST NOT feed them to a rebuild. Admitting them would make the result depend on local reclamation timing, which no peer shares, in place of the declared horizon, which is at least stated.
13.5. Convergence
Section titled “13.5. Convergence”With the preceding rules, materialized state is a pure function of the delivered event set and the receiver’s eviction horizons. On a node that evicts nothing the horizons drop out and it is a pure function of the delivered event set alone. Any delivery order permitted by delivery — per-peer in-order, arbitrary cross-peer interleaving, at-least-once duplication — converges to the same state.
“The delivered event set” is the whole input only for the columns the receiver’s schema actually has; a receiver that lacks a column applies the rest of the event and rebuilds the column when it gains one (13.6).
A table outside a receiver’s interest is outside its convergence claim. The receiver may have evicted the history it received for the table, and nothing re-delivers that history until the table is listed again and the backfill the widening starts has completed. Until then, its rows of that table agree with a peer’s only where the receiver authored the events behind them.
Agreement between two nodes therefore rests on two preconditions, not one.
A node MUST NOT reuse an HLC across distinct events. Two rules in the data model discharge it, and both are required: the tick discipline while a node runs, and clock durability across a restart. The second exists because the first is a rule about a value in memory: a clock re-initialized from the wall clock, or restored from a stale backup, satisfies the tick discipline exactly and still re-issues HLCs the node has already released.
Distinct events are distinct event_ids. An event re-signed over unchanged
content derives the identifier it already had and is one event, so re-signing is not
a reuse; signing different content under a used HLC is.
The event_id tiebreak bounds what a
reuse costs, and does not make it safe. Two distinct events from one site under one
HLC still have a defined order, so receivers holding both agree on the row. They do
not agree with a receiver that holds only one, and nothing on this page tells either
side that a second event exists. A receiver therefore MUST surface a reuse when it
sees one: on applying an event whose row already holds a retained event with the
same site_id and HLC and a different event_id, it MUST surface the row, the
site_id, the HLC and the event_ids of every event sharing them, as evidence of a
section 9.1
violation by that site. It MUST NOT refuse either event on that ground: which one a
receiver refused would depend on which arrived first, the divergence the tiebreak
exists to remove. A receiver that holds the pair surfaces it once, whichever order
the two arrived in.
Both hold the same horizons. Eviction is the one permitted departure from the pure-function property, and it is a deliberate trade rather than an oversight: a storage-constrained node gives up exactness on old rows to hold the table at all. Two nodes with the same delivered event set and different horizons differ in exactly two ways, both confined to rows whose history reaches below the higher of the two horizons. An event arriving below a node’s horizon counts as applied and writes nothing, where a node with the lower horizon applies it. And a resurrection rebuild whose tombstone clock sits below the horizon comes back partial, where the node with the lower horizon rebuilds the column. Rows whose history lies entirely above both horizons are unaffected, which is the bound worth stating: divergence is confined to evicted history, not spread across the table.
The divergence is accepted rather than automatically repaired, and it is worth being exact about why, because the obvious candidate does not do it. Widening backfill fires on a policy widening and not on a difference between two nodes, so nothing triggers it here; and a re-sent event landing below the receiver’s horizon is counted applied and written nowhere, so while the horizon stands the receiver defeats the re-delivery whatever the sender sends. The repair that does exist is deliberate and operator-driven: rehydration drops the horizon back to zero and takes the history from a peer that still holds it. Where no peer still holds it, nothing restores it.
SSP/1 defines no state digest, so a difference is not detectable on the wire either. The partial-rebuild signal in 13.4 is the only notice an application gets, which is why it is a MUST there rather than a SHOULD.
Implementations SHOULD verify convergence by property-based testing over randomized delivery orders rather than by example, because the failure modes live in interleavings a hand-written test is unlikely to pick. Such a test MUST fix the horizons equal across the nodes it compares, or it is exercising the horizons rather than the merge.
13.6. Held and dropped groups
Section titled “13.6. Held and dropped groups”| Condition | Behaviour | Watermark |
|---|---|---|
| Destination table missing | Group is held and retried in a later cycle | Does not advance past it |
| Destination table withdrawn | Event counts as applied, writes nothing and is not retained | Advances past it |
hlc_physical_ms beyond the skew bound |
Event is rejected and surfaced, and not retained | Does not advance past it |
| Signature verification fails | Event is dropped and surfaced | Advances past it |
Event of a removed site_id in a window an active removal closure closes, and not in its applied |
Event is dropped and surfaced as not in closure | Advances past it |
row_key is null or an empty map |
Event is dropped and surfaced | Advances past it |
row_key names any column the destination table does not have |
Event is dropped | Advances past it |
payload names columns the destination table does not have |
The columns it does have are applied; the rest are ignored and their column clocks left untouched | Advances past it |
A missing table and a withdrawn one are different conditions and MUST NOT be read as each other. A missing table is one the receiver does not have yet, and holding keeps the group until a migration adds it. A withdrawn table is one the receiver’s schema has marked as never coming back, so holding would retain and re-request its events forever. Only an explicit mark makes a table withdrawn (scope §17.1), and a table that is merely absent is missing.
The not in closure row is a drop, not a reject, because its condition cannot clear. The allowed set is fixed by one closure whose first accepted instance stands (identity §22.3), so no later cycle can admit the event, and a reject would have the sender re-offer every forgery on every cycle (§14.3), forever. Nothing is held either, so the forger pays and the removed node’s honest stream does not stall.
The signature row deserves its rationale, because holding would seem safer and is
not. Events are attributed by their signed kid, not by the connection that
delivered them — so if verification failures held the attributed site’s group, a
forger could stall the victim’s legitimate stream by sending garbage carrying
the victim’s kid. A forgery must cost the forger, not the node it impersonates.
row_key is the only thing that names a row, and every rule in this section is
keyed on (schema, table, row_key, column). A null or empty key therefore addresses
nothing: no column clock, no existence bit and no tombstone clock can be located for
it, so refusing it is the only behaviour left to define. The data
model types row_key as a non-empty map for
both operations for that reason.
The alternative — reading a null key as an inert marker event that materializes
nothing — is rejected deliberately. Such a marker is a signed, in-scope, watermarked
event carrying an arbitrary payload that no receiver rule ever inspects, which is
a covert channel through the sync plane with nothing to weigh against it: SSP/1 has
exactly two operations and both mutate a row.
The key-resolution row is an adversarial-key defense: a peer that sends events keyed on non-existent columns must not be able to stall the watermark forever. No destination mutation runs, and the watermark advances. The condition is any missing column rather than all of them, because the partially-resolvable composite key is the dangerous case — a receiver that discarded the unresolvable components and matched on the remainder would address every row sharing the surviving prefix, turning one event into a mass update. Either the whole key resolves or the event does not apply.
Unknown payload columns are applied in part, and the reason is that the benign
case is the common one: two nodes at different schema versions. A node that has not
yet run the migration adding a column still receives events carrying it, and both
dropping the event and holding the group would make an ordinary rolling upgrade lose
or stall data the receiver could have applied.
Holding is specifically unavailable here in a way it is not for a missing table.
Groups are per (site_id, schema, table), so a group held for a table that does not
exist contains only events for that table — a peer naming a fictional table stalls a
fictional group. A column lives inside a real table’s group, so holding on an
unknown column would stall a legitimate stream, which is precisely the stall a
hostile peer is after.
What makes partial application safe is the rule already stated in 13.1: a column clock advances only for a write actually applied. An ignored column leaves its clock untouched, so ignoring it never raises the bar for the same value arriving later.
An upsert asserts row existence independently of its columns (13.2). An upsert whose payload names no destination column at all therefore still applies: the row exists and its key columns are written, and no value columns are. That is not a special case — it is what partial application says when the intersection is empty.
Such a row is existent and empty, and empty is not the same claim as cleared. 13.3 makes a null a real, clocked assertion — a delete sets it — whereas a column the local schema never materialized carries no clock at all. Both surface to a reader as an absent value, so a receiver MUST NOT present an unmaterialized column to the application as a default, a zero, or a cleared value. The distinction lives in the column clock and the receiver is the only layer that can see it, which is the same reason a resurrection is surfaced rather than applied silently.
A receiver SHOULD also meter the events whose payload columns it ignored. Ignoring is expected and transient while a mesh rolls through a schema upgrade, and it is a schema-drift fault when it persists; the individual event looks identical in both cases and only the rate over time separates them.
That leaves the ignored value itself. The watermark advanced, so the sender will not re-offer the event and the receiver’s own retained log is the only remaining copy. A receiver that gains a column by migration MUST rebuild it from that log by the resurrection rebuild procedure — the highest-HLC upsert that carries the column, beats the tombstone clock, passed the apply checks and is not below the eviction horizon. Values whose events fall below that horizon are not recoverable, which is eviction working as specified rather than a defect of this rule. Retention has a cost on the other side of the ledger: the log now demonstrably holds column values that appear in no local table, which is why security §43.2 scopes at-rest protection to the log and not to the materialized store alone.
Convergence is therefore a pure function of the delivered event set and the receiver’s schema. Two nodes holding the same events under the same schema agree. Two nodes holding the same events under different schemas agree on the columns they share, and agree completely once the narrower one migrates and rebuilds.
The skew row is the one condition that may resolve and is nonetheless not held. The receiver keeps nothing — a retained far-future event is storage a hostile peer chooses the size of — so the retry unit is the sender’s next sync cycle rather than a receiver-side queue, and not advancing the watermark is what leaves the event in the set the sender still re-offers. The rationale in full, including why advancing would acknowledge the site’s whole backlog, is section 11.1.
Held-versus-dropped is the distinction to get right. Holding is for conditions that may resolve and that a hostile peer cannot induce against a legitimate stream — a table that has not been created yet. Dropping is for conditions that will not resolve, and for anything a hostile peer could otherwise weaponize into a stall. Rejecting is the third verb (section 38): like dropping it retains nothing, and like holding it leaves the watermark where it is.
13.7. The removal-closure quarantine
Section titled “13.7. The removal-closure quarantine”A removal closure refuses events from the moment it is active, and a peer may already have applied some of the events it refuses. Peers reach a removal in different orders: one pinned the cutoff by its own act and applied the removed node’s in-flight events before the closure arrived, and a later joiner received part of the backfill before it received the closure. A drop is never re-offered and nothing un-applies, so without this section each would hold a different subset of the removed node’s rows forever.
When a closure becomes active for a row, the peer MUST, for every table the closure
names, find every change event of the removed node it has already applied with
floor_hlc <= hlc_physical_ms <= removed_at_hlc whose event_id is not in that
table’s applied, and quarantine each one. A quarantined event stays in the
retained log, flagged, and is excluded from materialization. The peer surfaces every
quarantined event, so that the window is enumerable at every peer and not only at the
one that noticed.
For every column whose standing value a quarantined event supplied, the peer MUST re-resolve the column from its retained log with quarantined events excluded, by the method of the resurrection rebuild: the highest-HLC surviving upsert that carries the column, beats the tombstone clock, passed the apply checks and is not below the eviction horizon. Row existence and the tombstone clock are re-derived from the surviving events in the same way. A column with no surviving candidate becomes null, and the rebuild is partial: the peer MUST surface it as partial, naming the row and the horizon, exactly as section 13.4 requires of a partial resurrection.
With the quarantine, every peer’s materialized state for the closed tables of the removed node converges on the same thing whatever order the closure and the events arrived in: the events the closure lists, intersected with the events that peer was delivered. A quarantine is retained rather than deleted, and the closure that caused it is signed, so it is attributable and reversible in principle. No rule in SSP/1 lifts a quarantine.
14. Delivery
Section titled “14. Delivery”14.1. Cursors
Section titled “14.1. Cursors”A sender maintains one durable cursor per peer per transport path, and that cursor —
not anything the peer advertises — is what
selects the events the sender offers. A cursor for
a peer the sender has never sent to starts at genesis, so a node joining an
established mesh receives that sender’s history from the beginning rather than only
what was produced after it arrived. A cursor MUST NOT be initialised or advanced from
a peer’s advertised have_max_hlc.
A cursor is a position in the sender’s own arrival order, and MUST NOT be an HLC. A sender gives every event it retains, authored or received, an arrival position above every position it has given before, and selects for a peer the events whose position is above that peer’s cursor, lowest position first. Arrival positions are local: they never cross the wire, and they mean nothing on another node. They are durable in the same sense the cursor is. An event retained after a restart takes a position above every cursor the sender holds, whether or not the events that held the earlier positions have since been evicted.
An HLC cannot serve as the cursor because it orders events by when they were stamped,
not by when this sender came to hold them. A sender that relays absorbs other sites’
events after its cursor for a peer has moved on. An event stamped below that cursor,
produced earlier and delivered to the relay later, is then never selected for that
peer, on that cycle or any later one. The gap is permanent, which is the failure
section 32 names for have_max_hlc, reached
through a different scalar. Arrival order has no such hole: an event is selected
because this sender has not yet offered it, whatever its stamp. And because no two
events share an arrival position, the bound is exclusive with nothing to lose at the
boundary.
Cursors advance only after a successful push, to the highest arrival position the push carried. A failed push leaves the cursor untouched, so the same batch is re-offered on the next cycle.
Delivery is therefore at-least-once, and correctness rests on receiver idempotency rather than sender exactly-once. That is the cheaper and more robust half of the trade: idempotency is a local property a receiver can guarantee alone, whereas exactly-once delivery requires agreement the transport cannot provide.
There is no retry-backoff protocol. The retry unit is the next sync cycle.
14.2. Applied watermarks
Section titled “14.2. Applied watermarks”A receiver advances a local applied watermark per contiguous applied chunk, and
reports it to peers. A watermark is an HLC value per (site_id, schema, table)
meaning “everything from this site for this table at or below this HLC has been
applied”.
Watermarks MUST be monotonic and MUST fail closed: the absence of a watermark means not-applied, never applied. A receiver MUST NOT infer progress it cannot demonstrate.
A watermark only ever adds to what a sender offers. It is the peer’s claim about the peer, so a sender MUST NOT leave an event above its cursor out of a selection because a watermark says the peer holds it: a peer that over-reports would otherwise stop receiving events it does not have. What a watermark does decide is which events behind the cursor come back (section 14.3), and it lets an operator see how far behind a peer is.
14.3. Re-offer
Section titled “14.3. Re-offer”A successful push moves the cursor past every event it carried, whatever the receiver did with each one. Most outcomes are final: an applied event is applied, a duplicate was already there, and a dropped event is dropped by a rule that will not change its mind. Two are not. A rejected event is refused by a condition that may clear — the clock skew bound above all — and the receiver keeps nothing of it. A held event waits on the receiver for a condition that may never come. Neither settles its stream’s watermark, and the cursor alone would never offer either again.
So a sender MUST re-offer, on a later cycle, every event behind its cursor for a peer whose HLC is above the watermark that peer last reported for the event’s stream. A stream the peer has reported no watermark for counts as below every event, because absence means not-applied. The re-offer is the retry the skew rule’s “self-healing rather than lossy” rests on.
Two constraints bound it:
- Re-offers never displace the cursor’s selection. A sender spends on them only the room in a batch that the events above its cursor leave. New events are not delayed by a stream that never settles.
- Within that room, each stream’s lowest candidate comes first. A sender selects every candidate stream’s lowest such event before any stream’s second. A watermark advances only when the event at its lowest gap applies, so that is the event worth sending, and a stream held forever costs one event per cycle rather than the whole room.
A re-offer is an ordinary offer, and it moves no cursor: the event is already behind the cursor that would carry it. The receiver applies it if the condition has cleared, and answers it as it did before if it has not; apply is idempotent, so the repeat costs bandwidth and nothing else.
What the rule does not repair is a watermark that claims too much. A receiver whose mark already stands above an event it never applied, because a later event from the same stream settled first and a mark never moves backwards, reports a mark the re-offer reads as covering that event. That needs a site’s events to reach a receiver out of HLC order and the earlier one to be the one refused, which the skew bound cannot produce: an event below one already accepted is within the bound too.