Task #219 follow-up — close AlarmConditionState child-NodeId + Part 9 event-propagation gaps #198

Merged
dohertj2 merged 1 commits from task-219-followup-alarm-wiring into v2 2026-04-21 00:24:43 -04:00
Owner

Summary

PR #197 surfaced two integration-level wiring gaps in DriverNodeManager's MarkAsAlarmCondition path. This PR fixes both and upgrades the alarm integration test to assert the full dispatch path end-to-end — no more scope-outs.

Fix 1 — addressable child nodes

AlarmConditionState inherits ~50 typed children (Severity / Message / ActiveState / AckedState / EnabledState / …). The stack was leaving them with Foundation-namespace NodeIds (type-declaration defaults) or shared ns=0 counter allocations, so client Read on a child returned BadNodeIdUnknown. Pass assignNodeIds=true to alarm.Create, then walk the condition subtree and rewrite each descendant's NodeId symbolically as {condition-full-ref}.{symbolic-path} in the node manager's namespace. Stable, unique, and collision-free across multiple alarm instances in the same driver.

Fix 2 — event propagation to Server.EventNotifier

OPC UA Part 9 event propagation relies on the alarm condition being reachable from Objects/Server via HasNotifier. Call CustomNodeManager2.AddRootNotifier(alarm) after registering the condition so subscriptions placed on Server-object EventNotifier receive the ReportEvent calls ConditionSink emits per-transition.

Test upgrades in AlarmSubscribeIntegrationTests

  • Driver_alarm_transition_updates_server_side_AlarmConditionState_node — now asserts Severity == 700, message text, and ActiveState.Id == true through the OPC UA client (previously scoped out as BadNodeIdUnknown).
  • New: Driver_alarm_event_flows_to_client_subscription_on_Server_EventNotifier subscribes an OPC UA event monitor on ObjectIds.Server, fires a driver transition, and waits for the AlarmConditionType event to be delivered — asserting Message + Severity fields. Previously scoped out as 'Part 9 event propagation out of reach.'

Test plan

  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Server.Tests → 239 passed, 0 failed (+1 new event-subscription test).
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Core.Tests → 195 passed, 0 failed.

🤖 Generated with Claude Code

## Summary PR #197 surfaced two integration-level wiring gaps in `DriverNodeManager`'s `MarkAsAlarmCondition` path. This PR fixes both and upgrades the alarm integration test to assert the full dispatch path end-to-end — no more scope-outs. ### Fix 1 — addressable child nodes `AlarmConditionState` inherits ~50 typed children (`Severity` / `Message` / `ActiveState` / `AckedState` / `EnabledState` / …). The stack was leaving them with Foundation-namespace NodeIds (type-declaration defaults) or shared `ns=0` counter allocations, so client `Read` on a child returned `BadNodeIdUnknown`. Pass `assignNodeIds=true` to `alarm.Create`, then walk the condition subtree and rewrite each descendant's NodeId symbolically as `{condition-full-ref}.{symbolic-path}` in the node manager's namespace. Stable, unique, and collision-free across multiple alarm instances in the same driver. ### Fix 2 — event propagation to `Server.EventNotifier` OPC UA Part 9 event propagation relies on the alarm condition being reachable from `Objects/Server` via `HasNotifier`. Call `CustomNodeManager2.AddRootNotifier(alarm)` after registering the condition so subscriptions placed on Server-object `EventNotifier` receive the `ReportEvent` calls `ConditionSink` emits per-transition. ### Test upgrades in `AlarmSubscribeIntegrationTests` - `Driver_alarm_transition_updates_server_side_AlarmConditionState_node` — now asserts `Severity == 700`, message text, and `ActiveState.Id == true` through the OPC UA client (previously scoped out as `BadNodeIdUnknown`). - **New**: `Driver_alarm_event_flows_to_client_subscription_on_Server_EventNotifier` subscribes an OPC UA event monitor on `ObjectIds.Server`, fires a driver transition, and waits for the `AlarmConditionType` event to be delivered — asserting `Message` + `Severity` fields. Previously scoped out as 'Part 9 event propagation out of reach.' ## Test plan - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Server.Tests` → 239 passed, 0 failed (+1 new event-subscription test). - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Core.Tests` → 195 passed, 0 failed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
dohertj2 added 1 commit 2026-04-21 00:24:13 -04:00
PR #197 surfaced two integration-level wiring gaps in DriverNodeManager's
MarkAsAlarmCondition path; this commit fixes both and upgrades the integration
test to assert them end-to-end.

Fix 1 — addressable child nodes: AlarmConditionState inherits ~50 typed children
(Severity / Message / ActiveState / AckedState / EnabledState / …). The stack
was leaving them with Foundation-namespace NodeIds (type-declaration defaults) or
shared ns=0 counter allocations, so client Read on a child returned
BadNodeIdUnknown. Pass assignNodeIds=true to alarm.Create, then walk the condition
subtree and rewrite each descendant's NodeId symbolically as
  {condition-full-ref}.{symbolic-path}
in the node manager's namespace. Stable, unique, and collision-free across
multiple alarm instances in the same driver.

Fix 2 — event propagation to Server.EventNotifier: OPC UA Part 9 event
propagation relies on the alarm condition being reachable from Objects/Server
via HasNotifier. Call CustomNodeManager2.AddRootNotifier(alarm) after registering
the condition so subscriptions placed on Server-object EventNotifier receive the
ReportEvent calls ConditionSink emits per-transition.

Test upgrades in AlarmSubscribeIntegrationTests:
  - Driver_alarm_transition_updates_server_side_AlarmConditionState_node — now
    asserts Severity == 700, Message text, and ActiveState.Id == true through
    the OPC UA client (previously scoped out as BadNodeIdUnknown).
  - New: Driver_alarm_event_flows_to_client_subscription_on_Server_EventNotifier
    subscribes an OPC UA event monitor on ObjectIds.Server, fires a driver
    transition, and waits for the AlarmConditionType event to be delivered,
    asserting Message + Severity fields. Previously scoped out as "Part 9 event
    propagation out of reach."

Regression checks: 239 server tests pass (+1 new event-subscription test),
195 Core tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit 6863cc4652 into v2 2026-04-21 00:24:43 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#198