Skip to main content

positions_are_unique_under_concurrent_appends

Function positions_are_unique_under_concurrent_appends 

pub async fn positions_are_unique_under_concurrent_appends<F>(
    open: impl AsyncFn() -> F,
) -> RuleOutcome
where F: Fixture, F::Store: EventStore + Send,
Available on non-WebAssembly only.
Expand description

Concurrent unconditional appends never share a position.

positions_are_unique reads a quiescent store back after a single sequential writer, so it measures assignment and says nothing about assignment under contention. The defect it cannot see is a store that reads its head, suspends, and then allocates from the value it read — the in-process form of SELECT max(position) outside the transaction that will use it, and the shape RacingSequenceStore models.

The batch is two events rather than one on purpose: a store that binds one position for a whole multi-row insert is invisible to a singleton-only writer, which is what SharedBatchPositionStore taught the sequential rules at stage 3.