Skip to main content

reset_clears_rows_and_checkpoint_together

Function reset_clears_rows_and_checkpoint_together 

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

A reset applies the caller’s batch and returns the checkpoint to Checkpoint::NeverRun as one unit of work.

PS-16. The pairing is the claim: both halves, or neither. A store that clears the rows and leaves the checkpoint is the runbook procedure — two statements on two connections — and it is what Norvant’s night desk ran at 02:46:31 before the pod died at 02:46:33: the runner restarted, read the old checkpoint, resumed past it, applied sixty-one events into an empty table and reported healthy (spec/E2E-CASES.md:458-481).

Rejects: TwoStatementResetStore — a reset that applies the caller’s deletes and never touches the checkpoint. CommitAtFirstResetStore fails it too, at the same assertion and for its own reason, and its registry row says so.

§PS-16’s failure-injecting half, and why it needs no new capability

The clause pairs its rule with “a failure-injecting variant asserting that a reset that errors leaves both halves as they were”, and the projection fixture’s capability set — SECOND_HANDLE, RESET_REFUSAL, COMMIT_FAULT — contains nothing that arms a failing reset. Minting a fourth constant inside a rule-writing story is what commit-rollback-and-drop-rules refused to do and what the design record’s 2026-08-14 amendment exists for, so this rule reaches the same observation through the port’s own error path instead: a batch begun on a different store instance is rejected as ResetError::ForeignBatch, and that is a reset that errored, which any conformant store can produce and no fixture has to arm.

The two halves are asserted in that order — errored first, successful second — so “unchanged” is a recorded state rather than the empty one. Both are read through fresh handles.

What it deliberately does not assert. That the committed rows were there to begin with. The before-state is read back and compared against, rather than asserted to be Some, so a store that committed no rows fails commit_is_atomic_with_the_read_model — the rule that owns that defect — instead of failing here for a reason this rule is not about.