Merge master into #937 (scenarios: keep A09 + F937)
This commit is contained in:
@@ -121,6 +121,8 @@ otopcua-cli read -u opc.tcp://localhost:4840/OtOpcUa -n "ns=3;s=DEV.ScanState" -
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-n` / `--node` | Node ID to read (required) |
|
||||
| `--max-age` | Maximum cached value age in milliseconds (0–2147483647; default 0). Value attribute only |
|
||||
| `-a` / `--attribute` | Attribute to read instead of the value (case-insensitive): `Value` (default), `Historizing`, `AccessLevel`, `UserAccessLevel`, `DataType`, `ValueRank`, `ArrayDimensions`, `MinimumSamplingInterval`, `NodeClass`, `BrowseName`, `DisplayName`, `EventNotifier`. The output gains an `Attribute:` line. Used by the #921 gate to show a projected variable's `Historizing` is False when its origin lacks the history feature |
|
||||
|
||||
Output:
|
||||
|
||||
|
||||
+74
-6
@@ -90,6 +90,40 @@ reply cannot lengthen it. Renewal grants no parent or sibling visibility, Browse
|
||||
local Browse privilege. Missing capability, denied Metadata or an invalid lease leaves the item
|
||||
unavailable until valid authority can be established.
|
||||
|
||||
**A lapsed lease is not an access denial (#922).** A projected node idle longer than its mapping's
|
||||
`MetadataLeaseMilliseconds` keeps its retained proof; the lease is only *lapsed* when its time ran
|
||||
out or its route was replaced while the local catalog authority, mapping binding and cache
|
||||
generation are all still current and nothing revoked it. On a refused value Read / attribute Read /
|
||||
HistoryRead of such a node, the consumer first authorizes the caller against the lapsed subject
|
||||
(local grant + mapping bit, everything but the lease). A caller without the grant is still
|
||||
`BadUserAccessDenied` and nothing is sent to the origin. A granted caller gets the same exact
|
||||
`GetMetadata` renewal as above, for the operation it is performing (Read / HistoryRead bit, not
|
||||
Subscribe), one per node and operation at a time, with a 250 ms back-off after a failure. On-demand
|
||||
renewals never touch the unary budget (cold reads, writes) or the browse/subscription-renewal fetch
|
||||
slots: they queue (at most 64) for their own pool of `max(1, maxConcurrentFetches / 2)` origin calls,
|
||||
reserve 256 KiB each, and have 3 s end to end, so a batch of N lapsed nodes renews all N:
|
||||
|
||||
- **Value Read** answers `BadWaitingForInitialData` (as a cold read does) while the renewal runs off
|
||||
the request thread; once it commits, a read is scheduled so the client's retry is served from the
|
||||
fresh sample. `BadResourceUnavailable` while a renewal cannot be started (capacity, back-off).
|
||||
A non-Value attribute of a lapsed node answers `BadResourceUnavailable` while it renews.
|
||||
- **HistoryRead** renews within the request and is then served. The wait (one per batch, at most 4 s
|
||||
and never past `HistoryReadDeadline`, no node-manager `Lock` held, the request's cancellation
|
||||
honoured) takes one of the non-local history batch slots first. A batch that finds none free does
|
||||
not wait. A renewal that cannot complete (origin unreachable or silent, no slot) answers
|
||||
`BadResourceUnavailable`. A renewal that succeeded while the node manager's ACL veto still refuses
|
||||
answers `BadUserAccessDenied`.
|
||||
- **Browse:** a cached page past half its lease is served as is *and* refreshed in the background
|
||||
(one refresh per page key), so a re-browse renews the leases of the nodes it lists.
|
||||
|
||||
An origin that stopped granting the operation fails the renewal; the consumer then keeps answering
|
||||
the retryable status (it cannot tell that from an unreachable origin).
|
||||
|
||||
Not covered yet: a **Write** or **CreateMonitoredItems** on a lapsed node is still refused
|
||||
`BadUserAccessDenied` (neither starts a renewal; a re-browse, a Read or a HistoryRead of the node
|
||||
renews it, after which they succeed). A lease that was revoked (`Invalidate`), a removed mapping and a
|
||||
retired node are refusals, not lapses, and are never renewed.
|
||||
|
||||
An authorized logical monitored-item request can survive a physical stream expiry and seek a new
|
||||
pinned binding with bounded retries. The old binding and any queued sample evidence remain tied to
|
||||
their original authority and serving generation. The same item needs a fresh, complete baseline
|
||||
@@ -170,11 +204,35 @@ advertisement and a per-call request header, `x-otopcua-data-features`, whose va
|
||||
- The new RPCs (`HistoryRead`, `CallConditionMethod`) answer `FailedPrecondition("feature not negotiated")`. A
|
||||
history-only call is also refused `CallConditionMethod`.
|
||||
- Header-less goldens (`*Goldens.cs`) and the recorded-v1-client gates (`GrpcDataV1CompatibilityTests`,
|
||||
`GrpcDataV1RealOriginCompatibilityTests`) pin the v1 bytes. Every phase ran them with an empty goldens diff.
|
||||
`GrpcDataV1RealOriginCompatibilityTests`) pin the v1 bytes. Every phase ran them with an empty goldens diff. The two
|
||||
pre-deploy corrections below are the only deliberate differences. The real-origin gate applies them to the recorded
|
||||
goldens in `GrpcDataV1RealOriginCorrections`; the goldens are never re-recorded.
|
||||
|
||||
Fix two v1 defects before any v1 deploy. #916: `stable_source_id` leaks the driver id and RawPath to UNS-only peers.
|
||||
#917: v1 exports alarm-bearing raw tags as variables that never get a value. G0, the v1 deploy and soak (#915), is still
|
||||
open; see the plan's §1.1.
|
||||
### What an origin exports (v1 corrections #916, #917)
|
||||
|
||||
v1 was merged but not deployed (#915), so two defects were fixed in v1 itself. Header-less callers get the fix too.
|
||||
Neither change alters the wire shape: one drops an optional field, the other drops a page item. Evidence: `docs/plans/evidence/grpc-data-ext/V1-916-917.md`.
|
||||
|
||||
- **No `Metadata.stable_source_id` (#916).** The origin never sends field 10. It used to carry the internal acquisition key,
|
||||
which for a driver tag is `<len>:<driverInstanceId><RawPath>`. That disclosed driver ids and RawPaths to peers holding
|
||||
only a UNS export.
|
||||
- No consumer used the field except for byte accounting, so it was dropped rather than replaced by an opaque id. A
|
||||
stable opaque id would only let a peer correlate Raw and UNS nodes.
|
||||
- The field is `optional`. Old consumers decode its absence as null, so every version mix works.
|
||||
- Conditions dedupe on the keyed `condition_key` instead.
|
||||
- Internally the origin still keys acquisition on the unchanged `BackingSourceKey`.
|
||||
- **Alarm-bearing raw tags are not exported as values (#917).** A tag with an alarm config never gets a value: the driver
|
||||
host keeps it out of the value fan-out, and #896 gives it no UNS variable.
|
||||
- The origin compiles it as an unsupported value node. GetMetadata, Read, Subscribe and HistoryRead on it answer
|
||||
`Unsupported`, and writes are refused.
|
||||
- **Browse does not list it**, and the same holds for any unsupported value node, such as a data type v1 cannot carry.
|
||||
Every consumer build applies a browse page all or nothing and cannot materialise an `UnsupportedVariable`. Listing one
|
||||
made the whole folder unbrowsable on the consumer (`BadNoCommunication`); the live gate found this.
|
||||
- The node stays in the catalog, so an export rooted at it still compiles. Such a root grants nothing: the values are unsupported, and the condition sits under the tag's folder, not under the tag.
|
||||
- The alarm itself is forwarded as a **condition** (A1–A4, see "Condition forwarding end to end"). Condition placements
|
||||
do not depend on the value node.
|
||||
|
||||
G0, the v1 deploy and soak (#915), is still open; see the plan's §1.1.
|
||||
|
||||
## Remote history (runtime consumers)
|
||||
|
||||
@@ -200,6 +258,10 @@ the bit (see "Mixed versions" below); the AdminUI editor shows a reminder.
|
||||
**Negotiation.** The capabilities probe always asks for `history`; an origin advertises it only when a historian backend
|
||||
is configured. Other calls carry the header only toward an endpoint that advertised it. An origin without a historian, a
|
||||
pre-H2 origin, or a call without the header answers unsupported — the v1 responses are unchanged.
|
||||
Live-gated against a real pre-H2 origin (#921, `docs/plans/evidence/grpc-data-ext/H05-v1-origin.md`): a pre-H2 origin
|
||||
ignores the probe's header (capabilities byte-identical with and without it), so the consumer's projected variables have
|
||||
`Historizing` False, HistoryRead answers `BadHistoryOperationUnsupported` locally, and no HistoryRead or feature-headed data
|
||||
call is sent. (Sent anyway, a HistoryRead is refused `PERMISSION_DENIED` by the old data listener's v1 method allowlist.)
|
||||
|
||||
**Limits.**
|
||||
|
||||
@@ -479,8 +541,14 @@ refresh, EventIds) is documented in [Alarm tracking § Imported conditions](Alar
|
||||
is raised on the hub.
|
||||
- `DataConnections:ConditionKnownSettle:OpcUaClient` (default 60 s) is the only backstop timer. It exists for upstreams
|
||||
without ConditionRefresh.
|
||||
- Open gaps: #924 (L4 latency for Galaxy, Heidenhain and real Logix ALMD), #925 (Galaxy deploy-added conditions stay
|
||||
unknown) and #926 (an OpcUaClient RefreshEnd can signal known over lost events).
|
||||
- Open gaps: #924 (L4 latency for Galaxy, Heidenhain and real Logix ALMD) and #925 (Galaxy deploy-added conditions stay
|
||||
unknown).
|
||||
- An OpcUaClient RefreshEnd signals only for a lossless refresh bracket (#926). Loss inside the bracket — queue
|
||||
overflow, RefreshRequired, a skipped publish gap, or a missing RefreshStart — suppresses the signal and re-runs
|
||||
ConditionRefresh, at most 3 times per episode. If every retry is lossy, the conditions stay unknown and the timeout
|
||||
diagnostic reports them. A loss after the signal **withdraws** "known" for that subscription's conditions
|
||||
(`AlarmInitialStateEventArgs.Withdrawn` ⇒ `MarkConditionsKnown(Known: false)`, F5 re-armed, no backstop) until a
|
||||
clean refresh signals again. See `docs/drivers/OpcUaClient.md`.
|
||||
|
||||
### Condition key (`DataConnections:ConditionKeySecret`)
|
||||
|
||||
|
||||
@@ -206,6 +206,17 @@ The session-less alarm feed (`GatewayGalaxyAlarmFeed`) and alarm acknowledger (`
|
||||
|
||||
Every (re)open of `StreamAlarms` replays the gateway's active-alarm snapshot. `GatewayGalaxyAlarmFeed` maps each entry to a transition flagged `IsRestatement` (#656): `Active` → `Retrigger` (upstream's unack is authoritative), `ActiveAcked` → `ActiveAcknowledged` (one atomic active+acked projection — the old `Acknowledge` mapping projected an acked alarm **inactive** on a cold host), `Inactive` → `Clear`. The host writes no `/alerts` row for a replayed entry that changes nothing the condition shows, so a gateway reconnect no longer duplicates history; live `Transition` messages are never flagged. The gateway folds UnackRtn and AckRtn into `Inactive`, so an inactive-unacked alarm cannot be distinguished at reconnect (gateway contract limit).
|
||||
|
||||
**Establishing a changed alarm subscription without a stream reopen (#925).** The driver turns each `snapshot_complete` sentinel into `IAlarmInitialStateSignal.InitialAlarmStateDelivered` (grpc-data A1) for the live alarm subscription, but a sentinel only comes when `StreamAlarms` opens. A subscription that becomes live while the stream is already past its sentinel (a re-subscribe with a changed alarm set, a reconnect that kept the session-less feed, or a change during the snapshot phase, which the sentinel cannot vouch for) would otherwise stay "unknown" (Uncertain on gRPC-data consumers) until the stream happened to reopen. The driver now re-reads the active-alarm set with the gateway's `QueryActiveAlarms` RPC instead. That RPC serves the same monitor cache as the stream's opening snapshot and needs the same `EventsRead` scope.
|
||||
- **How a re-read is applied.** The entries are replayed exactly like snapshot entries: as restatements, with the same kind mapping. The signal follows the replay, and only if the subscription the re-read was made under is still the live one.
|
||||
- **Why there are no phantom transitions.** The stream stays open. Live dispatch and the replay are serialised, so each check below and its replay happen as one step.
|
||||
- An entry is skipped when the live stream delivered a full-state message for the same alarm after the query was issued (a snapshot entry, `Raise`, `Retrigger` or `Clear`), because that message is at least as new as the query's view of it (counter `galaxy.alarm_feed.snapshot_refresh.superseded`).
|
||||
- An `Acknowledge` carries only the ack, so it is merged, not treated as superseding: an `Active` entry replays as `ActiveAcked`. Skipping it would have marked a cold condition known while it still showed inactive.
|
||||
- If a stream (re)opened while the query was in flight, the whole re-read is discarded and does not signal. An alarm that cleared in the reopen gap is simply absent from the new snapshot, so the query's entry for it would be a phantom `Active`. The reopened stream's own sentinel covers the subscription.
|
||||
- A re-read is not started while the current stream has not yet delivered its sentinel.
|
||||
- **Bounded.** One re-read runs at a time. Requests that arrive while it runs collapse into one follow-up run. A failure is retried 3 times, 5 s apart. A gateway without the RPC (`Unimplemented`) is not retried. A re-read that fails never signals: the conditions stay unknown, F5 diagnoses them, and the next stream sentinel signals as before.
|
||||
- **Residuals.** The query can be *ahead* of the stream: it can show a raise whose live `Raise` is still queued. That `Raise` then lands on an already-active condition, and the host treats it as the re-statement it is. Like every snapshot replay, the query lists active alarms only. An alarm that cleared while no subscription was live, so that its live `Clear` was dropped, is not cleared by it. This is a pre-existing limit of every snapshot replay.
|
||||
- **In practice.** A deploy that changes a Galaxy driver's alarm tags also changes its config, so the driver respawns and its fresh feed's first sentinel covers the new set (#665: there is no in-place path). The re-read is the safety net for the paths where the feed outlives the subscription.
|
||||
|
||||
## Testing
|
||||
|
||||
- **Unit tests**: `tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Tests/` — fakes the gateway gRPC surface; covers Browse, Runtime, Health, and Config in isolation.
|
||||
|
||||
@@ -449,8 +449,33 @@ initialise (the AdminUI form drops them on the next save). Pinned by
|
||||
> `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.
|
||||
> **`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; `RefreshStart`/`RefreshEnd`
|
||||
> markers are dropped. A server without it (`BadNotSupported`/`BadMethodInvalid`/…) is logged once and tolerated.
|
||||
> `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.
|
||||
>
|
||||
> **A RefreshEnd signals "initial alarm state delivered" only for a lossless bracket (#926).** That signal is grpc-data
|
||||
> A1's known-state signal. The driver tracks RefreshStart…RefreshEnd per alarm subscription, and the RefreshEnd does
|
||||
> not signal when any of these happened:
|
||||
>
|
||||
> - no RefreshStart was seen;
|
||||
> - the server sent an `EventQueueOverflowEventType`. That notice comes from the Server object, so it is matched before
|
||||
> the source filter, and it is never projected as an alarm;
|
||||
> - a `RefreshRequired` arrived;
|
||||
> - a delivered publish message skipped a sequence number. This catches the gap the SDK gives up on after a failed
|
||||
> republish, which the SDK reports nowhere else.
|
||||
>
|
||||
> A RefreshStart that arrives while a bracket is still open is a loss too.
|
||||
>
|
||||
> Any loss logs a Warning and re-runs ConditionRefresh on that subscription. That includes an overflow or sequence gap
|
||||
> outside a bracket, which can hold a lost live transition, and a failed ConditionRefresh call.
|
||||
>
|
||||
> - **Withdraw on a later loss:** a loss after the subscription signalled also **withdraws "known"**
|
||||
> (`AlarmInitialStateEventArgs.Withdrawn`). The host takes known back for those conditions (`Uncertain` on a
|
||||
> consumer), keeps them out of the backstop, and diagnoses them if no signal follows.
|
||||
> - **Retry bounds:** at most 3 re-refreshes run per episode, backing off 2 s, 4 s and 8 s. A clean RefreshEnd resets
|
||||
> the budget. Once the budget is spent, a further loss gets a new budget only after a 5-minute cool-down.
|
||||
> - **RefreshRequired:** its sweeps are coalesced while one is queued. The alarm event item asks for a
|
||||
> queue of 10,000 (previously 1,000); the server may revise it down. Counters on `otopcua.driver.opcuaclient.events`:
|
||||
> `alarm_event_queue_overflow` and `alarm_refresh_lossy`.
|
||||
> Last-told state survives a re-initialise (the host re-subscribes the same set over nodes it did not rebuild) and is
|
||||
> forgotten when the subscribed set changes (the host rebuilt, recreating the nodes inactive). Index keys are server-stable (`nsu=`), so a namespace reorder across a re-initialise keeps
|
||||
> matching. docker-dev seeds an opc-plc driver (`MAIN-opcua`); the alarm tag is
|
||||
|
||||
@@ -65,7 +65,7 @@ found while verifying M1 (row M1).
|
||||
| N8 G0 deferral consequences | Accepted | Recorded-v1-client gate repeated at H2, A2 and A3 exits; §1.1: #915's soak should run on an X0-or-later build |
|
||||
| **Revision 4 (settled offline)** | | |
|
||||
| B5 interception point | Settled: works | §5.6 step 1 — NM implements `ICallAsyncNodeManager`; SDK 2.0.1 dispatch traced (validation's `FindMethodState` holds `Lock` only for the lookup; per-manager `CallAsync` awaited with `ConfigureAwait(false)`); A3 not blocked |
|
||||
| N5 node count | Settled: 48–49 nodes, ≈ 157 KiB each (was "~21") | §5.5 recomputed: 10,000 / 49 ≈ 204; `MaxConditions` 1,000; host caps 122,500 nodes / 400 MiB |
|
||||
| N5 node count | Settled: 48–49 nodes, ≈ 157 KiB each (was "~21"; the bytes were a `GC.GetTotalMemory` artifact — #929 re-measured ≈ 77 KiB node-only, see §5.5) | §5.5 recomputed: 10,000 / 49 ≈ 204; `MaxConditions` 1,000; host caps 122,500 nodes / 400 MiB |
|
||||
| `state_known` field | Settled: does not exist; named additions (revised in revision 5 by T1/T2) | §5.1: `_conditionStateKnown`, `MarkConditionsKnown`, driver signal / per-driver timer, scripted inputs-established |
|
||||
| Event re-gating, Galaxy keying, build reporting, opc-plc alarms, alarm-tag export | Settled from code/SDK | §5.4, §6, §4.3, A02, §5.2 (+ second pre-existing v1 defect) |
|
||||
| Remaining live items | Listed | §9.3 L1–L5 with pass criteria |
|
||||
@@ -88,7 +88,7 @@ found while verifying M1 (row M1).
|
||||
| Galaxy one-shot signal per feed instance | Accepted (verified `GatewayGalaxyAlarmFeed.cs:69,140-152,168`) | §5.1: signal raised on **every** sentinel (not the one-shot task), and drivers re-signal each complete cycle, so conditions become known again after a reopen or a deploy that adds them; A1 test (vii) |
|
||||
| **Fifth pass (revision 7)** | | |
|
||||
| G1 driver-wide signal scope | Accepted (verified `FocasAlarmProjection.cs:253-276`, `AbCipAlarmProjection.cs:211`, `HeidenhainAlarmProjection.cs:214`) | §5.1: `AlarmInitialStateEventArgs.ConditionIds`; `MarkConditionsKnown` takes a condition-id set; per-host / per-node hooks in the driver table; MTConnect excludes `Unavailable`; A1 test (viii) |
|
||||
| G2 RefreshEnd ordering across publish responses | Accepted; **settled by decompiling** `Opc.Ua.Client` 2.0.1: not ordered by default (`SequentialPublishing` false; parallel workers) | §5.1: `SequentialPublishing = true` on the alarm subscription (`OpcUaClientDriver.cs:2445`); gap ⇒ no signal; A1 test (ix) |
|
||||
| G2 RefreshEnd ordering across publish responses | Accepted; **settled by decompiling** `Opc.Ua.Client` 2.0.1: not ordered by default (`SequentialPublishing` false; parallel workers) | §5.1: `SequentialPublishing = true` on the alarm subscription (`OpcUaClientDriver.cs:2445`); A1 test (ix). Loss inside the refresh bracket (EventQueueOverflow, RefreshRequired, a publish-sequence gap the SDK skipped, or a missing RefreshStart) ⇒ that RefreshEnd does not signal and ConditionRefresh is re-run, bounded (#926) |
|
||||
| G3 deferred signal outliving a dropped alarm | Accepted (verified `OpcUaPublishActor.cs:1048-1051`, `:1106-1112`) | §5.1 loss rule: a drop or skip discards that source's deferred `MarkConditionsKnown`; A1 test (x) |
|
||||
| G4 re-bind rarely holds across failover | Accepted | §5.6 step 3: client-visible behaviour stated (`BadEventIdUnknown` → `RefreshRequired` → ConditionRefresh → Good); A03 corrected |
|
||||
| G5 suppression gate | Accepted (verified `DriverInstanceActor.cs:184-188,1144-1148,2536-2541`) | §5.1: signal attached/gated with `OnAlarmEvent`; A1 test (xi) |
|
||||
@@ -191,7 +191,7 @@ has accepted the call.
|
||||
| Namespaces (N4) | `NM:117-118` `RegisteredNamespaceUris` (Raw, UNS, mapped/raw, mapped/uns); `NM:283-284` `RealmOf` folds every index but 0/2 into Uns | A fifth URI `mapped/conditions` is a registration change; it must be classified before `RealmOf` |
|
||||
| Stable source id (N3) | `SourceSamplePublisher.cs:32-33` (`"<len>:<driverId><RawPath>"`), emitted in `Metadata.stable_source_id` at `LocalExportCatalog.Compilation.cs:92,123` | Not usable as a condition dedupe key (discloses RawPath); pre-existing disclosure on UNS reference variables (#916) |
|
||||
| SDK Call dispatch (B5) | Decompiled SDK 2.0.1: `StandardServer.CallAsync` → `MasterNodeManager.CallAsync` → `NodeManagerServiceDispatcher.CallAsync` (validation via `FindMethodState`, short `lock (Lock)`, then per-manager `IAsyncNodeManager.CallAsync`); `AsyncNodeManagerAdapter.CallAsync` forwards to `ICallAsyncNodeManager` when the wrapped manager implements it; `CustomNodeManager2` (NM's base) implements `INodeManager3` only and its sync `Call`/`GetMethodCalls` skip `Processed` items | NM implements `ICallAsyncNodeManager`; imported-condition calls are claimed and awaited with no `Lock` held (§5.6) |
|
||||
| Condition subtree (N5) | `NM:2461-2475` (optional `ConfirmedState`/`Confirm`/`ShelvingState`/`MaxTimeShelved` before `Create`), `ApplicationAlarmConditions.cs:7-11` (Alarm / OffNormal / Discrete) | Counted with SDK 2.0.1: 48 / 49 / 48 nodes, ≈ 157 KiB retained each (§5.5) |
|
||||
| Condition subtree (N5) | `NM:2461-2475` (optional `ConfirmedState`/`Confirm`/`ShelvingState`/`MaxTimeShelved` before `Create`), `ApplicationAlarmConditions.cs:7-11` (Alarm / OffNormal / Discrete) | Counted with SDK 2.0.1: 48 / 49 / 48 nodes, ≈ 157 KiB retained each (§5.5; corrected by #929 to ≈ 77 KiB node-only) |
|
||||
| Event delivery path (§5.4) | Decompiled SDK 2.0.1 `MonitoredItem.QueueEvent(EventFieldList)` enqueues by reference; `Subscription.ConstructMessage` moves queued lists into `EventNotificationList` by reference; a select-clause modify rebuilds queued lists via `GetEventFields` with `Handle` = the original event; `OtOpcUaSdkServer.cs:746,768` already rewrites every Publish/Republish via `ProjectedNotificationRewriter` (`WarmStandby.cs:917`), which today passes event payloads through untouched | A marked `EventFieldList` subclass survives to Publish/Republish; the rewriter is extended to events |
|
||||
| Native/scripted state signals (N1) | Native `Quality = BadWaitingForInitialData` at materialise (`NM:2527`), driven Good via `WriteAlarmQuality` (`NM:1480`); `RestoreCarryOver` (`NM:2727`); scripted re-assert only for non-normal conditions (`ScriptedAlarmHostActor.cs:491`); scripted cold start re-derives Active from a `ReadTag`-seeded cache (`ScriptedAlarmEngine.cs:440-461`, `StatusNeverPushed` `:58-67`, `WorstInputStatus` `:1325`); existing driver signals: Galaxy `IGalaxyAlarmFeed.InitialSnapshotCompleted` (`:38`), OpcUaClient ConditionRefresh sweep (`OpcUaClientDriver.cs:2552`); `IAlarmSource` implementers: Galaxy, OpcUaClient, MTConnect, FOCAS, AbCip, Heidenhain; SDK `SetActiveState` stamps `TransitionTime = Now` on every call (`NM:1364` calls it per projection) | `_conditionStateKnown` + `MarkConditionsKnown` deltas + driver signal / per-driver timer + inputs-established; origin-owned activation marker (§5.1, §5.6) |
|
||||
| Alarm-bearing tags (N3, §5.2) | `AddressSpaceComposer.cs:978-985` (#896: no UNS value Variable for an alarm-bearing backing tag); `AddressSpaceComposer.cs:835-850` (alarm tags are in `RawTags`); `LocalExportCatalog.Compilation.cs:120-130` (no Alarm filter) | UNS placement address is a reserved reference id with no node; v1 exports alarm-bearing raw tags as dead Variables (pre-existing defect) |
|
||||
@@ -476,7 +476,7 @@ conditions re-report (`NM:5639-5651`). Some state changes never produce an event
|
||||
|
||||
| Driver | Exact hook | Signal raised |
|
||||
|---|---|---|
|
||||
| Galaxy | `GatewayGalaxyAlarmFeed.cs:168`, where the gateway's `snapshot_complete` sentinel is handled in `Dispatch` on the feed thread after the snapshot entries (`:155-169`) | On **every** sentinel, covering every condition of the feed's current subscription. The existing `InitialSnapshotCompleted` task (`:69`) stays for its current users but is not the signal: it is one-shot per feed instance (the reopen loop `:140-152` does not reset it), and its `RunContinuationsAsynchronously` continuation could overtake queued transitions. After a gateway stream reopen, the reopened stream's sentinel signals again |
|
||||
| Galaxy | `GatewayGalaxyAlarmFeed.cs:168`, where the gateway's `snapshot_complete` sentinel is handled in `Dispatch` on the feed thread after the snapshot entries (`:155-169`) | On **every** sentinel, covering every condition of the feed's current subscription. The existing `InitialSnapshotCompleted` task (`:69`) stays for its current users but is not the signal: it is one-shot per feed instance (the reopen loop `:140-152` does not reset it), and its `RunContinuationsAsynchronously` continuation could overtake queued transitions. After a gateway stream reopen, the reopened stream's sentinel signals again. **#925:** a subscription that becomes live after the current stream's sentinel (or changes during its snapshot phase) is established by a `QueryActiveAlarms` re-read instead: the entries are replayed as restatements, except where a newer live message already arrived, and then the signal is raised (`docs/drivers/Galaxy.md`) |
|
||||
| OpcUaClient (**F1**, **G2**) | The per-event route that today drops `RefreshEndEventType` as a marker (`OpcUaClientDriver.cs:3066-3067`, `IsRefreshMarker` `:2860-2864`), reached from `OnEventNotification` (`:2749-2762`) | On receipt of `RefreshEndEventType`, covering every condition of that alarm subscription, after the refreshed events delivered before it were projected. **Not** when `TryConditionRefreshAsync` returns (`:2881-2900`). See G2 below for ordering across publish responses |
|
||||
| FOCAS | `FocasAlarmProjection.PollOnceAsync` per-host loop (`:243-276`): after `NoteAlarmReadSucceeded(host)` (`:273`) and that host's `Tick` (`:274`). The `continue` path for a failed host (`:253-272`) raises nothing | **Per host**: the condition ids of that host's alarm tags, after its read succeeded and its transitions were emitted. Raised again on each later successful read |
|
||||
| AbCip ALMD/ALMA | `AbCipAlarmProjection.Tick` (`:195`), called from `RunPollLoopAsync` (`:251`); a node whose `InAlarm` read is non-Good is skipped (`:211`) | **Per node**: at the end of each `Tick`, the condition ids of the nodes whose `InAlarm` (and, for ALMA, all plan refs) read Good in that tick. Skipped nodes are excluded |
|
||||
@@ -492,11 +492,39 @@ conditions re-report (`NM:5639-5651`). Some state changes never produce an event
|
||||
- So the RefreshEnd of a multi-response replay could be processed before an earlier response. A1 therefore sets
|
||||
**`SequentialPublishing = true` on the alarm subscription** (`OpcUaClientDriver.cs:2445`). The data subscriptions
|
||||
are unchanged.
|
||||
- **As implemented (A1):** there is no gap-based suppression. The SDK 2.0.1 surface the driver sees (the per-item
|
||||
`Notification` callback) exposes no per-message gap or republish failure. With `SequentialPublishing` the worker
|
||||
waits for a missing sequence number (republish) before it delivers later ones, so an ordinary gap still orders the
|
||||
RefreshEnd last. **Residual:** a gap the SDK gives up on could let a RefreshEnd signal over a lost refreshed event.
|
||||
The mitigation for notification-queue overflow and abandoned gaps is tracked in #926.
|
||||
- With `SequentialPublishing` the worker waits for a missing sequence number (republish) before it delivers later
|
||||
ones, so an ordinary (recovered) gap still orders the RefreshEnd last.
|
||||
- **As implemented (#926): a RefreshEnd signals only for a lossless RefreshStart…RefreshEnd bracket.** The driver
|
||||
tracks the bracket per alarm subscription. It does **not** signal when:
|
||||
- no RefreshStart opened the bracket (the head of the replay was discarded);
|
||||
- an `EventQueueOverflowEventType` arrived since the RefreshStart. That notice comes from the Server object, so it
|
||||
is matched by EventType **before** the source filter;
|
||||
- a `RefreshRequired` arrived since the RefreshStart;
|
||||
- a **publish-sequence gap** was seen inside the bracket. That is a delivered message whose sequence number is
|
||||
neither the previous one nor its successor; the SDK sets `EventFieldList.Message`, and the alarm subscription has
|
||||
one monitored item. This is how a gap the SDK gave up on is detected. SDK 2.0.1 reports that skip to nothing
|
||||
else: its `PublishStateChangedMask.Republish` callback fires only in a worker pass that also delivers a message,
|
||||
which the blocking gap prevents (verified by decompiling, and pinned by a real-SDK test).
|
||||
- A RefreshStart that arrives while a bracket is still open is itself a loss. It never erases the open bracket's
|
||||
loss.
|
||||
- **A loss after the signal withdraws "known"** (review r1). This covers an overflow or sequence gap outside a
|
||||
bracket, which can hold a live Raise. The driver raises `AlarmInitialStateEventArgs.Withdrawn` once per signalled
|
||||
episode, ordered like the signal. The host sends `MarkConditionsKnown(Known: false)` for exactly those
|
||||
conditions, removes them from the backstop, and puts them back in the F5 window. A clean RefreshEnd, or a
|
||||
transition, makes them known again.
|
||||
- Every loss, inside or outside a bracket, re-runs ConditionRefresh on that subscription. A failed ConditionRefresh
|
||||
call is retried the same way. The retries are bounded:
|
||||
- at most 3 per lossy episode, backing off 2 s, 4 s and 8 s;
|
||||
- a clean RefreshEnd ends the episode and resets the budget;
|
||||
- once the budget is spent, a further loss gets a new budget only after a 5-minute cool-down. So the driver
|
||||
never storms the upstream and never gives up permanently.
|
||||
- A RefreshRequired keeps its own sweep, now coalesced while one is queued.
|
||||
- With no signal, the conditions stay unknown (`Uncertain`) and F5's `ConditionKnownSignalTimeout` diagnostic
|
||||
reports them. They are never declared known-inactive, and the `Unsignalable` backstop is not used for this.
|
||||
- The alarm event item's queue is now 10,000 (it was 1,000), so overflow is rarer. The detection above is the fix.
|
||||
- Live on `opc-plc --alm` with a test-sized queue: the overflow notices reach the driver. With `DiscardOldest`
|
||||
false the RefreshEnd is itself dropped. With `DiscardOldest` true the RefreshEnd arrives over a lossy replay and
|
||||
is refused. Before the fix it signalled. Evidence: `docs/plans/evidence/grpc-data-ext/926-refresh-bracket.md`.
|
||||
- **OpcUaClient upstream without ConditionRefresh** (`:2887-2893`, "conditions already active are reported only on their
|
||||
next transition"). This is the one case with no signal at all. The driver reports `InitialStateUnsignalable` for that
|
||||
subscription, and the per-driver-type **backstop timer** (`DataConnections:ConditionKnownSettle:OpcUaClient`, default
|
||||
@@ -517,8 +545,13 @@ conditions re-report (`NM:5639-5651`). Some state changes never produce an event
|
||||
- `DriverHostActor` turns it into `MarkConditionsKnown(driverInstanceId, conditionIds)` and sends it to `OpcUaPublishActor` **after**
|
||||
the `AlarmStateUpdate`s it already forwarded (Akka preserves per-sender-pair order).
|
||||
- `OpcUaPublishActor` treats it as an alarm message. While a plan apply is in progress (`PlanPipelineBusy`) it is
|
||||
deferred beside the `AlarmStateUpdate`s (`HandleAlarmUpdate`/`DeferAlarm`) and replayed **after** the deferred
|
||||
alarms.
|
||||
deferred beside the `AlarmStateUpdate`s (`HandleAlarmUpdate`/`DeferAlarm`). **As implemented after #926 review
|
||||
r2:** the deferred alarm states, alarm qualities and marks are replayed in **arrival order** (one list, per-entry
|
||||
sequence). Marks are held per condition, so a later mark of the same condition replaces an earlier one, and
|
||||
withdrawals are bounded by the number of conditions.
|
||||
- A "known" mark still lands after the projections it summarises, because it arrived after them.
|
||||
- A withdrawal followed by a re-establishing transition now ends known, as the live path leaves it. Replaying all
|
||||
marks last had ended it unknown.
|
||||
- **Loss rule (G3).** The deferral is a bounded keyed store, not a queue. An `AlarmStateUpdate` that does not fit is
|
||||
dropped (`DeferAlarm` → `WarnDeferredOverflow`, `OpcUaPublishActor.cs:1048-1051`), and replay skips alarms outside the
|
||||
applied scope (`:1106-1112`).
|
||||
@@ -614,7 +647,9 @@ per-origin-cluster `${secret:}` of at least 32 UTF-8 bytes, identical on both pa
|
||||
- It cannot be dictionary-reversed from guessable paths. An unkeyed hash was rejected for that reason.
|
||||
- If the secret is absent, the origin advertises no `conditions` capability (fail closed, with a diagnostic).
|
||||
|
||||
> **Pre-existing v1 findings (not fixed here; filed as #916 and #917):**
|
||||
> **Pre-existing v1 findings (not fixed here; filed as #916 and #917).** *Update 2026-11-28: both are fixed in v1 before
|
||||
> deploy. `stable_source_id` is no longer sent, and alarm-bearing raw tags are no longer value nodes (not listed by Browse, `Unsupported` on every value operation). See
|
||||
> `docs/plans/evidence/grpc-data-ext/V1-916-917.md`.*
|
||||
> 1. #916 — `type:review-finding`, security: v1 already sends `stable_source_id` = driver id + RawPath on **UNS reference variables**
|
||||
> to UNS-only principals (same code path).
|
||||
> 2. #917 — `type:bug`: v1 exports alarm-bearing raw tags as `Variable` (`LocalExportCatalog.Compilation.cs:120-130` has no Alarm
|
||||
@@ -758,23 +793,28 @@ SDK 2.0.1 (scratch harness, §9.3) gives:
|
||||
| `OffNormalAlarmType` | **49** | 2 objects, 39 variables, 8 methods |
|
||||
| `DiscreteAlarmType` | **48** | 2 objects, 38 variables, 8 methods |
|
||||
|
||||
`Quality`, `BranchId` and `Comment` are present. The retained managed size measured **≈ 157 KiB per condition** (160,997 B
|
||||
for `OffNormal`, 2,000 instances, `GC.GetTotalMemory(true)` delta, excluding NM's own indexes). **Memory, not node count, is
|
||||
the binding limit.** The origin already pays the same per condition for its own local copy.
|
||||
`Quality`, `BranchId` and `Comment` are present. The retained managed size of the node tree alone is **≈ 77 KiB per
|
||||
condition** (79,085 B for `OffNormal`, 2,000 instances, retained heap `HeapSizeBytes − FragmentedBytes` after a full blocking
|
||||
GC; ≈ 90 KB of settled working set; excluding NM's own indexes; re-measured for #929, X0 evidence). Revision 4's
|
||||
"≈ 157 KiB (160,997 B)" was a `GC.GetTotalMemory(true)` delta, which on .NET 10 also counts committed-but-free GC regions
|
||||
(the same harness still reports 158,169 B that way) — it was inflated ≈ 2×. The in-server worst case measured by L2
|
||||
(node tree + NM indexes + identifiers + EventId registry + placements + runner records) is **111,715 B heap / 158,629 B working
|
||||
set**, and `BytesPerCondition` = **160,000 B** is set from that (A3 evidence, "L2 worst-case memory"). **Memory, not node
|
||||
count, is the binding limit.** The origin already pays the same node-tree cost per condition for its own local copy.
|
||||
|
||||
Arithmetic:
|
||||
|
||||
- with v1's `MaxProjectionNodes` default of 10,000 (`RemoteNamespaceMapping.cs:29`), 10,000 / 49 ≈ **204** conditions would
|
||||
exhaust a mapping (revision 3's "≈ 476 at 21 nodes" was wrong);
|
||||
- 10,000 imported conditions would retain ≈ 1.5 GiB.
|
||||
- 10,000 imported conditions would retain ≈ 1.5 GiB (at the L2 160,000 B each).
|
||||
|
||||
Defaults (conditions get their **own** budget; worst case is 49 nodes):
|
||||
|
||||
| Setting | Default | Nodes | Memory (≈ 157 KiB each) |
|
||||
| Setting | Default | Nodes | Memory (L2 `BytesPerCondition` 160,000 B each) |
|
||||
|---|---|---|---|
|
||||
| `RemoteNamespaceMapping.MaxConditions` | **1,000** per mapping | 49,000 | ≈ 153 MiB |
|
||||
| `DataConnections:MaxImportedConditionNodes` (host) | **122,500** per consumer node (= 2,500 × 49) | 122,500 | — |
|
||||
| `DataConnections:MaxImportedConditionBytes` (host) | **400 MiB** per consumer node (≈ 2,500 × 157 KiB = 384 MiB, rounded) | — | 400 MiB |
|
||||
| `DataConnections:MaxImportedConditionBytes` (host) | **400,000,000 B** per consumer node (= 2,500 × 160,000 B ≈ 381 MiB) | — | ≈ 381 MiB |
|
||||
|
||||
- Conditions are charged **once per `condition_key`**, not per placement. They do **not** consume `MaxProjectionNodes`, which
|
||||
stays for folders and variables; placement folders charge it as ordinary projected folders.
|
||||
@@ -790,14 +830,16 @@ Defaults (conditions get their **own** budget; worst case is 49 nodes):
|
||||
node's mappings exceeds `MaxImportedConditionNodes`.
|
||||
- Whether 1,000 per mapping / 2,500 per node covers real exports is live measurement L5 (§9.3). The defaults are tunable and
|
||||
sized from the measured memory cost, not from a guessed plant size.
|
||||
- **What the 157 KiB excludes (m-T7):**
|
||||
- **What the node-only figure (≈ 77 KiB; "157 KiB" before #929) excludes (m-T7):**
|
||||
- NM's indexes;
|
||||
- the `c1.<base64url JSON>/<browse path>` identifier strings on 48–49 nodes;
|
||||
- the per-condition EventId registry;
|
||||
- placement sets.
|
||||
|
||||
**L2 is the authority:** `MaxImportedConditionBytes` is set from the L2 measurement (per-condition in-server bytes × 2,500),
|
||||
and the 400 MiB above is a provisional default until L2 passes.
|
||||
**L2 is the authority:** `MaxImportedConditionBytes` is set from the L2 measurement (per-condition in-server bytes × 2,500).
|
||||
L2 passed at the A3 exit: the larger of its heap and settled-working-set figures, max of three runs, rounded up, is
|
||||
160,000 B, so the default is 400,000,000 B. The ≈ 40 KiB gap between the node-only heap (≈ 77 KiB) and L2's heap
|
||||
(≈ 109 KiB) is the excluded state above plus the worst-case placements, EventId slots and event-queue entries.
|
||||
|
||||
**Stream mechanics.**
|
||||
|
||||
@@ -1385,7 +1427,7 @@ Use two-state id selection via `SimpleAttributeOperand(type, [X, Id])`, as the C
|
||||
| Acks fail on busy alarms because the precondition moves | A2 | Origin-owned activation marker, bumped only on a new occurrence (T3) |
|
||||
| RawPath disclosure to UNS-only principals | A1 | Realm-local placements; keyed `condition_key`; property test; pre-existing `stable_source_id` disclosure is #916 |
|
||||
| Imported-condition method path regresses local methods | A3 | Claimed items only (`Processed`), `base.Call` unchanged for the rest; lock-freedom gate; existing `ConditionMethodEventTests` stay green |
|
||||
| Imported-condition memory (≈ 157 KiB each) | A3 | Own budget sized from the counted cost; byte cap 400 MiB per consumer node; L2 confirms in-server |
|
||||
| Imported-condition memory (≈ 77 KiB node-only, 160,000 B in-server worst case) | A3 | Own budget sized from the counted cost; byte cap 400,000,000 B (≈ 381 MiB) per consumer node; L2 confirmed in-server |
|
||||
| v1 unsoaked in service (G0 deferred, #915) | all | Per-phase live gates; deploy notes record the risk until #915 passes |
|
||||
|
||||
### 9.3 Settled offline vs. needs a live run
|
||||
@@ -1393,7 +1435,7 @@ Use two-state id selection via `SimpleAttributeOperand(type, [X, Id])`, as the C
|
||||
**Settled offline in revision 4** (no server needed):
|
||||
- the SDK 2.0.1 Call dispatch trace (decompiled with `ilspycmd` from the pinned package);
|
||||
- the event-delivery path;
|
||||
- condition node counts (48/49/48) and retained bytes (≈ 157 KiB);
|
||||
- condition node counts (48/49/48) and retained bytes (≈ 157 KiB in revision 4; ≈ 77 KiB after the #929 re-measure);
|
||||
- snapshot-copy cost (≈ 1.7–2.9 µs per condition);
|
||||
- the Galaxy ack-identity keying;
|
||||
- the absence of node build reporting;
|
||||
@@ -1401,8 +1443,10 @@ Use two-state id selection via `SimpleAttributeOperand(type, [X, Id])`, as the C
|
||||
- alarm-bearing tag export shape (#896).
|
||||
|
||||
The counts, bytes and copy timing come from a scratch harness: a console project referencing `OPCFoundation.NetStandard.Opc.Ua.Server`
|
||||
2.0.1 that builds each condition type with NM's optional children, walks `GetChildren`, measures a `GC.GetTotalMemory(true)`
|
||||
delta over 2,000 instances, and times the snapshot field copy. It is not in the repo; X0 task 4 commits it as evidence.
|
||||
2.0.1 that builds each condition type with NM's optional children, walks `GetChildren`, measures the retained heap over
|
||||
2,000 instances, and times the snapshot field copy. X0 task 4 committed it as evidence (`docs/plans/evidence/grpc-data-ext/harness/`).
|
||||
It first measured a `GC.GetTotalMemory(true)` delta; #929 switched it to the L2 method (full blocking GC,
|
||||
`HeapSizeBytes − FragmentedBytes`, settled working set) and the figure halved.
|
||||
|
||||
**Live measurements** — each runs on docker-dev unless stated, and each has a pass criterion:
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# #920 — `GrpcDataConfiguredDiscoveryWireTests` flake: root causes
|
||||
|
||||
2026-11-28. Two unrelated causes, one in production and one in a test. Neither is a timeout, and nothing was widened or
|
||||
skipped.
|
||||
|
||||
## 1. `Failed_sdk_item_construction_releases_candidate_and_fanout_ownership` — production race (fixed)
|
||||
|
||||
**Symptom.** The node manager's shared `ProjectedCandidateBudget` held 1 entry, expected 0.
|
||||
|
||||
**Cause.** Trace instrumentation (temporary, removed) showed that the extra entry was not the failed item's. It was a
|
||||
proof candidate on the *existing* item 1, for the acquisition it had already delivered (`v=1 complete=True`, same proof).
|
||||
The sequence:
|
||||
|
||||
1. Item 2's `CreateMonitoredItems` acquires a demand. Its stream registration gets the fake origin's snapshot, which
|
||||
repeats item 1's acquisition (same version, still fresh).
|
||||
2. The test's injected proof throws, so construction fails. The catch disposes the demand on the SDK thread.
|
||||
3. That disposal raced the stream pump's `Publish` for the registration. The pump had passed the top check
|
||||
(`!registration.Demand.IsValid`). The duplicate-baseline check `HasFreshCachedLocked(registration.Demand)` then read the
|
||||
dying demand's `IsValid == false` as "the cache is not fresh". The trace shows `Publish v=1 complete=True last=1
|
||||
fresh=False`.
|
||||
4. So the same acquisition was published again as a new complete baseline to every item on the node. Item 1 kept a
|
||||
candidate that no SDK notification will ever consume, because the node's value did not change. The candidate also
|
||||
kept its shared budget charge.
|
||||
|
||||
In production this applies to any subscription whose demand is disposed while its snapshot is being published: a failed
|
||||
item construction, a client deleting an item, or a session closing. Each such event re-baselines every other item on
|
||||
the node and leaves one orphan candidate on each, until that item's binding changes.
|
||||
|
||||
**Fix** (`ProjectedDataAccess`):
|
||||
|
||||
- `HasFreshCachedLocked` no longer depends on the demand's validity. Whether the cached acquisition is fresh does not
|
||||
depend on it.
|
||||
- After the duplicate check, `Publish` re-checks the demand. A demand disposed since the top check publishes nothing
|
||||
(`PublishDemand`).
|
||||
- `AfterPublishDemandCheckForTests` is an internal seam on the pump.
|
||||
|
||||
**Regression test.** `A_demand_disposed_mid_publish_does_not_republish_a_fresh_baseline`:
|
||||
|
||||
- It disposes the second item's demand at the seam.
|
||||
- Its positive control is a third item whose snapshot carries a new acquisition (v2) through the same in-order publisher.
|
||||
- It asserts that no v1 baseline arrived before v2, and that item 1 holds exactly one candidate.
|
||||
- **Red** with the two production lines reverted: `seen.Count(x => x.SourceVersion == 1) should be 0 but was 1`.
|
||||
- **Green** with the fix.
|
||||
|
||||
## 2. `Bad_null_sdk_notification_cannot_borrow_unproven_sample_evidence("different_timestamp")` — test race (fixed)
|
||||
|
||||
**Symptom.** `BadNoCommunication` was delivered where `BadUserAccessDenied` was expected.
|
||||
|
||||
**Cause.** SDK 2.0.1 delivers a node change to its items asynchronously, from `MonitoredNode2.ProcessChannelAsync`. A
|
||||
`QueueValue` stack trace confirmed this. Under load, the change for the sample the test had just published reached the
|
||||
item *after* the test's `Disabled → Reporting` cycle and after its injected notification. At queue size 1 it overwrote
|
||||
the injected notification (source timestamp T+1). The proven sample (T) that took its place correctly matched its
|
||||
candidate and was correctly delivered.
|
||||
|
||||
So the production fence held, and the test's assumption that delivery is synchronous was wrong. The `different_status`
|
||||
case already tolerates this ordering.
|
||||
|
||||
**Fix.** Before the mode cycle, the test waits until the SDK has queued the published sample. It checks the item's
|
||||
`m_lastValue` for source timestamp T and `BadNoCommunication`, with a 10 s bounded wait that fails with a message.
|
||||
|
||||
The other scenarios were already robust:
|
||||
|
||||
- `ambiguous` and `missing_timestamp`: a late second sample is ambiguous against both candidates, so it is denied anyway.
|
||||
- `expired_proof`: the proof is invalid, so the notification is denied anyway.
|
||||
|
||||
## Numbers (macOS, Release, shared host, load average 25–100 from parallel agents)
|
||||
|
||||
| | Before | After |
|
||||
|---|---|---|
|
||||
| Class runs (`--filter FullyQualifiedName~GrpcDataConfiguredDiscoveryWireTests`) | **5 / 16 failed** (4 × failed-construction, 1 × different_timestamp) | **30 / 30 consecutive passed** (111 tests each, incl. the new one) |
|
||||
| `different_timestamp` stressed in-process (100 ×) | 16 / 100, 6 / 40 | 0 / 100 |
|
||||
| failed-construction stressed in-process | 2 / 150 | 0 / 100 |
|
||||
| New regression test (25 ×) | red, deterministic | 0 / 25 |
|
||||
|
||||
Other gates at `4cf06261`: `dotnet build ZB.MOM.WW.OtOpcUa.slnx -c Release` 0 warnings / 0 errors; Runtime.Tests (rest of the
|
||||
suite, `Category!=E2E&Category!=LiveIntegration`) 1982 passed, 3 skipped; Host.Tests `.DataConnections.` (incl. the v1
|
||||
compatibility gate) 207 passed.
|
||||
@@ -0,0 +1,177 @@
|
||||
# #926 — OpcUaClient RefreshEnd signals only for a lossless refresh bracket
|
||||
|
||||
2026-11-28. Follow-up to A1 (plan §5.1, OpcUaClient row, G2).
|
||||
|
||||
## Defect
|
||||
|
||||
A1 takes the alarm subscription's `RefreshEndEventType` as `InitialAlarmStateDelivered`. That signal declares the
|
||||
conditions it covers state-known. The driver raised it on every RefreshEnd, including one that closed a replay that had
|
||||
lost events. A condition that was active upstream could then be declared known-inactive.
|
||||
|
||||
## Ways a replay can lose events
|
||||
|
||||
- **Event-queue overflow.** The upstream inserts an `EventQueueOverflowEventType` notice. Its SourceNode is the Server
|
||||
object, so the driver's source filter dropped it, and in pass-through mode it would have been projected as an alarm.
|
||||
Where the notice lands depends on `DiscardOldest`:
|
||||
- With `DiscardOldest` false (production), the newest events, often the RefreshEnd itself, are dropped.
|
||||
- With `DiscardOldest` true, or on a server that refreshes asynchronously, the RefreshStart and the head of the
|
||||
replay are dropped, but the RefreshEnd still arrives.
|
||||
- **RefreshRequired** arriving during the replay.
|
||||
- **A publish gap the SDK gives up on.** With `SequentialPublishing` the SDK holds later messages while it republishes
|
||||
the missing one. If that republish fails (`BadMessageNotAvailable`), it skips the gap and delivers the next message.
|
||||
- Decompiling SDK 2.0.1 (`Subscription` message worker) shows that `PublishStateChangedMask.Republish` is raised only
|
||||
inside `if (messagesToDeliver != null)`.
|
||||
- So when the gap is holding every later message back, which is exactly this case, no callback fires. Verified with a
|
||||
real `Subscription`: the order was `live:1, start:2, end:4` and no Republish state was raised.
|
||||
|
||||
## Fix (`OpcUaClientDriver`)
|
||||
|
||||
**Per-subscription bracket state.** Each `RemoteAlarmSubscription` has an `AlarmRefreshBracket`, guarded by
|
||||
`_alarmStateLock`.
|
||||
|
||||
**Bracket events are matched by EventType before projection** (`RouteBracketEvent`):
|
||||
- RefreshStart opens the bracket.
|
||||
- EventQueueOverflow records a loss and requests a re-refresh.
|
||||
- RefreshRequired records a loss; its existing sweep is the re-refresh.
|
||||
- RefreshEnd signals only if the bracket was opened and saw no loss. Otherwise it logs a Warning, increments
|
||||
`alarm_refresh_lossy`, and requests a re-refresh unless one was already requested.
|
||||
|
||||
**Publish-sequence check.** `RouteAlarmEventFieldList` reads `NoteAlarmMessageSequence(efl.Message.SequenceNumber)`
|
||||
before it routes the event. The alarm subscription has one monitored item, so every message that carries data
|
||||
consumes one sequence number. Inside a bracket, a number that is neither the same as the last nor its successor
|
||||
(wrap-aware) is a loss.
|
||||
|
||||
**Bounded re-refresh.** `ScheduleAlarmRefreshRetryLocked` → `RetryAlarmRefreshAsync`:
|
||||
- At most 3 re-refreshes per episode, backing off 2 s, 4 s, then 8 s. A clean RefreshEnd resets the budget.
|
||||
- Requests are coalesced while one is pending.
|
||||
- The retry is cancelled with the session's work token, and skipped if the subscription is no longer the one
|
||||
registered.
|
||||
- When the budget is spent, one Warning is logged (it includes the revised queue size) and nothing signals. The
|
||||
conditions stay unknown (`Uncertain`) and F5's `ConditionKnownSignalTimeout` diagnostic reports them.
|
||||
`Unsignalable` is deliberately not used: it starts the backstop that marks the conditions known.
|
||||
|
||||
**Queue size.** The alarm event item's queue is now 10,000 (it was 1,000), so overflow is rarer. The detection above is
|
||||
the actual fix.
|
||||
|
||||
**New counters.** `otopcua.driver.opcuaclient.events{event=alarm_event_queue_overflow|alarm_refresh_lossy}`.
|
||||
|
||||
## Tests
|
||||
|
||||
### Unit: `OpcUaClientRefreshBracketLossTests`
|
||||
|
||||
11 tests:
|
||||
|
||||
- an overflow inside the bracket, a RefreshEnd with no RefreshStart, and a RefreshRequired inside the bracket each
|
||||
suppress the signal, and each has a positive control;
|
||||
- an overflow outside a bracket requests a re-refresh;
|
||||
- the retry bound, and the budget reset after a clean bracket;
|
||||
- a re-refresh whose own RefreshStart is lost can request the next one;
|
||||
- sequence gap, repeat, wrap and gap-outside-bracket;
|
||||
- the overflow notice is never projected;
|
||||
- queue-size pin;
|
||||
- the real-SDK abandoned gap, plus a lossless real-SDK positive control.
|
||||
|
||||
`OpcUaClientInitialAlarmStateSignalTests`: the two tests that routed a RefreshEnd with no RefreshStart now route the
|
||||
RefreshStart first. A real server always sends one, and the live latency test below passes with the new requirement.
|
||||
|
||||
### Red
|
||||
|
||||
These mutations were run as red checks:
|
||||
|
||||
- **RefreshEnd always signals:** 6 of 10 bracket tests fail.
|
||||
- **Sequence check removed:** the real-SDK gap test fails.
|
||||
- **Live:** the same always-signal mutation gives `signals=3` over lossy replays (run `discardOldest=True`, below).
|
||||
|
||||
### Live: `OpcUaClientRefreshOverflowLiveTests`
|
||||
|
||||
Run against the shared `opc-plc --alm` at `opc.tcp://10.100.0.35:50000`, read-only, using test seams for the item's queue
|
||||
size and `DiscardOldest`. No local docker, so the rig lock was not needed.
|
||||
|
||||
| Case | Overflow notices seen | Lossy RefreshEnds refused | Signals |
|
||||
|---|---|---|---|
|
||||
| `DiscardOldest=false`, queue 1 | 25 | 0 (the RefreshEnd was dropped by the server) | 0 |
|
||||
| `DiscardOldest=true`, queue 2 | 11–20 across runs | 1–3 across runs (≤ 1 + 3, bounded) | 0 |
|
||||
| Production queue (control) | 0 | 0 | signalled |
|
||||
| Mutation (always signal), `DiscardOldest=true` | 15 | — | **3** |
|
||||
|
||||
The lossy-RefreshEnd count varies because opc-plc keeps firing live alarms, which can push a RefreshEnd out of a
|
||||
2-entry queue.
|
||||
|
||||
Two observations from the runs:
|
||||
|
||||
- `DiscardOldest=false` with queue 2 produced no overflow notice and no RefreshEnd on this opc-plc. It still never
|
||||
signalled, so the outcome was safe.
|
||||
- A `MeterListener` filtered by `ReferenceEquals` on `OtOpcUaTelemetry.OpcUaClientEvents` never enabled the counter
|
||||
when that class ran alone. The instrument is published inside the type's static initializer, where the field still
|
||||
reads null. The test now reads the field before calling `Start()`.
|
||||
|
||||
`OpcUaClientAlarmSignalLatencyTests` (L4) still passes 20 out of 20 samples, which means opc-plc sends RefreshStart.
|
||||
|
||||
## Residuals
|
||||
|
||||
- **False positives.** A StatusChange-only message on the alarm subscription consumes a sequence number and reads as a
|
||||
gap. So can an SDK sequence resync after a transfer. Either costs one bounded re-refresh and is never a wrong signal.
|
||||
- **Stale RefreshEnd.** If the previous replay's lossy RefreshEnd is still in flight when a re-refresh starts, it can
|
||||
request one extra refresh. That stays inside the bound.
|
||||
- ~~**Live losses after the conditions are known.** An overflow outside a bracket is repaired by a re-refresh. A gap
|
||||
outside a bracket is not detected, but the next bracket replays the full state. In both cases conditions that are
|
||||
already known are not taken back to unknown.~~ Superseded by review round 1 (below): both are losses, re-refreshed,
|
||||
and they withdraw "known".
|
||||
|
||||
## Review round 1 (2026-11-28)
|
||||
|
||||
| # | Finding | Outcome |
|
||||
|---|---|---|
|
||||
| 1 | A sequence gap outside a bracket was detected and ignored, although it can hold a live Raise. | **Fixed.** Every newer, non-successor sequence number is a loss, inside or outside a bracket. It withdraws "known" if the subscription signalled, and requests a re-refresh from the same budget. |
|
||||
| 2 | A loss after the signal never withdrew "known". The budget was shared across episodes. | **Fixed with a new host contract.** `AlarmInitialStateEventArgs.Withdrawn` is an additive constructor flag, exclusive with `Unsignalable`. The driver raises it once per signalled episode, on the first loss, ordered like the signal. `DriverHostActor` turns it into `MarkConditionsKnown(Known: false)` for exactly those conditions (the existing withdraw primitive), removes them from the backstop, and re-adds them to the F5 pending set. The budget was already per episode, because a clean RefreshEnd resets it. A spent budget now also renews after a 5-minute cool-down (`AlarmRefreshRetryCooldown`). While spent, a loss leaves the request open (`ScheduleAlarmRefreshRetryLocked` returns false), so the post-cool-down loss can start a retry. |
|
||||
| 3 | A nested RefreshStart erased the outer bracket's loss. | **Fixed.** A Start while a bracket is open is recorded as a loss with `??=`, so it never clears the existing one. A depth counter was rejected: in the serial case a lost RefreshEnd would keep the depth above zero forever, so nothing would ever signal. |
|
||||
| 4 | A failed ConditionRefresh (at subscribe, in a sweep, or in a retry) was never retried. | **Fixed.** The catch in `TryConditionRefreshAsync` calls `NoteConditionRefreshFailed`, which uses the same bounded retry. |
|
||||
| 5 | A retry's `finally` cleared a `RetryPending` that a newer retry had set. | **Fixed** with a generation token (`RetryGeneration`). |
|
||||
| 6 | Backward sequence numbers were written back, which produced a second, false gap. | **Fixed.** A repeated or older number (wrap-aware, forward distance ≥ 2³¹) is ignored and not recorded. |
|
||||
| 7 | The RefreshRequired sweep was unbounded. | **Coalesced**: a RefreshRequired is a no-op while a sweep is queued and not yet started. It is not rate-limited, so a server that sends RefreshRequired continuously still gets back-to-back sweeps. That limit existed before this change and is reported as a follow-up. |
|
||||
|
||||
**Red checks.** One mutation per fix, each run against the new tests:
|
||||
|
||||
- M1 (gap outside a bracket ignored): `Sequence_gap_outside_a_bracket_withdraws_known_and_re_refreshes` fails.
|
||||
- M2 (no withdraw): the 3 withdraw tests fail.
|
||||
- M3 (a nested Start erases the loss): `An_overlapping_RefreshStart_does_not_erase_the_loss` fails.
|
||||
- M4 (no generation token): `A_retry_scheduled_during_a_refresh_call_keeps_coalescing` fails.
|
||||
- M5 (older numbers recorded): `An_older_sequence_number_is_ignored_and_not_recorded` fails.
|
||||
- M6 (a failed refresh is not retried): `A_failed_ConditionRefresh_is_retried_bounded` fails.
|
||||
- M7 (host ignores `Withdrawn`): Runtime `A_withdrawn_signal_takes_known_back_and_rearms_F5_until_the_next_signal` and
|
||||
`A_withdrawal_cancels_the_backstop_for_its_conditions` fail.
|
||||
|
||||
M6 goes through the `ReportRefreshFailedForTest` seam. The catch that calls it is covered by review.
|
||||
|
||||
**Residual.** If a subscription never signalled (its initial refresh is still pending), a loss withdraws nothing,
|
||||
because nothing was known.
|
||||
|
||||
## Review round 2 (2026-11-28)
|
||||
|
||||
| # | Finding | Outcome |
|
||||
|---|---|---|
|
||||
| 1 | `OpcUaPublishActor` replayed every deferred alarm first and every mark last. So a withdrawal followed by a transition, both deferred by a plan, ended **unknown** although the transition had re-established the condition, and the host no longer counted it in F5. | **Fixed.** Deferred alarm states, alarm qualities and marks replay as **one list in arrival order**. Each entry carries a sequence number, and consecutive marks of the same (source, realm, known) are batched into one sink call. The G3 out-of-scope check is a pre-pass, so a source's known marks are still discarded wherever they sit in the list. Pinned by `Deferred_alarms_and_marks_replay_in_arrival_order`, which also checks the mirror order (transition then withdrawal ends unknown). That test is red against the previous actor. |
|
||||
| 5 | The deferred-withdrawal list was "bounded by connectivity edges", which stopped being true once #926 made withdrawals routine. | **Fixed.** Deferred marks are now held **per (realm, condition)**, and the latest mark wins. Withdrawals are never dropped, and are bounded by the number of conditions. Known marks for a new condition beyond `Capacity` still overflow, as before. `A_withdrawal_beyond_the_deferral_capacity_is_never_dropped` now expects one coalesced replay instead of three (it is red against the old list). |
|
||||
| 2 | The driver looked up the subscription outside `_alarmStateLock`, so a stale record could signal or withdraw. | **Fixed.** `IsRegisteredLocked` is re-checked under the lock before a RefreshEnd signals and before a withdrawal, and both removals (`UnsubscribeAlarmsAsync`, the shutdown loop) now take the lock. There is no deterministic unit test for this race; the lock is the guarantee. |
|
||||
| 3 | A withdrawal after F5 had already raised its diagnostic did not update the diagnostic's count. | **Fixed.** The host calls `Hub.UpdateUnsignalled` when the pending set grows under a raised diagnostic. Covered by `A_withdrawal_after_the_diagnostic_updates_its_count`, which is red with the call removed. |
|
||||
| 4 | Conditions on unsignalable subscriptions never withdraw. | **Documented** in `IAlarmInitialStateSignal`. Only a source that signalled withdraws; conditions made known by the backstop stay known through a later loss. That is the backstop's own residual. |
|
||||
| 6 | The backstop test had no positive control. | **Fixed.** The sibling condition that was not withdrawn is marked known by the same backstop. |
|
||||
| — | `AlarmInitialStatePublished` serialization | A comment now says it must stay in-process: a serialized copy that lost `Withdrawn` would default it to false and turn a withdrawal into a known mark. |
|
||||
|
||||
**Found, not mine.** `OpcUaPublishActorWarmTests.A_deployed_cluster_mode_that_disagrees_with_the_local_mode_is_logged_and_counted`
|
||||
fails when run in isolation. It has the same `MeterListener` and static-initializer trap fixed in the live test above:
|
||||
it matches `ReferenceEquals(instrument, OtOpcUaTelemetry.RedundancyModeMismatch)` before that field has been initialized.
|
||||
Reported as a follow-up.
|
||||
|
||||
**Round 2 gates:**
|
||||
|
||||
- Full Release build: 0 warnings.
|
||||
- OpcUaClient.Tests: 430/430.
|
||||
- OpcUaClient.IntegrationTests: 13/13, live against opc-plc.
|
||||
- `GrpcDataV1CompatibilityTests`: 49/49.
|
||||
- Runtime.Tests: 2095 of 2100 passed and 3 were skipped.
|
||||
- The 2 failures are pre-existing; neither is caused by #926.
|
||||
- `DriverHostActorApplyingStashTests.ACompletedApply_NeverReportsAWedge` fails every time on base `05f431f5d` too. I
|
||||
confirmed this in a clean worktree at that commit.
|
||||
- `GrpcDataConfiguredDiscoveryWireTests.Bad_null_sdk_notification_cannot_borrow_unproven_sample_evidence(different_timestamp)`
|
||||
fails only under full-suite load. It passes in isolation, both on this branch and on base.
|
||||
@@ -215,6 +215,26 @@ Heidenhain legs are **blocked**: Galaxy needs the VPN and mxaccessgw, and Heiden
|
||||
sentinel, which comes only on a stream reopen. Until then F5 diagnoses it.
|
||||
- This is by design (vii): the snapshot that preceded the subscribe may have carried that alarm while it was unroutable.
|
||||
- Open question: should the driver ask the gateway for a fresh snapshot on a changed subscription set?
|
||||
**Answered by #925 (2026-11-28):** yes. mxaccessgw already serves `QueryActiveAlarms` from the same monitor cache as the
|
||||
stream snapshot, so no gateway change was needed. A subscribe on a stream that is past its sentinel, and a sentinel for
|
||||
a stream opened under an earlier subscription (F4), both trigger a re-read. The re-read is replayed as restatements; an
|
||||
entry is skipped when the live stream already delivered a newer message for that alarm. Then the live subscription is
|
||||
signalled. Re-reads are coalesced: one in flight plus one follow-up. A failed re-read is retried 3 times and never
|
||||
signals. Tests: `GalaxyAlarmSnapshotRefreshTests` (6). Each of these mutations turns a test red: no re-read on subscribe
|
||||
(5 red), no supersede check, no handle check at the signal, Unimplemented retried, no re-read at a mismatched sentinel,
|
||||
no coalescing. The F5 re-arm for deploy-added refs was already in place (`RearmConditionSignalsAfterReindex`, review
|
||||
round 1). **Not live-gated:** no Galaxy or mxaccessgw is reachable (wonder-box hold).
|
||||
**#925 review round 1:**
|
||||
- *Ack-only supersede:* a live `Acknowledge` no longer supersedes an entry. It is merged instead (Active ⇒ ActiveAcked).
|
||||
Test `An_acknowledge_during_the_reread_merges_into_its_entry_instead_of_superseding_it`. Red on the original code, and
|
||||
on either mutation: ack counted as full state, or no merge.
|
||||
- *Reopen during the query:* a stream epoch is bumped before `StreamOpened`. A changed epoch at replay time drops the
|
||||
re-read and its signal. No re-read starts before the current stream's sentinel. Test
|
||||
`A_stream_reopen_during_the_reread_drops_its_replay_and_its_signal`. Red on the original code (phantom Tank2
|
||||
Retrigger plus a second signal), and with the epoch check removed.
|
||||
- *Lows:* a dispose race returns false instead of throwing `ObjectDisposedException`. The retry wait and the RPC observe
|
||||
a teardown token, which every runtime teardown cancels. An unexpected failure no longer discards a queued follow-up.
|
||||
- Galaxy.Tests: 645 passed, 13 skipped. The 13 alarm-signal tests passed 15 runs out of 15.
|
||||
- **OpcUaClient: no signal suppression on an SDK-reported sequence gap during a refresh.** Plan G2 says such a `RefreshEnd`
|
||||
"does not signal".
|
||||
- The SDK 2.0.1 surface the driver sees (the per-item `Notification` callback) exposes no per-message gap or republish
|
||||
@@ -222,6 +242,9 @@ Heidenhain legs are **blocked**: Galaxy needs the VPN and mxaccessgw, and Heiden
|
||||
- With `SequentialPublishing` the worker waits for the missing sequence number (republish) before delivering later ones.
|
||||
- Residual: a gap the SDK gives up on could let a `RefreshEnd` signal over a lost refreshed event. **Resolved in review
|
||||
round 2:** the plan's G2 text now states what is implemented, and the overflow and gap mitigation is tracked in #926.
|
||||
- **#926 (2026-11-28) closes the residual.** The driver now detects the skipped gap itself, from the delivered message's
|
||||
sequence number. It also detects queue overflow, RefreshRequired and a missing RefreshStart inside the refresh
|
||||
bracket, and re-runs ConditionRefresh, bounded. See `926-refresh-bracket.md`.
|
||||
- **MTConnect also signals on a mid-stream `/current` re-baseline** (OUT_OF_RANGE / Agent restart), not only on the subscribe
|
||||
resync and the pump's first act. A re-baseline is a complete re-read, and without the signal a restarted Agent's
|
||||
conditions would wait for the next reconnect.
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# #927 — live gate: driver-failure ack revert through DriverHostActor under the connection service principal
|
||||
|
||||
A2b (remote `CallConditionMethod`) had been gated live only for a scripted condition. The path where a remote ack of a
|
||||
**native** condition reaches a driver that fails it, and DriverHostActor reverts the node (`RevertNativeAlarmAck`,
|
||||
`AlarmStateUpdate(EstablishesState: false)`), was unit-tested only (`ConditionMethodNodeManagerTests`, A2.md "Driver failure
|
||||
revert seen in the stream"). This adds scenario **A09** to `scripts/validation/grpc-data/conditions_scenarios.py` and runs it.
|
||||
|
||||
## How the driver is made to fail (a real failure, no seam)
|
||||
|
||||
The conditions profile's SOURCE `OpcUaClient` driver `source-opcua` watches the run-owned `opc-plc:2.14.10 --alm` native alarm
|
||||
`EastTankYellow`. A09 `docker compose pause`s the `opcplc` container immediately before the consumer's ack. The driver is still
|
||||
`Connected` (its keep-alive has not yet noticed), so `OpcUaClientDriver.AcknowledgeAsync` sends the upstream
|
||||
`AcknowledgeableConditionType.Acknowledge` call and gets **no reply**; the SDK call fails with a `ServiceResultException`
|
||||
(request timeout) inside the 5 s ack window, `DriverInstanceActor.HandleAcknowledgeAsync` reports `AlarmAckFailed`, and
|
||||
DriverHostActor reverts. The container is unpaused in the scenario's `finally` (and again by the per-scenario restore if it
|
||||
was left paused). Pausing also freezes opc-plc's own alarm cycling, so no upstream transition can explain the
|
||||
Unacknowledged that follows the ack.
|
||||
|
||||
**Why not an upstream refusal.** The option the issue suggests — an upstream that answers the Acknowledge with a Bad status
|
||||
(stale EventId, already acked) — does **not** revert today: `OpcUaClientDriver.AcknowledgeAsync` only logs a per-ack Bad
|
||||
result (and an ack whose condition id resolves to nothing), by design (`docs/drivers/OpcUaClient.md`: "a reply still returns
|
||||
normally, including per-ack refusals … a refusal is the server answering"), to keep refusals off the AlarmAcknowledge breaker.
|
||||
`DriverOperationRefusedException` now exists for exactly that (breaker-exempt, reverts), so an upstream refusal leaving the
|
||||
node Acknowledged is a gap — reported as a follow-up, not changed here (it reverses a documented driver decision). A
|
||||
no-reply transport failure is the failure class the driver does surface, and it exercises the whole revert path.
|
||||
|
||||
## Result — run `a927-1`, 2026-11-28, HEAD `cdbbe22a9`: A09 **PASS** (12/12)
|
||||
|
||||
`rig.py up --conditions` → `seed` → 85 s → `deploy --timeout 300` → `conditions_scenarios.py --only A09` → `rig.py down`
|
||||
(0 run containers, 0 run volumes).
|
||||
|
||||
| Check | Evidence |
|
||||
|---|---|
|
||||
| native condition present on both sides, Unacknowledged | consumer `EastTankYellow` `Inactive, Unacknowledged` (opaque `ns=6;s=c1.…` id), origin `ns=2;s=opcua/opcplc/EastTankYellow` same record time |
|
||||
| caller gets Good | 15:13:40 `opcplc` paused; consumer CLI `ack` ⇒ `Acknowledge successful` (plan §5.6 step 5: native ⇒ Good, `AcceptedUnconfirmed`; the failure reaches the caller as the revert) |
|
||||
| audit records the remote call | origin `source-1`: `Data-connection condition method Acknowledge by fixture-consumer (key …) on Raw:…:opcua/opcplc/EastTankYellow op a3-…: AcceptedUnconfirmed 0x00000000; on behalf of fixture-cli` — the connection's **service principal** (`fixture-consumer`) on behalf of the end user |
|
||||
| the driver really failed | 15:13:46 `DriverInstance source-opcua: native-alarm acknowledge of opcua/opcplc/EastTankYellow failed` |
|
||||
| DriverHostActor reverted (EstablishesState: false) | 15:13:46 `DriverHost source-1:4053: … did not reach the alarm system (the upstream acknowledge failed (ServiceResultException)); reverting the condition to unacknowledged` — `RevertNativeAlarmAck` is the only producer of that line and of an `EstablishesState: false` update |
|
||||
| origin node applied, then reverted | origin Server-object events after the ack: `Inactive, Acknowledged` → `Inactive, Unacknowledged` (nothing else: upstream frozen) |
|
||||
| consumer saw the reverted delta | consumer events after the ack: `Inactive, Acknowledged` → `Inactive, Unacknowledged`; same ConditionId, a new EventId |
|
||||
| positive control | 15:13:48 unpaused; 30 s later the condition was `Active, Unacknowledged` (opc-plc had re-activated it; whether the paused call was later applied upstream is not observable from this state); a second consumer ack of the current EventId ⇒ Good and **no** new revert line in the next 15 s |
|
||||
|
||||
Evidence files (removed with the run folder; copies taken before `down`): `evidence/A4S-A09.json`, `A4S-results.md`, the CLI
|
||||
`*.process.json` logs.
|
||||
|
||||
## Not covered
|
||||
|
||||
- The upstream-refusal flavour (Bad per-ack status) — it does not revert; follow-up above.
|
||||
- `/alerts` (alarm-history) rows for the ack and its revert were not asserted.
|
||||
@@ -300,6 +300,8 @@ regions at baseline). Per the plan, `MaxImportedConditionBytes` is now set from
|
||||
**205,665** (the managed-heap figure, the larger of the two) and the default `DataConnections:MaxImportedConditionBytes` =
|
||||
205,665 × 2,500 = **514,162,500 B (≈ 490 MiB)** (was 400 MiB). `MaxConditions` (1,000 per mapping) needs no lowering.
|
||||
Nearly all of it is the SDK condition node + children (X0's node-only figure was 160,997); the A3b EventId registry adds ~1 KB.
|
||||
(Superseded: these figures and X0's were `GC.GetTotalMemory` deltas — see round 2's L2 below and #929, which re-measured the
|
||||
node-only retained heap at 79,085 B.)
|
||||
|
||||
## Live — run `a3b-cond-3` (build `82ecc116`, clean tree) — PASS
|
||||
|
||||
@@ -658,7 +660,7 @@ Worst case (2 placements per condition, all 8 EventId slots filled, 3 event item
|
||||
**L2: PASS** (both ≤ 200 MiB in every run). `BytesPerCondition` = the larger of the two per-condition figures, max of three runs,
|
||||
rounded up: 158,629 → **160,000** (was 230,000); `MaxImportedConditionBytes` default = 160,000 × 2,500 = **400,000,000 B
|
||||
(≈ 381 MiB)** (was ≈ 548 MiB). The X0 node-only figure (160,997) and A3b's 197.4 MiB were taken with `GetTotalMemory` too and are
|
||||
likely inflated the same way (not re-measured here).
|
||||
likely inflated the same way (not re-measured here; #929 re-measured X0: 79,085 B node-only heap, X0 evidence).
|
||||
|
||||
## Gates (round 2, at `b884db5f`)
|
||||
|
||||
@@ -693,7 +695,8 @@ Active/Acknowledged; `passed: true`. Teardown: no run-labelled containers or net
|
||||
|
||||
- File: the `GrpcDataConditionStreamTests.Overflow_before_the_snapshot_is_drained_resets_the_stream` load sensitivity (above).
|
||||
- The plan's L2 / X0 figures (≈ 157–161 KiB per condition node, §5.5 table) came from `GC.GetTotalMemory` and are likely
|
||||
inflated by the same region accounting; the plan's §5.5 table was not edited (evidence only).
|
||||
inflated by the same region accounting; the plan's §5.5 table was not edited (evidence only). Done in #929: the X0 harness
|
||||
now uses the L2 method (79,085 B node-only heap vs 158,169 B by `GetTotalMemory`), and §5.5 cites L2's 160,000 B.
|
||||
|
||||
# A3 — Verification review round 2
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ The sources were the code at `91438049` and the evidence logs X0–A3. The plan
|
||||
| # | Plan says | Code does (evidence) |
|
||||
|---|---|---|
|
||||
| D1 | §5.6 step 2(c): one per-node semaphore (default 8) bounds remote method calls. | 8 per node **and** 4 per connection inside them. A dispatch with < 250 ms of budget left is `BadTimeout`, unsent (`ImportedConditionMethods.cs:63-79`, `:247`, `:270`; A3b review S4). |
|
||||
| D2 | §5.5 / §6: `MaxImportedConditionBytes` 400 MiB, ≈ 157 KiB (160,997 B) per condition. | `BytesPerCondition` = 160,000. The default is 400,000,000 B ≈ 381 MiB (`ProjectedConditionAccess.cs:58-61`, `DataConnectionOptions.cs:25`; A3 round-2 L2 measured the retained heap, not `GC.GetTotalMemory`). #929 re-measures the plan's figures. |
|
||||
| D2 | §5.5 / §6: `MaxImportedConditionBytes` 400 MiB, ≈ 157 KiB (160,997 B) per condition. | `BytesPerCondition` = 160,000. The default is 400,000,000 B ≈ 381 MiB (`ProjectedConditionAccess.cs:58-61`, `DataConnectionOptions.cs:25`; A3 round-2 L2 measured the retained heap, not `GC.GetTotalMemory`). #929 re-measured the plan's figures: node-only 79,085 B heap (X0 harness, now on the L2 method); §5.5 corrected, default unchanged. |
|
||||
| D3 | §6 metrics list `…conditions.refresh_required`. | Not present (`OtOpcUaTelemetry.cs:233-265` has `unsignalled`, `partition_overflows`, `items`, `resyncs`, `capacity_rejections`, `condition_methods`, `marks_discarded`). A4 diagnostics work; TODO 2. |
|
||||
| D4 | §5.4/§5.5: demand per connection the caller could see. | Demand is node-wide: the first admitted event item opens every condition-bearing connection, and the per-event gate still decides visibility (A3a deviation 2). |
|
||||
| D5 | §6: local visibility uses "the Subscribe grant on the `RemoteNamespaceMapping` scope". | `Subscribe` on the **placement folder's** scope, within a current mapping of the placement's realm that grants `AlarmSubscribe`, not `AlarmRead` (`ProjectedConditionAccess.cs:170-190`; A3 Runtime gate tests). Narrower than the mapping scope, and consistent with it. |
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
# #921 — H05 live gate against a real pre-H2 (v1) origin
|
||||
|
||||
The H3 gate replaced H05 ("v1 origin ⇒ unsupported") with an origin export that drops HistoryRead (H3.md "Not verified /
|
||||
substitutions"). That removes `Historizing` before any wire call, so the plan §4.3 mixed-version row "new consumer → v1 origin"
|
||||
was never exercised live. This gate runs it against a SOURCE pair built from a pinned pre-H2 commit.
|
||||
|
||||
## Rig additions (`scripts/validation/grpc-data/`, README "Pinned pre-H2 SOURCE")
|
||||
|
||||
- `rig.py up --source-revision <sha>`: `resolve_pinned_source_revision` requires X0 `a15912539` to be an ancestor (a pre-X0
|
||||
node rejects the whole snapshot once a newer bit is authored), H2 `ef938b435` **not** to be one, and no `rpc HistoryRead` in
|
||||
that revision's `data_connection.proto`. **`0c86edc19`** (the #918 merge, between H1 and H2 on master's first-parent line)
|
||||
passes; it is post-X0 (tolerant readers, feature header parsed with `SupportedFeatures = None`), its
|
||||
`LocalDataServices.Implemented()` has no HistoryRead and its proto has no HistoryRead RPC — a genuine v1 origin.
|
||||
- The rig `git archive`s it into the run folder, adds one rig file (`node-probe/WireTap.cs`, ASP.NET Core only, compiled
|
||||
unchanged against the pinned tree) and builds the pinned tree's own Dockerfile (`compose.source-pinned.yml`). CONTROL and
|
||||
CONSUMER run this checkout. `verify_candidate` checks SOURCE stamps against the pinned revision and export hash, the other
|
||||
four against this checkout. Unit tests: `PinnedSourceRevisionTests` (6, incl. the real `0c86edc1` / H2 commits).
|
||||
- **Wire tap** (`GRPC_DATA_WIRE_TAP=1`, only on the pinned SOURCE): per data-listener request, one line at arrival (gRPC path,
|
||||
`x-otopcua-data-features` value, remote address — before authentication) and one at completion (gRPC status). No credential
|
||||
or body.
|
||||
- `Client.CLI read --attribute <name>` (new; `Historizing`, `AccessLevel`, …) for a real OPC UA attribute read.
|
||||
- `history_v1_origin_gate.py` (H05V1) and probe `--scenario history-v1-origin`.
|
||||
|
||||
## Result — run `h05v1-1`, 2026-11-28 15:20–15:26 UTC: **PASS, 25/25 checks**
|
||||
|
||||
`rig.py up --history --source-revision 0c86edc1 --timeout 1500` → `seed` → 80 s → `deploy --timeout 300` (all six nodes
|
||||
applied the HEAD-built artifact, including the pinned SOURCE pair) → `history_v1_origin_gate.py` → `down` (0 containers,
|
||||
0 volumes, 0 images left). SOURCE has a SqlServer historian and historizes `counter` (the `--history` overlay).
|
||||
|
||||
| Assertion | Observed |
|
||||
|---|---|
|
||||
| builds | `source-1/2` stamp `0c86edc194bf…` (pinned export hash `1111f654…`); `control-*`, `consumer-*` stamp HEAD `cdbbe22a9` |
|
||||
| projected Raw + UNS `counter` `Historizing` | `False` (Good) on both; `AccessLevel` = 1 (CurrentRead, no HistoryRead bit) |
|
||||
| control: origin's own `counter` | `Historizing` `True`, `AccessLevel` = 13 (HistoryRead bit set); projected value Read Good on both realms |
|
||||
| `historyread` on projected Raw / UNS `counter` | `HistoryRead of ns=4;s=p1.… failed: BadHistoryOperationUnsupported (0x80720000).` (UNS `ns=5` same) |
|
||||
| control: `historyread` on the origin's node | Good, 30–31 rows in the window |
|
||||
| diagnostics (CONSUMER page, prerendered) | `Negotiated features none (v1 behaviour) · origin history not advertised · projected history reads good 0 · uncertain 0 · bad 0` |
|
||||
| diagnostics (SOURCE page) | `Exports with dropped unknown operation bits: export-raw: HistoryRead; export-uns: HistoryRead — this node's build is older than a feature authored here; the dropped bits grant nothing until the node is upgraded.` |
|
||||
| tap, consumer window (12 arrivals, all from the two consumer containers, no other remote) | methods `GetCapabilities, Browse, GetMetadata, Read` (control: the consumer's v1 traffic is there); **no** `HistoryRead` / `CallConditionMethod`; the only arrivals carrying the feature header are the capability probes (`history,conditions`, plan §4.1: the probe always asks) |
|
||||
| tap positive control (probe `history-v1-origin`, both origins) | capabilities with `history,conditions` byte-identical to capabilities without (operations 31, no `history`, no `conditions`); a HistoryRead with header `history` arrives at the tap with that header and completes **`grpc-status 7` (PERMISSION_DENIED)** |
|
||||
|
||||
**Finding (harness expectation, not a product defect).** The first pass (same run) failed two expectations of mine, both
|
||||
corrected in the harness and re-run green:
|
||||
1. A sent HistoryRead is refused **PERMISSION_DENIED**, not the UNIMPLEMENTED the issue/plan text guessed. At `0c86edc1`,
|
||||
`DataConnectionEndpoints` admits only its six v1 methods (`GetCapabilities, Browse, GetMetadata, Read, Write, Subscribe`) on
|
||||
the data listener and refuses any other path before gRPC routing. A current consumer never sends one (the tap shows it), so
|
||||
this only affects a hand-rolled caller; documented in `DataConnections.md`.
|
||||
2. The first projected value Read answered `BadWaitingForInitialData`; the gate now retries only that status (bounded 60 s),
|
||||
as every mapped positive read on this rig does (README).
|
||||
|
||||
The re-run used `--pinned-build` (harness and probe source edited after `up`; images unchanged, probe republished).
|
||||
|
||||
Evidence (run folder removed by `down`; copies taken before): `evidence/H05V1-results.json`, `probe/source-1/wire-tap.jsonl`.
|
||||
|
||||
## Not covered
|
||||
|
||||
- Subscribe / Write from the consumer to the v1 origin did not occur in the window (the gate reads via the CLI); the H2/A2
|
||||
recorded-v1-client gates cover the header-less shapes of those calls.
|
||||
- Conditions against a v1 origin (`--conditions` with a pinned SOURCE) were not run.
|
||||
@@ -139,7 +139,7 @@ while held, 0 after the session closed; `down` ⇒ 0/0/0/0 for both runs.
|
||||
**Found on the re-run (pre-existing v1 projection behaviour, not an H3 defect — for a follow-up):** an idle projected node's
|
||||
authority lapses with its 15 s `MetadataLeaseMilliseconds`; any read after that is `BadUserAccessDenied` — a value Read exactly as a
|
||||
HistoryRead (reproduced in the Runtime harness) — and a re-browse served from the still-cached browse page does not renew it
|
||||
(live: the H06 rebuild leg denied right after a re-browse). The gate now starts each held leg right after a deploy + re-browse.
|
||||
(live: the H06 rebuild leg denied right after a re-browse). The gate now starts each held leg right after a deploy + re-browse. **Fixed by #922** (`fu922.md`): a lapsed lease now renews on demand. The gate no longer re-browses before H04's resume, and H06(c) idles past the lease on purpose.
|
||||
|
||||
## Review round 3 (approve-with-changes) — fixes
|
||||
|
||||
@@ -173,7 +173,7 @@ Round 3 was itself an independent (Fable) verification of the round-2 commits
|
||||
|
||||
- **H05**: the rig builds no pinned v1 image, so "v1 origin" is substituted by an origin that does not advertise history for the
|
||||
principal (export without bit 32). The v1 wire shape itself is covered by the H2 recorded-v1-client gates; the live v1-origin
|
||||
path is follow-up **#921**.
|
||||
path is follow-up **#921** — since run live against a pinned pre-H2 origin (`0c86edc1`), PASS 25/25: `H05-v1-origin.md`.
|
||||
- **H01 tie clusters**: not representable live on either backend — SqlServer `hist.Sample` PK `(TagId, SourceTimeUtc)`, QuestDB
|
||||
`DEDUP UPSERT KEYS(ts, tag)` keep one sample per timestamp. Tie paging is proven by the H1 port fuzz (10k seeds).
|
||||
- **ReadyReplica consistency** on projected history and the Gateway backend (H4) were not run.
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
# v1 pre-deploy corrections: #916 and #917
|
||||
|
||||
Two defects in gRPC data connections v1 (merged `95c5e484`, never deployed, #915), found while planning remote history and
|
||||
alarm forwarding (plan §5.2, "Pre-existing v1 findings"; N3). Both are fixed in the v1 origin catalog
|
||||
(`LocalExportCatalog.Compilation.cs`), so header-less v1 callers get the fix too. Neither changes the wire shape.
|
||||
|
||||
## #916: `Metadata.stable_source_id` disclosed driver ids and RawPaths
|
||||
|
||||
**Defect.** `Compile` put `BackingSourceKey.StableSourceId` into `Metadata.stable_source_id` (proto field 10) on every value
|
||||
node, in every realm. For a driver source that key is `SourceKey.ForDriver`'s `<len>:<driverInstanceId><driver reference>`,
|
||||
and the reference is the RawPath. So a peer holding only a UNS export learned the origin's driver instance ids and RawPaths.
|
||||
The recorded real-origin golden shows the leak: `Browse/uns` carries `8:driver-1Plant/Modbus/dev1/Speed` on the UNS Speed
|
||||
reference.
|
||||
|
||||
**Consumer-side uses of the field (all of them).** Every read of `DataMetadata.StableSourceId` / `Metadata.stable_source_id`
|
||||
in `src/`:
|
||||
|
||||
| Site | Use |
|
||||
|---|---|
|
||||
| `DataProtoMapper.EncodeMetadata` / `DecodeMetadata` | Copies it when present. Decodes absence as `null` (`HasStableSourceId`). |
|
||||
| `ProjectedProofSize.cs:21` | Byte accounting of a proof. |
|
||||
| `OtOpcUaNodeManager.cs:4439` | Byte accounting of a projected definition. |
|
||||
|
||||
Nothing dedupes on it, compares it, keys on it, or exposes it to the consumer's own OPC UA clients. It is not an OPC UA
|
||||
property, not shown in the AdminUI and not logged. `DataSourceIdentity.StableSourceId` (Core.Abstractions) has no users.
|
||||
A1–A4 dedupe conditions by the keyed `condition_key` (`ConditionKeys`), never by this field.
|
||||
|
||||
**Decision: omit the field on every export, in every realm.** We considered two alternatives:
|
||||
|
||||
- *A keyed opaque id* (HMAC like `condition_key`). Rejected. No consumer uses the field, so an opaque value would only be a
|
||||
stable cross-realm correlator: it would tell a peer holding both a Raw and a UNS export that two nodes share a source.
|
||||
It would also depend on `DataConnections:ConditionKeySecret`, which is optional, so the field would come and go with an
|
||||
unrelated setting.
|
||||
- *Omit only where the realm differs.* Rejected. A Raw export also does not need the internal key, and keeping one rule
|
||||
is simpler to audit.
|
||||
|
||||
**Mixed versions.** Field 10 is `optional`. An old consumer decodes its absence as `null` and uses it for nothing but size
|
||||
accounting, so an upgraded origin works with old consumers, and a new consumer works with an old origin (it ignores
|
||||
the value).
|
||||
|
||||
One effect to know about: consumers compare whole `DataMetadata` records, field 10 included, when they renew a
|
||||
projection (`ProjectedCatalogCache.SameMetadata`, `OtOpcUaNodeManager` projected-variable reuse). An origin pair running a
|
||||
pre-fix build on one member and this build on the other would therefore look like a metadata change at failover, and the
|
||||
node would be re-projected once. No pre-fix build was ever deployed (#915), so this cannot happen in the field.
|
||||
|
||||
The internal `BackingSourceKey` (on `LocalDataNode.Source`) is unchanged: acquisition, sample routing,
|
||||
partitioning, write routes and `SourceKey.TryDriver` still use it.
|
||||
|
||||
## #917: alarm-bearing raw tags were exported as Variables that never get a value
|
||||
|
||||
**Defect.** `Compile` added every raw tag plan as a `Variable` with Read/Subscribe/HistoryRead. An alarm-bearing tag
|
||||
(`RawTagPlan.Alarm != null`) never receives a value, because `DriverHostActor` keeps it out of the value fan-out and #896
|
||||
gives it no UNS variable. So a consumer that imported one read `BadWaitingForInitialData` forever.
|
||||
|
||||
**Are these tags now forwarded as conditions?** Yes. Since A1–A4, every alarm-bearing raw tag gets a native condition
|
||||
placement at its RawPath in Raw (parented at its device or group folder). Every UNS reference to one gets a placement at
|
||||
the reserved `Area/Line/Equipment/EffectiveName` id, parented at the equipment. Both are listed through root-scoped
|
||||
condition items and keyed by `condition_key`, and the consumer materialises them in its `mapped/conditions` namespace.
|
||||
The alarm is therefore served as a condition, never as a value.
|
||||
|
||||
**Decision: compile the tag as an unsupported value node, and do not list it in Browse.** The rule is
|
||||
`supported = plan.Alarm is null && …` in `Compile`. In `LocalDataServices.BrowseAsync`, a child with a `Source` and
|
||||
`!Supported` is skipped.
|
||||
|
||||
- **Value operations.** Every value gate already keys on `LocalDataNode.Supported`: GetMetadata, Read and Subscribe
|
||||
answer `Unsupported`, history requires `Supported`, and `DataWriteDispatchGate` refuses writes.
|
||||
- **The node stays in the catalog.** Removing it would turn a deployable `DataExport` rooted at that tag
|
||||
(`RootKind = RawTag` is valid) into a catalog compile failure ("Export has no valid origin root") for the whole cluster.
|
||||
- **Browse hides it. The live gate forced this.** The first attempt listed the tag as the existing v1
|
||||
`UnsupportedVariable` kind, on the assumption that consumers skip that kind. They do not. `ProjectedNamespaceApplier`
|
||||
hands a whole page to `IProjectedNamespacePageSink.TryApply`, and `OtOpcUaNodeManager.TryEnsureProjectedVariable`
|
||||
rejects anything that is not a Folder, Variable or Tag (`OtOpcUaNodeManager.cs:4988`). So **one** `UnsupportedVariable`
|
||||
child failed the whole page.
|
||||
- On run `fu916-1`, browsing the consumer's `remote-opc` branch (the A4 Raw mapping of the opc-plc device, which holds
|
||||
the alarm tag `EastTankYellow`) answered `BadNoCommunication`.
|
||||
- The rig's `resolve` walk hit the same status, and `deploy` timed out on "deployed catalog and OPC UA namespace
|
||||
identity".
|
||||
- Every consumer build behaves this way, including the merged v1 consumers. Listing the node would therefore break any
|
||||
mixed-version consumer. Not listing it works for all of them, because a page simply has one item fewer.
|
||||
- **The same holds for any unsupported value node**, for example a data type v1 cannot carry. A pre-existing v1 origin
|
||||
already broke consumer browse of a folder holding one, and the browse filter fixes that too.
|
||||
|
||||
Condition placements are independent of the value node. They need only their parent folder or equipment, so condition
|
||||
forwarding is unchanged. The live gate below re-proves it on the alarm tag itself.
|
||||
|
||||
## The v1 gate: goldens not re-recorded
|
||||
|
||||
`GrpcDataV1RealOriginGoldens` (recorded on `1086593a`) captured both defects. The goldens stay as recorded. The new
|
||||
`GrpcDataV1RealOriginCorrections.Expected(scenario)` applies exactly two edits to the parsed golden message and
|
||||
re-serialises it:
|
||||
|
||||
- it clears `stable_source_id` on every Metadata;
|
||||
- it removes HighTemp from the device Browse page, and makes its GetMetadata item `status = Unsupported` with no value
|
||||
and no lease.
|
||||
|
||||
The test then compares the real origin's header-less bytes with the result. Only Browse, Browse/uns and GetMetadata are
|
||||
corrected. GetCapabilities, Read, Write, Write/no-write-grant and Subscribe are compared with the raw goldens, unchanged.
|
||||
`V1_corrections_916_917_are_exact_and_the_recorded_leak_was_real` pins the method:
|
||||
|
||||
- an unedited golden re-serialises byte-identically, so an edit is the only possible difference;
|
||||
- the corrected scenarios really differ from the goldens, and the others really do not;
|
||||
- the recorded UNS browse really contains the leaked `driver-1Plant/Modbus/dev1/`, and no corrected scenario does;
|
||||
- HighTemp is the single Unsupported item in GetMetadata, and the only item dropped from the recorded device page.
|
||||
|
||||
The fake-origin gate `GrpcDataV1CompatibilityTests` is untouched and green.
|
||||
|
||||
Before the fix, the decoded diff of real-origin output against the goldens was exactly these edits: field 10 on every
|
||||
value node of Browse, Browse/uns and GetMetadata, plus the HighTemp entries.
|
||||
|
||||
## Red/green
|
||||
|
||||
| Test | Before the fix (master behaviour) | After |
|
||||
|---|---|---|
|
||||
| `GrpcDataConditionPlacementTests.No_exported_metadata_carries_the_internal_source_key_916` (60 generated topologies; encoded metadata of every node; UNS bytes searched for every driver id and RawPath; positive control: the internal key still contains them) | **Failed**: `node.Metadata.StableSourceId should be null` | Pass |
|
||||
| `GrpcDataConditionPlacementTests.An_alarm_bearing_raw_tag_is_an_UnsupportedVariable_and_keeps_its_condition_placements_917` (positive controls: a plain tag, and the same tag without its alarm config, stay supported `Variable`s; 3 placements and the Raw listing intact; an export rooted at the alarm tag compiles) | **Failed**: alarm tag `Supported` was true | Pass |
|
||||
| `GrpcDataV1RealOriginCompatibilityTests` header-less + feature-header Browse, Browse/uns, GetMetadata vs the raw goldens | Pass on master; fail with the fix | Compared with `Expected(...)`: pass |
|
||||
|
||||
Control run: with master's `src` restored over this branch's tests, the full Runtime.Tests `Feature=GrpcData` run failed
|
||||
exactly the two new tests (#916, #917). All other tests passed (1021/1023).
|
||||
|
||||
The browse filter has its own red/green. With the `LocalDataServices` skip commented out, the real-origin Browse scenario
|
||||
fails, both header-less and with the feature header (2 failures). With the skip restored, it passes.
|
||||
|
||||
## Gate runs (Release, on `70539999` + docs)
|
||||
|
||||
- Runtime.Tests `Feature=GrpcData`: **1023/1023 passed in 3 of 3 consecutive full runs.**
|
||||
- Two earlier full runs each failed one test,
|
||||
`GrpcDataConfiguredDiscoveryWireTests.Bad_null_sdk_notification_cannot_borrow_unproven_sample_evidence(different_timestamp)`:
|
||||
it expected `BadUserAccessDenied` and got `BadNoCommunication`.
|
||||
- This is the pre-existing intermittent **#920**, which reproduces on master and is being fixed separately. It passed
|
||||
40/40 in isolation here.
|
||||
- It is not touched by this change. Its fixture's nodes are all `Supported`, so the browse skip is a no-op there, and
|
||||
the test exercises SDK notification queueing, not catalog metadata.
|
||||
- The new 60-seed property test takes about 125 ms, the same order as the existing 60-seed UNS-only property test, so
|
||||
it is not a load source.
|
||||
- Host.Tests `Feature=GrpcData`: 210/210 passed. This includes `GrpcDataV1CompatibilityTests` (fake origin, untouched),
|
||||
`GrpcDataV1RealOriginCompatibilityTests` and `GrpcDataHistoryWireTests`.
|
||||
- `dotnet build -c Release` (whole solution): 0 warnings, 0 errors.
|
||||
|
||||
## Live gate (local grpc-data rig, `--conditions` profile, under the shared rig lock)
|
||||
|
||||
| Run | Build | Result |
|
||||
|---|---|---|
|
||||
| `fu916-1` | `b7ca71f1`: alarm tag listed as `UnsupportedVariable` | **Failed**, which is how the browse defect above was found. `deploy` timed out on "deployed catalog and OPC UA namespace identity". The seeder `resolve` got `BadNoCommunication`. The consumer's `remote-opc` folder answered `BadNoCommunication` to a Client.CLI browse, while the SOURCE leaves read Good on both pair members |
|
||||
| `fu916-2` | interim | Discarded. The image was built while the source tree was being edited, so `verify_candidate` refused it ("running manifest does not match current image build inputs") |
|
||||
| `fu916-3` | `70539999`: Browse skips unsupported value nodes | **PASS**, details below |
|
||||
|
||||
`fu916-3` ran `up --conditions` → `seed` → 85 s → `deploy --timeout 300` (ready) → `conditions_a3_smoke.py` → `conditions_scenarios.py` → `down`:
|
||||
|
||||
- `deploy --timeout 300` reached ready;
|
||||
- `conditions_a3_smoke.py` reported `passed: true` (origin and consumer subscribers each saw Active/Unacknowledged → Active/Acknowledged);
|
||||
- `conditions_scenarios.py` passed **A01–A08, 8/8**, `source_revision` `70539999`. A04 is the three placements of the alarm tag `EastTankYellow` (Raw `map-opc`, UNS `map-pumpa`/`map-pumpb`) and the UNS-only principal's records;
|
||||
- `down` left 0 run containers.
|
||||
|
||||
A Client.CLI browse of consumer-1 then showed `remote-opc` → `FastUInt1` only, with the alarm tag not listed. Evidence is in
|
||||
`artifacts/grpc-data/runs/fu916-3/evidence/` (`A4S-results.{json,md}`).
|
||||
|
||||
The live run does not separately probe `stable_source_id` over gRPC. #916 is pinned by the wire-level real-origin gate and
|
||||
the 60-seed property test above.
|
||||
|
||||
## Review round 1 (2026-11-28)
|
||||
|
||||
| Finding | Fix | Red/green |
|
||||
|---|---|---|
|
||||
| #916 defence in depth: the mapper still encoded field 10 if anything set it | `DataProtoMapper.EncodeMetadata` never writes field 10. `DecodeMetadata` drops it, so a consumer of a pre-fix origin never retains it in `OriginMetadata`. The proto marks field 10 deprecated in a comment (not renumbered or removed) | `GrpcDataCodecTests.Stable_source_id_is_never_encoded_and_is_dropped_on_decode_916`: red with master's mapper, green with the fix. Engineering units (field 11) are the positive control |
|
||||
| The fake-origin gate's goldens carry field 10 from its fake metadata, so the mapper change moves them | `GrpcDataV1Corrections.Expected` clears field 10 on the parsed Browse/GetMetadata goldens. That is the only edit, and the goldens are not re-recorded | `V1_correction_916_clears_only_stable_source_id`: the recording really carried field 10, an unedited golden re-serialises identically, and the other RPCs compare raw |
|
||||
| Browse page boundaries | A skipped unsupported node no longer counts against the page's scan bound. The budget timeout still bounds the call. The skip therefore never yields an empty `Complete=false` page | `GrpcDataLocalConnectionTests.Browse_skips_unsupported_value_nodes_across_page_boundaries_917`, page size 2 over `[Speed, u, u, u, v, u, v]`. Red before the fix (an empty first-continuation page). Green after: `Speed, c3, c5` each exactly once, 2 non-empty pages, completes. Positive control: the skipped nodes are addressable (`Unsupported`) |
|
||||
| Internal metadata still said an unsupported node was writable | `Add` compiles `writable &= supported` (raw tags, UNS references, virtual tags) | The #917 test fixture's alarm tag is now `ReadWrite`. `alarm.Metadata.Writable.ShouldBeFalse()` was red before the change and green after. Positive control: the same tag without its alarm is writable |
|
||||
| Stale "browsable" test doc; "an export may still be rooted at it" | Both reworded. Such a root compiles, but grants nothing: the values are unsupported, and the condition placement sits under the tag's folder, not under the tag | — |
|
||||
|
||||
A consumer receiving an empty `Complete=false` page is no longer produced by this change. It can still come from the
|
||||
pre-existing name filter. Whether the consumer resolver tolerates one was not tested end to end; it is suggested as a
|
||||
follow-up.
|
||||
|
||||
Gates after the review, Release:
|
||||
|
||||
- Commons.Tests: 513/513.
|
||||
- Runtime.Tests `Feature=GrpcData`: 1024/1024.
|
||||
- Host.Tests `Feature=GrpcData`: 211/211. This includes both v1 gates.
|
||||
- `dotnet build -c Release`: 0 warnings, 0 errors.
|
||||
@@ -51,8 +51,16 @@ optional children NM adds before `Create()`: `ConfirmedState`, `Confirm`, `Shelv
|
||||
|
||||
`Quality`, `BranchId` and `Comment` are present.
|
||||
|
||||
Retained size is ≈ 157 KiB per condition (160,997 B). It was measured on 2,000 `OffNormal` instances as a
|
||||
`GC.GetTotalMemory(true)` delta.
|
||||
Retained size is ≈ 77 KiB per condition: **79,085 B** managed heap, ≈ 90 KB settled working set (re-measured 2026-11-28 for
|
||||
#929, three runs: heap 79,085 / 79,085 / 79,085 B, working set 90,284 / 90,144 / 90,038 B). It is measured on 2,000
|
||||
`OffNormal` instances as the change in `HeapSizeBytes − FragmentedBytes` of the last full blocking GC (after forced
|
||||
compacting collections), with the working set sampled until it settles — the same `Measure()` as the L2 harness.
|
||||
|
||||
- **Correction (#929).** X0 originally reported ≈ 157 KiB (160,997 B), a `GC.GetTotalMemory(true)` delta. On .NET 10 (GC
|
||||
regions) that call also counts committed-but-free region space (A3 round 2 showed +92 vs +218 MiB for the same state); the
|
||||
harness still logs it for comparison and it reads 158,169 B, i.e. ≈ 2× the retained heap.
|
||||
- `BytesPerCondition` (160,000 B) is unaffected: it comes from the L2 in-server worst case (111,715 B heap / 158,629 B
|
||||
working set, A3 round 2), which already used this method. Node-only ≈ 77 KiB of L2's ≈ 109 KiB heap is the SDK node tree.
|
||||
|
||||
- It excludes NM's indexes, the `c1.` identifier strings, the EventId registry and placement sets (m-T7).
|
||||
- L2 (A3 exit) is the authority for `MaxImportedConditionBytes`.
|
||||
@@ -220,6 +228,10 @@ pre-H2 master `1086593a`.
|
||||
2. Still expect these exact bytes **without** the header.
|
||||
3. Expect them **with** the header too, until the server advertises the feature in `SupportedFeatures`.
|
||||
4. Never re-record.
|
||||
- **Pre-deploy corrections (#916, #917; 2026-11-28).** Two deliberate v1 fixes change real-origin Browse, Browse/uns and
|
||||
GetMetadata. `GrpcDataV1RealOriginCorrections.Expected` applies exactly those edits to the parsed, unre-recorded golden:
|
||||
it clears `stable_source_id`, drops the alarm-bearing HighTemp from the device Browse page, and makes its GetMetadata
|
||||
item `Unsupported`. A test pins that the edits are the only difference. See `V1-916-917.md`.
|
||||
|
||||
## 3. Gate runs
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
# #922 — a lapsed projected metadata lease is not an access denial
|
||||
|
||||
Found in the H3 live gate (`H3.md` §"Found on the re-run"). Pre-existing v1 projection behaviour (95c5e484).
|
||||
|
||||
## Root cause
|
||||
|
||||
A projected node's authority is its catalog proof, bound to a `BoundProjectionLease` whose remote `MetadataAuthorityLease` lasts
|
||||
`MetadataLeaseMilliseconds` (15 s on the rig) from the browse that fetched it. Only a **subscription** ever renewed it
|
||||
(`RemoteNamespaceResolver.RenewExactAsync`, Subscribe only). After the lease lapsed:
|
||||
|
||||
- `ProjectedCatalogCache.TryResolveProjected` / `Valid` required `Lease.IsValid`, so `ProjectedDataAccess.TryAcquire` returned
|
||||
`false`, and the node manager's Read pre-loop mapped **every** `false` to `BadUserAccessDenied`. A lapse looked the same as an
|
||||
ACL denial.
|
||||
- HistoryRead: `AuthorizeHistoryRead` → `DataPlaneAuthorizer` → `MappedSubjectResolver` (`TryResolveProjected`) returned
|
||||
`Deny` ⇒ `BadUserAccessDenied`.
|
||||
- Re-browse: a cached parent page is served while its own lease holds, and nothing renews on a cache hit. A re-browse just
|
||||
before the page's lease ran out therefore renewed nothing, and the nodes lapsed seconds later (the H06 observation).
|
||||
|
||||
## Fix
|
||||
|
||||
| Piece | Change |
|
||||
|---|---|
|
||||
| `BoundProjectionLease.Renewable` | the lease is invalid ONLY because it is transient: the remote time ran out or the route was replaced, while the local catalog authority, mapping binding and cache generation are current and nothing called `Invalidate` |
|
||||
| `ProjectedCatalogCache.TryResolveForRenewal` | the retained, non-retired proof that is valid or `Renewable` (every `ValidCore` fence except the lease) |
|
||||
| `OtOpcUaNodeManager.TryResolveForRenewal` (+ `IProjectedNodeLookup`, sinks) | the committed live definition without the authority check (lock-free snapshot), so the renewal commits against the exact SDK node |
|
||||
| `DataOperationPolicy.AuthorizeMappedSubject` | `AuthorizeMapped` minus the lease checks. Classifies a refusal only and serves nothing |
|
||||
| `IProjectedDataAccess.RenewLapsed` → `ProjectedLapseOutcome {Denied, Renewing, Unavailable}` | `Denied` unless the node is lapsed-renewable AND the caller holds the grant for the operation (local grant + mapping bit + op-specific checks). Otherwise starts ONE exact renewal per node (`RenewExactAsync` generalised to `authorizeAs`/`required` = Read or HistoryRead; the subscription default is unchanged), off the request thread, inside the unary budget, with a 250 ms back-off after a failure. A successful Read renewal then schedules a read so the retry is served from cache |
|
||||
| Read pre-loop | `Denied` ⇒ `BadUserAccessDenied` (unchanged); `Renewing` ⇒ `BadWaitingForInitialData` (as for a cold read); `Unavailable` ⇒ `BadResourceUnavailable`. A non-Value attribute of a lapsed node ⇒ `BadResourceUnavailable` |
|
||||
| `AuthorizeHistoryRead` | renews lapsed projected handles within the request (one block-bridged wait per batch, ≤ 5 s, no `Lock` held — the SDK released it before dispatching, as H3 recorded), re-authorizes, then serves. A renewal that does not complete ⇒ `BadResourceUnavailable` |
|
||||
| `ProjectedBrowseAccess` | an initial cached page past half its lease is served AND refreshed in the background (one in flight per page key) |
|
||||
|
||||
The node-manager `Lock` is never held across a network renewal. The Read path only starts the task. The renewal commits
|
||||
through `IProjectedNamespacePageSink.TryRenewExact`, which takes `Lock` briefly and performs no I/O.
|
||||
|
||||
## Red / green (Runtime harness, `GrpcDataLeaseLapseWireTests`, `Trait Issue=922`, real consumer SDK session + projection stack)
|
||||
|
||||
| Test | master (`05f431f5d` src) | fix |
|
||||
|---|---|---|
|
||||
| value Read after the lease lapses ⇒ retryable, renews on demand without a browse (twice), attribute read not denied | **FAIL** (`BadUserAccessDenied`) | pass |
|
||||
| no local Read grant ⇒ still `BadUserAccessDenied` after the lapse; no metadata/read call; renewal counter 0 (counted synchronously at admission) | pass | pass |
|
||||
| HistoryRead after the lapse ⇒ renewed in the request, Good, 3 values | **FAIL** (`BadUserAccessDenied`) | pass |
|
||||
| lapsed HistoryRead with the origin unreachable ⇒ `BadResourceUnavailable`, nothing read; Good after recovery | **FAIL** (`BadUserAccessDenied`) | pass |
|
||||
| no local HistoryRead grant ⇒ still `BadUserAccessDenied` after the lapse, unsent | pass | pass |
|
||||
| re-browse of a cached page past half its lease renews (origin browse call, lease holds at t0+20 s) | **FAIL** (no origin call) | pass |
|
||||
|
||||
Real ACL denial and lease lapse are tested both ways. The lapse cases are red on master and the ACL-denial controls are green on
|
||||
both. 8 consecutive green runs of the six tests after the final assertion fix.
|
||||
Harness note: the fixture origin observes its single sample once, so the sample's origin age grows with the manual clock. The
|
||||
value tests use a stale timeout and client maxAge longer than the idle gaps, so that age stays out of the result under test.
|
||||
|
||||
## Gates
|
||||
|
||||
`dotnet build -c Release` (solution) 0 errors. Runtime.Tests 2096 passed / 3 skipped / **2 failed** under machine load average
|
||||
100–150: `VirtualTagActorTimerTests.Ticks_during_a_slow_run_coalesce_instead_of_piling_up` and
|
||||
`GrpcDataConfiguredDiscoveryWireTests.Failed_sdk_item_construction_releases_candidate_and_fanout_ownership` (its first
|
||||
subscription publish was not Good, and it calls no code path changed here). Once load dropped, both passed 12/12 on master `src`
|
||||
and 12/12 on the fix. Cause not established, so this is recorded as load-correlated, not as a flake. OpcUaServer.Tests 1460 passed
|
||||
(+2 skips). Host.Tests 497 passed, including `GrpcDataV1CompatibilityTests` (goldens untouched). Core.Tests 385 passed (+1 skip).
|
||||
|
||||
## Live (grpc-data rig, OrbStack, run `f922a-sqlserver`, `--history --history-backend sqlserver`)
|
||||
|
||||
`history_gate.py` with the workaround removed: H04 no longer re-browses before its resume, and H06(c) now deliberately idles
|
||||
`LEASE_LAPSE_SECONDS = 20` (> the 15 s lease) after its restore before the held read. **H01–H06 all PASS** (47/34/35/44/58/238
|
||||
assertions).
|
||||
|
||||
Value-Read probe (one browse, then never again; Client CLI `read --max-age 10000` on CONSUMER, raw/counter and uns/scalar):
|
||||
the fresh-lease control and both idle legs (20 s and 40 s, i.e. past the lease) answer `BadWaitingForInitialData` then Good on
|
||||
the next read, with **no `BadUserAccessDenied` anywhere**. With the CLI's default `--max-age 0`, every projected read (lapsed or
|
||||
not) stays `BadWaitingForInitialData`, because the v1 Read path never serves `maxAge = 0` from cache. That is separate from this
|
||||
fix and is filed as a follow-up. `rig.py down` ⇒ 0 containers / volumes / networks / images.
|
||||
|
||||
## Security review round 1 (no auth bypass; two availability findings + lows) — fixes
|
||||
|
||||
Merged local master first (incl. #916/#917, DataConnections), clean, build 0 errors.
|
||||
|
||||
| # | Finding | Resolution | Red/green |
|
||||
|---|---|---|---|
|
||||
| 1 | A renewal reserved `MaxUnaryBytes` in the unary budget: (A) a batch of N lapsed nodes renewed only the first, (B) while one ran, every cold read / write / subscription renewal was refused | renewals left the unary budget: own resolver pool `max(1, maxConcurrentFetches/2)` (never `_fetchSlots`), a bounded queue (64), 256 KiB each, 3 s end to end including the pool wait | `A_read_batch_of_several_lapsed_nodes_renews_every_node…`, `A_history_batch_of_several_lapsed_nodes…`, `A_renewal_in_flight_does_not_crowd_out_a_cold_read…`: all **red** on the pre-review fix, green now |
|
||||
| 2 | `AuthorizeHistoryRead` waited 5 s before the history batch limiter and ignored the request token, so concurrent HistoryReads against a slow origin pinned SDK threads past the 16-batch cap. The wait also equalled the renewal budget | the wait first takes a non-local history slot with `Wait(0)` (none free ⇒ no wait, retryable), honours `OperationContext.CancellationToken`, and lasts 4 s (≤ `HistoryReadDeadline`) against a 3 s renewal | `Concurrent_history_reads_against_a_slow_origin…`: 24 reads against a silent origin, ≥ 24 − RemoteSlots answer in < 2.5 s, all `BadResourceUnavailable`, origin untouched, Good after release. **Red** on the pre-review fix (all 24 waited ~5 s) |
|
||||
| 3 | Two authorities (policy classifies, `DataPlaneAuthorizer` vetoes) | a renewal that completed `true` and is still vetoed ⇒ `BadUserAccessDenied` | by construction; the grant-revoked test below covers the revoked case |
|
||||
| 4 | Renewals keyed by node only, though each requests its operation's bit | keyed by (realm, id, operation), back-off too | — |
|
||||
| 5 | Back-off map cleared wholesale at 4096; browse refresh deduped per (caller, MaxResults) | expired entries are evicted first, otherwise the one expiring first; one background refresh per parent node | — |
|
||||
| 6 | Write / CreateMonitoredItems on a lapsed node | documented in `docs/DataConnections.md` as not covered (still `BadUserAccessDenied` until a read/browse renews); reported as a follow-up | — |
|
||||
|
||||
New safety controls, green on both the pre-review fix and now: an `Invalidate`d lease ⇒ `BadUserAccessDenied`, no renewal, no origin
|
||||
call. A grant revoked while the renewal is parked at the origin ⇒ nothing served, the renewal never commits, then
|
||||
`BadUserAccessDenied`. A mapping removed while renewing ⇒ not revived, not answered as a lapse. 13 #922 tests, 5 consecutive green
|
||||
runs.
|
||||
@@ -18,18 +18,33 @@ static class P {
|
||||
int total = Count(ctx, alarm, kinds);
|
||||
Console.WriteLine($"{name}: total={total} ({string.Join(", ", kinds.Select(k => k.Key + "=" + k.Value))}); Quality={(alarm.Quality!=null)} BranchId={(alarm.BranchId!=null)} Comment={(alarm.Comment!=null)}");
|
||||
}
|
||||
// #929: GC.GetTotalMemory counts committed-but-free regions on .NET 10. Use the last full blocking GC's
|
||||
// HeapSizeBytes - FragmentedBytes plus a settled working set: the same method as the L2 harness's Measure()
|
||||
// (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ImportedConditionMemoryMeasurementTests.cs).
|
||||
static (long Heap, long WorkingSet) Measure() {
|
||||
for (int i = 0; i < 3; i++) { GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true, true); GC.WaitForPendingFinalizers(); }
|
||||
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true, true);
|
||||
var info = GC.GetGCMemoryInfo(GCKind.FullBlocking);
|
||||
using var p = System.Diagnostics.Process.GetCurrentProcess(); p.Refresh(); long ws = p.WorkingSet64;
|
||||
var settle = System.Diagnostics.Stopwatch.StartNew();
|
||||
while (settle.Elapsed < TimeSpan.FromSeconds(10)) {
|
||||
Thread.Sleep(500); p.Refresh(); long next = p.WorkingSet64; bool stable = Math.Abs(next - ws) < 1024 * 1024; ws = next; if (stable) break; }
|
||||
return (info.HeapSizeBytes - info.FragmentedBytes, ws);
|
||||
}
|
||||
static void Main() {
|
||||
var ctx = new SystemContext((ITelemetryContext)null) { NodeIdFactory = new Ids(), NamespaceUris = new NamespaceTable() };
|
||||
ctx.NamespaceUris.Append("urn:a"); ctx.NamespaceUris.Append("urn:b");
|
||||
Run("AlarmConditionState", p => new AlarmConditionState(p), ctx);
|
||||
Run("OffNormalAlarmState", p => new OffNormalAlarmState(p), ctx);
|
||||
Run("DiscreteAlarmState", p => new DiscreteAlarmState(p), ctx);
|
||||
var keep = new List<object>(); long before = GC.GetTotalMemory(true);
|
||||
var keep = new List<object>(); var (heap0, ws0) = Measure(); long before = GC.GetTotalMemory(true);
|
||||
for (int i = 0; i < 2000; i++) { var parent = new FolderState(null); var a = new OffNormalAlarmState(parent);
|
||||
a.ConfirmedState = new TwoStateVariableState(a); a.Confirm = new AddCommentMethodState(a); a.ShelvingState = new ShelvedStateMachineState(a);
|
||||
a.MaxTimeShelved = new PropertyState<double>.Implementation<VariantBuilder>(a);
|
||||
a.Create(ctx, new NodeId("c"+i, 2), new QualifiedName("c"+i, 2), new LocalizedText("c"+i), true); keep.Add(a); }
|
||||
long after = GC.GetTotalMemory(true); Console.WriteLine($"retained bytes/condition (2000, OffNormal, no address-space indexes): {(after-before)/2000}"); GC.KeepAlive(keep);
|
||||
var (heap1, ws1) = Measure(); long after = GC.GetTotalMemory(true);
|
||||
Console.WriteLine($"retained bytes/condition (2000, OffNormal, no address-space indexes): heap {(heap1-heap0)/2000} (GCMemoryInfo), " +
|
||||
$"working set {(ws1-ws0)/2000} (settled); GC.GetTotalMemory delta {(after-before)/2000} (not used, #929)"); GC.KeepAlive(keep);
|
||||
var conds = keep.Cast<OffNormalAlarmState>().ToArray(); var recs = new object[conds.Length];
|
||||
for (int w = 0; w < 3; w++) { var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
for (int i = 0; i < conds.Length; i++) { var c = conds[i]; recs[i] = (c.NodeId, c.ActiveState?.Id?.Value, c.AckedState?.Id?.Value, c.ConfirmedState?.Id?.Value,
|
||||
|
||||
Reference in New Issue
Block a user