Function limit_applies_across_items_not_per_item
pub async fn limit_applies_across_items_not_per_item<F: Fixture>(
open: impl AsyncFn() -> F,
) -> RuleOutcomeExpand description
limit is a budget for the whole result, not one per query item.
ES-14: limit(n) MUST yield the first n events of the ordered result
set, not n per query item. The two items match three events each and the
budget is four, so a store applying it per item returns six.
LimitPerItemStore is that store — one statement per QueryItem, each
carrying LIMIT n, unioned client-side with the budget never re-applied
to the merged result. It is the same adapter shape ES-12 rejects, failing
here for an independent reason, which is why both rules are worth having.
The two items’ matches are contiguous blocks rather than interleaved,
and that is deliberate. Interleaving would make item order and position
order disagree, so ItemOrderedUnionStore and SortByEventTypeStore
would both fail this rule for reasons
query_item_order_does_not_change_the_result_set and
read_defaults_to_ascending_order already own. Blocks keep this rule
about the budget.
The backwards mirror is here for read_limit_applies_after_filtering’s
reason: a store truncates at whichever end it scans from, and a per-item
budget is written into the same clause either way.