fix(grpc-data): A4 #930/#931 — in-stream condition retries (no refresh storm), ConditionCapacity recovery, reconnect backoff, ledger, single RefreshRequired, parked-runner release; condition diagnostics core

#930 N2: an Unavailable mapping (refused item, failed root, snapshot timeout) is retried on the OPEN stream by
re-adding its item (AddSubscriptionItems) on its own backoff — definitive refusals (Denied/NotFound/Unsupported)
on LongRetryDelay (5 min, doubling to 4x), transient ones on the snapshot timeout x 2^n (<= 8x) — so healthy
mappings are never re-snapshotted for it; an incomplete barrier whose incomplete set equals the previous barrier's
sends no RefreshRequired. N3: ConditionCapacity is retried in-stream on the long timer and recovers.
#931 N4 exponential reconnect backoff (MaxReconnectDelay 60 s); N5 held-but-unlisted keys charged beside known
claims (overlapping unknown ones) + SetMaterialised cap report; N6 method calls read Serving without _gate;
N7 a capacity reset that removed conditions sends no second RefreshRequired; N8 a parked runner is released once
its removal finished.
A4 diagnostics core: DataConnectionConditionDiagnostics (side-labelled items/resyncs/capacity/method metrics, new
refresh_required counter, consumer + origin evidence), Commons contracts, DI + deployment-runtime + driver-host wiring.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-11-24 23:03:53 -05:00
parent 9143804987
commit 78eb98ea13
15 changed files with 920 additions and 105 deletions
@@ -35,7 +35,8 @@ internal sealed partial class DataSubscriptionSession
{
Stream.Dispose(); // releases the snapshot memory charge
r.Dispose();
OtOpcUaTelemetry.DataConnConditionItems.Add(-1);
if (Stream.Diagnostics is { } diagnostics) diagnostics.OriginItemClosed(Stream);
else DataConnectionConditionDiagnostics.CountItems(DataConnectionConditionDiagnostics.OriginSide, -1);
}
}
}
@@ -108,9 +109,11 @@ internal sealed partial class DataSubscriptionSession
var principal = _context.PrincipalId;
var snapshots = _capacity.Snapshots;
var stream = new ConditionItemStream(hub, source, authority.Scope, request.ConditionScope!.IncludeInfo, services.Clock,
reserveSnapshot: bytes => snapshots.TryAcquire(principal, bytes, out var lease) ? lease : null, chunkBytes: chunkBytes);
reserveSnapshot: bytes => snapshots.TryAcquire(principal, bytes, out var lease) ? lease : null, chunkBytes: chunkBytes,
diagnostics: services.ConditionDiagnostics);
var item = new ConditionItem(request.ClientItemId, handle, authority, stream, reservation!);
OtOpcUaTelemetry.DataConnConditionItems.Add(1);
if (stream.Diagnostics is { } itemDiagnostics) itemDiagnostics.OriginItemOpened(stream);
else DataConnectionConditionDiagnostics.CountItems(DataConnectionConditionDiagnostics.OriginSide, 1);
lock (_gate)
{
_conditionItems.Add(handle.Handle, item);