Merge #992: OpcUaClient indexed recovery re-publish, safe unsubscribe ordering, Bad publish for refused refs, post-dispatch BadTimeout, IPv6 probe preflight

This commit is contained in:
Joseph Doherty
2026-12-03 10:21:21 -05:00
11 changed files with 653 additions and 24 deletions
+13 -2
View File
@@ -427,11 +427,22 @@ initialise (the AdminUI form drops them on the next save). Pinned by
|------------|------|-------|
| `ITagDiscovery` | `DiscoverAsync` (recursive browse) | Mirrors the upstream tree from `BrowseRoot` (default `ObjectsFolder` i=85), bounded by `MaxDiscoveredNodes` / `MaxBrowseDepth` |
| `IReadable` | `ReadAsync` → `Session.ReadAsync` | Upstream `StatusCode`s pass through verbatim (cascading-quality rule) |
| `IWritable` | `WriteAsync` → `Session.WriteAsync` | Passthrough write |
| `IWritable` | `WriteAsync` → `Session.WriteAsync` | Passthrough write. A failure that can occur AFTER the request was sent (`ServiceResultException` `BadRequestTimeout`/`BadTimeout`/`BadSecureChannelClosed`/`BadConnectionClosed`/`BadRequestInterrupted`, `TimeoutException`) reports `BadTimeout` ("outcome unknown"), like a cancelled wait; any other failure is the pre-wire `BadCommunicationError`. Health is `Degraded` in both (no reply arrived) — #992 G-14 |
| `ISubscribable` | native OPC UA subscriptions / monitored items | The remote server pushes data changes |
| `IHostConnectivityProbe` | session keep-alive | Host key is the endpoint URL actually connected to after the failover sweep |
| `IAlarmSource` | `SubscribeAlarmsAsync` (EventFilter) + `AcknowledgeAsync` | Subscribes to upstream alarm/condition events and forwards acks |
> **Subscribe-time refusals and unsubscribe ordering (#992).** A subscribed ref that gets no monitored item — it does not
> resolve to an upstream node id (`BadNodeIdInvalid`, no wire call) or the server refused the create (`BadNodeIdUnknown`,
> `BadAttributeIdInvalid`, … — `CreateItemsAsync` reports these on the item's status, it does not throw) — is published
> **Bad once with that code** and counted in ONE summarised Warning (G-12); it used to sit silently at the host's last
> stamp, `BadNoCommunication`, pointing at comms rather than the address. (It is not added to the skipped-tag report, which
> is an init-time snapshot.) The recovery / reconcile re-publish finds a ref's subscriptions through a per-subscription ref
> set, not a scan of every monitored item under the delivery lock (G-10: 20k refs went from ~6 s to ~1 s). `UnsubscribeAsync` /
> `UnsubscribeAlarmsAsync` leave the subscription tracked until they hold the subscription gate; if the wait is **cancelled**
> (the host's 5 s unsubscribe token vs a slow `ConditionRefresh`), the handlers are detached synchronously — nothing more is
> delivered, even to the re-subscribed set — and the wire delete is queued until the gate frees (G-11).
> **Native alarms (#619).** An alarm raw tag is `TagConfig` `{ "nodeId": "<upstream SourceNode>", "alarm": {...} }`.
> The host subscribes with RawPaths and routes on (driver, RawPath), so the driver matches each
> event's `ConditionId` (then its `SourceNode`) against the tag's authored `nodeId` and reports the **RawPath** as
@@ -447,7 +458,7 @@ initialise (the AdminUI form drops them on the next save). Pinned by
> condition after a start or deploy respawn is flagged `IsRestatement` and states the upstream condition so it lands
> from whatever the host retained: an inactive+acked one goes out as `Clear` + `Acknowledge` (#657; it used to be an
> `Unspecified` the host wrote as "Activated", and a retained-Active host condition stayed Active). So the host writes no
> duplicate row when its condition already shows that state (see `docs/AlarmTracking.md`). Condition **branch** events (non-null `BranchId`) are ignored.
> duplicate row when its condition already shows that state (see `docs/AlarmTracking.md`). Condition **branch** events (non-null `BranchId`) are ignored. An event from an authored alarm source that is **not a condition** (no `ConditionId`, no `ActiveState`/`AckedState` — audit/system events on the same node, #992 G-13) is dropped, never forwarded as `Unspecified` (it replaced the condition's message and wrote an "Activated" row); pass-through mode (no authored refs) still forwards everything.
> **`ConditionRefresh`** is called after the event item is created, after a keep-alive outage the session survived, and on a
> `RefreshRequired` event, so a condition already active upstream is reported at subscribe. The `RefreshStart`/`RefreshEnd`
> markers are never projected as alarms. A server without ConditionRefresh (`BadNotSupported`/`BadMethodInvalid`/…) is logged once and tolerated.
+1 -1
View File
@@ -42,7 +42,7 @@ with a human-readable explanation rather than a false-green TCP-open tick.
| Driver | Handshake | Ok message | Dev-rig target |
|--------|-----------|------------|----------------|
| **Modbus** | FC03 (Read Holding Registers, qty 1 @ addr 0) via `ModbusTcpTransport`. A Modbus exception PDU still proves a real Modbus device → `Ok`. A non-MBAP reply → handshake fail. | `"Modbus FC03 OK"` | `10.100.0.35:5020` (Modbus sim) |
| **OpcUaClient** | `DiscoveryClient.GetEndpointsAsync` — no session, no app-cert, no auth. ≥ 1 endpoint → `Ok`. A non-OPC-UA TCP server throws or times out → handshake fail. | `"OPC UA: N endpoint(s)"` | `opc.tcp://10.100.0.35:50000` (opc-plc) |
| **OpcUaClient** | `DiscoveryClient.GetEndpointsAsync` — no session, no app-cert, no auth. ≥ 1 endpoint → `Ok`. A non-OPC-UA TCP server throws or times out → handshake fail. The TCP preflight (here and in the Galaxy probe) uses a dual-mode socket, so an IPv6 literal / AAAA-only host reaches the handshake (#992 G-15; it was IPv4-only). | `"OPC UA: N endpoint(s)"` | `opc.tcp://10.100.0.35:50000` (opc-plc) |
| **S7** | `Plc.OpenAsync` (COTP CR/CC + S7 setup-communication), check `IsConnected`, then `Close`. Wrong rack/slot or a non-S7 server causes `OpenAsync` to throw → handshake fail. | `"S7 connected (CPU …)"` | `10.100.0.35:1102` (python-snap7 sim) |
| **AbCip** | `libplctag` Tag `InitializeAsync` (EIP session + CIP Forward Open). A CIP-level error such as tag-not-found still proves the controller answered CIP → `Ok`. A session/ForwardOpen/connect error → handshake fail. | `"CIP session OK"` | `10.100.0.35:44818` (CIP sim) |
| **AbLegacy** | Same `libplctag` `InitializeAsync` handshake as AbCip, PCCC protocol family. | `"CIP session OK"` (PCCC family) | Deferred — no PLC5/SLC sim |