fix(alarms): a scripted condition's Part 9 method returns the engine's verdict (#937)

Before: the alarm-commands topic is fire-and-forget, so an OPC UA method (and a
remote gRPC-data condition method) returned Good even when the engine rejected
the command because its last load failed.

- ScriptedAlarmCommandReadinessView: the host's latest load outcome; the node
  manager's handler refuses BadInvalidState before the SDK applies anything
  while the last load failed (lock-free read).
- Bounded ask: inside CallAsync (off Lock) each local request runs base.Call
  alone; the handler only STARTS AlarmCommandAsker (broadcast for the peer +
  DriverHostActor -> ScriptedAlarmHostActor.ExecuteAlarmCommand on the local
  engine, CommandId-deduplicated) and the Call awaits the verdict: refused =>
  BadInvalidState, no answer => BadTimeout OutcomeUnknown.
- Remote CallConditionMethod: ExecuteConditionMethodAsync => DriverConfirmedFailure
  / OutcomeUnknown on the origin.
- Host ownership uses the latest plan set (stable across a load in flight and a
  failed load's half-built set).
- Docs: ScriptedAlarms.md (verdicts, residual, duplicate-activation trade-off),
  DataConnections.md, rules/alarms.md. Live leg scenario F937 + seeder
  scripted_predicate mutation.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-11-28 09:40:35 -05:00
parent 05f431f5d8
commit d6f2a1b5e2
21 changed files with 1074 additions and 38 deletions
@@ -26,7 +26,11 @@ public sealed record OriginConditionMethodCall(AddressSpaceRealm Realm, string C
/// <param name="Native">Whether the condition is native (driver-fed): an applied native call is accepted, not confirmed.</param>
/// <param name="StatusCode">The OPC UA status (Good when applied).</param>
/// <param name="Diagnostic">A refusal's reason text, when the gate gave one.</param>
public sealed record OriginConditionMethodOutcome(bool Applied, bool Native, uint StatusCode, string? Diagnostic);
/// <param name="Dispatched">#937: <see cref="Applied"/> is false, but the call reached the scripted-alarm engine — which refused
/// it, or did not answer (<see cref="Unknown"/>). The node manager had already applied its node state.</param>
/// <param name="Unknown">#937: the engine did not answer inside the budget (or failed): the command may still apply.</param>
public sealed record OriginConditionMethodOutcome(bool Applied, bool Native, uint StatusCode, string? Diagnostic,
bool Dispatched = false, bool Unknown = false);
public sealed partial class OtOpcUaNodeManager
{