Skip to main content

head_advances_across_two_handles

Function head_advances_across_two_handles 

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

A head read through one handle covers what another handle wrote.

ES-30’s third rule, and the one that needs ES-33’s fixture. It is two_handles_observe_each_others_appends asked of the head rather than of the read and the condition probe: the same shared consistency boundary, reached through the one method whose answer an adapter is most tempted to keep in a field.

§What it rejects

LastWrittenHeadStore: a handle that remembers the position its own last append returned and answers head() from it. It is the “cached last-written position” ES-30’s Rejects: names, and it is the rule’s alone — against a single handle that cache is exactly right, so it passes both of the other head rules and every other rule in this suite. Whether the cache is a field, a session variable or a currval() is an implementation detail; what makes it wrong is that a store is not a connection, and every deployment with a pool reaches one store two ways.

§Two details that would make it pass for the wrong reason

The observer connects before the write, because a handle that samples the head when it opens would sample the right answer afterwards. And the assertion is the portable relation rather than an equality against the position append returned, for head_not_below_the_visible_log’s reason: this rule is about a stale handle, not about how fresh a frontier is.

The anchor rests on ES-33 and ES-34, both [FROZEN]: two handles are two handles onto one backing store, and an append through one is visible through the other. If the read below comes back short, the finding is there and not here.