Skip to main content

interleaved_appends_on_one_handle_elect_one_winner

Function interleaved_appends_on_one_handle_elect_one_winner 

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

Two append futures from one handle both complete, and exactly one wins.

ES-36. This is racing_conditional_appends_elect_one_winner’s question asked of a store that is genuinely re-entered rather than called twice in sequence, and MemoryEventStore cannot surface the difference: its append body has no suspension point, so it holds no lock across one.

§What it rejects, and the asymmetry that matters in production

A RefCell-backed adapter that holds its borrow across an awaited storage call — AwaitAcrossBorrowStore — panics here on the second poll. For a pooled SQL adapter holding one connection the same defect is a deadlock, not a panic, and that is the one place in this catalogue where a real adapter hangs where the mutant falls over. A hung test reports a timeout and names nothing; this rule is why the workspace’s instrument for the shape is a RefCell rather than a pool.

More subtly it also rejects a store that drops the borrow around the await and thereby leaves a window between its condition probe and its write, so that both writers see a store missing the other’s row and both commit. PreCommitPositionStore is that store, and the winner assertion is what catches it.