fix(grpc-data): #966 a modify's replacement no longer emits a live delta before its snapshot
The suspected ordering gap was real. A modify that replaces an item commits on the delivery side (the ack's commit): the replacement enters _items (it was already registered with the delivery scheduler at staging) and its snapshot job goes to _committedSnapshots, which only the NEXT tick moves to the pump. A tick already past that dequeue that then reads a source change (e.g. from a sibling item on the same source, whose interest group survives the modify) marks the source dirty. The scheduler hands it the replacement's handle, and ConsiderAsync sent the newer value as a live delta before SnapshotBegin. The snapshot that followed carried the older captured value. ConsiderAsync now defers an item whose interest group is not snapshot-complete. LastConsidered is left unchanged, and the group's own lease (its cursor starts at the snapshot capture) yields the change once SnapshotEnd commits. The same guard covers added and recovered items. Nothing starves: an undelivered SnapshotEnd stops the stream. Deterministic test (BeforeDirtyTickForTests hold + gated modify ack + publish under the hold): red 3/3 before (value:R:20 | begin | snapshot:R:10), green after, with a positive control that 20 is delivered after the end. Parallel in-process stress of the unhooked scenario (2 items on one source, modify one under continuous publish): 60/40000 violations before (10000 x widths 2/4/6/8), 0/40000 after.
This commit is contained in:
@@ -181,6 +181,14 @@ replaces the origin item (trigger, deadband or view change) could also produce i
|
||||
acknowledgement released the replaced item's interest while a session tick was reading it. That
|
||||
release is no longer counted as a lost history; the replacement continues with its own snapshot.
|
||||
|
||||
An item's first frames on a Subscribe stream are its snapshot (`SnapshotBegin`, its snapshot value, `SnapshotEnd`). A
|
||||
live delta for that item comes only after them. This applies to an added item, an item recovered from waiting for
|
||||
initial data, and the new handle a `Modify` returns when it replaces the item. Until #966 a replacement could break
|
||||
this. If a source change was read (for example through another item on the same source) while the modify's ack was
|
||||
being committed, the replacement could send that newer value as a live delta before its `SnapshotBegin`. The
|
||||
snapshot that followed then carried the older captured value. Now the change waits until the item's snapshot is
|
||||
complete, and the item then delivers it as a live delta.
|
||||
|
||||
### Mixed versions (X0 rollout)
|
||||
|
||||
The remote history and alarm work (`docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md`)
|
||||
|
||||
Reference in New Issue
Block a user