Skip to main content

contains_event_id_reports_membership

Function contains_event_id_reports_membership 

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

ES-41 (VT-7) — contains_event_id answers about an identity, not about a position.

The membership operation VT-7 requires, and the whole reason it is a dedicated port operation rather than a query: dedup is a membership test, so it gets a membership test.

The wrong implementation is the natural one — SELECT 1 FROM events WHERE position = ?, which is what an adapter writes when its events table has a position column and no origin columns yet, which is every adapter before it implements ingest. It passes every single-store rule in the suite, because a store that has ingested nothing only ever holds its own incarnation, and it fails the first time a peer asks: a foreign event is reported as already present whenever the local log happens to be at least that long, and the batch carrying it is silently dropped. PositionOnlyMembershipStore in tests/mutation_coverage/mutants.rs is it.

The foreign incarnation is built by flipping every byte of the store’s own, which is the only way a rule can name an incarnation this store certainly does not have: EventStore has no store_id() accessor (ES-19’s prose says why one was refused), so the only StoreId a rule can obtain is the one it read back, and !b == b holds for no byte. A hard-coded sentinel would be a value some real adapter could one day mint.