Skip to main content

reissued_conditional_batch_lands_once

Function reissued_conditional_batch_lands_once 

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

A conditional append whose condition matches its own events is at-most-once under verbatim reissue.

ES-24 [FROZEN], and the guarantee costs nothing to provide because it falls out of the condition the caller already wrote. After a dropped future (ES-22, ES-23) the caller does not know whether its append landed. Reissuing the identical batch resolves it: a refusal means the first attempt landed, Ok means it had not and now has. Either way the store holds exactly one copy, and the caller needs no identity, no idempotency key and no new API — which is what makes this clause severable from EventId.

What it rejects is a store that writes before it decides. WriteThenCheckStore — autocommit plus a separate probe — extends its log and then evaluates the condition, so the batch’s own events are in the set the probe reads and the first attempt is refused while its rows stay down. A caller following the documented resolution procedure reads that refusal as “my write already landed”, stops, and has written nothing at all on the one path where the answer matters.

§Two deliberate choices in the arrangement

The store is seeded first, so that no assertion here runs against an empty store: condition_against_an_empty_store_admits_the_append owns that degenerate case and NullAggregateProbeStore is its mutant, and a rule that started empty would fail it for a reason that is not this rule’s.

The second attempt is asserted with is_err, not with a match on ConditionViolated. Which error a rejection is reported as is ES-25’s MUST and condition_rejection_is_reported_as_condition_violated owns it; demanding the discriminant here would make ViolationAsStoreErrorStore fail a rule about reissue for a reason that has nothing to do with reissue.