Skip to main content

commit_is_atomic_with_the_read_model

Function commit_is_atomic_with_the_read_model 

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

The read-model write and the checkpoint write become durable together, or neither does.

PS-1, and the invariant the whole port exists for. A read model and its checkpoint that can disagree is a projection that either replays applied events after a restart or skips events forever, and no amount of ordering or retrying fixes it.

Rejects: CheckpointOnlyStore — a store that commits the checkpoint and discards the write set, which is the natural shape for any adapter whose read model lives somewhere other than its checkpoint table. It is named by the specification (§4.11) and registered in tests/projection_mutation_coverage.rs, where its declaration also records the two further rules it fails — a store that applies no rows fails any rule that reads one back.

What it deliberately does not assert. Only the coupling. “Both absent” is a legal outcome here — PS-1’s MUST is a coupling rather than a progress obligation — and asserting presence would make this rule fail for a defect commit_advances_the_checkpoint already owns. A rule that fails in two places for two reasons tells an adapter author neither.

Both halves are read through fresh handles, and through ProjectionProbe only — never an inherent method on a concrete store, which no adapter in the field has.