fix(DV-2): clarify placeholder comment, stable MinValue timestamp, drain DCL probe in new tests

- Replace placeholder-loop comment with the double-render guard explanation
- Use _alarmTimestamps.GetValueOrDefault(binding, DateTimeOffset.MinValue) so the
  placeholder timestamp is stable/idempotent across snapshot calls (was UtcNow)
- Add dcl.ExpectMsg<SubscribeAlarmsRequest>() drain in Snapshot_QuietNativeBinding_EmitsPlaceholder
  and Snapshot_NativeBindingWithLiveCondition_NoPlaceholder to consume the DCL message
  the NativeAlarmActor sends at startup
This commit is contained in:
Joseph Doherty
2026-06-17 15:08:37 -04:00
parent cc017aabfc
commit b5347faf44
2 changed files with 9 additions and 4 deletions
@@ -1117,9 +1117,11 @@ public class InstanceActor : ReceiveActor
_alarmTimestamps.GetValueOrDefault(name, DateTimeOffset.UtcNow)));
}
// Native source bindings with no live condition: emit a placeholder so the
// Debug View tree shows the configured binding node even when quiet. A binding
// is "quiet" when no retained event carries its canonical name.
// A native binding is "already represented" if any retained event carries its
// canonical name — it renders in the Debug View via those condition rows. The
// placeholder below covers ONLY bindings with zero retained events (truly quiet
// since startup). Do NOT narrow this to State==Active: a binding holding a
// retained Normal/resolved condition would then be rendered twice.
var liveBindings = _latestAlarmEvents.Values
.Where(e => !string.IsNullOrEmpty(e.NativeSourceCanonicalName))
.Select(e => e.NativeSourceCanonicalName)
@@ -1130,7 +1132,8 @@ public class InstanceActor : ReceiveActor
if (liveBindings.Contains(binding)) continue;
states.Add(new AlarmStateChanged(
_instanceUniqueName, binding, AlarmState.Normal, 0, DateTimeOffset.UtcNow)
_instanceUniqueName, binding, AlarmState.Normal, 0,
_alarmTimestamps.GetValueOrDefault(binding, DateTimeOffset.MinValue))
{
Kind = _nativeAlarmKinds.GetValueOrDefault(binding, AlarmKind.NativeOpcUa),
NativeSourceCanonicalName = binding,