Skip to main content

reopened_store_does_not_reissue_an_event_id

Function reopened_store_does_not_reissue_an_event_id 

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

VT-6 — reopening a store does not reissue an EventId.

This rule replaces VT-6’s originally named store_id_is_stable_across_reopen, which was invalid: it would fail every adapter that takes the second of the two mechanisms the clause permits — mint a fresh incarnation on every open — and a rule that forbids a permitted implementation is worse than a decorative one. What is asserted instead is the invariant both mechanisms satisfy.

The first assertion is not padding. Replacing a rule loses whatever the replaced rule caught by accident, and store_id_is_stable_across_reopen rejected mint-per-append as a side effect of demanding stability. The reissue assertion alone does not, because per-append minting produces EventIds that all differ. “Two events in one open share a StoreId” is the weakest assertion that rejects it, it is true under both permitted mechanisms, and it costs one extra append.

The wrong implementation the second assertion rejects is sharp, and it is the restore failure in miniature: a store that keeps its StoreId across a reopen and restarts its position counter at 1. That is what a restored backup looks like from the inside, and LosingFixture in tests/mutation_coverage/mutants.rs is it — a store with nothing durable behind it, so a reopen finds an empty medium and the next append mints an identity the store has already issued to a different event.

What this rule cannot reach is detection: nothing in the tree can present an adapter with a restore it must notice, and DurableFixture reopens by instruction rather than by fault. The harm VT-6 names is reissue, and reissue is observable by instruction; detection stays phase 13’s, in happenstance-sync-testkit’s restored_peer_does_not_reissue_identities.