fix(grpc-data): removal admission keyed on the credential, lazy + bounded, no stale verdict write-back (#936 review r1)

S3: the SDK installs a new identity object on every ActivateSession (decompiled
Opc.Ua.Server 2.0.1: Session.UpdateUserIdentity assigns EffectiveIdentity;
MonitoredItem/Subscription.EffectiveIdentity read the current session's), so an
object-keyed admission forgot a re-activated or transferred session. Admission
is now keyed on RoleCarryingUserIdentity.AdmissionKey (principal + api key id),
and a removal also tells an item that passes the current gate (uncached).
S4: the per-condition record is a lazily allocated locked HashSet<string> (no
ConditionalWeakTable per condition), one entry per credential, capped at 1024,
dropped after the removal's RefreshRequired is decided.
N4: Verdict writes back only while that instance is still live.
Tests: OI re-activation (red on revert), unit S3/S4 + N4 (red on revert); docs.
Also DataConnections.md for #933 r1 S1/S2.
This commit is contained in:
Joseph Doherty
2026-11-25 12:06:02 -05:00
parent 9d969c4724
commit e61db01686
6 changed files with 159 additions and 13 deletions
+4 -1
View File
@@ -867,7 +867,10 @@ This section is what an OPC UA client of the **consumer** sees. Code: `OpcUaServ
`MaxUnknownHold`). Removal emits **no** `NodeDeleted` model change. For a removal, "may see" means "its identity was
admitted by the gate to that condition instance" (a delivery, a refresh replay or a Read/Browse of it), recorded per
instance — not the current mapping set, which no longer admits anybody once the removal was caused by the mapping
leaving it (#936). The event carries no condition field (`SourceNode = Server`, `Message = "RefreshRequired"`), and a
leaving it (#936) — or "passes the current gate". The record is keyed on the credential (principal + API key id), not
the SDK identity object, because the SDK installs a new identity object on every ActivateSession: a session re-activated
on a new channel, or a transferred subscription, is still told. It is allocated on first admission, holds one entry per
credential (capped at 1024 per condition), and is dropped with the condition. The event carries no condition field (`SourceNode = Server`, `Message = "RefreshRequired"`), and a
session never admitted to the condition is not sent one;
- a resync leaves retained EventIds un-re-bindable (see EventIds below).
- **Before the first barrier, a refresh returns nothing imported**, because nothing is materialised yet. Conditions appear