fix(grpc-data): #962 a modify's ack commit releasing a replaced item's interest mid-tick no longer resets the stream

The Runtime.Tests flake (Changing_the_filter_acknowledges_a_new_revision_before_its_snapshot) was a real
production race. DataSubscriptionSession.TickAsync captures the snapshot-complete interest-group leases
under the gate, awaits the snapshot/condition pumps, then reads each lease's changes. A Modify that replaces
an item is committed on the DELIVERY side (the ack's commit -> CommitStaged -> ReleaseItem), which disposes
the replaced item's SourceInterestLease. If that lands between the capture and the read, TryReadChanges
returns false exactly like a lost history and the session answered a successful modify with
Reset: "Source change history expired." (ack, then Reset instead of SnapshotBegin).

InterestGroup now carries Released (set under the gate in ReleaseItem before the lease is disposed); the
tick skips a failed read of a group the session itself released - the replacement has its own snapshot.
A failed read of a group the session still owns is still a reset.

Regression test holds a tick at the capture point (BeforeDirtyTickForTests), commits the modify under it
via a gated transport write, then lets the tick read: red 3/3 before, green after. Stress of the original
scenario (5000 iterations x 6 widths): 137/30000 Reset before, 0/30000 after.
This commit is contained in:
Joseph Doherty
2026-12-01 21:30:59 -05:00
parent 60e1328218
commit 23b28e001f
3 changed files with 148 additions and 4 deletions
+5
View File
@@ -175,6 +175,11 @@ Listener, connection, export and projection limits bound messages, streams, moni
retained bytes, metadata and call lifetimes. Tune them together for measured workload demand;
defaults are admission bounds, not a throughput or capacity guarantee. Overload can reject work or
reset a stream, requiring a fresh snapshot. Do not interpret that recovery as lossless replay.
A reset reading "Source change history expired." (consumer `ResetHistory`) means the origin lost a
source's change history for an item it still serves. Until #962 a Subscribe-stream `Modify` command that
replaces the origin item (trigger, deadband or view change) could also produce it intermittently: the modify's
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.
### Mixed versions (X0 rollout)