Skip to main content

batch_reads_reflect_pending_writes

Function batch_reads_reflect_pending_writes 

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

An open batch can be read through, and sees its own pending writes.

PS-12. A projection that maintains a counter, a running total or any other read-modify-write does get then set inside the batch, and a store whose batch get answers from committed state loses every write the batch has not committed yet — silently, and worst exactly when the chunk is large.

Rejects: CommittedReadBatchStore — a batch get that goes to the store. It is the natural shape rather than a contrivance: one round trip on the connection the batch is already holding is what an adapter author writes, and it is right for every projection that never reads what it wrote.

The assertion is on the value written, not on is_some(): a store that answered Some(0) for every key would pass a presence check while losing the write.

§What a skip here does not cover, stated rather than left to be inferred

Declaring READS_THROUGH_BATCH false is a conformant answer — PS-12’s second arm permits a batch with no read path at all — and this rule then reports a skip. What that skip does not say is that the adapter is safe for read-modify-write projections. It says the opposite: such an adapter has no read path for a projection’s apply to use, which is the situation §4.4 describes going wrong, and rebuild_is_chunk_size_invariant is unverified for it for exactly the same reason.