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
@@ -53,6 +53,10 @@ public sealed class DeferredAddressSpaceSink : IOpcUaAddressSpaceSink, ISurgical
public void WriteAlarmCondition(string alarmNodeId, AlarmConditionSnapshot state, DateTime sourceTimestampUtc, AddressSpaceRealm realm)
=> _inner.WriteAlarmCondition(alarmNodeId, state, sourceTimestampUtc, realm);
/// <inheritdoc />
public void WriteAlarmCondition(string alarmNodeId, AlarmConditionSnapshot state, DateTime sourceTimestampUtc, AddressSpaceRealm realm,
bool establishesState) => _inner.WriteAlarmCondition(alarmNodeId, state, sourceTimestampUtc, realm, establishesState);
/// <inheritdoc />
public void WriteAlarmQuality(string alarmNodeId, uint statusCode, DateTime sourceTimestampUtc, AddressSpaceRealm realm)
=> _inner.WriteAlarmQuality(alarmNodeId, statusCode, sourceTimestampUtc, realm);
@@ -81,6 +81,20 @@ public interface IOpcUaAddressSpaceSink
/// the condition was materialised under).</param>
void WriteAlarmCondition(string alarmNodeId, AlarmConditionSnapshot state, DateTime sourceTimestampUtc, AddressSpaceRealm realm);
/// <summary>
/// <see cref="WriteAlarmCondition(string, AlarmConditionSnapshot, DateTime, AddressSpaceRealm)"/> that says
/// whether the projection ESTABLISHES the condition's state (A1 §5.1 T2). <see langword="false"/> for a projection
/// no source decided — the #760 ack-revert re-projects the projector's cached prior state — so it never makes a
/// withdrawn condition known again (review round 2 F1). The default ignores the flag.
/// </summary>
/// <param name="alarmNodeId">The condition node id.</param>
/// <param name="state">The full condition state.</param>
/// <param name="sourceTimestampUtc">The source timestamp in UTC.</param>
/// <param name="realm">The condition's realm.</param>
/// <param name="establishesState">Whether this projection establishes the condition's state.</param>
void WriteAlarmCondition(string alarmNodeId, AlarmConditionSnapshot state, DateTime sourceTimestampUtc, AddressSpaceRealm realm,
bool establishesState) => WriteAlarmCondition(alarmNodeId, state, sourceTimestampUtc, realm);
/// <summary>Annotate a materialised condition's source-data quality OUT OF BAND from any alarm
/// transition (used by the driver-connectivity path: comms lost → <see cref="OpcUaStatus.BadNoCommunication"/>,
/// restored → <see cref="OpcUaStatus.Good"/>). Sets ONLY the condition's Quality — never