fix(grpc-data): A4 review r1 — AdminUI helpers null-safe + doc comments restored; metric descriptions name both sides; docs: S1/S2/S3 behaviour, RefreshRequired only on a changed incomplete set, SourceName vs runtime status (S4), scripted Good = applied, A4-docs citations

This commit is contained in:
Joseph Doherty
2026-11-25 00:22:54 -05:00
parent c93290d0a0
commit 0cac09cee3
8 changed files with 60 additions and 19 deletions
+9 -2
View File
@@ -36,7 +36,7 @@ The sources were the code at `91438049` and the evidence logs X0–A3. The plan
| 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. |
| D6 | A07: "RefreshRequired observed if refresh preceded snapshot". | RefreshRequired is sent only at an **incomplete** barrier, on removal and on an un-re-bindable resync (`ProjectedConditionAccess.Runner.cs:374`, `:405`; `ProjectedConditionRegistry.cs:311-340`, `:412`). A ConditionRefresh before a *complete* first barrier gets no RefreshRequired; the conditions then arrive as their records apply (A3a deviation 4, never closed). The A4 live gate should decide whether A07's expectation or the code is right. |
| D6 | A07: "RefreshRequired observed if refresh preceded snapshot". | RefreshRequired is sent only at an **incomplete** barrier whose incomplete set changed (#930), on a capacity reset that removed nothing, on removal and on an un-re-bindable resync (`ProjectedConditionAccess.Runner.cs:703`, `:521`; `ProjectedConditionRegistry.cs:311-340`, `:412`). A ConditionRefresh before a *complete* first barrier gets no RefreshRequired; the conditions then arrive as their records apply (A3a deviation 4, never closed). The A4 live gate should decide whether A07's expectation or the code is right. |
| D7 | A03: "an ack with a pre-failover EventId ⇒ `BadEventIdUnknown`". | Holds only when the resynced record's `time` differs. With the same `time` and unchanged state, a new incarnation re-binds the retained EventIds and the old EventId stays ackable (F6, `ImportedConditionMethods.cs:386-415`). This matches plan §5.6 step 3 N6/F6, so A03's wording is the narrower case. A03 should drive a failover where `time` changes. |
| D8 | `RemoteNamespaceMapping.ConditionMethodTimeoutMilliseconds` doc comment: "ack/confirm/shelve". | Shelve is not forwarded (bit 512 reserved, `BadNotSupported`). The comment is stale; code is not changed here. |
| D9 | §5.2/§6: secret rotation = "removal + addition + RefreshRequired". | True after an origin restart: the next complete snapshot carries new keys, and the old ones are removed with RefreshRequired (Deviation 6 fix). The docs add that the two pair members must hold the same secret, or a failover changes every id (`ConditionKeys.cs:17-20`). This is not a disagreement, only an operational consequence the plan does not state. |
@@ -49,13 +49,20 @@ are cited at `~/Desktop/ScadaBridge` `a87c0575`. **This is to be recorded in `si
gate.** Two findings need a ScadaBridge change; they are not yet filed as issues.
1. **`SourceName` shape: `<local anchor subject>/<placement path relative to the remote root>`.**
- Evidence: `ProjectedConditionAccess.Runner.cs:563-564` builds `anchor + "/" + primary.RelativePath`. `:567-575`
- Evidence: `ProjectedConditionAccess.Runner.cs:951` builds `anchor + "/" + primary.RelativePath` (`:955-962` keep a held
`SourceName`, A4 review r1 S4). `:966-974`
strips the remote root subject and computes the folder. `ProjectedConditionRegistry.cs:458` sets it at creation, and
`:479` updates it on every record ("display only; rides the next event").
- Impact: ScadaBridge builds its per-condition key from `SourceName` + `.` + `ConditionName` (`OpcUaAlarmMapper.cs:45-51`;
`RealOpcUaClient.cs:1228-1240`). For an imported condition, that key is therefore the projected path, not the origin's
RawPath. It **changes when the primary-placement mapping changes**, for example when the Raw mapping is disabled and a
UNS mapping becomes primary. ScadaBridge would then see a different alarm, even though `ConditionId` did not move.
- Runtime status (A4 review r1 S4, decided at `a4-code`): before the fix, a Raw mapping that was merely refused,
`Unavailable` or retrying made the UNS placement primary, so `SourceName` flipped on a transient refusal and flipped
back on recovery (A4 made that state long-lived). Now a held `SourceName` is kept while its mapping is not contributing;
it moves only on a deployed-config change or when that mapping, known again, no longer lists the condition. Residual: a
condition **first** seen while the Raw mapping is unavailable starts with the UNS `SourceName` and moves once Raw lists
it. Add both cases to ScadaBridge#147.
- **Finding:** ScadaBridge should key imported conditions on `ConditionId`/`SourceNode`, or accept that a mapping change
re-keys them.
2. **`ConditionId` is opaque and stable for the life of the connection. Mapping changes do not move it; secret rotation does.**