fix(dcl): forget an OPC UA condition's last state once it returns to normal (review 2026-10-21 02/L3)

This commit is contained in:
Joseph Doherty
2026-10-22 06:28:00 -04:00
parent d51ea5136a
commit f18d3adbfc
3 changed files with 102 additions and 3 deletions
@@ -1236,8 +1236,18 @@ public class RealOpcUaClient : IOpcUaClient
var kind = inRefresh
? AlarmTransitionKind.Snapshot
: OpcUaAlarmMapper.DeriveKind(prevAcked, acked, prevActive, active);
lastState?.TryAdd(sourceRef, (active, acked));
if (lastState != null) lastState[sourceRef] = (active, acked);
if (lastState != null)
{
// Inactive + acknowledged IS the default prior state above, so forgetting it changes
// no derived kind — and keeps the map bounded on servers whose condition names carry
// a per-occurrence component (batch, lot, counter), where every occurrence is a new
// key for the life of the session (review 2026-10-21 02/L3; mirrors the actor's
// CacheAlarmTransition removal rule).
if (!active && acked)
lastState.Remove(sourceRef);
else
lastState[sourceRef] = (active, acked);
}
onTransition(new NativeAlarmTransition(
SourceReference: sourceRef,