driver-galaxy: EventPump dispatches OnAlarmTransition family (PR B.1) #409

Merged
dohertj2 merged 1 commits from track-b1-eventpump-alarm into master 2026-04-30 15:44:34 -04:00
Owner

Summary

Second PR of the alarms-over-gateway epic (docs/plans/alarms-over-gateway.md). Depends on PR A.1 in mxaccessgw (already merged).

  • EventPump.Dispatch becomes a switch on MxEventFamily. New DispatchAlarmTransition decodes the proto event, runs raw severity through MxAccessSeverityMapper, fires internal OnAlarmTransition with a full-payload GalaxyAlarmTransition record.
  • MxAccessSeverityMapper — four-bucket ladder (Low/Medium/High/Critical → OPC UA 250/500/750/1000) matching v1's GalaxyAlarmTracker (docs/v1/AlarmTracking.md).
  • GalaxyAlarmTransition — internal record carrying the rich payload until AlarmEventArgs gets extended in PR E.7.
  • New metrics: galaxy.alarm_transitions.received, galaxy.alarm_transitions.decoding_failures.

No runtime impact yet — the gateway doesn't emit the new family until A.3 ships. This PR stops the EventPump from silently dropping it once it does.

Test plan

  • dotnet build ZB.MOM.WW.OtOpcUa.slnx — clean (0 errors)
  • MxAccessSeverityMapperTests — full bucket ladder + clamp for out-of-range inputs (11 cases)
  • EventPumpAlarmTests — raise/ack/clear dispatches in order with operator metadata + original-raise preserved; unspecified-kind drops; missing-body drops; mixed data-change + alarm streams dispatch independently; OnWriteComplete / OperationComplete filtered out (5 tests)
  • Full Driver.Galaxy.Tests — 196 passed (was 191; 5 new)

Follow-up

PR B.2 (next) — GalaxyDriver implements IAlarmSource and wraps OnAlarmTransition onto OnAlarmEvent. AcknowledgeAsync routes through the new gateway RPC.

## Summary Second PR of the **alarms-over-gateway** epic (docs/plans/alarms-over-gateway.md). Depends on **PR A.1** in mxaccessgw (already merged). - EventPump.Dispatch becomes a switch on MxEventFamily. New DispatchAlarmTransition decodes the proto event, runs raw severity through MxAccessSeverityMapper, fires internal OnAlarmTransition with a full-payload GalaxyAlarmTransition record. - MxAccessSeverityMapper — four-bucket ladder (Low/Medium/High/Critical → OPC UA 250/500/750/1000) matching v1's GalaxyAlarmTracker (docs/v1/AlarmTracking.md). - GalaxyAlarmTransition — internal record carrying the rich payload until AlarmEventArgs gets extended in PR E.7. - New metrics: galaxy.alarm_transitions.received, galaxy.alarm_transitions.decoding_failures. No runtime impact yet — the gateway doesn't emit the new family until A.3 ships. This PR stops the EventPump from silently dropping it once it does. ## Test plan - [x] dotnet build ZB.MOM.WW.OtOpcUa.slnx — clean (0 errors) - [x] MxAccessSeverityMapperTests — full bucket ladder + clamp for out-of-range inputs (11 cases) - [x] EventPumpAlarmTests — raise/ack/clear dispatches in order with operator metadata + original-raise preserved; unspecified-kind drops; missing-body drops; mixed data-change + alarm streams dispatch independently; OnWriteComplete / OperationComplete filtered out (5 tests) - [x] Full Driver.Galaxy.Tests — 196 passed (was 191; 5 new) ## Follow-up PR B.2 (next) — GalaxyDriver implements IAlarmSource and wraps OnAlarmTransition onto OnAlarmEvent. AcknowledgeAsync routes through the new gateway RPC.
dohertj2 added 1 commit 2026-04-30 15:44:19 -04:00
Second PR of the alarms-over-gateway epic
(docs/plans/alarms-over-gateway.md). Depends on PR A.1 in mxaccessgw
(merged) which added the OnAlarmTransitionEvent body + family. No
runtime impact yet — the gateway doesn't emit the new family until
A.3 ships; this PR just stops dropping it on the floor.

EventPump.Dispatch becomes a switch on MxEventFamily. The new
DispatchAlarmTransition decodes the proto event, runs the raw severity
through MxAccessSeverityMapper (the same four-bucket ladder v1 used —
250/500/750/1000 boundaries per docs/v1/AlarmTracking.md), and fires
an internal OnAlarmTransition event with a GalaxyAlarmTransition
record carrying the full payload.

Body absent or transition-kind unspecified → counted via
galaxy.alarm_transitions.decoding_failures and dropped. Gateway
version skew or worker malformed event therefore degrades to "fall
back to the sub-attribute path" rather than crashing the pump.

GalaxyDriver consumes the internal event in PR B.2 (next), wrapping
it onto IAlarmSource.OnAlarmEvent. The richer fields (operator user
+ comment, original raise time, category) become visible on the OPC
UA Part 9 condition once AlarmEventArgs gets extended in E.7.

Tests:
- MxAccessSeverityMapperTests — full bucket ladder + clamp behaviour
  for negative + out-of-range inputs.
- EventPumpAlarmTests — raise/ack/clear sequence dispatches in order
  with operator metadata + original-raise preserved; unspecified
  kind drops; missing body drops; mixed data-change + alarm streams
  dispatch independently; OnWriteComplete / OperationComplete
  filtered out.

Full Driver.Galaxy.Tests suite: 196 passed (was 191 — 5 new tests).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit c59bf59635 into master 2026-04-30 15:44:34 -04:00
dohertj2 deleted branch track-b1-eventpump-alarm 2026-04-30 15:44:34 -04:00
Sign in to join this conversation.