4.8 KiB
4.8 KiB
Native Alarms — Execution Resume Notes
Skill in progress: superpowers-extended-cc:executing-plans on docs/plans/2026-05-29-native-alarms.md.
To resume: /superpowers-extended-cc:executing-plans docs/plans/2026-05-29-native-alarms.md (reads …md.tasks.json).
Workspace
- Worktree:
/Users/dohertj2/Desktop/scadalink-design-native-alarms(branchfeat/native-alarms, offmain@09e19dbwhich holds the design + plan). - Do all work here;
maincheckout stays untouched. Build:dotnet build ZB.MOM.WW.ScadaBridge.slnx. - The shared MS SQL container
scadabridge-mssqlis up (the ConfigDB MsSql migration-fixture tests use it).
Progress: Tasks 1–12 done & committed; 13–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.
Next batch (4): Tasks 13–17 (site runtime) — all unit-testable with Akka.TestKit. Then 18–19 (proto/gRPC), 20–22 (mgmt/CLI), 23–25 (UI), 26 (seed), 27 (docs), 28 (live integration).
Known-flaky baseline (NOT my regressions)
- 5
StaleTagMonitor*TestsinZB.MOM.WW.ScadaBridge.Commons.Testsare timing-flaky under load. User approved treating as known-flaky; do not "fix". Watch only for NEW failures.
Decisions / deviations made during execution (carry forward)
- T2:
AlarmStateChanged.Conditionis a computed-default property (getter falls back toAlarmConditionStateFactory.ForComputed(State, Priority)); additions are init-props (additive).AlarmConditionStateFactorylives inCommons/Types/Alarms. - T8:
ResolvedNativeAlarmSourcehas noIsLockedfield (per plan). Inheritance lock is enforced via a locallockedNamesHashSet insideResolveInheritedNativeAlarmSources. Override-lock is NOT enforced at flatten (matches plan; UI/validation layer handles it). - T9:
SemanticValidator.Validategained an optional 3rd paramIReadOnlySet<string>? alarmCapableConnectionNames = null. Connection-existence check only runs when callers pass it; empty source-ref / empty connection-name always checked.ValidationCategory.NativeAlarmSourceInvalidadded. (Wiring real callers to pass the connection set is not yet done — fine for now.) - T10:
DataConnectionActorroutes alarm transitions by source-ref prefix (transition.SourceObjectReference/SourceReferenceStartsWith bound key), dedup per transition. One feed per source-ref, ref-counted. Internal recordsAlarmTransitionReceived,AlarmSubscribeCompleted.NativeAlarmSourceUnavailablepushed on entering Reconnecting;ReSubscribeAllAlarmson reconnect. - T11 (OPC UA):
OpcUaAlarmMapperis pure/tested.RealOpcUaClient.CreateAlarmSubscriptionAsyncdoes event MonitoredItem +EventFilter(select clauses indexed 0–12) +ConditionRefreshviaCallAsync(the syncCallis obsolete→error).AlarmConditionStatecollides withOpc.Ua.AlarmConditionState— fully-qualified asCommons.Types.Alarms.AlarmConditionStateat the onenewsite. Behavior unverified until Task 28 (live A&C server). - T12 (MxGateway):
MxGatewayAlarmMapperis pure/tested. Gateway proto enumsAlarmConditionState/AlarmTransitionKindcollide with Commons enums → aliased (ProtoConditionState/ProtoTransitionKindfor proto; explicitusing X = Commons…for the Commons ones).MxGatewayClient.StreamAlarmsAsync(StreamAlarmsRequest, ct) → IAsyncEnumerable<AlarmFeedMessage>confirmed present in pkg v0.1.0. Adapter opens one shared session-less feed (gateway-wide, null prefix), ref-counted, first-callback drives it (the actor routes).RealMxGatewayClient.RunAlarmStreamAsyncreconnects internally (5s) — does NOT useRaiseDisconnected. Reference: OtOpcUa…Driver.Galaxy/Runtime/GatewayGalaxyAlarmFeed.cs. Behavior unverified until Task 28 (live gateway).
Execution cadence
- Per-task TDD: write test → confirm RED → implement → GREEN → commit. Update native task status + this
.tasks.jsoneach task; report at each batch boundary and wait for "start"/feedback. - Batches so far: B1 = T1–4, B2 = T5–8, B3 = T9–12. Next proposed: B4 = T13–17.
- Native task IDs map plan Task N → native id (N+6) — but on resume the native list is rebuilt from
.tasks.json(Step 0).
Watch items for remaining tasks
- T18 (proto):
sitestream.protois not auto-compiled —<Protobuf>include is commented out, generated.csvendored inSiteStreamGrpc/. Manual macOS regen only (toggle include →dotnet build→ copy generated files → re-comment). Do NOT auto-compile on Linux. - T28: OPC UA A&C live smoke (SkippableFact) + confirm infra OPC UA server exposes A&C; manual deploy check via
bash docker/deploy.sh/docker-env2/deploy.sh.