fix(alarms): diff across monitor restarts, version reconciles, cache the watch-list (SEC-005..SEC-010, #250, #254)
ci / windows-x86 (push) Successful in 3m34s
ci / java (push) Failing after 12m34s
ci / portable (push) Failing after 24m29s

- SEC-005: a lifecycle that ends keeps its cache as the previous
  generation; the next lifecycle's first reconcile diffs against it and
  broadcasts Clear for alarms gone during the gap (derived from the new
  worker snapshot, documented in gateway.md as a reconcile repair, not a
  synthesized event). The retired set is hidden from CurrentAlarms; gap
  joiners get the whole set. Each lifecycle start broadcasts its
  re-baselined provider status.
- SEC-006: live transitions stamp a sequence; a reconcile leaves alarms
  changed live after it was issued alone (no stale Clear / re-raise).
- SEC-007: an Acknowledge of an uncached alarm is broadcast but no longer
  inserts an ActiveAcked row; other non-Raise kinds do not touch the cache.
- SEC-009: a changed original raise time is a Raise repair; a non-OK
  reconcile is logged/surfaced and fails the initial reconcile.
- SEC-008: watch-list resolution cached per Galaxy deploy time and
  fingerprinted by SHA-256 once per resolution; refresh runs on its own
  loop; the failover-edge refresh is bounded to 10 s.
- SEC-010: restart backoff doubles from 5 s to a 5 min cap and resets on
  Monitoring; repeated identical faults log one summary line.
This commit is contained in:
Joseph Doherty
2026-12-03 10:08:07 -05:00
parent eb37565e59
commit 0ccf3d400b
7 changed files with 1484 additions and 71 deletions
+10 -4
View File
@@ -900,10 +900,16 @@ MXAccess item addresses for the `InAlarm`, `Acked`, `AckMsg`, and `Priority`
subtags (confirmed AVEVA `AlarmExtension` field names, verified against the live
ZB Galaxy `attribute_definition` rows).
The gateway refreshes this list on the existing alarm reconciliation cadence
and immediately before publishing a failover-to-subtag status. It compares a
canonical fingerprint of all six target fields and sends
`UpdateAlarmWatchListCommand` only for a material change. The worker constructs,
The gateway refreshes this list on the alarm reconciliation cadence, on a loop
of its own so a slow or hung Galaxy SQL query never delays a reconcile pass, and
immediately before publishing a failover-to-subtag status (bounded to 10 seconds,
after which the status is published with the last acknowledged list and the
periodic loop retries). The resolver caches a successful resolution against the
Galaxy's last deploy time (`GetLastDeployTimeAsync`), so an undeployed galaxy
costs one deploy-time query per refresh rather than the alarm-attribute query
and a rebuilt list; a failed discovery or an unknown deploy time is not cached.
The gateway compares a SHA-256 of a canonical fingerprint of all six target
fields and sends `UpdateAlarmWatchListCommand` only for a material change. The worker constructs,
subscribes, and attaches the replacement standby on its STA before swapping it
in; a setup failure leaves the previous standby and the current primary/subtag
mode unchanged. The gateway advances its acknowledged fingerprint only after an