Skip to main content

committed_rows_and_checkpoint_survive_a_reopen

Function committed_rows_and_checkpoint_survive_a_reopen 

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

A committed read-model row and its checkpoint are both still there after every handle is dropped and the fixture reopens its storage.

PS-1’s durable, read across a reopen. Every other rule in this family observes a commit through a second handle onto the same running store, which is what PS-1’s coupling needs and is exactly what a store that never reaches its medium survives: the process still holds the rows and the checkpoint, so every fresh handle sees them. This rule is the one that looks after the process’s hold has been let go.

Rejects: InMemoryDatabaseStore — an adapter whose committed state lives in process memory, an in-memory database shared behind one handle or a write-back cache never flushed, so a reopen finds the checkpoint NeverRun — and VolatileReadModelStore, whose checkpoint is durable and whose read model sits in a process-local cache, so a reopen finds a checkpoint that claims rows the read model no longer has. The second is the sharper of the two: it is PS-1’s coupling broken by a restart, and it passes commit_is_atomic_with_the_read_model, because before the reopen both halves are present.

§Why it is capability-gated

A reopen needs the fixture’s co-operation — which file to close, which pool to drain — and a store with no medium outside the process has nothing a reopen could read back. So the rule is gated on REOPEN, which CF-17 governs, and a fixture that declines it gets this rule as a reported skip carrying its own reason. MemoryProjectionFixture declines it, so a reference run prints that skip.

The writer is dropped before the reopen, on purpose: a handle that carried the state across would make the rule pass for the wrong reason. The checkpoint is compared against the position the commit was given, held in a binding, never a literal (CF-6).