Function head_of_an_empty_store_is_none
pub async fn head_of_an_empty_store_is_none<F: Fixture>(
open: impl AsyncFn() -> F,
) -> RuleOutcomeExpand description
A store holding nothing reports no head.
ES-30. head() returns Option<SequencePosition> precisely so that the
empty store has an answer that is not a position, and this is the rule
that makes the None mean what the signature says.
§What it rejects
EmptyHeadIsFirstStore: SELECT IFNULL(MAX(position), 0) decoded into a
non-nullable integer, then turned back into a SequencePosition with
SequencePosition::new(value).unwrap_or(SequencePosition::FIRST) —
because MAX over no rows is NULL, because the driver’s scalar decode
wants a non-nullable column type, and because this workspace’s own house
rule forbids unwrap in library code and unwrap_or is the shortest
thing that satisfies it. A NonZero newtype makes the fallback look
forced. The store then reports a position no event occupies on the one
state every adapter is in on its first run, and the paginating adapter
ES-11 prescribes bounds its first window by it.
§The anchor, and why it is not head() == append
Without the second half, a store whose head is Ok(None)
unconditionally passes this rule forever — and that store also passes
ES-31’s “am I caught up?” comparison by never being caught up. The anchor
is the portable relation rather than an equality against what append
returned, for the reason head_not_below_the_visible_log documents.