fix(grpc-data): A1 review round 2 F1 + F2 — an ack-revert establishes nothing; every Good edge withdraws; Bad edge forgets unsignalable

F1: RevertNativeAlarmAck projected through WriteAlarmCondition, which re-marked a comms-withdrawn native condition
known; with the Good edge's conditional withdrawal skipped (GoodSinceUtc null) it read known-inactive-Good until the
replay. AlarmStateUpdate.EstablishesState (false for the revert) rides a new default sink overload
WriteAlarmCondition(..., establishesState) through the deferred and SDK sinks to the node manager, and every Good
edge now withdraws unconditionally.
F2: the Bad edge clears the unsignalable set, so a stale report cannot arm the backstop on the next Good edge.
The rig's CollectAlarmTraffic skips withdrawals (every edge now sends one).
This commit is contained in:
Joseph Doherty
2026-11-24 11:26:56 -05:00
parent 7489456843
commit 4d21ccafa1
10 changed files with 127 additions and 14 deletions
@@ -78,11 +78,11 @@ public sealed partial class DriverHostActor
/// <summary>
/// A connectivity edge restarts the F5 window (from quality Good) and the backstop; a Bad edge cancels both.
/// Review S2: the Bad edge withdraws "known" from the driver's conditions — the source can no longer vouch for
/// their state, and an alarm raised during the outage would otherwise read known-inactive, Good after the
/// reconnect until the replay. A Good edge withdraws too (ahead of the Good quality annotation) when no Bad edge
/// was seen since the previous Good one, or it comes from a new child incarnation. They become known again only
/// on the reconnected source's next signal (or transition).
/// Review S2 / round 2 F1: every edge withdraws "known" from the driver's conditions — on the Bad edge the source
/// can no longer vouch for their state (an alarm raised during the outage would otherwise read known-inactive,
/// Good after the reconnect until the replay), and the Good edge withdraws again, unconditionally. They become
/// known again only on the reconnected source's next signal (or transition). The Bad edge also forgets the
/// unsignalable set (F2).
/// </summary>
private void OnConditionSignalConnectivity(string driverInstanceId, bool connected, IActorRef sender, long? connectionEpoch)
{
@@ -99,17 +99,22 @@ public sealed partial class DriverHostActor
}
var t = Tracker(driverInstanceId);
// A Good edge with no Bad edge since the previous Good one (or from a new incarnation) — withdraw here instead.
var missedBadEdge = connected && (t.GoodSinceUtc is not null || (t.Owner is not null && !Equals(t.Owner, sender)));
t.Owner = sender;
t.Epoch++;
Timers.Cancel(SignalTimeoutKey(driverInstanceId));
Timers.Cancel(BackstopKey(driverInstanceId));
t.Pending.Clear();
t.PendingSinceUtc = null;
if (!connected || missedBadEdge) WithdrawDriverConditionsKnown(driverInstanceId);
// Review round 2 F1: withdraw on EVERY edge — the Good one too, unconditionally (ahead of the Good quality
// annotation): whatever made a condition known since the Bad edge (an ack-revert projection, a missed Bad
// edge, a new incarnation) cannot vouch for the reconnected source's state.
WithdrawDriverConditionsKnown(driverInstanceId);
if (!connected)
{
// Review round 2 F2: an unsignalable report belongs to the subscription that made it; the reconnected
// subscription reports again if it still cannot signal. Kept, it would arm the backstop on the next Good
// edge and turn a later FAILED refresh into known-by-timer instead of F5's unknown.
t.Unsignalable.Clear();
t.GoodSinceUtc = null;
t.ConnectionEpoch = null;
return;
@@ -2680,7 +2680,10 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
"reverting the condition to unacknowledged", _localNode, conditionNodeId, reason);
// Native conditions live in the Raw realm at their bare NodeId (the apply pass's single raw condition).
_opcUaPublishActor?.Tell(new ZB.MOM.WW.OtOpcUa.Runtime.OpcUa.OpcUaPublishActor.AlarmStateUpdate(
conditionNodeId, snapshot, DateTime.UtcNow, AddressSpaceRealm.Raw));
conditionNodeId, snapshot, DateTime.UtcNow, AddressSpaceRealm.Raw,
// Review round 2 F1: the projector's cached prior state, not a driver transition — it establishes nothing
// (a condition withdrawn by a comms loss must stay unknown until its driver signals again).
EstablishesState: false));
}
/// <summary>