Skip to main content

condition_with_one_guard_behaves_as_today

Function condition_with_one_guard_behaves_as_today 

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

A one-guard condition is evaluated by the same rules as any other guard.

VT-30’s compatibility half: AppendCondition::new(query) produces a single unbounded guard, after_every_guard/_opt apply to every guard, and every existing call site keeps its meaning as the single-guard case. What that obliges of a store is one sentence — the one-guard path is not exempt from the boundary semantics — and it is the sentence a store can get wrong on its own.

§What this rule adds that the condition_after_* family does not

Every other append-condition rule in this suite builds a condition with exactly one guard, so all of them already exercise the single-guard path, and any store uniformly wrong about after is caught by one of them. What none of them can see is a store wrong about after on one path only, because none of them ever builds the other path.

That is the regression VT-30’s refactor invites, and it is what this rule owns. An adapter generalising to N guards keeps a guards.len() == 1 fast path — the overwhelmingly common case, and the one where a UNION per guard is pure overhead — and that fast path is the old statement, written before boundaries existed and never re-reviewed, while the general path is new and was. SingleGuardFastPathStore is the compiled version: correct for two guards, and for one guard it asks only whether any event matches the query at all. MinCollapseStore is its mirror image — right on one guard, wrong on N — and condition_guards_carry_independent_boundaries catches that one.

§Why two fixture instances

The two spellings must be compared against stores in the same state, and an admitted append is a write: measuring both on one store would let the second spelling see an event the first one added, so a store whose probe is sensitive to unrelated events — ExistenceProbeStore, UncorrelatedProbeStore — would fail this rule for a reason that has nothing to do with guard arity. Each instance is driven to completion before the next is opened, so a fixture that failed to isolate them fails two_fixture_instances_observe_none_of_each_others_appends, which owns that, rather than this.