Merge #966: a Modify's replacement item no longer emits a live delta before its snapshot (real ordering defect, 60/40k -> 0/40k)

This commit is contained in:
Joseph Doherty
2026-12-02 13:12:38 -05:00
3 changed files with 93 additions and 1 deletions
@@ -1031,7 +1031,16 @@ internal sealed partial class DataSubscriptionSession : IDataSubscriptionTranspo
private async Task ConsiderAsync(Item item)
{
lock (_gate) if (_challengedHandles.ContainsKey(item.Handle.Handle)) return;
lock (_gate)
{
if (_challengedHandles.ContainsKey(item.Handle.Handle)) return;
// #966: no live delta before the item's own snapshot. A modify's replacement (or an added/recovered item) is
// scheduler-registered and in _items before its SnapshotEnd commits; a dirty mark for its source (from a
// sibling group, or a commit landing mid-tick after the snapshot dequeue) would otherwise emit a newer live
// value ahead of its SnapshotBegin. Nothing is lost: LastConsidered is untouched and the group's own lease
// (cursor from the snapshot capture) yields the change once the group is snapshot-complete.
if (item.Interest is { SnapshotComplete: false }) return;
}
if (item.Ticket is not { } ticket) return;
using var read = _services.SubscriptionHub.Read(ticket);
if (read.Readiness != DataReadiness.Ready || read.Sample is null) { CloseWithReset("Source became unavailable."); return; }