Skip to main content

reset_is_not_commit_at_first

Function reset_is_not_commit_at_first 

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

reset is distinguishable from commit(empty_batch, id, FIRST, Live), in the checkpoint and in the replay that follows it.

PS-19 and PS-20. The substitute is the one every deployment reaches for — six scenarios out of six reached for it and all six got it wrong (RUNBOOK.md:3904-3907) — and it is wrong in the way nobody ever finds: the checkpoint reads back as a position, the runner resumes strictly after it, and event 1 is skipped permanently and silently (spec/E2E-CASES.md:437-456).

Rejects: CommitAtFirstResetStore — a reset implemented as commit(batch, id, FIRST, Live). It compiles, it returns Ok, and the checkpoint moves, so every rule asserting only that something changed passes it. TwoStatementResetStore fails it too, at the same assertion: a checkpoint that never moved is Live as well.

§Both halves, and neither is sufficient alone

The state half compares the two checkpoints by variant — NeverRun against Live { .. } — never by position: comparing a checkpoint against any SequencePosition is simultaneously a CF-6 violation and the exact value the defective store writes, so a rule written that way could not tell the two apart. Checkpoint is a three-variant enum precisely so this assertion can be made without naming a position (spec/SPECIFICATION.md:5008-5024). The consequence half derives a resume point from each under the port’s own rule — in one private helper shared by both arms, so the derivation is stated once — and asserts the event at the store’s first position is applied in the reset case and not in the substitute’s. The variant check alone would not see the consequence; the resume check alone would not see the state.

No runner is built. PS-20’s property is a claim about how a resume point is derived from a checkpoint, and that derivation is four lines the rule owns — the runner itself belongs to a later phase and a different crate.

§Why each checkpoint is read immediately after its own operation

So that a store which shares one checkpoint row between projections fails reset_is_scoped_to_one_projection and distinct_projections_advance_independently — the rules that own that defect — rather than this one, which is about a single projection’s state being told apart from another single projection’s.