Merge #1116: dispatch log says 'delivery outcome unknown' for Cancelled/DeadlineExceeded; docker-dev README deploy responses + stale LDAP bind password / login-enabled flip; ScriptedAlarms.md explains when /alerts shows Refused

This commit is contained in:
Joseph Doherty
2026-12-05 02:38:15 -05:00
4 changed files with 68 additions and 4 deletions
+17 -3
View File
@@ -135,7 +135,16 @@ The first build takes a few minutes (.NET SDK image + restore + publish). **No m
Central nodes authenticate against the shared GLAuth at `10.100.0.35:3893` (baseDN `dc=zb,dc=local`). `DevStubMode` is **not** active. Sign in with any test user (password `password`); `multi-role` / `password` returns all three roles (Administrator, Designer, Viewer). Group→role mappings are seeded by `seed/seed-clusters.sql`. The GLAuth source of truth + deploy runbook is in `scadaproj/infra/glauth/`. **Do not** enable `DevStubMode` outside local debugging — production must always bind a real LDAP backend.
The LDAP service-account bind password is read from the host env var `OTOPCUA_LDAP_BIND_PASSWORD` (compose default `serviceaccount123`, the committed dev password of the shared GLAuth, so the rig works with nothing set). Export it before `docker compose up` to bind with a different password (#619).
The LDAP service-account bind password is read from the host env var `OTOPCUA_LDAP_BIND_PASSWORD` (#619). **The compose default (`serviceaccount123`) is stale since SEC-36**: the shared GLAuth's `serviceaccount` password was rotated out-of-band and is deliberately not recorded in any repo (see `~/Desktop/scadaproj/infra/glauth/README.md`, "Users"). The default is fine with login disabled (the rig's default, `Security__Auth__DisableLogin: "true"`, never binds), but any **login-enabled** gate must export the current value from the owner / secret store first, and never commit it:
```bash
export OTOPCUA_LDAP_BIND_PASSWORD='<current value from the owner/secret store>'
export OTOPCUA_DISABLE_LOGIN=false # real cookie login flow on central-1/central-2
./docker-dev/compose.sh up -d # recreates central-1/central-2 with login on
# ...run the gate; sign in as e.g. multi-role / password...
unset OTOPCUA_DISABLE_LOGIN OTOPCUA_LDAP_BIND_PASSWORD # back to the default (login disabled)
./docker-dev/compose.sh up -d
```
## Headless deploy
@@ -153,8 +162,13 @@ The body is optional and the no-body form is fully supported (verified on this r
the minimal-API `DeployRequest?` parameter binds a missing body *and* a `Content-Length: 0` body
as **null** — it does not 400 — and the handler defaults the audit field to
`CreatedBy = "rest-api"`. A bare `./docker-dev/deploy.sh` answers `202 Accepted` with the new
`deploymentId` + `revisionHash`, `200` when there is nothing to deploy, and `409` while another
deployment is still in flight.
`deploymentId` + `revisionHash`. A repeat POST is **not** a no-op: it creates a new deployment (it may
reuse the previous revision hash) and answers `202` again. The other answers are `202` with a
`Location` to poll when the outcome is unknown (the ask timed out; the deployment may still go
ahead), `409` while another deployment is still in flight, `422` when the deployment is rejected
(validation / deploy gates), `401` for a missing/bad API key, `503` when the deploy API is not
configured or available, and `500` for an unexpected outcome. (`DeployApiEndpoints.cs` maps a
`NoChanges` outcome to `200`, but nothing currently produces it.)
### First-POST 404 — mechanism CONFIRMED (2026-08-18)
+7 -1
View File
@@ -555,7 +555,13 @@ Aggregation (`AlarmCommandVerdictAggregator`): **any owner applied ⇒ Applied**
peer owner refused or did not answer); else **any unknown ⇒ Outcome unknown** (amber — never "refused": that node may still
apply it); else an owner's refusal ⇒ **Refused: <reason>** (red); else no node owns the alarm ⇒ **Not applied**. The
per-node breakdown is in the chip's "Request details". A result with no verdict (a validation failure, a server fault, or a
pre-#950 admin singleton during a rolling upgrade) renders as before. Wire changes are additive both ways: a pre-#950
pre-#950 admin singleton during a rolling upgrade) renders as before.
**Reading the chip (#1116).** Re-acknowledging an already-acknowledged alarm is **Applied** — the engine treats it as a
no-op, it is not an error. **Refused: <reason>** only arises when the *owning* node refuses the command: its last config
load failed (the node manager returns `BadInvalidState`), a malformed command, or no engine on that node. An engine-gate
timeout (the command was still queued behind a long load when the host's op bound expired) is not a refusal when the
engine may still run it — that renders as **Outcome unknown** (amber), per the aggregation rules above. Wire changes are additive both ways: a pre-#950
central never sets `verdict_requested`, so a new node serves it exactly as before. The `/alerts` and `/script-log` live-status pills reflect real feed health driven by the SignalR bridge actors' DPS subscription state.
Under redundancy, the `alerts` topic rows are deduplicated to the Primary node — see [Redundancy.md §Primary-gated alarm emission and historization](Redundancy.md#primary-gated-alarm-emission-and-historization).
@@ -628,6 +628,17 @@ public sealed class CentralCommunicationActor : ReceiveActor, IWithTimers
return;
}
if (IsDeliveryOutcomeUnknown(result.FailureStatus))
{
_log.Warning(
"Mesh: {CommandType} (correlationId={CorrelationId}) delivery outcome unknown to {NodeId} "
+ "({Status}: {Detail}) \u2014 the node may have received and applied it; the deploy coordinator's "
+ "re-send/ack will settle it (#1107)",
result.CommandType, result.CorrelationId, result.NodeId,
result.FailureStatus, result.FailureDetail);
return;
}
_log.Warning(
"Mesh: {CommandType} (correlationId={CorrelationId}) was NOT delivered to {NodeId} "
+ "({Status}: {Detail}). This actor does not retry it; a deployment is re-sent by the deploy "
@@ -637,6 +648,17 @@ public sealed class CentralCommunicationActor : ReceiveActor, IWithTimers
result.FailureStatus, result.FailureDetail);
}
/// <summary>
/// #1116: a gRPC client deadline / cancellation can expire after the node already received (and applied) the
/// command, so <c>Cancelled</c> / <c>DeadlineExceeded</c> (the dispatch also maps a dial timeout to
/// <c>Cancelled</c>) are "outcome unknown", not "not delivered".
/// Statuses such as <c>Unavailable</c> (no connection) guarantee non-delivery.
/// </summary>
/// <param name="failureStatus">The recorded failure status text, or null.</param>
/// <returns>True when delivery may still have happened.</returns>
public static bool IsDeliveryOutcomeUnknown(string? failureStatus)
=> failureStatus is "Cancelled" or "DeadlineExceeded";
private void HandleApplyAck(ApplyAck ack)
{
var coordinator = _coordinator();
@@ -0,0 +1,22 @@
using Shouldly;
using Xunit;
using ZB.MOM.WW.OtOpcUa.ControlPlane.Communication;
namespace ZB.MOM.WW.OtOpcUa.ControlPlane.Tests.Communication;
public sealed class DeliveryOutcomeClassificationTests
{
[Theory]
[InlineData("Cancelled")]
[InlineData("DeadlineExceeded")]
public void Deadline_or_cancel_is_outcome_unknown(string status)
=> CentralCommunicationActor.IsDeliveryOutcomeUnknown(status).ShouldBeTrue();
[Theory]
[InlineData("Unavailable")]
[InlineData("Unknown")]
[InlineData("InvalidArgument")]
[InlineData(null)]
public void Other_statuses_stay_not_delivered(string? status)
=> CentralCommunicationActor.IsDeliveryOutcomeUnknown(status).ShouldBeFalse();
}