docs(plans): history+alarms plan rev 3 — fold in second Fable pass (N1-N8), settle Q1/Q2
v2-ci / unit-tests (push) Has been cancelled
v2-ci / unit-tests (push) Has been cancelled
Owner snapshot from live conditions (not the event callback); root-scoped condition subscription; realm-local placement with a keyed condition_key; NodeIds keyed on (connection, condition_key) so re-homing never changes them; dedicated condition budgets; sixth mask site; repeated v1-client gates. Q1: condition streams run under the connection service principal, re-gated per local caller. Q2: re-home is NodeId-stable; unavoidable changes are accepted as remove+add+RefreshRequired. Pre-existing v1 stable_source_id leak: #916.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# gRPC data connections: remote history and alarm/event forwarding
|
||||
|
||||
Date: 2026-11-23 (revision 2, after independent review)
|
||||
Date: 2026-11-23 (revision 3, after the independent review's first and second passes; owner decisions of 2026-11-23 applied)
|
||||
Status: **Design + phased plan, not approved, not implemented.** No code, schema or issue changes accompany this
|
||||
document. It extends the merged v1 feature (`95c5e484`), whose design is
|
||||
[`2026-11-15-grpc-data-connections-design.md`](2026-11-15-grpc-data-connections-design.md) ("v1 design") and whose
|
||||
plan/gate structure is [`2026-11-15-grpc-data-connections-implementation-plan.md`](2026-11-15-grpc-data-connections-implementation-plan.md)
|
||||
("v1 plan"). Operator guide: [`docs/DataConnections.md`](../DataConnections.md) §"Feature boundary".
|
||||
Independent review of revision 1: [`2026-11-23-grpc-data-connections-history-alarms-relay-plan-review.md`](2026-11-23-grpc-data-connections-history-alarms-relay-plan-review.md)
|
||||
Independent review (first pass of revision 1; "Second pass" section of revision 2): [`2026-11-23-grpc-data-connections-history-alarms-relay-plan-review.md`](2026-11-23-grpc-data-connections-history-alarms-relay-plan-review.md)
|
||||
(the review's file name refers to this plan's earlier name; revision 1 also covered relay, now deferred — §8).
|
||||
|
||||
Conventions: "verified" claims cite a file read at `649f2ecd2`. Claims marked **(inferred)** are not proven from source and
|
||||
@@ -26,25 +26,25 @@ found while verifying M1 (row M1).
|
||||
| Finding | Verdict | Where addressed |
|
||||
|---|---|---|
|
||||
| B1 projected identity (`mapped/raw|uns` namespaces, opaque `p1.` ids, realm folding in `RealmOf`) | Accepted (verified `ProjectedDataIds.cs:8-11,47-57`, `NM:283-284`, `NM:2410`, `NM:4883-4888`) | §5.2 identity, §5.3 mapped condition registry, H3/A4 CLI recipes resolve by browsing |
|
||||
| B2 tap point misses SDK-applied method transitions; snapshot lacks Retain/comment/EventId | Accepted (verified `NM:3198-3202`, `DriverHostActor.cs:2612-2637`, `NM:3003-3037`) | §5.1: hub fed from `ReportConditionEvent` (`NM:1540`), A1 parity gate on reported events |
|
||||
| B2 tap point misses SDK-applied method transitions; snapshot lacks Retain/comment/EventId | Accepted (verified `NM:3198-3202`, `DriverHostActor.cs:2612-2637`, `NM:3003-3037`); second pass: partially closed ⇒ closed by N1 | §5.1: snapshot from live nodes, callback for deltas only |
|
||||
| B3 remote native ack via preflight+route acknowledges nothing at the origin | Accepted (verified `NM:3197-3202`, `DriverHostActor.cs:2612`, `NM:2577`) | §5.6 session-less `TryExecuteConditionMethod` entry point, A2 |
|
||||
| B4 `AlarmRead` unenforced; Server-object delivery unfiltered with ACLs off | Accepted (verified `NodePermissions.cs:24`, no `OpcUaOperation.AlarmRead`; `NM:7155-7171`) | §5.4 visibility gate independent of `AclEnforced`; permission = `CreateMonitoredItems`/Subscribe on mapping scope |
|
||||
| B5 Part 9 handlers run under `Lock` | Accepted (verified `NM:3001-3009`) | §5.6: projected methods intercepted before any `Lock`; no local apply before owner confirms; lock-freedom test |
|
||||
| B5 Part 9 handlers run under `Lock` | Accepted (verified `NM:3001-3009`); second pass: closed conditional on X0 | §5.6 step 1: `ICallAsyncNodeManager` path preferred (symbols verified in SDK 2.0.1), sync partition fallback; if X0 finds neither lock-free, A3 is blocked — no local-apply fallback; lock-freedom is a hard A3 gate |
|
||||
| B6 relay vs origin==expected-cluster binding | Accepted | Relay removed from this plan; constraints recorded in §8 |
|
||||
| M1 hard-coded operation masks abort the snapshot on old nodes | Accepted (verified `DataConnectionValidator.cs:12`, `DataConnectionDeploymentRuntime.cs:151-152`, `DataContracts.cs:271-276`, `DataProtoMapper.cs:1054-1062`, `:284`); **plus a fifth site** `Runtime/DataConnections/ProjectedDataAccess.cs:157` (acquisition allowlist) | §4.3, X0 (tolerant readers ship first), rollout rule |
|
||||
| M1 hard-coded operation masks abort the snapshot on old nodes | Accepted (verified `DataConnectionValidator.cs:12`, `DataConnectionDeploymentRuntime.cs:151-152`, `DataContracts.cs:271-276`, `DataProtoMapper.cs:1054-1062`, `:284`); **plus** `ProjectedDataAccess.cs:157` (acquisition allowlist); second pass adds the sixth, `LocalDataServices.cs:47` `Implemented(target)` (verified; used at `:81,204,216`) | §4.3: four tolerance sites in X0; three grow sites (`DataConnectionValidator`, `Implemented(target)`, `ProjectedDataAccess`) in H2/H3/A2/A3 |
|
||||
| M2 no per-call negotiation on unary RPCs; v1 client faults on unknown frame arm | Accepted (verified `DataConnectionGrpcService.cs:26`, `LocalDataServices.cs:222`, `GrpcDataConnection.cs:548,762-767`, `DataProtoMapper.cs:1207`) | §4.1 feature header on every RPC; X0's open question is closed |
|
||||
| M3 override-resident history rules | Accepted (verified `NM:8810-8817`, `:8839`, `:8854-8902`, `:10815`) | §3.1 port boundary at override level; H1 parity cases |
|
||||
| M4 standing condition stream = new authority mode, outside projection budget | Accepted | §5.5 demand-driven stream, budget charge, all-or-nothing capacity |
|
||||
| M4 standing condition stream = new authority mode, outside projection budget | Accepted; second pass: partially closed ⇒ closed by N2/N5 and owner Q1 | §5.5 root-scoped item, per-connection demand, separate condition budget |
|
||||
| M5 relay loop key / both validator sites | Accepted | §8 (deferred constraints) |
|
||||
| M6 bits/migration late; Gateway optional | Accepted (verified validator `:22,103,268`) | H2 carries bits+migration+artifact; Gateway leg is a required H4 gate |
|
||||
| M7 duplicate conditions inside one mapping | Accepted | §5.2/§5.3: one condition per (consumer node, connection, origin condition), extra placements = notifiers |
|
||||
| M8 method→permission mapping, standby, audit text | Accepted (verified `NM:3285-3290`, `NM:3118-3124`) | §4.2 bits derived from `AlarmOperationFor`; §5.6 standby; §6 sanitised separate audit field |
|
||||
| M8 method→permission mapping, standby, audit text | Accepted (verified `NM:3285-3290`, `NM:3118-3124`); second pass: `AlarmCommand` crosses the mesh, so a new field needs a cross-version proof | §4.2 bits from `AlarmOperationFor`; §5.6 standby; §6: `AlarmCommand` is **not** extended — sanitised remote audit text lives in the origin's data-connection audit log |
|
||||
| M9 building on undeployed v1 | Accepted, soak deferred by owner | §1.1 — G0 is a later deploy gate (#915), not a blocker |
|
||||
| m1 MAC redundant; in-memory store is a test double | Accepted (verified `HistoryContinuationStore.cs:107-123`) | §3.2: no MAC; new production `PeerHistoryContinuationStore` with idle expiry |
|
||||
| m2 two release mechanisms | Accepted | §4.2: `release_continuations` flag only |
|
||||
| m3 `HistoryEventRow` fields | Accepted (verified `HistoryReadContracts.cs:194-204`) | §7 deferred event history defines the row from `HistoricalEvent` |
|
||||
| m4 `SubscriptionFrame` field 8 taken | Accepted | §4.2: new arm = 9 |
|
||||
| m5 origin EventId round-trip unnecessary | Accepted | §5.6: consumer validates its own EventIds; origin precondition = condition version |
|
||||
| m5 origin EventId round-trip unnecessary | Accepted | §5.6: consumer validates its own EventIds; origin precondition = `expected_activation_time` |
|
||||
| m6 Galaxy ack-identity lookup unverified | Accepted | X0 task; §5.6 marked (inferred) |
|
||||
| m7 assembly budget per node | Accepted | §3.2: per-request budget |
|
||||
| m8 aggregate configuration judged by consumer | Accepted | §4.2: configuration fields sent; origin `IsServable` decides |
|
||||
@@ -53,6 +53,16 @@ found while verifying M1 (row M1).
|
||||
| m11 relay hop bound | Accepted | §8: hop cap 2 until measured |
|
||||
| Nits (line numbers, relay schema, phase keys, negotiation surface) | Accepted | Line refs fixed; phase keys verified free-form (`run-unit-phase.py:139` only requires a manifest key); no new protocol minors — capability fields + feature header only |
|
||||
| Scope cuts 1–5 | Accepted | Relay (§8), event history and modified reads (§7), Shelve/Enable/Disable (§7), `is_restatement`/release RPC/MAC/EventId map removed |
|
||||
| **Second pass** | | |
|
||||
| N1 event-fed hub is not a state source | Accepted (verified `NM:1561-1565` standby early return, `NM:5639-5651`, `NM:1363-1418`, `NM:1386-1388`) | §5.1: `SnapshotConditions` under a short `Lock` hold + watermark; deltas raised before the standby return and on silent applies; `state_known`; `snapshot_complete` withheld until apply complete + Primary verdict; A1 parity cases (a)–(g) |
|
||||
| N2 no condition-subscription contract | Accepted (verified `SubscriptionItem` names a single `View`) | §4.2 `SubscriptionItem.condition_scope`; §5.5 root-scoped item, `total`, `removed`, `snapshot_complete` |
|
||||
| N3 cross-realm home leaks RawPath | Accepted (verified `LocalExportCatalog.cs:42-48`, `NM:4885`, `DataPlaneAuthorizer.cs:182`); **refinement:** `stable_source_id` cannot be the dedupe key — it embeds driver id + RawPath (`SourceSamplePublisher.cs:32-33`, `LocalExportCatalog.Compilation.cs:92,123`) | §5.2 realm-local placement addresses + keyed `condition_key`; pre-existing v1 disclosure filed as #916 |
|
||||
| N4 ConditionId depends on stream order / home | Accepted | §5.2: NodeId = (connection, `condition_key`) in a new `mapped/conditions` namespace; mapping changes never change it; primary placement (SourceName only) from deployed config |
|
||||
| N5 default budgets | Accepted (verified `RemoteNamespaceMapping.cs:29` = 10,000) | §5.5 arithmetic: 10,000 / 21 ≈ 476; own budget, `MaxConditions` 2,000 per mapping, node cap 210,000 nodes, admission at snapshot begin, 80% warning, validator warning |
|
||||
| N6 `occurrence` across failover | Accepted | §5.6 step 3: `expected_activation_time` + EventId re-binding on unchanged resync; gated in A03 |
|
||||
| N7 notifier wiring vs lazy folders | Accepted (verified projected folders created `EventNotifier = None`, `NM:4919`) | §5.3 lazy, symmetric wiring; folders with event items pinned |
|
||||
| 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 |
|
||||
| Owner decisions 2026-11-23 | Applied | Q1 → §5.5 (service principal upstream, per-caller re-gating); Q2 → §5.2 (NodeIds stable across mapping disable; residual change accepted) |
|
||||
|
||||
---
|
||||
|
||||
@@ -77,6 +87,9 @@ What still holds without G0: every phase's own exit gate, including the docker-d
|
||||
before it merges. Deploying any phase to a production fleet before #915 passes stacks it on an unsoaked v1; record that
|
||||
risk in the deploy notes when it happens.
|
||||
|
||||
Per review N8, #915's soak should run on an **X0-or-later** build: a soak of pre-X0 v1 says nothing about the tolerant
|
||||
readers that every later phase depends on.
|
||||
|
||||
#915's bar, for reference: at least one real redundant pair consuming from another cluster over TLS, with a Raw and a UNS
|
||||
mapping in use; 14 consecutive days with no p0/p1 grpc-data issue and no unexplained stream resets or authority/lease
|
||||
failures; one planned failover of each pair during the window.
|
||||
@@ -117,7 +130,8 @@ Projected variables never set the `HistoryWrite` bit. Nothing is reserved for Hi
|
||||
|
||||
Conditions owned by the origin are native (`ConditionId = RawPath`, one node fanned to referencing equipment folders) or
|
||||
scripted (`ConditionId = ScriptedAlarmId`). Each appears **once** on each consumer node that imports it: a real
|
||||
`AlarmConditionState` in the mapped namespace, with notifiers on every projected folder that mirrors an origin placement.
|
||||
`AlarmConditionState` in the `mapped/conditions` namespace, keyed by (connection, opaque condition key), with notifiers on
|
||||
every projected folder that mirrors an origin placement.
|
||||
Methods execute at the origin's active Primary under the origin's authorization. Nothing is applied locally before the origin
|
||||
has accepted the call.
|
||||
|
||||
@@ -135,19 +149,22 @@ has accepted the call.
|
||||
| Seam | File(s) | Consequence |
|
||||
|---|---|---|
|
||||
| Wire | `Commons/Protos/data_connection.proto` | `CapabilitiesResponse` 1–15 used; `Metadata` 1–13; `SubscriptionCommand` oneof 5–9; `SubscriptionFrame` oneof 4–7 **and field 8 = `Serving`** ⇒ new arms start at 9 |
|
||||
| Operation masks (M1) | `Configuration/Validation/DataConnectionValidator.cs:12,22`; `Runtime/DataConnections/DataConnectionDeploymentRuntime.cs:151-152` (throws ⇒ aborts the whole snapshot); `Abstractions/DataConnections/DataContracts.cs:271-276` (`DataCapabilities.Validate` throws); `Commons/DataConnections/DataProtoMapper.cs:1054-1062` (masks, benign), `:284` (`Metadata.allowed_operations` cast unmasked); `Runtime/DataConnections/ProjectedDataAccess.cs:157` (acquisition allowlist) | All five change in X0 (tolerant) and H2/A2 (new bits) |
|
||||
| Operation masks (M1) | `Configuration/Validation/DataConnectionValidator.cs:12,22`; `Runtime/DataConnections/DataConnectionDeploymentRuntime.cs:151-152` (throws ⇒ aborts the whole snapshot); `Abstractions/DataConnections/DataContracts.cs:271-276` (`DataCapabilities.Validate` throws); `Commons/DataConnections/DataProtoMapper.cs:1054-1062` (masks, benign), `:284` (`Metadata.allowed_operations` cast unmasked); `Runtime/DataConnections/ProjectedDataAccess.cs:157` (acquisition allowlist); `Runtime/DataConnections/LocalDataServices.cs:47` `Implemented(target)` (origin advertised set, used at `:81,204,216`) | Four tolerance sites change in X0; three grow sites (validator, `Implemented`, `ProjectedDataAccess`) change in the phase adding a bit |
|
||||
| Negotiation (M2) | `Host/Grpc/DataConnectionGrpcService.cs:26` (`Math.Max(3,…)`), `Runtime/DataConnections/LocalDataServices.cs:222` (`Math.Max(5,…)`), `GrpcDataConnection.cs:548` (`CompactCodecHeader` precedent), `:762-767` + `DataProtoMapper.cs:1207` (unknown arm ⇒ `"Expected control or acknowledgement."` ⇒ stream faults) | Per-call feature header; the server must never send unnegotiated shapes |
|
||||
| History overrides (M3) | `NM:8791-9060`; modified+bounds `NM:8810-8817`; `NormalizeHistoryValues` `NM:8839`; aggregate refusals `NM:8854-8902`; `ServeNodeAsync` `NM:10083`; `ServeRawPagedAsync` `NM:10191`; `HistoryContinuationMatches` `NM:10815` (binds the NodeId string) | Port boundary = override level |
|
||||
| Tagname lookup | `NM:949` public `TryGetHistorizedTagname(string, out, AddressSpaceRealm)` | Origin resolves an export view without SDK types |
|
||||
| Continuation stores | `OpcUaServer/HistoryContinuationStore.cs` — `SessionHistoryContinuationStore` (production); `InMemoryHistoryContinuationStore` is a **test double** without idle expiry (`:107-123`) | A new production per-peer store is needed |
|
||||
| Mapped authorization | `Core/Authorization/DataOperationPolicy.cs:80-88` (non-Browse/Read/Write/Subscribe ⇒ `None` ⇒ deny); `OpcUaServer/Security/DataPlaneAuthorizer.cs:166-178` (unknown mapped id ⇒ deny), `:184-187` (mapped `CreateMonitoredItems` denied); `NM:837` (`SecurityFilteringActive` true whenever a mapped resolver exists) | HistoryRead and alarm operations on mapped nodes are closed today and are opened deliberately |
|
||||
| Projected identity (B1) | `Abstractions/DataConnections/ProjectedDataIds.cs:8-11` (`https://zb.com/otopcua/mapped/raw`, `…/mapped/uns`), `:47-57` (`p1.` + base64url(JSON{MappingId, Origin}); base64url excludes `/`); `NM:106-107` (`IsProjectedDescendant` = ns index 2/3); `NM:283-284` (`RealmOf` folds mapped 2→Raw, 3→Uns); `NM:2410` (`MaterialiseAlarmCondition` mints into the **local** realm namespace); `NM:4886-4889` (projection accepts only Folder/Variable/Tag) | Projected conditions need their own registry and id scheme |
|
||||
| Condition report choke point (B2) | `NM:1540` `ReportConditionEvent` (callers `NM:1418,1505,3034,5650`); method wrapper `NM:2998-3037` under `lock (Lock)`; native SDK-applied ack `NM:3197-3202`; `DriverHostActor.cs:2612-2637` ("success sends nothing back") | The hub taps reported events, not `OpcUaPublishActor.AlarmStateUpdate` |
|
||||
| Condition state (B2, N1) | `NM:1540` `ReportConditionEvent` (callers `NM:1418,1505,3034,5650`), Warm-Standby early return `NM:1561-1565`; delta gate `NM:1363-1418`, ConditionClass silent `NM:1386-1388`; rebuild re-report `NM:5639-5651`; method wrapper `NM:2998-3037` under `lock (Lock)`; native SDK-applied ack `NM:3197-3202`; `DriverHostActor.cs:2612-2637` | Snapshot from live nodes (`_alarmConditions`) under `Lock`; callback for deltas only, raised before the standby return and on silent applies |
|
||||
| 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 async call (B5) | `Opc.Ua.Server.dll` 2.0.1 contains `ICallAsyncNodeManager`, `AsyncCustomNodeManager`, `OnCallMethod2Async` (symbols checked in the restored package); NM has no `Call` override | Async interception of imported-condition methods is likely available; X0 confirms dispatch and lock behaviour |
|
||||
| Native ack (B3) | `NM:3197` router "non-blocking … safe under Lock"; `NM:2576-2577` native AddComment has only the SDK path; `DriverHostActor` reverts on failure | The origin needs a session-less execution entry that applies and reports like the SDK path |
|
||||
| Server-object filtering (B4) | `NM:7155-7171` `OnConditionReportEvent`: `scopes = AclEnforced ? ConditionVisibilityScopes(node) : null` (inert with ACLs off) | Imported conditions need their own gate that does not depend on `AclEnforced` |
|
||||
| Method lock (B5) | `NM:3001-3009` `ReportAfterMethod` = `lock (Lock) { sdkHandler(); … }` | No remote wait may run there |
|
||||
| Permissions (M8) | `NM:3285-3290` `AlarmOperationFor` (Confirm ⇒ AlarmConfirm; shelve ops ⇒ AlarmShelve; everything else, including AddComment and Enable/Disable, ⇒ AlarmAcknowledge); `NM:3118-3124` (Warm Standby refuses every method) | Wire bits derived from this one function |
|
||||
| Projection budget (M4) | `NM:4909-4910` `ReserveProjectedNode`, `OpcUaServer/ProjectedNodeLifetime.cs` | Conditions are charged against it |
|
||||
| Projection budget (M4, N5, N7) | `NM:4909-4910` `ReserveProjectedNode`, `OpcUaServer/ProjectedNodeLifetime.cs`, `RemoteNamespaceMapping.cs:29` (`MaxProjectionNodes = 10000`), projected folders `EventNotifier = None` (`NM:4919`) | Conditions get their own budget; placement folders gain `SubscribeToEvents` when wired |
|
||||
| Authorization vocabulary | `Configuration/Enums/NodePermissions.cs` (`AlarmRead` declared, **not enforced**), `NodeAclScopeKind.RemoteNamespaceMapping` | Visibility uses Subscribe/`CreateMonitoredItems` on the mapping scope |
|
||||
| Scripted commands | `Commons/OpcUa/AlarmCommand.cs`, `Runtime/ScriptedAlarms/ScriptedAlarmHostActor.cs` | Origin path for scripted methods (as AdminUI `/alerts` uses) |
|
||||
| Alarm history / alerts | `Runtime/Historian/HistorianAdapterActor.cs` (alerts topic, Primary-gated) | Imported conditions never enter the consumer's `alerts` topic |
|
||||
@@ -211,7 +228,8 @@ refactor must keep it there.
|
||||
- **No new protocol minor.** Each feature has a `CapabilitiesResponse` advertisement field plus a **per-call request header**,
|
||||
`x-otopcua-data-features` (comma list: `history`, `conditions`), sent on **every** RPC. This follows the
|
||||
`CompactCodecHeader` precedent (`GrpcDataConnection.cs:548`). The server keeps v1 behaviour for any call without the header:
|
||||
- Browse/GetMetadata return the v1 catalog shape: no `Condition` nodes, and alarm-bearing raw tags exactly as v1 exports them;
|
||||
- Browse/GetMetadata return the v1 catalog shape unchanged (conditions never appear in the catalog for anyone; they are
|
||||
discovered only through the root-scoped item), and alarm-bearing raw tags stay exactly as v1 exports them;
|
||||
- Subscribe never emits a condition arm;
|
||||
- new RPCs answer `Unimplemented`-equivalent `FailedPrecondition("feature not negotiated")`.
|
||||
- The consumer sends the header only when the selected endpoint advertised the feature. After a failover it re-derives the
|
||||
@@ -226,10 +244,11 @@ refactor must keep it there.
|
||||
// CapabilitiesResponse
|
||||
HistoryCapabilities history = 16; // raw, processed, at_time; aggregates (stable HistoryAggregateType names);
|
||||
// timestamp_resolution_ticks; max_values_per_page; max_concurrent_reads; continuation_idle_ticks
|
||||
ConditionCapabilities conditions = 17; // state_items; methods (bitmask); max_conditions
|
||||
ConditionCapabilities conditions = 17; // root_scope_items; methods (bitmask); max_conditions; advertised only when
|
||||
// DataConnections:ConditionKeySecret is provisioned
|
||||
// Metadata
|
||||
HistoryInfo history = 14; // historizing
|
||||
ConditionInfo condition = 15; // only when "conditions" negotiated; node_kind = "Condition"
|
||||
// (no Condition node kind in Browse/Metadata: conditions are discovered only through the root-scoped item, N2)
|
||||
|
||||
rpc HistoryRead(HistoryReadRequest) returns (HistoryReadResponse);
|
||||
message HistoryReadRequest { repeated HistoryReadItem items = 1; Budget budget = 2;
|
||||
@@ -246,24 +265,33 @@ message HistoryReadResult { string correlation_id = 1; uint32 status_code = 2; r
|
||||
message HistorySample { TypedValue value = 1; uint32 status_code = 2;
|
||||
TimestampOverride source_timestamp = 3; TimestampOverride server_timestamp = 4; }
|
||||
|
||||
// SubscriptionItem (header-gated): one root-scoped item per mapping = "all conditions under this export root" (N2)
|
||||
ConditionScope condition_scope = 4; // in SubscriptionItem; view = the mapping's remote root; no per-condition items
|
||||
message ConditionScope { bool include_info = 1; }
|
||||
|
||||
message ConditionInfo { string condition_type = 1; // namespace-URI qualified
|
||||
string condition_name = 2; int32 source_kind = 3; // NATIVE / SCRIPTED
|
||||
View home = 4; // the one origin condition address
|
||||
repeated View notifiers = 5; // origin placements (raw device folder + referencing equipment)
|
||||
uint32 supported_methods = 6; string origin_source_name = 7; }
|
||||
message ConditionState { // SubscriptionFrame oneof arm 9 (wrapped in ConditionStates)
|
||||
Handle handle = 1; int64 version = 2; int64 occurrence = 3; // occurrence increments on each new activation
|
||||
bool active = 4; bool acknowledged = 5; bool confirmed = 6; bool enabled = 7; int32 shelving = 8;
|
||||
uint32 severity = 9; string message = 10; uint32 quality = 11; google.protobuf.Timestamp unshelve_at = 12;
|
||||
int32 condition_class = 13; google.protobuf.Timestamp time = 14; bool retain = 15;
|
||||
optional string comment = 16; optional string client_user_id = 17; }
|
||||
message ConditionStates { bool is_snapshot = 1; repeated ConditionState items = 2; bool snapshot_complete = 3; }
|
||||
repeated View placements = 4; // realm-local placement addresses inside THIS export (§5.2), never cross-realm
|
||||
uint32 supported_methods = 5; }
|
||||
message ConditionState {
|
||||
string condition_key = 1; // opaque keyed hash (§5.2); dedupe + consumer identity
|
||||
int64 version = 2; bool removed = 3; bool state_known = 4;
|
||||
ConditionInfo info = 5; // first appearance in an epoch and in every snapshot record
|
||||
bool active = 6; bool acknowledged = 7; bool confirmed = 8; bool enabled = 9; int32 shelving = 10;
|
||||
uint32 severity = 11; string message = 12; uint32 quality = 13; google.protobuf.Timestamp unshelve_at = 14;
|
||||
int32 condition_class = 15; google.protobuf.Timestamp time = 16; bool retain = 17;
|
||||
google.protobuf.Timestamp activation_time = 18; // ActiveState transition time (method precondition, N6)
|
||||
optional string comment = 19; optional string client_user_id = 20; }
|
||||
message ConditionStates { // SubscriptionFrame oneof arm 9
|
||||
Handle handle = 1; // the root-scoped item's handle
|
||||
bool is_snapshot = 2; optional int32 total = 3; // total on the first snapshot chunk (admission before materialising, N5)
|
||||
repeated ConditionState items = 4; bool snapshot_complete = 5; }
|
||||
|
||||
rpc CallConditionMethod(ConditionMethodRequest) returns (ConditionMethodResponse);
|
||||
message ConditionMethodRequest { string operation_id = 1; View condition = 2; int32 method = 3;
|
||||
int64 expected_occurrence = 4; optional string comment = 5;
|
||||
message ConditionMethodRequest { string operation_id = 1; View placement = 2; int32 method = 3;
|
||||
google.protobuf.Timestamp expected_activation_time = 4; optional string comment = 5;
|
||||
string expected_serving_incarnation = 6; int64 remaining_budget_ticks = 7;
|
||||
optional string on_behalf_of = 8; } // untrusted audit text; capped and sanitised at the origin (§6)
|
||||
optional string on_behalf_of = 8; } // untrusted audit text; capped, sanitised, audit-log only (§6)
|
||||
message ConditionMethodResponse { int32 state = 1; uint32 status_code = 2; optional string diagnostic = 3; Serving serving = 4; }
|
||||
```
|
||||
|
||||
@@ -272,7 +300,7 @@ New `DataOperations` bits (M8: derived from `AlarmOperationFor`, one authority s
|
||||
| Bit | Name | Covers |
|
||||
|---|---|---|
|
||||
| 32 | `HistoryRead` | Raw/Processed/AtTime |
|
||||
| 64 | `AlarmSubscribe` | condition state items and condition metadata (the **origin-side** grant; local visibility uses Subscribe, §5.4) |
|
||||
| 64 | `AlarmSubscribe` | root-scoped condition items (the **origin-side** grant; local visibility uses Subscribe, §5.4) |
|
||||
| 128 | `AlarmAcknowledge` | Acknowledge, AddComment (Enable/Disable later, same bit — `AlarmOperationFor` `_` arm) |
|
||||
| 256 | `AlarmConfirm` | Confirm |
|
||||
| 512 | `AlarmShelve` | reserved for the deferred shelve methods |
|
||||
@@ -289,6 +317,12 @@ X0 changes:
|
||||
- `DataConnectionValidator.cs:12`: still rejects unknown bits. The known set grows only in the phase that adds the feature
|
||||
(H2, A2), so authoring cannot get ahead of the code.
|
||||
- `ProjectedDataAccess.cs:157`: extended in the phase that acquires with a new operation (H3, A3).
|
||||
- `LocalDataServices.cs:47` `Implemented(target)` (second pass): the origin's advertised/metadata operation set; a bit absent
|
||||
here is never advertised. Grows in H2 (`HistoryRead`) and A2 (`AlarmSubscribe`/`AlarmAcknowledge`/`AlarmConfirm`), never in X0.
|
||||
|
||||
**Compatibility gate, repeated (N8):** the recorded-v1-client test (Browse, GetMetadata, Read, Write, Subscribe; byte-identical
|
||||
behaviour, no new shapes without the header) is an exit gate of X0, **H2, A2 and A3** — the phases that touch v1 hot paths —
|
||||
so a v1 regression is attributable without a soak baseline.
|
||||
|
||||
AdminUI shows a deploy-time warning, and the validator a blocking error, when a connection/export/mapping carries a feature
|
||||
bit while any node in `ConsumerNodeIds` (or the exporting cluster) reports a build without the feature. **(inferred: nodes
|
||||
@@ -298,176 +332,293 @@ first", in the rollout docs and the deploy checklist.)**
|
||||
| Consumer | Origin | Behaviour |
|
||||
|---|---|---|
|
||||
| new | v1 | Features not advertised ⇒ no header ⇒ v1 behaviour. Projected variables keep `Historizing=false` and no HistoryRead bit; HistoryRead ⇒ `BadHistoryOperationUnsupported`; no conditions. Diagnostics: "origin lacks feature" |
|
||||
| v1 | new | No header ⇒ unchanged v1 catalog, frames and RPCs (C/H test with a recorded v1 client covering Browse, GetMetadata, Read, Subscribe) |
|
||||
| v1 | new | No header ⇒ unchanged v1 catalog, frames and RPCs (recorded-v1-client gate at X0/H2/A2/A3) |
|
||||
| new | new, grant missing | Per-item `BadUserAccessDenied` / condition items not admitted |
|
||||
| pair mid-upgrade | — | Cluster selection re-probes capabilities per endpoint; history CPs and condition streams are incarnation-bound, so a failover onto an older binary drops the feature (`BadContinuationPointInvalid`; condition quality Bad, then RefreshRequired) |
|
||||
|
||||
---
|
||||
|
||||
## 5. Alarm/event forwarding — redesigned semantics
|
||||
## 5. Alarm/event forwarding — semantics (revision 3)
|
||||
|
||||
### 5.1 Origin condition hub (B2)
|
||||
### 5.1 Origin condition state: node snapshot plus deltas (B2, N1)
|
||||
|
||||
- **Tap:** a new SDK-free callback raised from `ReportConditionEvent` (`NM:1540`), the single point where every
|
||||
condition event is reported: driver/engine projections (`NM:1418`, `:1505`), method wrappers including SDK-applied native acks
|
||||
and comment-only reports (`NM:3034`), rebuild carry-over (`NM:5650`). It is invoked under `Lock` with an immutable record:
|
||||
- snapshot fields, Retain, comment, ClientUserId, Time, condition class and quality;
|
||||
- a per-condition `version` (monotonic within the serving incarnation) and `occurrence`.
|
||||
The **origin's condition nodes are the source of truth.** An event-fed hub alone is not one. On a Warm Standby
|
||||
`ReportConditionEvent` returns before delivery (`NM:1561-1565`). After a restart or rebuild only off-normal carried-over
|
||||
conditions re-report (`NM:5639-5651`). Some state changes never produce an event (delta gate `NM:1363-1418`; ConditionClass
|
||||
"never fires an event on its own", `NM:1386-1388`).
|
||||
|
||||
The callback only enqueues into a bounded `ConditionStateHub` partition (no I/O, never blocks; overflow ⇒ that partition's
|
||||
epoch is invalidated ⇒ subscribers reset). Teardown (`ForgetPredefinedSubtree`) raises a removal record.
|
||||
- `OpcUaPublishActor.AlarmStateUpdate` is **not** used as the tap: native acks applied by the SDK never pass through it
|
||||
(`DriverHostActor.cs:2612-2637`).
|
||||
- **A1 gate:** parity on **reported events**. For every reported condition event the hub must hold an identical record. A
|
||||
local-client native ack on the origin is a required case; so are AddComment, scripted Confirm, ack-revert (#760), quality-only
|
||||
updates and rebuild carry-over.
|
||||
- **Snapshot:** a new SDK-free `SnapshotConditions(scope)` on the node manager enumerates the live condition nodes
|
||||
(`_alarmConditions`) in an export scope. It runs under one short `Lock` hold and copies an immutable record per condition
|
||||
plus the hub's version watermark at that instant. Because every delta is raised under the same `Lock`, the cut is atomic: a
|
||||
delta is either in the snapshot or after the watermark.
|
||||
- The snapshot includes **every** live condition in scope — inactive, acknowledged and normal-state ones too — so a
|
||||
complete snapshot defines the *set*, not just the retained subset.
|
||||
- Cost target: ≤ 20 ms `Lock` hold at 10,000 conditions, measured in A1. If it is exceeded, slice by hub partition, each
|
||||
slice with its own watermark.
|
||||
- **Deltas:** the SDK-free callback is raised for every condition state change, at two points:
|
||||
- in `ReportConditionEvent` **before** the Warm-Standby early return, so a standby's hub stays current and a promoted
|
||||
Primary starts correct;
|
||||
- in `WriteAlarmCondition` **after apply even when the delta gate reports no event** — a state-only record, which covers
|
||||
ConditionClass and other silent fields.
|
||||
|
||||
### 5.2 Identity (B1, M7)
|
||||
The callback only enqueues into a bounded `ConditionStateHub` partition: no I/O, never blocks. Overflow ⇒ that partition's
|
||||
epoch is invalidated ⇒ affected subscribers reset to a fresh snapshot. Teardown (`ForgetPredefinedSubtree`) raises a removal
|
||||
record.
|
||||
- **Never a falsely empty or falsely normal snapshot.** Each record carries `state_known`. It is false for a condition that
|
||||
has been materialised since the last process start or rebuild but has not yet been projected by its source:
|
||||
- native: no `WriteAlarmCondition` for it since materialise, and its driver host not yet Steady (the same Stale/Steady signal
|
||||
that gates `NativeAlarmAckPreflightView`, #765);
|
||||
- scripted: the engine's initial evaluation not yet applied;
|
||||
- a #641 carried-over condition counts as known.
|
||||
|
||||
- **One condition per (consumer node, connection, origin condition address)**, materialised in a **home mapping**: the first
|
||||
mapping on that consumer node with the feature that catalogues the condition, ordered Raw realm before UNS, then mapping id
|
||||
ordinal.
|
||||
- Every other placement becomes **notifier wiring only**: other origin notifier folders in the same mapping, and the same
|
||||
condition reached through another mapping. This covers both the within-mapping case (one native alarm referenced by two
|
||||
equipment) and the cross-mapping case (Raw + UNS). It preserves the local model: one condition, extra notifiers, one
|
||||
Server-object copy (Q4, settled).
|
||||
- **NodeId:** mapped namespace of the home realm (`ProjectedDataIds.NamespaceUri(realm)`), identifier
|
||||
`ProjectedDataIds.Identifier(homeMappingId, originConditionAddress)`.
|
||||
- **Children (#629):** `<conditionIdentifier>/<browse path>`, added as `ProjectedDataIds.ChildIdentifier`. Decoding splits at
|
||||
the first `/`; the base64url alphabet has none, so the split is unambiguous. The mapped resolver classifies a child as
|
||||
belonging to its condition's subject, so child Reads and method Calls are authorized like the condition
|
||||
(`DataPlaneAuthorizer.cs:166-178` would otherwise deny them).
|
||||
- **If the home mapping is disabled or loses the feature,** the condition is re-homed deterministically. That is a new NodeId,
|
||||
so clients see a removal then an addition, and a RefreshRequired is emitted. Documented.
|
||||
- **Fields:**
|
||||
**(inferred: the per-condition "projected since materialise" flag can be kept in NM beside `_alarmConditions`; A1 task 1.)**
|
||||
`snapshot_complete` is withheld until the origin's current address-space apply has completed (`CompleteAddressSpaceApply`
|
||||
ran for the active generation) and the serving node holds its Primary verdict. Until then the stream sends a Control `NotReady`.
|
||||
- **Consumer rule:** a condition is retired only when it is absent from a complete snapshot, or a removal record arrives. A
|
||||
record with `state_known = false` never changes the consumer's last state. It sets condition `Quality = Uncertain`
|
||||
(waiting for initial data) until a known record arrives.
|
||||
- **A1 parity gate:** after each of the scenarios below, hub snapshot == node state for every condition, and the consumer
|
||||
retires nothing that is still active at the origin:
|
||||
- (a) cold start before any driver publish;
|
||||
- (b) standby promotion with standing active alarms;
|
||||
- (c) rebuild with carried-over alarms;
|
||||
- (d) a local-client native ack (SDK-applied);
|
||||
- (e) a ConditionClass-only change;
|
||||
- (f) ack-revert (#760);
|
||||
- (g) a quality-only update.
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| `ConditionId` / `SourceNode` | the projected condition NodeId (opaque) |
|
||||
| `SourceName` | `<home mapping local branch path>/<origin SourceName>`, e.g. `Plant/remote-a` + `/` + `Plant/Modbus/dev1/HR200` |
|
||||
| `ConditionName`, `Severity` (verbatim), `ConditionClassId/Name`, `Message`, `Time`, `Comment`, `ClientUserId` | from the origin record |
|
||||
| `EventId` | consumer-minted |
|
||||
The parity is asserted on node state, not on the count of reported events.
|
||||
|
||||
`SourceName` is human-meaningful and unique per consumer: anchor paths are unique locally, and origin SourceNames are unique
|
||||
per origin cluster. **The local invariant "SourceName = ConditionId identifier" does not hold for imported conditions.**
|
||||
Clients must key on `ConditionId`, which is what ScadaBridge's documented guidance already says. The ScadaBridge impact is
|
||||
checked in the A4 exit gate.
|
||||
### 5.2 Addressing, listing and identity (B1, M7, N3, N4)
|
||||
|
||||
### 5.3 Mapped condition registry (B1)
|
||||
**Addressing within the listing export's realm (N3).** A condition is listed only by exports whose realm contains it, and is
|
||||
addressed in that realm:
|
||||
|
||||
Projected conditions do **not** go through `MaterialiseAlarmCondition` or the `RealmKey`-keyed maps (`_alarmConditions`,
|
||||
`_eventNotifierSources`, `_nativeAlarmNodeIds`), because `RealmOf` folds mapped namespaces into Raw/Uns. A new
|
||||
`ProjectedConditionRegistry` keyed by full NodeId (namespace index included) does three things:
|
||||
| Listing export | Native condition placement address | Scripted condition placement address |
|
||||
|---|---|---|
|
||||
| Raw | `raw` namespace, identifier = RawPath (the raw tag), parent = its device/group folder | not listed (scripted conditions have no raw placement) |
|
||||
| UNS | `uns` namespace, identifier = the **UNS reference variable id** of each referencing equipment (`Area/Line/Equipment/EffectiveName`, unique by the effective-name guard), parent = that equipment | `uns` namespace, its ScriptedAlarmId address under its equipment |
|
||||
|
||||
- creates the `AlarmConditionState` through a factory that shares the field/child-id assignment code with
|
||||
`MaterialiseAlarmCondition` (refactored into a common helper — no duplicate identity rules);
|
||||
- wires notifiers symmetrically (the `WireAlarmNotifiers` pattern);
|
||||
- applies stream records through a state-apply helper shared with `WriteAlarmCondition`, so the delta gate (#656 no-op re-statements) is the same code.
|
||||
- No RawPath ever reaches a UNS-only principal.
|
||||
- Every placement view passes the existing export realm checks: `LocalExportCatalog.cs:42-48`; and on the consumer
|
||||
`NM:4885` (`View.Realm == definition.Realm`) and `DataPlaneAuthorizer.cs:182` (realm matches namespace), because each
|
||||
placement is projected under a mapping of the same realm.
|
||||
- A method called through a UNS placement resolves at the origin by reference → backing raw tag → condition, and is authorized
|
||||
against that **placement's** origin ACL subject (the equipment scope).
|
||||
|
||||
**Dedupe key.** Each record carries an opaque `condition_key`. `Metadata.stable_source_id` is **not** usable: for driver sources
|
||||
it is `"<len>:<driverInstanceId><RawPath>"` (`SourceSamplePublisher.cs:32-33`, emitted at
|
||||
`LocalExportCatalog.Compilation.cs:92,123`), so it would disclose the RawPath.
|
||||
|
||||
`condition_key = base64url(HMAC-SHA256(K_p, originClusterId ‖ 0x00 ‖ ConditionId))`, where
|
||||
K_p = HKDF(`DataConnections:ConditionKeySecret`, info = authenticated principal id). The secret is a per-origin-cluster
|
||||
`${secret:}`, identical on both pair members.
|
||||
|
||||
- It is stable across restarts, failover and re-deploys.
|
||||
- It is identical across a principal's Raw and UNS listings, so the consumer dedupes.
|
||||
- It differs per principal, so two principals cannot correlate.
|
||||
- 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 finding (not fixed here; to be filed as `type:review-finding`, security):** v1 already sends
|
||||
> `stable_source_id` = driver id + RawPath on **UNS reference variables** to UNS-only principals (same code path).
|
||||
|
||||
**Imported condition NodeId (N4).** Keyed on **(connection, condition_key)** only — never the mapping, the home placement or
|
||||
stream order:
|
||||
|
||||
- Namespace: a new third mapped namespace, `https://zb.com/otopcua/mapped/conditions`, registered beside the two in
|
||||
`NM:117-118`.
|
||||
- Identifier: `c1.` + base64url(JSON{ConnectionId, ConditionKey}). Children (#629) are `<identifier>/<browse path>`, split at
|
||||
the first `/` (base64url has none).
|
||||
- ⚠️ `RealmOf` (`NM:283-284`) folds every index other than 0/2 into `Uns`. The condition namespace must therefore be
|
||||
dispatched **before** `RealmOf` anywhere a NodeId is classified: authorizer, history, read, call. A guard test feeds a
|
||||
condition-namespace id to every classifier.
|
||||
- The mapped resolver gets a `MappedCondition` resolution kind. It resolves a condition (or child) id to its **set of current
|
||||
placements**, each a realm-consistent (mapping, placement view). The id is authorized if **any** placement passes the
|
||||
requested operation (§5.4). The realm check at `DataPlaneAuthorizer.cs:182` is applied per placement, unchanged for variables.
|
||||
- The NodeId changes **only** if:
|
||||
- the `DataConnectionId` is replaced;
|
||||
- the origin condition is re-created with a new ConditionId (a raw tag rename — already a new condition locally);
|
||||
- the condition-key secret is rotated;
|
||||
- every placement disappears (then it is removed).
|
||||
|
||||
Disabling, adding or re-ordering mappings changes only notifier wiring. Per the owner decision (Q2), a remaining unavoidable
|
||||
change is accepted as removal + addition + `RefreshRequiredEventType`, never as a rejected disable.
|
||||
|
||||
**Fields:**
|
||||
|
||||
| Field | Value |
|
||||
|---|---|
|
||||
| `ConditionId` / `SourceNode` | the imported condition NodeId (opaque, as above) |
|
||||
| `SourceName` | `<local branch path of the primary placement's mapping>/<placement address relative to that mapping's remote root>` — e.g. `Plant/remote-a/Modbus/dev1/HR200` (Raw) or `assembly/remote-line-2/filler/HR200` (UNS) |
|
||||
| `ConditionName`, `Severity` (verbatim), `ConditionClassId/Name`, `Message`, `Time`, `Comment`, `ClientUserId` | from the origin record |
|
||||
| `EventId` | consumer-minted |
|
||||
|
||||
- The **primary placement** is chosen from **deployed configuration only**: Raw mappings before UNS, then mapping id ordinal,
|
||||
then placement address ordinal, among the enabled condition-bearing mappings of the connection on this consumer node.
|
||||
Conditions are materialised only after every one of those mappings' root items has completed its first snapshot (§5.5), so
|
||||
the choice never depends on stream order.
|
||||
- `SourceName` is a display field, not identity. It changes only when the deployed set of mappings changes, and is carried
|
||||
on the next event.
|
||||
- The local invariant "SourceName = ConditionId identifier" does **not** hold for imported conditions; clients key on
|
||||
`ConditionId` (ScadaBridge guidance already says so; checked in the A4 exit gate).
|
||||
|
||||
### 5.3 Consumer condition registry (B1, N7)
|
||||
|
||||
Imported conditions do **not** use `MaterialiseAlarmCondition` or the `RealmKey`-keyed maps (`_alarmConditions`,
|
||||
`_eventNotifierSources`, `_nativeAlarmNodeIds`). A new `ProjectedConditionRegistry`, keyed by full NodeId, does the following:
|
||||
|
||||
- creates the `AlarmConditionState` through a factory that shares field/child-id assignment with `MaterialiseAlarmCondition`
|
||||
(one refactored helper);
|
||||
- applies stream records through a state-apply helper shared with `WriteAlarmCondition`, so the #656 delta gate is the same code;
|
||||
- **wires notifiers lazily and symmetrically (N7).**
|
||||
- The Server object is always wired.
|
||||
- A placement's projected folder is wired when it materialises: it is set `EventNotifier |= SubscribeToEvents`; projected
|
||||
folders are created with `EventNotifier = None`, `NM:4919`.
|
||||
- It is unwired on retirement (`ProjectedNodeLifetime`) with `RemoveNotifier(…, bidirectional: true)`.
|
||||
- A folder holding an admitted event item is pinned.
|
||||
|
||||
### 5.4 Visibility and authorization (B4)
|
||||
|
||||
- **Local permission:** an imported condition's events reach an item only if the item's caller passes the mapping gate for
|
||||
`CreateMonitoredItems` (`DataOperations.Subscribe`) on **any** placement mapping that wires the condition. That is the same
|
||||
permission local alarm visibility uses (`NM:6437-6442`). `NodePermissions.AlarmRead` is not used; it is not enforced
|
||||
anywhere today.
|
||||
- **The gate runs regardless of `AclEnforced`** in all three delivery paths: `OnConditionReportEvent` (Server object), folder
|
||||
notifier delivery (`ProjectedEventDelivery`'s per-(session, identity) verdict cache) and `ConditionRefresh`. It is cached per
|
||||
(session, identity, condition, authority generation).
|
||||
- Event monitored items on projected notifiers and on the Server object are admitted through a verified path instead of the
|
||||
blanket deny at `DataPlaneAuthorizer.cs:184-187` (event items only; data items keep v1's path).
|
||||
- Queued event notifications carry the v1 publish-time authority marker so they are re-gated at Publish/Republish. **(inferred:
|
||||
the SDK clones `EventFieldList` notifications the same way the v1 marker relies on for data notifications; X0 verifies, and if
|
||||
not, A3 adds a final-send filter in the event queue.)**
|
||||
- **Gate A3-SEC:** with `Security:Acl:Enabled=false`, a session without the mapping grant subscribed at `i=2253` and on a
|
||||
projected folder receives **zero** imported events and zero on ConditionRefresh. A positive-control session with the grant
|
||||
receives them, and an absence assertion follows a must-arrive sentinel.
|
||||
`CreateMonitoredItems` (`DataOperations.Subscribe`) on **any** current placement mapping. That is the permission local alarm
|
||||
visibility uses (`NM:6437-6442`). `NodePermissions.AlarmRead` is not used (not enforced anywhere).
|
||||
- **The gate runs regardless of `AclEnforced`** in `OnConditionReportEvent` (Server object), folder delivery
|
||||
(`ProjectedEventDelivery` verdict cache) and `ConditionRefresh`. It is cached per (session, identity, condition, authority
|
||||
generation).
|
||||
- Event items on projected notifiers, on the Server object and on imported conditions are admitted through a verified path.
|
||||
This replaces the blanket deny at `DataPlaneAuthorizer.cs:184-187` for event items only; data items keep v1's path.
|
||||
- Publish-time re-gating uses the v1 authority marker. **(inferred: SDK cloning of `EventFieldList` matches the data-notification
|
||||
behaviour the marker relies on; X0 verifies, otherwise A3 adds a final-send filter.)**
|
||||
- **Gate A3-SEC:** with `Security:Acl:Enabled=false`, a session without the mapping grant at `i=2253` and on a projected folder
|
||||
receives zero imported events and zero on refresh. A positive-control session with the grant receives them, and the absence
|
||||
assertion follows a must-arrive sentinel.
|
||||
|
||||
### 5.5 Stream demand, authority and budget (M4)
|
||||
### 5.5 Subscription contract, demand, authority and budget (M4, N2, N5; owner decision Q1)
|
||||
|
||||
- **Demand-driven:** a mapping's condition stream opens on the first admitted local event item that could see its conditions
|
||||
(a projected notifier under the mapping, or the Server object when the caller holds the mapping's Subscribe grant). It closes
|
||||
when the last such item goes, after a short linger (default 30 s) to absorb churn.
|
||||
- Upstream it runs under the **connection service principal** (as v1 value demand does). Downstream delivery is re-gated per
|
||||
local caller (§5.4). This item goes to the security review.
|
||||
- A ConditionRefresh issued before the mapping's first `snapshot_complete` answers with what is materialised, then emits
|
||||
`RefreshRequiredEventType` on the mapping's notifiers and to authorized Server-object items once the snapshot completes.
|
||||
- **Budget:** each condition charges itself, its children (about 20 nodes) and any not-yet-materialised ancestor folders
|
||||
against `MaxProjectionNodes`/bytes (`ReserveProjectedNode`) and against `MaxConditions`. Ancestors of a materialised condition
|
||||
are pinned while it is.
|
||||
- If the snapshot's set cannot be charged **in full**, the mapping's conditions go `Unavailable(ConditionCapacity)`: no
|
||||
partial set (a partial set would make ConditionRefresh lie), a diagnostic, and RefreshRequired.
|
||||
- **Queue class:** conditions use a non-coalescing bounded class inside the stream (priority control > condition > value).
|
||||
Overflow ⇒ reset ⇒ fresh snapshot; a condition state is never silently dropped or merged.
|
||||
- **Duplicates:** records with `version ≤` the last applied in an epoch are dropped. Across epochs the shared delta gate
|
||||
suppresses unchanged re-statements.
|
||||
- **Gaps:** intermediate transitions during an interruption are lost; state converges. Origin alarm history is the record (event
|
||||
history over the wire is deferred, §7).
|
||||
- **Disconnect:** after `ConditionStaleTimeoutMilliseconds`, every condition of the mapping gets `Quality = BadNoCommunication`
|
||||
(an annotation only, #477) with one event; methods answer `BadNoCommunication`.
|
||||
- **Resync:** a new epoch ⇒ full snapshot ⇒ reconcile. Conditions missing from a **complete** snapshot get Retain=false and are
|
||||
retired; changed ones produce one event. If the resync is incomplete ⇒ RefreshRequired.
|
||||
**Root-scoped condition item (N2).** One item per mapping means "all conditions under this export root" — no per-condition
|
||||
discovery and no recursive Browse:
|
||||
|
||||
### 5.6 Methods: no `Lock`, no local apply before the owner confirms (B3, B5, m5, M8)
|
||||
- `SubscriptionItem.condition_scope` (header-gated) names the mapping's remote root view; the ack returns **one** handle.
|
||||
- Frames are `ConditionStates`:
|
||||
- snapshot begin carries `total`, the condition count, so capacity is decided before anything is materialised;
|
||||
- records carry `condition_key`, placement views in the export's realm, `ConditionInfo` (on first appearance in an epoch and
|
||||
in every snapshot), state, `state_known` and a `removed` flag;
|
||||
- `snapshot_complete` ends the snapshot.
|
||||
- Conditions added or removed by a later origin deploy are ordinary delta records, so "complete" is well defined.
|
||||
- It counts as one monitored item against v1 limits and as `total` against the condition budgets.
|
||||
|
||||
**Consumer** (option 1 of the review):
|
||||
**Demand (Q1, settled).**
|
||||
|
||||
1. The node manager's `Call` handling **partitions projected-condition method requests** (object = a registry condition, method =
|
||||
an Acknowledge/AddComment/Confirm declaration id) **before any node-manager `Lock` is taken and before base dispatch**.
|
||||
Projected conditions get no SDK `OnAcknowledge`/`OnConfirm`/`OnAddComment` handlers that apply state, and are never wrapped
|
||||
by `ReportAfterMethod`. **(inferred: the override point. `CustomNodeManager2.Call` is virtual, and the SDK 2.0 line may offer
|
||||
an async call path that X0 must check first; X0 also records whether the base takes `Lock` before our partition, in which case
|
||||
the partition moves into an `INodeManager`-level `Call` override.)**
|
||||
2. Local checks, no I/O and no `Lock`:
|
||||
- mapping gate with `AlarmOperationFor(method)` on a placement mapping;
|
||||
- per-call key re-check (`AuthorizeKeyUsable`, #563);
|
||||
- Upstream, condition items run under the **connection's service principal**, exactly as v1 value demand does. Downstream
|
||||
delivery is re-gated per local caller (§5.4). Per-caller delegated identity is out of scope.
|
||||
- Demand is per **connection**: on the first admitted local event item that could see any condition of the connection, the
|
||||
consumer opens root items for **all** enabled condition-bearing mappings of that connection on this node, in one stream.
|
||||
They close together after the last such item goes plus a linger (default 30 s).
|
||||
- Conditions are materialised after **all** of them report `snapshot_complete` — the connection barrier, bounded by
|
||||
`ConditionSnapshotTimeoutMilliseconds`; on timeout the incomplete mappings are `Unavailable` and the rest proceed.
|
||||
- A ConditionRefresh before the barrier answers with what exists, then emits `RefreshRequiredEventType` to authorized items
|
||||
when the barrier completes.
|
||||
|
||||
**Budget (N5).** The arithmetic that broke revision 2: `MaxProjectionNodes` defaults to 10,000
|
||||
(`RemoteNamespaceMapping.cs:29`). A condition subtree is ≈ 21 nodes (the condition plus its state-machine, property and
|
||||
method children; exact count measured in X0). So 10,000 / 21 ≈ **476** conditions would exhaust the whole projection budget.
|
||||
|
||||
Revision 3 gives conditions their **own** budget:
|
||||
|
||||
- `RemoteNamespaceMapping.MaxConditions`, default **2,000** per mapping = 42,000 condition nodes at 21 each;
|
||||
- host option `DataConnections:MaxImportedConditionNodes`, default **210,000** per consumer node (= 10,000 conditions × 21);
|
||||
- host option `DataConnections:MaxImportedConditionBytes`, default from the X0 per-condition byte measurement × 10,000.
|
||||
- Conditions are charged **once per condition_key**, not per placement, and do **not** consume `MaxProjectionNodes`. That stays
|
||||
for folders and variables. Placement folders charge it as ordinary projected folders (bounded by the placement count).
|
||||
- **Admission before materialising:** `total > MaxConditions`, or the connection's sum exceeding the node cap, ⇒ that mapping
|
||||
is `Unavailable(ConditionCapacity)` with the observed count in diagnostics. It stays all-or-nothing per mapping, because a
|
||||
partial set makes ConditionRefresh lie, but it happens at snapshot begin with an explanation rather than mid-materialisation.
|
||||
- An 80% high-water diagnostic warning is raised.
|
||||
- The validator warns when Σ `MaxConditions` of a node's mappings × 21 exceeds `MaxImportedConditionNodes`.
|
||||
- **(inferred: realistic counts are tens to hundreds of conditions per line and low thousands per area, so 2,000 per mapping
|
||||
leaves headroom; confirm against the docker-dev and one production export count in A4.)**
|
||||
|
||||
**Stream mechanics.**
|
||||
|
||||
- Conditions use a non-coalescing bounded queue class (priority control > condition > value). Overflow ⇒ reset ⇒ fresh snapshot.
|
||||
- Records with `version ≤` the last applied in an epoch are dropped; across epochs the shared delta gate suppresses unchanged
|
||||
re-statements.
|
||||
- Gaps lose intermediate transitions. State converges, and origin alarm history is the record.
|
||||
- **Disconnect:** after `ConditionStaleTimeoutMilliseconds`, `Quality = BadNoCommunication` on the connection's conditions,
|
||||
with one event each; methods answer `BadNoCommunication`.
|
||||
- **Resync:** a new epoch ⇒ snapshot ⇒ reconcile (retire only under §5.1's consumer rule). An incomplete resync ⇒ RefreshRequired.
|
||||
|
||||
### 5.6 Methods: no `Lock`, no local apply before the owner confirms (B3, B5, m5, M8, N6)
|
||||
|
||||
**Consumer:**
|
||||
|
||||
1. **Interception point (B5, conditional on X0).** SDK 2.0.1 ships `ICallAsyncNodeManager`, `AsyncCustomNodeManager` and
|
||||
`OnCallMethod2Async` (symbols verified in `Opc.Ua.Server.dll` 2.0.1). NM has no `Call` override today.
|
||||
- Preferred: NM implements `ICallAsyncNodeManager` and handles method calls whose object is an imported condition, or a
|
||||
child of one, **asynchronously**, without holding `Lock` or a request thread while the remote call is in flight. Every
|
||||
other call is delegated to the existing synchronous path unchanged.
|
||||
- X0 must establish that `MasterNodeManager` dispatches to that interface per node manager, and that nothing in the
|
||||
dispatch takes NM's `Lock` first.
|
||||
- Fallback: a synchronous `Call` partition before base dispatch, plus a per-node semaphore (default 8) so request threads
|
||||
cannot be exhausted.
|
||||
- **If X0 finds neither path free of `Lock`, A3 is blocked and §5.6 is redesigned.** There is no fallback that applies
|
||||
state locally.
|
||||
|
||||
Imported conditions get no state-applying SDK handlers and are never wrapped by `ReportAfterMethod`.
|
||||
2. **Local checks** (no I/O, no `Lock`):
|
||||
- mapping gate `AlarmOperationFor(method)` on any current placement;
|
||||
- key re-check (`AuthorizeKeyUsable`, #563);
|
||||
- method in `supported_methods` (native Confirm ⇒ `BadNotSupported`, unsent);
|
||||
- Warm Standby refusal (same rule as `NM:3122-3124`);
|
||||
- Warm Standby refusal (`NM:3122-3124` rule);
|
||||
- **EventId:** must be one this consumer minted for that condition within its last N (default 8) events — a small registry
|
||||
with its own short lock. Unknown ⇒ `BadEventIdUnknown`. The matching record's `occurrence` becomes `expected_occurrence`.
|
||||
No origin EventId exists on the wire (m5).
|
||||
3. A bounded remote `CallConditionMethod` on the request thread. Timeout = min(request deadline, `ConditionMethodTimeout`,
|
||||
default 5 s). A per-node semaphore (default 8 concurrent) stops these calls exhausting SDK request threads; excess ⇒
|
||||
`BadTooManyOperations`.
|
||||
4. The consumer returns the origin's status and **does not touch local condition state**. The origin applies and reports the
|
||||
change, the hub streams it, and the consumer applies it through §5.3 and reports one consumer event. A later revert at the
|
||||
origin (#760/#869) arrives the same way.
|
||||
- Outcome mapping: scripted applied ⇒ Good; native ⇒ Good (`AcceptedUnconfirmed` in diagnostics); `RejectedBeforeDispatch`
|
||||
⇒ the origin's status; transport loss after send ⇒ `BadCommunicationError` with `OutcomeUnknown` in diagnostics.
|
||||
- **No retry anywhere.** Duplicate `operation_id`s join in the origin's operation registry.
|
||||
- The client may see Good before the confirming event arrives. Documented, as for v1 writes.
|
||||
5. **Lock-freedom gate (A3):** stall the origin's method handler for 5 s. A concurrent Read, Browse and data Publish on the
|
||||
consumer must complete in under 200 ms. A local client must observe no acknowledged state before the origin's record arrives
|
||||
(positive control: the state does arrive after release).
|
||||
with its own lock. Unknown ⇒ `BadEventIdUnknown`.
|
||||
3. **Precondition and re-binding (N6).** Each minted EventId is bound to the record it was reported with; the record carries
|
||||
the origin's `activation_time`, its ActiveState transition time. That value is sent as `expected_activation_time`.
|
||||
- When a resync (new epoch, including origin failover or restart) delivers a record whose state is unchanged under the
|
||||
shared delta gate, the consumer **re-binds** that condition's retained EventIds to the new record. Pre-failover EventIds
|
||||
stay ackable without a ConditionRefresh even if the promoted node reports a different transition time.
|
||||
- A changed state (a new activation) does not re-bind: the old EventIds answer `BadEventIdUnknown`.
|
||||
- Gated in A03.
|
||||
4. **Remote call.** One bounded remote `CallConditionMethod`. Timeout = min(request deadline, `ConditionMethodTimeout`,
|
||||
default 5 s).
|
||||
5. **Result.** The consumer returns the origin's status and does **not** touch local condition state. The origin applies and
|
||||
reports, the hub streams it, and the consumer applies it (§5.3) and reports one consumer event. Reverts (#760/#869) arrive
|
||||
the same way.
|
||||
- Outcomes: scripted ⇒ Good; native ⇒ Good (`AcceptedUnconfirmed` in diagnostics); `RejectedBeforeDispatch` ⇒ the
|
||||
origin's status; transport loss after send ⇒ `BadCommunicationError` with `OutcomeUnknown` in diagnostics.
|
||||
- **No retry anywhere.** Duplicate `operation_id`s join in the origin registry.
|
||||
- The client may see Good before the confirming event arrives. Documented.
|
||||
6. **Lock-freedom gate (A3, hard):** stall the origin's method handler for 5 s. Concurrent Read, Browse and data Publish on
|
||||
the consumer complete in < 200 ms. No acknowledged state is observable locally before the origin's record arrives
|
||||
(positive control: it arrives after release).
|
||||
|
||||
**Origin:** a new session-less node-manager entry point, `TryExecuteConditionMethod(realm, conditionId, method, comment,
|
||||
expectedOccurrence, principal, audit)`. Both it and the SDK path are factored out of `HandleNativeAlarmAck` +
|
||||
`ReportAfterMethod`, so neither goes around the other. It:
|
||||
**Origin:** a session-less `TryExecuteConditionMethod(placementView, method, comment, expectedActivationTime, principal,
|
||||
operationId)`. It is factored out of `HandleNativeAlarmAck` + `ReportAfterMethod` together with the SDK path, so neither goes
|
||||
around the other. It:
|
||||
|
||||
- resolves the placement to the condition (UNS placements via reference → raw tag);
|
||||
- takes `Lock`;
|
||||
- runs the same gate: the export bit (checked at ingress), the origin ACL via `EvaluateAlarmCommandGate` semantics for the
|
||||
service principal, the Primary gate (`NativeAlarmAckPrimaryGate`), Warm Standby refusal, native preflight
|
||||
(`NativeAlarmAckPreflight`);
|
||||
- checks the occurrence precondition (moved ⇒ `BadEventIdUnknown`);
|
||||
- for **native**: applies Ack + the Confirmed/Retain re-assert + the comment to the `AlarmConditionState`, reports once, then
|
||||
invokes the existing non-blocking `NativeAlarmAckRouter`, so `DriverHostActor`'s "already acknowledged / revert on failure"
|
||||
contract holds unchanged;
|
||||
- for **scripted**: publishes `AlarmCommand` (the AdminUI `/alerts` path) and returns Good on admission;
|
||||
- releases `Lock` and returns.
|
||||
- runs the gate: origin ACL on the **placement's** subject for the service principal, Primary gate, Warm Standby refusal,
|
||||
native preflight;
|
||||
- checks `expected_activation_time` (mismatch ⇒ `BadEventIdUnknown`);
|
||||
- native: applies Ack + the Confirmed/Retain re-assert + the comment, reports once, invokes the non-blocking
|
||||
`NativeAlarmAckRouter` (the `DriverHostActor.cs:2612-2637` contract holds);
|
||||
- scripted: publishes `AlarmCommand` unchanged (§6 audit);
|
||||
- releases `Lock`.
|
||||
|
||||
Remote condition methods are additionally **Primary-only for scripted conditions**: `DataCapabilitiesProvider` strips the alarm
|
||||
method bits off-Primary, and ingress re-checks before dispatch. Condition state streaming is Primary-only by default (a Warm
|
||||
standby runs no native drivers).
|
||||
Remote condition methods are Primary-only for both kinds: `DataCapabilitiesProvider` strips the method bits off-Primary, and
|
||||
ingress re-checks. Condition streaming is Primary-only by default.
|
||||
|
||||
**A2 gate:** the **origin's own** OPC UA subscribers see exactly one ack event for a remote native ack. A driver failure
|
||||
reverts it on both origin and consumer. A remote AddComment on a native condition stores the comment.
|
||||
**A2 gate:** the origin's own subscribers see exactly one ack event for a remote native ack; a driver failure reverts on both
|
||||
sides; a remote native AddComment is stored.
|
||||
|
||||
### 5.7 What the consumer does not do with imported conditions (Q3, settled)
|
||||
|
||||
- no publication to the `alerts` topic (so no consumer alarm history and no `/alerts` rows; counts and stream state appear in
|
||||
data-connection diagnostics only);
|
||||
- no `alerts` topic publication, so no consumer alarm history and no `/alerts` rows (diagnostics only);
|
||||
- not fed to `NativeAlarmProjector`;
|
||||
- no local shelving timers;
|
||||
- only nodes in the mapping's `ConsumerNodeIds` mirror state, each independently (consumer redundancy is covered in A4).
|
||||
- only nodes in the mapping's `ConsumerNodeIds` mirror state, each independently (consumer redundancy: A06).
|
||||
|
||||
---
|
||||
|
||||
@@ -485,29 +636,39 @@ reverts it on both origin and consumer. A remote AddComment on a native conditio
|
||||
resolvable by `GalaxyAckIdentityDirectory` (`src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Galaxy/Runtime/GalaxyAckIdentityDirectory.cs`);
|
||||
X0 verifies, otherwise every such ack is refused.)**
|
||||
|
||||
**Audit (M8):**
|
||||
**Audit (M8, second pass):**
|
||||
|
||||
- `on_behalf_of` is capped at 128 characters, stripped of control and format characters, and stored in a **separate** audit
|
||||
field: a new optional `AlarmCommand.RemoteAuditText`, plus the origin's data-connection audit log.
|
||||
- `AlarmCommand.User` / ClientUserId is the service principal only, never concatenated with remote text.
|
||||
- AdminUI and alarm-history renderers display `RemoteAuditText` as plain text.
|
||||
- `on_behalf_of` is capped at 128 characters, stripped of control and format characters, and written **only** to the origin's
|
||||
data-connection audit log: principal, placement address, operation id, method, outcome, sanitised text.
|
||||
- `AlarmCommand` (`Commons/OpcUa/AlarmCommand.cs`) is **not** extended. It crosses the mesh on `alarm-commands`, and a new
|
||||
field would need a cross-version deserialization proof on a not-yet-upgraded pair member. Its `User` and the condition's
|
||||
`ClientUserId` are the service principal only, never concatenated with remote text.
|
||||
- Surfacing remote audit text in alarm history is a later change, with that cross-version test.
|
||||
|
||||
**Condition key secret (N3):** `DataConnections:ConditionKeySecret` is a per-origin-cluster `${secret:}`, identical on both pair
|
||||
members, never committed. Without it the origin does not advertise `conditions`. Rotating it changes every imported condition's
|
||||
NodeId: accepted under owner decision Q2, as removal + addition + RefreshRequired, and documented as a planned operation.
|
||||
|
||||
**Schema** — each migration lands in the first phase that needs it (M6). Columns are non-null with defaults; no backfill.
|
||||
|
||||
| Phase | Migration | Changes |
|
||||
|---|---|---|
|
||||
| H2 | `AddDataConnectionHistory` | `DataConnection.HistoryTimeoutMilliseconds` (30000); `DataExport.MaxConcurrentHistoryReads` (4), `MaxHistoryValuesPerPage` (10000), `MaxHistoryResponseBytes` (4 MiB); `RemoteNamespaceMapping.MaxHistoryAssemblyBytesPerRequest` (16 MiB) |
|
||||
| A2 | `AddDataConnectionConditions` | `DataExport.MaxConditions` (10000), `AllowGalaxyServiceAck` (false); `RemoteNamespaceMapping.MaxConditions` (10000), `ConditionStaleTimeoutMilliseconds` (30000), `ConditionMethodTimeoutMilliseconds` (5000) |
|
||||
| A2 | `AddDataConnectionConditions` | `DataExport.MaxConditions` (2000), `AllowGalaxyServiceAck` (false); `RemoteNamespaceMapping.MaxConditions` (2000), `ConditionStaleTimeoutMilliseconds` (30000), `ConditionMethodTimeoutMilliseconds` (5000), `ConditionSnapshotTimeoutMilliseconds` (30000) |
|
||||
| A2 (host options, not ConfigDb) | — | `DataConnections:MaxImportedConditionNodes` (210000), `DataConnections:MaxImportedConditionBytes` (from the X0 measurement × 10,000), `DataConnections:ConditionKeySecret` (secret) |
|
||||
|
||||
Each migration phase also adds the bits to `KnownOperations`, extends `DeploymentArtifact.DataConnections.cs`, and includes the
|
||||
new fields in `DataConnectionScopeRevision` (so DB-less nodes and the LocalDb artifact cache receive them). It also adds
|
||||
validator rules: mapping bits ⊆ connection bits, limits positive, `AllowGalaxyServiceAck` only with `AlarmAcknowledge`.
|
||||
validator rules: mapping bits ⊆ connection bits, limits positive, `AllowGalaxyServiceAck` only with `AlarmAcknowledge`, and
|
||||
(A2) a warning when Σ `MaxConditions` of a consumer node's mappings × the measured subtree size exceeds
|
||||
`MaxImportedConditionNodes`. Each also grows `LocalDataServices.cs:47` `Implemented(target)`.
|
||||
|
||||
**AdminUI** (`ClusterDataConnections.razor`, editor models, `DataConnectionDiagnostics`):
|
||||
|
||||
- operation checkboxes and limit fields arrive in the phase that adds the bits (H2, A2);
|
||||
- diagnostics follow in H4/A4: negotiated features; history counts by status class; open remote continuations; condition
|
||||
stream state, snapshot time, count, capacity state, RefreshRequired count; method outcomes; dropped-unknown-bit count;
|
||||
stream state, snapshot time, observed condition count vs limit (80% warning), capacity state, `state_known=false` count,
|
||||
RefreshRequired count; method outcomes; dropped-unknown-bit count;
|
||||
- every AdminUI task ends with a docker-dev `/run` drive (no bUnit; login disabled on the rig).
|
||||
|
||||
**Metrics** (no ids in labels): `otopcua.dataconn.history.reads{variant,status_class}`, `…history.continuations.active`,
|
||||
@@ -518,7 +679,7 @@ validator rules: mapping bits ⊆ connection bits, limits positive, `AllowGalaxy
|
||||
|
||||
## 7. Deferred within these capabilities (not planned here)
|
||||
|
||||
- **HistoryReadEvents on mapped notifiers.** It needs §5.2 identity first. The wire row is defined from
|
||||
- **HistoryReadEvents on mapped notifiers.** It builds on §5.2 identity (placement addresses, `condition_key`). The wire row is defined from
|
||||
`HistoricalEvent(EventId, SourceName, EventTimeUtc, ReceivedTimeUtc, Message, Severity, EventTypeName, ConditionName, AlarmId,
|
||||
ConditionReference)` (`HistoryReadContracts.cs:194-204`), not invented fields. Where-clauses: only `OfType` conjunctions are
|
||||
forwarded. Plan it after A4.
|
||||
@@ -575,11 +736,17 @@ condition state and methods; A3 OPC UA clients.
|
||||
### X0 — Tolerant readers, contract reservation, investigations (release before any new bit)
|
||||
|
||||
- **Tasks:**
|
||||
1. Mask-tolerant readers at the five M1 sites (§4.3).
|
||||
1. Mask-tolerant readers at the four M1 tolerance sites (§4.3); the three grow sites stay unchanged until their phase.
|
||||
2. Feature-header plumbing on every RPC: server records the per-call feature set (empty today).
|
||||
3. Reserve proto fields 14–17 / arm 9 and bits 32–512, with golden tests. The server still advertises nothing.
|
||||
3. Reserve proto fields (capabilities 16–17, metadata 14, `SubscriptionItem.condition_scope`), frame arm 9 and bits
|
||||
32–512, with golden tests. The server still advertises nothing.
|
||||
4. Investigations, recorded in `docs/plans/evidence/grpc-data-ext/X0.md`:
|
||||
- the `Call` override point and lock behaviour (§5.6);
|
||||
- the method interception point (§5.6 step 1): does `MasterNodeManager` dispatch to `ICallAsyncNodeManager` per node
|
||||
manager, and does any dispatch path take NM's `Lock` before an imported-condition partition? Outcome decides whether
|
||||
A3 proceeds (async preferred, sync partition + semaphore fallback, otherwise A3 blocked);
|
||||
- the materialised `AlarmConditionState` subtree size (nodes) and bytes per condition — sets the §5.5 defaults;
|
||||
- whether NM can keep a per-condition "projected since materialise" flag for `state_known` (§5.1);
|
||||
- registering a fifth namespace URI and classifying it before `RealmOf` (§5.2);
|
||||
- `EventFieldList` clone and authority marker (§5.4);
|
||||
- Galaxy ack-identity lookup for a data-connection key;
|
||||
- node build/feature reporting for the M1 validator gate;
|
||||
@@ -623,7 +790,8 @@ condition state and methods; A3 OPC UA clients.
|
||||
tagname. Denied and unhistorized are indistinguishable. Per-principal admission and the response-byte cap;
|
||||
- client: header gating, deadlines, `FailedPrecondition`/`Unimplemented` ⇒ unsupported;
|
||||
- `LocalDataConnection` history for direct runtime consumers;
|
||||
- **validator bit + `AddDataConnectionHistory` + artifact projection + AdminUI checkboxes/limits**.
|
||||
- **validator bit + `LocalDataServices.cs:47` `Implemented(target)` + `AddDataConnectionHistory` + artifact projection +
|
||||
AdminUI checkboxes/limits**.
|
||||
- Files: proto/mapper, `Host/Grpc/DataConnectionGrpcService.cs`,
|
||||
`Runtime/DataConnections/{LocalDataServices,LocalDataConnection,GrpcDataConnection,DataCapabilitiesProvider,LocalExportCatalog.Compilation}.cs`,
|
||||
`Core/Authorization/DataOperationPolicy.cs`, `Configuration/{Entities/*,Validation/DataConnectionValidator.cs,Migrations/*}`,
|
||||
@@ -633,7 +801,8 @@ condition state and methods; A3 OPC UA clients.
|
||||
- H wire: denied vs unhistorized, admission ⇒ `BadTooManyOperations`, v1 peer and header-less caller, cancel not a backend
|
||||
fault, lost page ⇒ `BadContinuationPointInvalid`;
|
||||
- F validator + migration up/down; P artifact; U editor models.
|
||||
- Exit gate: H2 manifest; Host wire suite; docker-dev smoke of a direct runtime-consumer read (harness probe).
|
||||
- Exit gate: H2 manifest; Host wire suite; **recorded-v1-client compatibility gate** (§4.3); docker-dev smoke of a direct
|
||||
runtime-consumer read (harness probe).
|
||||
|
||||
**H3 — Consumer OPC UA projection.**
|
||||
- Tasks: projected `Historizing`/AccessLevel; `IProjectedHistoryAccess` (`ProjectedDataAccess.cs:157` allowlist extended);
|
||||
@@ -688,27 +857,38 @@ Expected: identical rows/status/timestamps to the origin; continuation followed
|
||||
|
||||
### Phase A — Alarm/event forwarding
|
||||
|
||||
**A1 — Origin hub, identity primitives, catalog (header-gated).**
|
||||
- Tasks: the `ReportConditionEvent` callback and `ConditionStateHub` (§5.1); `occurrence`; condition catalogue entries emitted
|
||||
**once** at their home address with `notifiers` (§5.2), only for callers that negotiated `conditions` **and** hold
|
||||
`AlarmSubscribe` on the export (header-less callers keep the v1 shape); `ProjectedDataIds.ChildIdentifier` + decode.
|
||||
- Files: NM (callback only), new `Runtime/DataConnections/ConditionStateHub.cs`, `LocalExportCatalog*.cs`,
|
||||
`LocalCatalogCoordinator.cs`, `Abstractions/DataConnections/ProjectedDataIds.cs`.
|
||||
**A1 — Origin condition state, placements and keys (header-gated, invisible until A2).**
|
||||
- Tasks:
|
||||
- `SnapshotConditions(scope)` under a short `Lock` hold with watermark;
|
||||
- the delta callback in `ReportConditionEvent` (before the standby return) and in `WriteAlarmCondition` for silent applies;
|
||||
- `state_known`; the `ConditionStateHub`;
|
||||
- realm-local placement enumeration per export: Raw = RawPath; UNS = reference variable ids and ScriptedAlarmId;
|
||||
- the `condition_key` derivation and its secret;
|
||||
- `snapshot_complete` readiness (apply complete + Primary verdict);
|
||||
- `ProjectedDataIds`-style `c1.` identifier, child id helpers and the condition-namespace constant.
|
||||
- Files: NM (snapshot + callback + `state_known` only), new `Runtime/DataConnections/ConditionStateHub.cs`,
|
||||
`LocalExportCatalog*.cs` (placement enumeration; the catalog stays v1-shaped), `LocalCatalogCoordinator.cs`,
|
||||
`Abstractions/DataConnections/ProjectedDataIds.cs` (or a sibling `ImportedConditionIds.cs`).
|
||||
- Tests:
|
||||
- R/O reported-event parity (§5.1 cases, the local-client native ack required);
|
||||
- version/occurrence monotonicity;
|
||||
- catalogue: one native condition referenced by two equipment ⇒ one entry with three notifiers;
|
||||
- A: child id round-trip; ids with `/` in the origin path still decode.
|
||||
- Exit gate: A1 manifest; reviewer sign-off on the source inventory.
|
||||
- R/O parity cases (a)–(g) of §5.1, asserted on node state;
|
||||
- a **falsely-empty** negative test: an origin restart with standing alarms ⇒ `snapshot_complete` is not sent until apply
|
||||
completes, and no record claims "inactive" with `state_known = true` before its source projected;
|
||||
- `Lock`-hold timing at 10,000 conditions ≤ 20 ms;
|
||||
- a UNS-only export lists no RawPath anywhere in the record (property test over generated topologies);
|
||||
- `condition_key` stable across restart and pair members, equal across a principal's Raw/UNS listings, different across
|
||||
principals;
|
||||
- A: id and child round-trip.
|
||||
- Exit gate: A1 manifest; reviewer sign-off on the state-source inventory.
|
||||
|
||||
**A2 — Wire and origin execution.**
|
||||
- Tasks: condition items on Subscribe (arm 9, non-coalescing class, `snapshot_complete`); `CallConditionMethod`;
|
||||
`TryExecuteConditionMethod` (§5.6 origin); Primary/standby; operation registry; audit sanitising;
|
||||
`AllowGalaxyServiceAck`; **validator bits + `AddDataConnectionConditions` + artifact + AdminUI checkboxes**.
|
||||
root-scoped `condition_scope` items with `total`, `removed`, `snapshot_complete` (§5.5); `TryExecuteConditionMethod` (§5.6
|
||||
origin, placement-resolved, `expected_activation_time`); Primary/standby; operation registry; audit-log sanitising;
|
||||
`AllowGalaxyServiceAck`; **validator bits + `Implemented(target)` + `AddDataConnectionConditions` + artifact + AdminUI
|
||||
checkboxes**.
|
||||
- Files: proto/mapper, `Runtime/DataConnections/{DataSubscriptionSession,DeliveryScheduler,LocalSubscriptionService,LocalDataServices,WriteOperationRegistry,DataCapabilitiesProvider}.cs`,
|
||||
`Host/Grpc/DataConnectionGrpcService.cs`, NM (entry point factored from `HandleNativeAlarmAck`/`ReportAfterMethod`),
|
||||
`OpcUaServer/NativeAlarmAck.cs`, `Commons/OpcUa/AlarmCommand.cs` (`RemoteAuditText`),
|
||||
`Runtime/ScriptedAlarms/ScriptedAlarmHostActor.cs`, Configuration and AdminUI files.
|
||||
`OpcUaServer/NativeAlarmAck.cs`, Configuration and AdminUI files (`AlarmCommand` unchanged).
|
||||
- Tests:
|
||||
- H wire:
|
||||
- remote native ack ⇒ the **origin's own** subscribers see exactly one ack event;
|
||||
@@ -716,18 +896,22 @@ Expected: identical rows/status/timestamps to the origin; continuation followed
|
||||
- native AddComment stored;
|
||||
- off-Primary / Warm Standby ⇒ `RejectedBeforeDispatch`;
|
||||
- Galaxy without opt-in ⇒ `BadUserAccessDenied`, no state change;
|
||||
- occurrence moved ⇒ `BadEventIdUnknown`;
|
||||
- `expected_activation_time` mismatch ⇒ `BadEventIdUnknown`;
|
||||
- a method through a UNS placement resolves to the condition and is authorized on the equipment subject;
|
||||
- duplicate operation id joins;
|
||||
- transport drop ⇒ `OutcomeUnknown`, no retry;
|
||||
- audit text sanitised and separate;
|
||||
- R: stream priority, overflow ⇒ reset, revocation mid-snapshot, header-less stream never receives arm 9;
|
||||
- audit text sanitised, in the audit log only, `AlarmCommand` untouched;
|
||||
- R: stream priority, overflow ⇒ reset, revocation mid-snapshot, header-less stream never receives arm 9; an origin deploy
|
||||
adding and removing conditions arrives as delta records; `total` above the limit is reported before any record;
|
||||
- F/P/U as in H2.
|
||||
- Exit gate: A2 manifest; security/mutation review (includes the standing-principal question in §5.5).
|
||||
- Exit gate: A2 manifest; **recorded-v1-client compatibility gate**; security/mutation review (owner accepted the §5.5
|
||||
service-principal model; the review checks its implementation).
|
||||
|
||||
**A3 — Consumer registry, visibility and methods.**
|
||||
- Tasks: `ProjectedConditionRegistry` (§5.3); home mapping and notifier wiring (§5.2); event items on projected notifiers and
|
||||
the Server object (§5.4); demand-driven streams and budget (§5.5); method interception (§5.6 consumer); RefreshRequired;
|
||||
`alerts` exclusion.
|
||||
- Tasks: `ProjectedConditionRegistry` (§5.3) in the `mapped/conditions` namespace with the `MappedCondition` resolver kind
|
||||
classified before `RealmOf`; lazy symmetric notifier wiring (N7); primary placement from deployed config; event items on
|
||||
projected notifiers and the Server object (§5.4); per-connection demand, snapshot barrier and condition budget (§5.5);
|
||||
method interception per the X0 outcome (§5.6); EventId re-binding (N6); RefreshRequired; `alerts` exclusion.
|
||||
- Files: NM, `OpcUaServer/ProjectedEventDelivery.cs`, new `OpcUaServer/ProjectedConditionRegistry.cs`, new
|
||||
`OpcUaServer/IProjectedConditionAccess.cs`, new `Runtime/DataConnections/ProjectedConditionAccess.cs`,
|
||||
`OpcUaServer/Security/DataPlaneAuthorizer.cs`, `Core/Authorization/DataOperationPolicy.cs`, `ProjectedDataAccess.cs:157`.
|
||||
@@ -740,10 +924,14 @@ Expected: identical rows/status/timestamps to the origin; continuation followed
|
||||
- no local apply before origin confirmation;
|
||||
- unknown EventId ⇒ `BadEventIdUnknown` unsent;
|
||||
- native Confirm ⇒ `BadNotSupported` unsent;
|
||||
- capacity ⇒ `Unavailable(ConditionCapacity)`, no partial set;
|
||||
- home-mapping disable ⇒ re-home + RefreshRequired;
|
||||
- `total` over `MaxConditions` ⇒ `Unavailable(ConditionCapacity)` before materialising, other mappings unaffected;
|
||||
2,000 conditions in one mapping materialise without touching `MaxProjectionNodes`;
|
||||
- **disabling the primary-placement mapping leaves every `ConditionId` unchanged** (only notifiers and `SourceName` move);
|
||||
a second mapping opened later does not change any NodeId (N4);
|
||||
- a condition-namespace id is never classified as Raw/Uns by `RealmOf` (guard test across authorizer, read, history, call);
|
||||
- placement folder retired ⇒ notifier unwired; folder with an event item is not retired;
|
||||
- resync with no event for unchanged state, followed by a must-arrive real transition (#656 positive control).
|
||||
- Exit gate: A3 manifest; SDK/security review.
|
||||
- Exit gate: A3 manifest; **recorded-v1-client compatibility gate**; SDK/security review.
|
||||
|
||||
**A4 — Diagnostics, docs, docker-dev and live gates.**
|
||||
- Tasks: diagnostics; docs (`DataConnections.md`, `AlarmTracking.md` "Imported conditions", `ScriptedAlarms.md`,
|
||||
@@ -753,8 +941,8 @@ Expected: identical rows/status/timestamps to the origin; continuation followed
|
||||
|---|---|
|
||||
| A01 | Scripted raise, ack, confirm via consumer; origin and consumer both show it |
|
||||
| A02 | Native condition (OpcUaClient → opc-plc alarms, per X0) ack + AddComment; Confirm refused |
|
||||
| A03 | Origin failover mid-stream ⇒ resync, no duplicate events, positive control |
|
||||
| A04 | One native alarm referenced by two equipment + a Raw mapping ⇒ one consumer condition, three notifiers, one `i=2253` event |
|
||||
| A03 | Origin failover mid-stream with standing active alarms ⇒ resync retires nothing still active, no duplicate events, positive control; an ack with a **pre-failover** EventId succeeds after the unchanged resync (N6) |
|
||||
| A04 | One native alarm referenced by two equipment + a Raw mapping ⇒ one consumer condition (same `ConditionId` regardless of which mapping's subscriber came first), three notifiers, one `i=2253` event; a UNS-only principal's records carry no RawPath |
|
||||
| A05 | ACLs off, session without mapping grant at `i=2253` ⇒ zero imported events (with positive control) |
|
||||
| A06 | Consumer Primary change with clients connected to both consumer nodes ⇒ both converge, no duplicates |
|
||||
| A07 | Consumer node restart ⇒ ConditionRefresh correct after snapshot; RefreshRequired observed if refresh preceded snapshot |
|
||||
@@ -766,7 +954,8 @@ Expected: identical rows/status/timestamps to the origin; continuation followed
|
||||
# 1. browse from the UNS anchor to the projected equipment folder (mapped/uns namespace)
|
||||
otopcua-cli browse -u opc.tcp://localhost:4841/OtOpcUa -U apikey -P "$KEY" -n "ns=<uns-ns>;s=assembly" -d 1
|
||||
otopcua-cli browse -u ... -n "<anchor NodeId>" -r -d 3 # note the projected equipment folder NodeId F
|
||||
# 2. subscribe to its events with refresh; each notification prints ConditionId (projected) and EventId
|
||||
# 2. subscribe to its events with refresh; each notification prints ConditionId (opaque c1. id in the mapped/conditions
|
||||
# namespace) and EventId — use the printed values, never construct them
|
||||
otopcua-cli alarms -u ... -U apikey -P "$KEY" -n "$F" --refresh
|
||||
# 3. act on the printed ConditionId / EventId
|
||||
otopcua-cli ack -u ... -n "<ConditionId>" -e <EventId hex> -c "remote ack"
|
||||
@@ -780,7 +969,7 @@ Use two-state id selection via `SimpleAttributeOperand(type, [X, Id])`, as the C
|
||||
- **Exit gate:** A01–A08 pass with baseline restoration; reviewer approval; docs; **ScadaBridge consumer-impact check**
|
||||
recorded in `sister-project-history/otopcua.md`:
|
||||
- `SourceName` shape `<branch>/<origin SourceName>`;
|
||||
- `ConditionId` opaque and stable while the home mapping is unchanged;
|
||||
- `ConditionId` opaque and stable for the life of the connection (mapping changes do not move it; secret rotation does);
|
||||
- native `ConfirmedState = true` re-assert preserved;
|
||||
- severity verbatim;
|
||||
- RefreshRequired handling.
|
||||
@@ -795,21 +984,27 @@ Use two-state id selection via `SimpleAttributeOperand(type, [X, Id])`, as the C
|
||||
| Imported alarms leak with ACLs off | A3 | Gate independent of `AclEnforced`, A3-SEC + A05 |
|
||||
| Remote wait freezes the address space | A3 | Interception before `Lock`, semaphore, lock-freedom gate |
|
||||
| Remote ack is a no-op at origin | A2 | Session-less entry factored from the SDK path; origin-subscriber assertion |
|
||||
| Partial condition sets make ConditionRefresh lie | A3 | All-or-nothing capacity, RefreshRequired |
|
||||
| Partial condition sets make ConditionRefresh lie | A3 | Per-mapping all-or-nothing decided at snapshot begin from `total`; own budget sized ≈ 4× expected counts |
|
||||
| Failover/restart clears live alarms on the consumer | A1/A3 | Snapshot from node state, `state_known`, withheld `snapshot_complete`, retire-only-on-complete; A1 (a)–(c), A03 |
|
||||
| RawPath disclosure to UNS-only principals | A1 | Realm-local placements; keyed `condition_key`; property test; pre-existing `stable_source_id` disclosure is #916 |
|
||||
| No lock-free interception point in the SDK | X0/A3 | X0 decides; A3 blocked rather than any local-apply fallback |
|
||||
| v1 unsoaked in service (G0 deferred, #915) | all | Per-phase live gates; deploy notes record the risk until #915 passes |
|
||||
|
||||
---
|
||||
|
||||
## 10. Open questions for the owner
|
||||
|
||||
Settled by this revision: Q1 (HistoryUpdate out), Q3 (no consumer `/alerts`/alarm history), Q5 (ReadyReplica history
|
||||
allowed, Primary default), Q2 (service-principal attribution, with a separate Galaxy opt-in and sanitised audit text), Q4 (one
|
||||
condition with extra notifiers), Q6 (relay deferred, §8), and G0 (the 14-day soak is deferred to #915, not a blocker).
|
||||
**None remain.** Settled: Q1 (HistoryUpdate out), Q3 (no consumer `/alerts`/alarm history), Q5 (ReadyReplica history allowed,
|
||||
Primary default), Q2 of revision 1 (service-principal attribution with a separate Galaxy opt-in and audit-log-only sanitised
|
||||
text), Q4 (one condition with extra notifiers), Q6 (relay deferred, §8), G0 (14-day soak deferred to #915, on an X0-or-later
|
||||
build), and the owner decisions of 2026-11-23:
|
||||
|
||||
Remaining:
|
||||
- **Standing upstream authority (§5.5) — accepted.** Condition streams run upstream under the connection's service principal,
|
||||
as v1 value demand does, and are re-gated per local caller on delivery. Per-caller delegated identity is out of scope.
|
||||
- **Mapping disable and NodeIds (§5.2) — applied.** Imported condition NodeIds are keyed on (connection, `condition_key`), so
|
||||
disabling any mapping does not change them. The remaining unavoidable changes are accepted as removal + addition +
|
||||
RefreshRequired, never as a rejected disable: connection replaced, origin condition re-created, key-secret rotation.
|
||||
|
||||
1. **Standing upstream authority for condition streams (§5.5).** Do you accept that a condition stream, once opened by a local
|
||||
subscriber, runs upstream under the connection's service principal (re-gated per local caller on delivery)? The alternative
|
||||
is to make condition visibility per local caller end to end, which needs delegated identity.
|
||||
2. **Re-home behaviour (§5.2).** When the home mapping is disabled, do you accept a NodeId change (removal + addition +
|
||||
RefreshRequired)? The alternative is to reject disabling a home mapping while another mapping still places its conditions.
|
||||
Items that depend on X0 findings rather than owner input: the method interception point (§5.6 step 1 — A3 is blocked if no
|
||||
lock-free path exists), `EventFieldList` re-gating, the Galaxy ack-identity lookup, the condition subtree size, and
|
||||
node feature reporting for the M1 deploy check.
|
||||
|
||||
Reference in New Issue
Block a user