byCount

History-windowing policy: keep the last n visible elements, targeting the leading prefix — every id (visible or tombstoned) that sorts before the start of the retained window of n visible elements.

This is the convergent replacement for MutableSharedFlow(replay = n, DROP_OLDEST): old visible history is forgotten once it falls out of the window. The leading prefix — live and tombstoned ids alike — is dropped via the un-gated windowing path; reroot-to-HEAD (#254) keeps the retained window reachable after its predecessor is purged.

Per-peer divergence is allowed. Two replicas with different n both converge: after Compact set-union the more-aggressive (smaller-n) window dominates.

Parameters

n

the number of trailing visible elements to retain. n <= 0 targets the entire prefix; a window larger than the visible count selects nothing.