Skip to main content

compensation_is_atomic_with_the_losing_event

Function compensation_is_atomic_with_the_losing_event 

Source
pub async fn compensation_is_atomic_with_the_losing_event<F: SyncFixture>(
    open: impl AsyncFn() -> F,
) -> Result<RuleOutcome, Violation>
Expand description

SY-2, the transport’s half: a losing event and the compensation that answers it travel as one group, and a peer hands them back as one group.

A hub has adjudicated a conflict: one claim won, and the other is sent on together with the reversal the hub wrote for it, in one [EventGroup]. Whoever pulls that from this peer ingests a group at a time, atomically (IngestStore::ingest), so a peer that splits the group hands its reader a log where the losing claim stands with nothing resolving it. The store-side half — one ingest commits the group whole — rides on ES-18 and on the ingest suite.

§Rejects

A peer that flattens what it is pushed into one group per event, or that pages by event count and ends a pull between the two. tests/wrong_peers.rs carries both.

§Does not reject

Compensate-after-commit, the defect SY-2’s own Rejects paragraph names: ingest the losing event, return, and author the compensation afterwards. That is the authoring side’s mistake, made before anything reaches a peer, and a rule that holds only a peer cannot see it — this rule hands the peer a group that is already whole. The authoring half is tracked by #320; until it lands, a green run here certifies the transport and nothing upstream of it.

§Errors

A Violation of SY-2 if the peer refuses the pushes, or if the group it hands back with the losing claim does not also hold its reversal.