diff --git a/docs/plans/2026-05-29-native-alarms.RESUME.md b/docs/plans/2026-05-29-native-alarms.RESUME.md index 2350cdb7..3e6e65d8 100644 --- a/docs/plans/2026-05-29-native-alarms.RESUME.md +++ b/docs/plans/2026-05-29-native-alarms.RESUME.md @@ -8,10 +8,15 @@ - Do all work here; `main` checkout stays untouched. Build: `dotnet build ZB.MOM.WW.ScadaBridge.slnx`. - The shared MS SQL container `scadabridge-mssql` is up (the ConfigDB MsSql migration-fixture tests use it). -## Progress: Tasks 1–15 done & committed; 16–28 pending -Commits (oldest→newest): `696da92` T1, `edc2dac` T2, `ea14ace` T3, `9134419` T4, `63f1ec2` T5, `aedd17c` T6, `fc05ba1` T7, `e5392d2` T8, `ba27873` T9, `d3b3d15` T10, `1fbb814`+`0d30b7d` T11, `c741170` T12, `b44a844` T13, `24fd7be` T14, `fda7ac9` T15. +## Progress: Tasks 1–18 done & committed; 19–28 pending +Commits (oldest→newest): `696da92` T1, `edc2dac` T2, `ea14ace` T3, `9134419` T4, `63f1ec2` T5, `aedd17c` T6, `fc05ba1` T7, `e5392d2` T8, `ba27873` T9, `d3b3d15` T10, `1fbb814`+`0d30b7d` T11, `c741170` T12, `b44a844` T13, `24fd7be` T14, `fda7ac9` T15, `6d31858` T16, `bca21ff` T17, `20b41b8` T18. -**Cadence is now batches of 3 (user choice on resume).** Batch 4 = T13–15 (site runtime store/options/actor) ✅. Full SiteRuntime.Tests green (311/311). Next: **Batch 5 = T16–18** (InstanceActor wiring → AlarmActor enrich → proto regen). Then 19 (gRPC), 20–22 (mgmt/CLI), 23–25 (UI), 26 (seed), 27 (docs), 28 (live integration). +**Cadence is batches of 3 (user choice on resume).** Batch 4 = T13–15 ✅, Batch 5 = T16–18 ✅. Full SiteRuntime.Tests green (313/313); Communication.Tests green (200/200). Next: **Batch 6 = T19–21** (gRPC mapping → mgmt command contracts → ManagementActor handlers). Then 22 (CLI), 23–25 (UI), 26 (seed), 27 (docs), 28 (live integration). + +## Decisions / deviations — Batch 5 (T16–18) +- **T16:** Connection protocol IS in `FlattenedConfiguration.Connections[name].Protocol` → `ResolveNativeKind` maps protocol-contains-"Mx" → `NativeMxAccess` else `NativeOpcUa`; passed into NativeAlarmActor. Added `_latestAlarmEvents` (enriched event per AlarmName) + extracted `BuildAlarmStatesSnapshot()` used by both `HandleSubscribeDebugView` and `HandleDebugSnapshot` (enriched events ∪ Normal-projection fallback for computed alarms that haven't fired). Native actors skipped when `_dclManager == null` (isolated tests). **Beyond the plan's Files list (justified):** redeploy/undeploy clear — added `native_alarm_state` DELETE to `SiteStorageService.RemoveDeployedConfigAsync` transaction (undeploy) + `ClearNativeAlarmsForInstanceAsync` next to `ClearStaticOverridesAsync` in `DeploymentManagerActor` redeploy path. Native state survives failover (rehydrate) but resets on redeploy — mirrors static-override semantics. +- **T17:** Test-only (as the plan predicted) — `AlarmStateChanged.Condition` getter already defaults to `ForComputed(State, Priority)` from T2, so computed alarms carry the unified condition without code change. Added regression `AlarmActor_ComputedAlarm_CarriesUnifiedConditionState`. +- **T18:** Proto regen done via the documented macOS manual flow (uncomment `` → delete vendored → build → copy `obj/Debug/net10.0/Protos/*.cs` → re-comment). csproj nets to no change. Only `Sitestream.cs` changed (service `SitestreamGrpc.cs` untouched — message-only change). `confirmed` is proto `bool` per plan (null→false fidelity loss accepted). New fields 8–21 on `AlarmStateUpdate`. ## Decisions / deviations made during execution — Batch 4 (T13–15) - **T15:** `NativeAlarmActor` ctor has an optional trailing `AlarmKind nativeKind = AlarmKind.NativeOpcUa` (additive — keeps the 7-arg call working). T16 will pass `NativeMxAccess` when the connection protocol is MxGateway. Persistence is **fire-and-forget** (`ContinueWith` OnlyOnFaulted logs) — never blocks the actor. State keyed by `SourceReference`; `AlarmName` on the emitted `AlarmStateChanged` is set to the `SourceReference`. Snapshot path: `Snapshot` buffers, `SnapshotComplete` atomic-swaps (dropped → emit `Active=false`). Live path ignores older `TransitionTime`; retention drops a condition once `!Active && Acknowledged`. `NativeAlarmSourceUnavailable` = log + retain (no emit). Subscribe retry via `ScheduleTellOnceCancelable` at `NativeAlarmRetryIntervalMs`. diff --git a/docs/plans/2026-05-29-native-alarms.md.tasks.json b/docs/plans/2026-05-29-native-alarms.md.tasks.json index 9a725ded..cbc6d727 100644 --- a/docs/plans/2026-05-29-native-alarms.md.tasks.json +++ b/docs/plans/2026-05-29-native-alarms.md.tasks.json @@ -16,9 +16,9 @@ {"id": 13, "subject": "Task 13: SiteRuntimeOptions alarm cap + retry", "status": "completed"}, {"id": 14, "subject": "Task 14: Site SQLite NativeAlarmState store", "status": "completed"}, {"id": 15, "subject": "Task 15: NativeAlarmActor", "status": "completed", "blockedBy": [1, 2, 3, 4, 13, 14]}, - {"id": 16, "subject": "Task 16: InstanceActor wiring", "status": "pending", "blockedBy": [15]}, - {"id": 17, "subject": "Task 17: Enrich computed AlarmActor emit", "status": "pending", "blockedBy": [2]}, - {"id": 18, "subject": "Task 18: Extend sitestream.proto + regenerate", "status": "pending", "blockedBy": [2]}, + {"id": 16, "subject": "Task 16: InstanceActor wiring", "status": "completed", "blockedBy": [15]}, + {"id": 17, "subject": "Task 17: Enrich computed AlarmActor emit", "status": "completed", "blockedBy": [2]}, + {"id": 18, "subject": "Task 18: Extend sitestream.proto + regenerate", "status": "completed", "blockedBy": [2]}, {"id": 19, "subject": "Task 19: gRPC alarm mapping (server + client)", "status": "pending", "blockedBy": [2, 18]}, {"id": 20, "subject": "Task 20: Management command contracts + registry", "status": "pending", "blockedBy": [4]}, {"id": 21, "subject": "Task 21: ManagementActor handlers", "status": "pending", "blockedBy": [6, 20]}, @@ -30,5 +30,5 @@ {"id": 27, "subject": "Task 27: Documentation sync", "status": "pending", "blockedBy": [16, 19, 22, 23, 24, 25]}, {"id": 28, "subject": "Task 28: Integration / live verification", "status": "pending", "blockedBy": [10, 11, 12, 16, 19]} ], - "lastUpdated": "2026-05-31 batch-4-complete" + "lastUpdated": "2026-05-31 batch-5-complete" }