Function failed_commit_leaves_both_unchanged
pub async fn failed_commit_leaves_both_unchanged<F: ProjectionFixture>(
open: impl AsyncFn() -> F,
) -> RuleOutcomeExpand description
A commit that reported failure left the read model and the checkpoint
exactly as they were.
PS-1’s second conjunct, on its own: the clause’s “or not at all” arm
is a claim about the failed commit, and no other rule in this family ever
sees one. commit_is_atomic_with_the_read_model observes the coupling
after a commit that succeeded, which is the first conjunct; a store can
keep that one perfectly and still leave a half-applied batch behind
whenever a write fails, and every rule above it would stay green.
Rejects: PartialCommitStore — an adapter that applies its
read-model writes row by row and writes the checkpoint last, so a failure
on the checkpoint write leaves the rows durable while commit reports the
error honestly. It is the same adapter family CheckpointOnlyStore comes
from — a read model that does not live in the store the checkpoint lives
in — with the failure arriving one statement later, and it is what any
adapter that forgot the transaction does the first time a write fails.
§Why this rule is capability-gated, and the capability is the fixture’s
Nothing a caller holds can make a conformant commit fail; that is the
property under test. So the injection belongs to the adapter — a trigger
that raises on the third row, a CHECK armed for one write, a connection
killed between the two halves — and
COMMIT_FAULT is where a store
says whether it has one. A store with no way to fail a commit declines and
this rule reports a skip, which is an honest hole rather than a silent
pass. MemoryProjectionFixture is exactly such a store, so the reference
run prints that skip: the oracle cannot demonstrate this conjunct, and
saying so is the whole of CF-18.
§Why the armed commit is required to fail
The Err assertion below is a demand on the fixture, not on the
store, and the distinction is what keeps the rule inside PS-1. A store is
free to absorb a fault and commit anyway; what it may not do is have a
fixture that declares COMMIT_FAULT and arms something the store shrugs
off, because “no fault fired” and “the fault fired and everything landed”
are the same Ok over the same full state, and a rule that accepted both
would be a green result about a store nothing had ever faulted. That is
CF-39’s argument on the event-store side, where it is a second rule
(arming_a_mid_batch_fault_makes_the_append_fail) because ES-18 states
the swallow permission in the clause itself and the two claims had to be
separable. PS-1 states no such permission, so the demand is folded in here
as this rule’s precondition rather than split into a rule of its own — and
the residue that split would have bought is named rather than hidden: a
fixture whose arm_commit_fault has an empty body is caught by this
assertion, but no fixture-level mutant is registered for it, because
nothing in the workspace declares the capability yet except the mutant
harness. The trait’s provided body panics, which is what catches the
commoner mistake of declaring the capability and forgetting the override.
What it deliberately does not assert. Progress. The checkpoint is
compared against what a fresh handle saw before the faulted commit,
exactly as rollback_leaves_both_unchanged does, so a store that
committed nothing has an unchanged checkpoint here and is rejected by
commit_advances_the_checkpoint instead, which is the rule that owns
that defect.