Skip to main content

commit_rejects_a_regressing_position

Function commit_rejects_a_regressing_position 

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

A commit naming a position strictly below the current checkpoint is refused, and neither half moves.

PS-22. Under a redeploy where an old runner pod has not yet exited, two runners share an id and the stale one drags the checkpoint backwards; every event between the two positions is then applied twice, which is harmless only for projections that happen to be idempotent. The guard converts a silent double-apply into a reported error.

Rejects: UnconditionalCheckpointStore — the adapter that issues UPDATE checkpoint SET position = ? unconditionally, which is what everyone writes. UncommittedTransactionStore also fails it, because a store that recorded no checkpoint has nothing to regress against.

What it deliberately does not assert. Anything about an equal position. PS-22 permits accepting one, so a rule that rejected it would forbid a conformant adapter; no commit in this body names a position the store already holds.