docs(grpc-data): A4 docs — feature negotiation, imported conditions end to end, method status table, limits, security, ScadaBridge impact

DataConnections.md: x-otopcua-data-features negotiation; condition forwarding (key secret, bits 64/128/256, AllowGalaxyServiceAck,
methods + status codes, limits/defaults, troubleshooting); corrects the A2a 'deploy adds/removes arrive as deltas' claim (a deploy
ends the stream). AlarmTracking.md: Imported conditions. ScriptedAlarms.md: known after the first completed evaluation; what
forwards. security.md: imported-condition gate, per-caller method re-check, service principal, on_behalf_of, audit category.
Evidence A4-docs.md: plan-vs-code disagreements, TODO markers for the A4 code merge, ScadaBridge consumer impact.
This commit is contained in:
Joseph Doherty
2026-11-24 22:58:23 -05:00
parent 9143804987
commit 916c14eca1
5 changed files with 553 additions and 17 deletions
+39
View File
@@ -401,6 +401,45 @@ In the v2 actor system, scripted-alarm engine composition is owned by the driver
Both engine and source are disposed on server shutdown via the driver-role host teardown path.
## Forwarding over a data connection
An origin can stream its scripted conditions to another cluster over a gRPC data connection
([DataConnections.md](DataConnections.md#condition-forwarding-end-to-end-a1a3)). The consumer projects them as imported
conditions ([AlarmTracking.md](AlarmTracking.md#imported-conditions-grpc-data-connections)). Two scripted-specific rules
apply.
**A scripted condition becomes *known* only after its first completed evaluation.**
- `Active` is not persisted. After a load, the engine re-derives it from a value cache that `ReadTag` seeds before any
driver has published, so "loaded" is not "known".
- The engine raises `OnInputsEstablished(alarmId, Established: true)` only after the first predicate evaluation that
**completes** since the load or the last revert (`ScriptedAlarmEngine.NoteEvaluationCompleted`). Completes means: no input
still never-pushed, valid evidence, and the predicate returned a bool.
- A Bad input, a script runner that is not up, or a predicate that timed out, was refused or threw establishes nothing.
- The flag is queued as the last of that evaluation's emissions, so the Active projection is dispatched first.
`ScriptedAlarmHostActor` then sends `MarkConditionsKnown` on the same chain as its `AlarmStateUpdate`s.
- During a load the host holds the flags until the post-load re-assert of non-normal (#487) conditions has been queued.
This keeps a freshly re-materialised, inactive node from being declared known ahead of its persisted active state.
- An input that reverts to never-pushed (`NoteInputsReverted`, e.g. a tag re-created by a deploy) withdraws "known". Every
reload clears the established set and re-raises the flag for each alarm as it evaluates again.
- Until then the origin streams the condition with `state_known = false`, and the consumer shows it
`Quality = UncertainInitialValue` and never as "known inactive". A scripted alarm whose inputs never arrive stays
unknown, which is honest: the origin cannot know its state either.
- A projection alone never marks a scripted condition known. That includes a restored-unacked re-assert and an early ack;
only native projections do that (A1 review B1).
**What forwards.**
- Scripted conditions are listed at their `ScriptedAlarmId` in the **UNS** realm, under the equipment that owns them. A
UNS mapping whose remote root covers that equipment imports them; a Raw mapping does not.
- They advertise Acknowledge, AddComment **and Confirm** (`supported_methods` = all three), gated by the export, connection
and mapping bits `AlarmAcknowledge` (128) and `AlarmConfirm` (256).
- A remote call is dispatched through the same wrapped handler as a local OPC UA call, so the engine receives the same,
unchanged `AlarmCommand` (`User` = the connection's service principal). The consumer answers `Good` once the origin has accepted
the call and routed the command (`DriverConfirmedSuccess`). The consumer's node changes only when the resulting record arrives.
- Shelve/Unshelve/Enable/Disable are not forwarded (`BadNotSupported` on the consumer; bit 512 reserved). Operators shelve at
the origin, where `/alerts` and the shelving timers live.
- The activation marker survives a rebuild for scripted conditions, so the engine's re-assert of a still-active alarm is not
a new occurrence. Consumer EventIds stay ackable across that re-assert.
## Key source files
- `src/Core/ZB.MOM.WW.OtOpcUa.Core.ScriptedAlarms/ScriptedAlarmEngine.cs` — orchestrator, cascade wiring, shelving timer, `OnEvent` emission