Skip to main content

head_is_the_highest_visible_position

Function head_is_the_highest_visible_position 

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

head() covers the whole store, not the part some default query matches.

ES-30, in the portable form ADR-0013 §4 amends the clause to: append a batch holding at least one event a narrower default query would not match, read the whole store with Query::all(), and assert head() is not below the highest position that read yielded. The relation does not assert read-your-own-writes, and head_not_below_the_visible_log carries the whole argument for why. The anchor does read back the untagged append, so the rule settles the frontier first (CF-42).

§The seeding is the rule

A rule that appended one uniform batch could not fail: whatever query a scoped head is written against, one batch of identical events either matches it entirely or not at all, and in both cases the scoped answer and the true answer agree. So the highest event here is untagged and carries a second type, and that is what a scoped head has to miss.

§What it rejects

DefaultQueryHeadStore: SELECT max(e.position) FROM event e JOIN tag t ON t.event_id = e.id — the head statement written against the same joined view the read path is built around, because there is one view and reusing it is the obvious move. An untagged event at the top of the log is invisible to it, so the store under-reports its head to every projection runner and every paginating caller, and the events past the under-reported head are exactly the ones nothing else in the deployment tags.

ES-30’s other two rejected implementations are not this rule’s and were never going to be. A cached last-written position returns the right answer against a single handle and is head_advances_across_two_handles’ to reject; the backwards().limit(1) workaround as a universal answer is hung on E2E-13 by ES-30’s own text.