Skip to main content

read_from_a_gap_position

Function read_from_a_gap_position 

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

from is a range predicate over assigned positions, not a seek.

ES-9. Reading from a position nothing occupies must yield the next matching event above it, or below it reading backwards, and must neither error nor come back empty on that ground alone.

§Where the gap comes from, and why it is the one above the head

The port has no delete, and a store allocating densely leaves no interior gap for a rule to aim at — so a rule that needed one could only run against an adapter that is already sparse, which is not the adapter under test. The position immediately above the head is unoccupied on every store, whatever it allocates and wherever it starts, because nothing has been appended since. Reading backwards from it is therefore the portable half of ES-9, and it is the half no existing rule reaches: six rules pass from — read_from_is_inclusive, read_backwards_from_with_limit, read_from_composes_with_multi_item_query, read_from_composes_with_limit, read_from_and_to_bound_a_closed_window and this one — and every one of the other five hands it a position the store actually assigned. This sentence read “the only two rules that pass from at all” until phase 12’s pre-publication review counted them; the count is written out here rather than left implicit because it is the claim that decayed.

The interior half runs only where the fixture’s own allocator left a hole — GappedPositionStore, and any adapter allocating from a sequence with CACHE 7, from a transaction id, or with a shard id in the low bits. On a dense store the branch is skipped rather than faked, which is the honest answer: the assertion above it is what every store owes.

It rejects FromIsAnOffsetStore — from bound to the OFFSET already in the paging query, which skips by a count and so yields nothing at all from a position above the head — and BackwardsIgnoredStore, whose backwards branch never reaches the SQL, so the same predicate becomes a floor and the read comes back empty.