fix(alarms): #999 K-4 a timed shelve expiring on a predicate evaluation emits Unshelved + AutoUnshelve audit

This commit is contained in:
Joseph Doherty
2026-12-03 10:39:17 -05:00
parent b9955f6946
commit 626d0b33c5
5 changed files with 154 additions and 19 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ rationale is recorded in the engine's class doc so it is not re-proposed:
- `ApplyOneShotShelve` / `ApplyTimedShelve(unshelveAtUtc)` / `ApplyUnshelve` — shelving transitions. `Timed` requires `unshelveAtUtc > nowUtc`.
- `ApplyEnable` / `ApplyDisable` — operator enable/disable. Disabled alarms ignore predicate results until re-enabled; on enable, `ActiveState` is re-derived from the next evaluation.
- `ApplyAddComment(text)` — append-only audit entry, no state change.
- `ApplyShelvingCheck(nowUtc)` — called by the 5s timer; promotes expired `Timed` shelving to `Unshelved` with a `system / AutoUnshelve` audit entry. The sole owner of timed-shelve expiry — the OPC UA node's own SDK timer does nothing.
- `ApplyShelvingCheck(nowUtc)` — called by the 5s timer **and by the engine before every completed predicate evaluation** (serial and out-of-process batch paths, and at load); promotes expired `Timed` shelving to `Unshelved` with a `system / AutoUnshelve` audit entry and an `Unshelved` emission queued ahead of the predicate's own transition. The sole owner of timed-shelve expiry — the OPC UA node's own SDK timer does nothing, and `ApplyPredicate` no longer expires a timed shelve itself (#999 / review K-4: an input push that crossed the deadline before the timer used to unshelve the alarm silently — no event, no audit, the node stuck at TimedShelved).
- `ApplyAcknowledge` on an already-acknowledged alarm is a no-op **unless it carries a comment**, which is recorded as an `AddComment` (emission `CommentAdded`; `LastAck*` untouched) — the OPC UA node reports a commented re-ack, so the system of record must hold the comment too.
Two invariants the machine enforces: