Function dropped_append_future_leaves_no_partial_batch
pub async fn dropped_append_future_leaves_no_partial_batch<F: Fixture>(
open: impl AsyncFn() -> F,
) -> RuleOutcomeExpand description
Dropping an append future leaves the store fully applied or unchanged,
never partially applied.
ES-22 [FROZEN]. In Rust, cancellation is dropping the future: there is
no cancel token, the caller simply stops polling and the state machine is
destroyed at whatever suspension point it had reached. Nothing runs
afterwards except Drop impls, and the call produces no Result at all —
which is why ES-23’s outcome is unspecified while ES-22’s shape is
not. The store may have committed, and may commit afterwards; what it may
never do is hold two rows of a three-row batch.
What it rejects is an adapter that executes a batch as several statements
with a suspension point between them and relies on running to completion.
YieldingRowAtATimeStore is the compiled version: one row per statement,
awaiting between rows, so a drop after the first poll leaves exactly one
row down. It is not a rename of RowAtATimeStore, which
a_concurrent_reader_never_sees_a_partial_batch owns — that one tests the
visibility of rows that all land in the end, this one tests rows that
never land at all. Neither substitutes for the other.
MemoryEventStore passes trivially, because its append body contains no
.await at all and the first poll runs it to completion — which is
precisely why the reference store cannot answer this question and a real
adapter must.
§Why the future is polled once rather than not at all
An async fn body runs nothing until its first poll, so a future that
is built and dropped has provably done nothing and this rule would be
asserting over an untouched store. One poll is what puts the append in
flight. poll_once answers None when the store suspended and Some
when it finished, and ES-22 permits both.