fix(alarms): route native alarms by ConditionId (dotted FullName), not bare SourceNodeId (integration review)
v2-ci / build (push) Failing after 46s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped

This commit is contained in:
Joseph Doherty
2026-06-14 04:09:01 -04:00
parent 7e86fa7099
commit f9be38430c
2 changed files with 27 additions and 21 deletions
@@ -49,9 +49,11 @@ public sealed class DriverHostActorNativeAlarmTests : RuntimeActorTestBase
private static readonly RevisionHash RevA = RevisionHash.Parse(new string('a', 64));
private static readonly DateTime Ts = new(2026, 6, 14, 10, 0, 0, DateTimeKind.Utc);
/// <summary>A native alarm RAISE published by SourceNodeId (the alarm tag's FullName) lands on the
/// condition's folder-scoped NodeId (here <c>eq-1/temp_hi</c>) as an
/// <see cref="OpcUaPublishActor.AlarmStateUpdate"/> with <c>State.Active == true</c>.</summary>
/// <summary>A native alarm RAISE whose <c>ConditionId</c> equals the alarm tag's <c>FullName</c> lands on
/// the condition's folder-scoped NodeId (here <c>eq-1/temp_hi</c>) as an
/// <see cref="OpcUaPublishActor.AlarmStateUpdate"/> with <c>State.Active == true</c>. The event carries a
/// production-shaped <c>SourceNodeId</c> (the bare owning object, distinct from <c>ConditionId</c>) so the
/// lookup is proven to key on <c>ConditionId</c>, not <c>SourceNodeId</c>.</summary>
[Fact]
public void Native_alarm_raise_routes_to_folder_scoped_condition_NodeId_active()
{
@@ -64,8 +66,8 @@ public sealed class DriverHostActorNativeAlarmTests : RuntimeActorTestBase
actor.Tell(new DriverInstanceActor.AttributeAlarmPublished("drv-1", new AlarmEventArgs(
new StubAlarmHandle(),
SourceNodeId: "Temp.HiHi",
ConditionId: "cond-1",
SourceNodeId: "Temp", // bare owning object (SourceObjectReference) — NOT the lookup key
ConditionId: "Temp.HiHi", // dotted alarm full-reference = the authored FullName (the lookup key)
AlarmType: "OffNormalAlarm",
Message: "temperature high",
Severity: AlarmSeverity.High,
@@ -79,8 +81,8 @@ public sealed class DriverHostActorNativeAlarmTests : RuntimeActorTestBase
update.TimestampUtc.ShouldBe(Ts);
}
/// <summary>An <see cref="DriverInstanceActor.AttributeAlarmPublished"/> for a SourceNodeId not in the
/// alarm map produces NO <see cref="OpcUaPublishActor.AlarmStateUpdate"/> (unknown-ref drop).</summary>
/// <summary>An <see cref="DriverInstanceActor.AttributeAlarmPublished"/> whose <c>ConditionId</c> is not in
/// the alarm map produces NO <see cref="OpcUaPublishActor.AlarmStateUpdate"/> (unknown-ref drop).</summary>
[Fact]
public void Unknown_alarm_ref_produces_no_AlarmStateUpdate()
{
@@ -92,8 +94,8 @@ public sealed class DriverHostActorNativeAlarmTests : RuntimeActorTestBase
actor.Tell(new DriverInstanceActor.AttributeAlarmPublished("drv-1", new AlarmEventArgs(
new StubAlarmHandle(),
SourceNodeId: "NoSuch.Alarm",
ConditionId: "cond-x",
SourceNodeId: "Temp", // owning object exists, but the condition ref below is unmapped
ConditionId: "NoSuch.HiHi", // dotted ref not in the alarm map ⇒ drop
AlarmType: "OffNormalAlarm",
Message: "nope",
Severity: AlarmSeverity.Low,
@@ -122,8 +124,8 @@ public sealed class DriverHostActorNativeAlarmTests : RuntimeActorTestBase
actor.Tell(new DriverInstanceActor.AttributeAlarmPublished("drv-1", new AlarmEventArgs(
new StubAlarmHandle(),
SourceNodeId: "Temp.HiHi",
ConditionId: "cond-1",
SourceNodeId: "Temp", // bare owning object (SourceObjectReference) — NOT the lookup key
ConditionId: "Temp.HiHi", // dotted alarm full-reference = the authored FullName (the lookup key)
AlarmType: "OffNormalAlarm",
Message: "temperature high",
Severity: AlarmSeverity.High,
@@ -169,8 +171,8 @@ public sealed class DriverHostActorNativeAlarmTests : RuntimeActorTestBase
actor.Tell(new DriverInstanceActor.AttributeAlarmPublished("drv-1", new AlarmEventArgs(
new StubAlarmHandle(),
SourceNodeId: "Temp.HiHi",
ConditionId: "cond-1",
SourceNodeId: "Temp", // bare owning object (SourceObjectReference) — NOT the lookup key
ConditionId: "Temp.HiHi", // dotted alarm full-reference = the authored FullName (the lookup key)
AlarmType: "OffNormalAlarm",
Message: "temperature high",
Severity: AlarmSeverity.High,