Merge #950: AdminUI /alerts scripted-alarm ack/shelve report the engine verdict (ExecuteAck.alarm_verdict / DPS replies collected per request, Applied/Refused/Outcome unknown)

# Conflicts:
#	docs/ScriptedAlarms.md
#	src/Core/ZB.MOM.WW.OtOpcUa.Commons/OpcUa/AlarmCommand.cs
This commit is contained in:
Joseph Doherty
2026-12-01 19:46:28 -05:00
28 changed files with 1452 additions and 73 deletions
+28 -6
View File
@@ -191,8 +191,8 @@ after a full rebuild, carrying the unchanged `LastTransitionUtc`. Decisions:
SDK applies anything (no event, nothing routed); a call that passed that pre-check and then met a rejection (it was queued
behind a load that failed) also returns `BadInvalidState` and the node is reverted — see
[Operator command verdicts](#operator-command-verdicts-937).
The AdminUI `/alerts` buttons still publish fire-and-forget ("Ack sent"), so for them the only record remains the host's
Warning `… NOT applied — …`. The next good load re-asserts every node from the store.
Since #950 the AdminUI `/alerts` buttons report it too ("Refused: …" — see [AdminUI path](#adminui-path)).
The next good load re-asserts every node from the store.
**Accepted trade-off:** because the next good load after a failed one reads the store (which has no `Active` column), each
alarm whose predicate is still true is a new occurrence — **one transient failed deploy costs one duplicate activation
(`Activated` + `Unacknowledged`, one `alerts` row) per still-true alarm** on the next good deploy.
@@ -501,9 +501,8 @@ let through while a load is pending; the engine queues a command behind it). The
shows subscribers two events: the method's, then the corrective one. An OutcomeUnknown leaves the node changed (the engine
may still apply it) unless a late refusal arrives inside the late window (#951). A command whose direct ask gave up and whose
broadcast copy is then refused by the local engine (no one awaits a broadcast copy) still keeps the node change until the
next good deploy re-asserts it. A command racing the engine's first load queues behind it rather than failing.
**Not covered:** the AdminUI `/alerts` buttons are still fire-and-forget across the central→node transport (they report
"Ack sent", not "applied").
next good deploy re-asserts it. (#958) A command racing the engine's first load queues behind it rather than failing.
The AdminUI `/alerts` buttons report the engine's verdict too since #950 — see [AdminUI path](#adminui-path).
`OnTimedUnshelve` (the SDK's internal auto-unshelve timer, armed for the real remaining time since Gitea #597) is a **no-op**: the engine owns timed-shelve expiry via `ApplyShelvingCheck` (`system / AutoUnshelve`), and routing an `Unshelve` from the timer pre-empted that on every expiry as an operator-style unshelve from both pair nodes (review R1 M2).
@@ -513,7 +512,30 @@ next good deploy re-asserts it. A command racing the engine's first load queues
### AdminUI path
The AdminUI `/alerts` page (`Alerts.razor`) shows per-row **Acknowledge / Shelve / Unshelve** buttons. These are gated by the `DriverOperator` AdminUI policy and routed through the `AdminOperationsActor` cluster singleton (`AcknowledgeAlarmCommand` / `ShelveAlarmCommand`), which publishes onto the same `alarm-commands` topic. Cross-node routing is handled by the cluster singleton — the command always reaches the driver-role node hosting the engine that owns the alarm regardless of which AdminUI instance the operator is connected to. The Shelve button accepts a duration (minutes) and passes it to `ShelveAlarmAsync(Timed, unshelveAtUtc)`; result chips auto-clear after ~8 s. The `/alerts` and `/script-log` live-status pills reflect real feed health driven by the SignalR bridge actors' DPS subscription state.
The AdminUI `/alerts` page (`Alerts.razor`) shows per-row **Acknowledge / Shelve / Unshelve** buttons. These are gated by the `DriverOperator` AdminUI policy and routed through the `AdminOperationsActor` cluster singleton (`AcknowledgeAlarmCommand` / `ShelveAlarmCommand`), which publishes onto the same `alarm-commands` topic. Cross-node routing is handled by the cluster singleton — the command always reaches the driver-role node hosting the engine that owns the alarm regardless of which AdminUI instance the operator is connected to. The Shelve button accepts a duration (minutes) and passes it to `ShelveAlarmAsync(Timed, unshelveAtUtc)`; result chips auto-clear after ~8 s.
**The result chip is the engine's verdict (#950), not "sent".** For each request `AdminOperationsActor` spawns an
`AlarmCommandVerdictCollector`, which sends the command with `AlarmCommand.VerdictRequested` set and gathers every node's
answer for up to **7 s** (`AlarmCommandVerdictCollector.DefaultWindow`, under the client's 10 s ask), finishing early once
each node it sent to has answered:
- **gRPC command plane** (`MeshTransport:Mode=Grpc`, every split-topology deployment): `CentralCommunicationActor` tells the
collector the dialled `ClusterNode` set, then one verdict per node. A node handles a `verdict_requested`
`AlarmCommandMessage` by asking its driver host (`ScriptedAlarmHostActor.ExecuteAlarmCommand`, the #937 path, **no ask
deadline** — nothing else carries the command to that node, so a late engine still applies it), bounded at 5 s, and
returns the outcome in the additive `ExecuteAck.alarm_verdict`. A transport failure, a timed-out engine, or an **empty
ack (a node built before #950, which takes the old one-way path)** is that node's *unknown*.
- **DistributedPubSub** (`Dps`, single mesh): the command is published with the collector as the sender; each
`ScriptedAlarmHostActor` answers it — non-owners with `AlarmCommandOutcome.NotOwned` — and the collector expects one answer
per Up `driver` member. A node built before #950 (or a driver node with no scripted-alarm host) stays silent: that node is
*unknown* and the reply waits the full window.
Aggregation (`AlarmCommandVerdictAggregator`): **any owner applied ⇒ Applied** (green; "Applied on n of m servers" when a
peer owner refused or did not answer); else **any unknown ⇒ Outcome unknown** (amber — never "refused": that node may still
apply it); else an owner's refusal ⇒ **Refused: <reason>** (red); else no node owns the alarm ⇒ **Not applied**. The
per-node breakdown is in the chip's "Request details". A result with no verdict (a validation failure, a server fault, or a
pre-#950 admin singleton during a rolling upgrade) renders as before. Wire changes are additive both ways: a pre-#950
central never sets `verdict_requested`, so a new node serves it exactly as before. The `/alerts` and `/script-log` live-status pills reflect real feed health driven by the SignalR bridge actors' DPS subscription state.
Under redundancy, the `alerts` topic rows are deduplicated to the Primary node — see [Redundancy.md §Primary-gated alarm emission and historization](Redundancy.md#primary-gated-alarm-emission-and-historization).