Skip to main content

append_stamps_a_local_event_id

Function append_stamps_a_local_event_id 

pub async fn append_stamps_a_local_event_id<F: Fixture>(
    open: impl AsyncFn() -> F,
) -> RuleOutcome
Expand description

VT-5 — a locally appended event’s EventId is this store’s incarnation paired with the position this store just assigned.

Two assertions, rejecting two different stores.

That id.position() equals position rejects any identity computed from something other than the assigned position: a content hash (ContentHashIdentityStore), or a batch-wide RETURNING value read once and applied to every row (SharedBatchIdentityStore). It is sound here and only here because every event this rule writes is a local append — for an event that arrived through ingest the two numbers are deliberately different, which is what SequencedEvent’s own documentation explains and why the field is not redundant.

That every event of one open shares one id.store() rejects PerEventStoreIdStore, which mints a fresh incarnation per event. That store satisfies VT-6’s literal MUST — no pair is ever reissued — while destroying everything the type is for: every event becomes its own origin, a peer’s Watermark grows one row per event rather than one per incarnation, and VT-5’s peer-independent sort degenerates to comparing 128 opaque bits.

Two appends rather than one batch, because the incarnation is a property of the store and not of the call.