Skip to main content

append_is_atomic_under_a_mid_batch_fault

Function append_is_atomic_under_a_mid_batch_fault 

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

A batch interrupted by a fault part way through lands whole or not at all.

ES-18’s second rule, and the complement of append_is_atomic rather than its successor. That one reaches the write path through the condition, which rejects a store that writes before it decides (WriteThenCheckStore is the compiled version). This one reaches the case a condition can never produce: two rows written, the third failing, and the store obliged to undo the first two. Whoever is tempted to merge them should read ES-18, where the merge was made once and reversed by compiling a store.

It rejects a per-row INSERT loop with the BEGIN forgotten — the same shape a_concurrent_reader_never_sees_a_partial_batch catches from the visibility side, where every row does eventually land. Here a row does not land, and rollback is the only thing that can save the store.

§Why it is capability-gated, and why the capability is the fixture’s

Nothing an outside caller holds can reach between two rows of one append; that is the property under test. So the injection belongs to the adapter — a trigger that raises on the third insert, a constraint armed for one write — and MID_BATCH_FAULT is where a store says whether it has one. A store with no way to fail a single row declines and this rule reports a skip, which is an honest hole rather than a silent pass.

§Both answers are checked, and neither is assumed

A store may swallow the fault and commit the batch anyway — retrying the row, say. That is conformant. What is not conformant is disagreeing with itself: Err and a partial log, or Ok and a partial log.