Commit Graph

1672 Commits

Author SHA1 Message Date
Joseph Doherty b57307ed0d Merge #956/#957: unknown value-kind decodes to a skip marker (version skew); /raw refuses newly-alarming an export root; data-connection saves validate only introduced errors; ACL-hidden nodes inside a grant answer NotFound 2026-12-01 20:34:45 -05:00
Joseph Doherty 285015c9de fix(dataconn): #957 /raw refuses adding an alarm to an export-root tag; data-connection saves refuse only errors they introduce; ACL-hidden nodes inside a grant answer NotFound
1. RawTreeService.UpdateTagAsync refuses the edit that makes a tag alarm-bearing while it roots an enabled
   DataExport (RawTag, or UnsTagReference to it) with the #942 DataExportRootAlarmBearing text (shared constants).
   DataConnectionAdminService refuses only errors a save/delete introduces or that remain on the saved row, so a
   pre-existing invalid row no longer blocks unrelated rows (two invalid rows used to deadlock); deploy gate unchanged.
2. Origin: GetMetadata/Read/Subscribe/condition admission answer a node inside the grant that the origin ACL hides
   (no Browse and no Read) NotFound, like a missing one (Browse omits it; HistoryRead/Write already uniform). Denied
   stays for visible nodes. Consumer renewal treats NotFound like Denied (#939 Refused), so tightening the ACL on a
   projected node still reads BadUserAccessDenied.
2026-12-01 20:34:22 -05:00
Joseph Doherty 0de062ba93 Merge #955: deploy compose reads under Snapshot isolation (no range locks held across ~22 config tables; reproduced 5 s deadlock-victim stalls vs concurrent edits) + sp_getapplock compose serialisation; phase timing from actor receipt 2026-12-01 20:31:54 -05:00
Joseph Doherty 0a9719c86e fix(deploy): #955 compose under SNAPSHOT + compose app lock, not SERIALIZABLE; time the deploy from receipt
The deploy compose's SERIALIZABLE transaction range-locked every config table for the whole
validate+compose+gzip: a concurrent edit held the deploy (as long as its lock), was held by it,
or deadlocked with it (reproduced on SQL Server: ~5 s per deadlock-monitor cycle, the deploy the
victim 9 of 10 times). SNAPSHOT reads take no shared locks; composes stay serialised by a
transaction-owned sp_getapplock taken before any data access (row-lock-first would fail a queued
compose with 3960). The #949 phase timer now starts at receipt (dispatch, in-flight-check).
The #923 gate's specific 10.5 s stall is not proven to be this mechanism (see evidence).
2026-12-01 20:31:10 -05:00
Joseph Doherty a38c600cb0 Merge #958: scripted-alarm refused broadcast copy settles the expired ask's LateOutcome -> mutation-guarded revert (30 s window, 1024 cap) 2026-12-01 20:24:34 -05:00
Joseph Doherty 401f9a9685 fix(alarms): #958 a broadcast copy the local engine refuses reverts the node
When the direct verdict ask expired before the engine reached it, or never started before its
asker's deadline, the host answered OutcomeUnknown and let the broadcast copy decide - but nobody
awaited that copy, so a local refusal left the SDK-applied node change until the next good deploy.

The host now keeps a pending decision per CommandId and returns it as the unknown answer's
LateOutcome; OnAlarmCommand settles it with the copy's local outcome (applied / refused / unknown /
not owned). The node manager's existing #951 chain follows it, so a refused copy reverts the node
under the per-condition mutation-counter guard (one chain, one terminal verdict - no double revert;
a newer change wins). Never-arriving copies settle unknown after 30 s; a stopping host settles its
pending decisions unknown; at most 1024 pending per host.

Tests: Runtime host tests (refused/applied copy settles the late outcome, copy-first answers
directly, window expiry, stop) - red without the LateOutcome wiring; wire test of the production
chain reverting exactly once, and not at all after a newer change (falsified by disabling the
mutation guard). Docs: ScriptedAlarms.md residual + #958 section, rules/alarms.md.
2026-12-01 20:24:15 -05:00
Joseph Doherty e66f072121 fix(grpc-data): an unknown value/element kind or per-item metadata status from a newer origin fails one item, not the whole browse/metadata response (#956)
DataProtoMapper.DecodeMetadata decodes an undefined ValueKind / ArrayElementKind number to an unknown-kind
marker (DataMetadata.HasUnknownKind, ValidateDecoded) instead of throwing; Validate/Encode still refuse it.
The resolver's #941 IsMaterialisable skips the marker whatever its node kind (a Folder included); a remote
root carrying it is refused. An undefined per-item metadata status decodes to Unavailable (no value, no lease).
Unspecified (0), bad array shape, unknown realm and unknown branch status still fail closed.
2026-12-01 20:20:15 -05:00
Joseph Doherty 647b7f631e feat(adminui): #954 OpcUaClient driver form field for AlarmRefreshRequiredMinInterval (+ round-trip and factory-parse tests) 2026-12-01 20:18:13 -05:00
Joseph Doherty 92da56c071 Merge #938/#939/#940/#948: projected Read maxAge=0 serves a bounded async origin read; renewal carries refusal kind (PERMISSION_DENIED -> BadUserAccessDenied, cached 5 s); Write/CreateMonitoredItems renew a lapsed lease; no proof candidate for a re-delivered consumed acquisition 2026-12-01 19:56:38 -05:00
Joseph Doherty 62d9504868 fix(grpc-data): maxAge=0 projected reads served from an awaited origin read; origin refusals are access denials; Write/CreateMonitoredItems renew lapsed leases (#938, #939, #940)
#938: OtOpcUaNodeManager implements IReadAsyncNodeManager. A projected Value read whose maxAge the
cache cannot satisfy (0 always: Part 4 "read the source"; ScadaBridge's DCL and the Client CLI send
0) is served from IProjectedDataAccess.ReadNowAsync in the same request — same unary admission,
authenticated freshness-checked read and cache publication as ScheduleRead, pumped through the
unary budget, at most 5 s / request deadline − 250 ms, no Lock, no blocked thread. A lapsed lease
is renewed first and read in the same request. Previously every maxAge=0 read answered
BadWaitingForInitialData forever.

#939: RemoteNamespaceResolver.RenewExactOutcomeAsync reports Renewed/Refused/Failed. Refused only
for the origin's verdict (PERMISSION_DENIED call, Denied item, Metadata not granted, operation not
granted / not writable) ⇒ BadUserAccessDenied, held 5 s per node+operation unsent; transport and
other failures stay retryable. HistoryRead follows it.

#940: RenewLapsed accepts Write (gated on the local write role) and Subscribe. WriteAsync awaits the
renewal (≤ 4 s, ≤ half the timeout hint) then dispatches, BadResourceUnavailable unsent otherwise.
CreateMonitoredItems awaits renewals once per request (ICreateMonitoredItemsAsyncNodeManager) and
classifies each projected item PER ITEM outside Lock (lapse ⇒ BadResourceUnavailable, refusal ⇒
BadUserAccessDenied) — a refusal thrown from the item manager used to fault the whole request.

Red/green: 15 wire tests in GrpcDataProjectedOriginAccessWireTests (12 red on the pre-fix source,
controls green both ways); 4 existing tests updated where the first read is now Good. Evidence:
docs/plans/evidence/grpc-data-ext/938-939-940-948.md.
2026-12-01 19:55:49 -05:00
Joseph Doherty e3a3f70c78 Merge #950: AdminUI /alerts scripted-alarm ack/shelve report the engine verdict (ExecuteAck.alarm_verdict / DPS replies collected per request, Applied/Refused/Outcome unknown)
# Conflicts:
#	docs/ScriptedAlarms.md
#	src/Core/ZB.MOM.WW.OtOpcUa.Commons/OpcUa/AlarmCommand.cs
2026-12-01 19:46:28 -05:00
Joseph Doherty 09aaabbeef fix(alarms): AdminUI /alerts ack/shelve reports the scripted engine's verdict (#950)
The /alerts buttons went central->node fire-and-forget and always showed
"Ack sent". AdminOperationsActor now spawns a per-request
AlarmCommandVerdictCollector (7 s window, under the client's 10 s ask) that
sends the command with AlarmCommand.VerdictRequested and gathers each node's
answer, finishing early once every node it sent to has answered.

- gRPC plane: CentralCommunicationActor tells the collector the dialled
  ClusterNode set and one verdict per node. A node handles a
  verdict_requested AlarmCommandMessage by asking its driver host
  (ScriptedAlarmHostActor.ExecuteAlarmCommand, the #937 path, no ask deadline,
  bounded 5 s) and returns it in the ADDITIVE ExecuteAck.alarm_verdict.
  Transport failure / timeout / empty ack (pre-#950 node) => that node unknown.
- DPS: published with the collector as sender; each ScriptedAlarmHostActor
  answers (non-owners NotOwned); expected set = Up driver members.
- Aggregation: any owner applied => Applied (partial noted); else any
  unknown/silent node => Outcome unknown (never "refused"); else owner
  refusal => Refused: <reason>; else no owner => Not applied.
- UI: green Applied / red Refused (reason) / amber Outcome unknown, per-node
  detail in the details pane; a verdict-less reply (validation, server fault,
  pre-#950 singleton) renders as before.

Wire is back-compatible both ways (new proto fields only; VerdictRequested and
NotOwned default false). Real-wire test through the real router, dialer,
interceptor and NodeCommandGrpcService (red without the node change).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-01 19:45:17 -05:00
Joseph Doherty bc4d44f7da Merge #951/#952/#953: scripted-alarm late refusal reverted via kept-alive ask (LateOutcome); pre-gate cancellation -> NotApplied; superseded load-generation failures ignored 2026-12-01 19:42:43 -05:00
Joseph Doherty 068124d1ae fix(alarms): #951 #952 #953 — late refusal reverts, never-started command is NotApplied, superseded load failure ignored
#951: the hosted-service Ask lives LateVerdictWindow (30 s) past the caller's bound
(ExecuteAlarmCommand deadline unchanged); the OutcomeUnknown it returns carries the
still-running ask as AlarmCommandOutcome.LateOutcome (process-local). The node manager
watches it (or the asker task itself when its backstop expired, following unknown
chains) and reverts the node on a late NotApplied, under the existing per-condition
mutation-counter guard. Both CallAsync and remote ExecuteConditionMethodAsync paths.

#952: ScriptedAlarmEngine throws ScriptedAlarmCommandNotStartedException (an OCE) when a
command is cancelled before it acquires _evalGate; a cancellation inside SaveAsync stays
a plain OCE (unknown). The host maps not-started to NotApplied and remembers it, except on
the direct ask once its asker's deadline passed (asker already answered unknown and
broadcast): then unknown + not remembered, so the broadcast copy decides (as review r2 M2).

#953: a faulted load pipes back AlarmsLoadFailed(cause, generation); a failure from a
generation a newer apply superseded publishes no readiness (it would refuse every command
while the newer load is in flight).

Red/green: each fix reverted individually turns its tests red (Core 1, Runtime 3,
Host 1, OpcUaServer.IntegrationTests 4).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-01 19:42:24 -05:00
Joseph Doherty 09c374c796 Merge #941/#942/#943: gRPC data consumer skips unbuildable browse kinds; DataExportRootAlarmBearing deploy/authoring gate; outside-grant addresses answer NotFound (GetMetadata/Read/Subscribe/condition admission) 2026-12-01 19:32:34 -05:00
Joseph Doherty bddf3724f8 fix(dataconn): #941 #942 #943 consumer skips unmaterialisable browse items, gate refuses alarm-bearing export roots, no existence oracle
#941: RemoteNamespaceResolver now skips an origin browse item this build cannot
materialise (NodeKind not Folder/Variable/Tag, or a value/array-element kind with no
OPC UA built-in type: Guid, Bytes) instead of failing the whole page, so one
UnsupportedVariable no longer makes the folder BadNoCommunication. Malformed items of a
supported kind still fail closed. New real-SDK wire tests: an injected unmaterialisable
child (4 kinds) is skipped across BrowseNext pages, and an empty Complete=false origin
page is paged through.

#942: DataConnectionValidator (authoring + DraftValidator deploy gate, not node-side
ValidateDeployed) refuses DataExportRootAlarmBearing: an export rooted at an
alarm-bearing RawTag (grants nothing) or at a UnsTagReference to one (no UNS node, so
the node's catalog compile throws and refuses the whole export set).

#943: GetMetadata, Read, Subscribe and condition-item admission answer an address
outside every export of the principal as NotFound, identical to a missing one
(LocalExportCatalog.DisclosesAddress replaces ContainsAddress). Denied stays for
addresses inside a grant. Browse, Write, HistoryRead and condition methods were
already uniform.
2026-12-01 19:32:14 -05:00
Joseph Doherty 88c9766ab5 fix(deploy): #949 ask timeout on the deploy trigger is OutcomeUnknown (202 + pre-allocated id), not a failure; slow-compose phase timings
The id is allocated before the ask and travels in StartDeployment, so a timed-out
caller can name and poll the deployment that may still go ahead. REST answers 202
OutcomeUnknown with a Location; the AdminUI shows 'could not be confirmed, may still
be created'; a retry during a running compose gets 409 naming the same id. The actor
logs per-phase timings for composes slower than 3 s.
2026-12-01 19:27:13 -05:00
Joseph Doherty 4fcabdf24a fix(grpc-data): a re-delivered, already-consumed acquisition leaves no orphan proof candidate (#948)
ProjectedMonitoredItem remembers the acquisition its last SDK notification consumed (key only,
no value retained). A complete snapshot of that same acquisition, arriving while nothing else is
queued (no candidate, no queued loss, no reset since), renews health evidence but adds no
candidate: the node's value does not change, so the SDK never raises a notification to consume it,
and the candidate held its shared budget charge until the binding changed. Cleared on any queue
reset (rebind, loss, client mode change, unmatched notification), so a fail-safe miss only costs
an unproven notification + baseline request.

Red/green: A_redelivered_already_consumed_acquisition_leaves_no_orphan_candidate (red: 1 orphan).
2026-12-01 19:27:09 -05:00
Joseph Doherty e42e666a1d fix(alarms): #937 review r2 — deadline/poison refusals unsent, Call size quota, expired asks skip the engine, mutation-counter revert guard
M1: a scripted method whose request deadline leaves < the dispatch floor, or that
follows an unanswered scripted method in the same Call, is refused BadTimeout in
its handler (unsent, unapplied); OpcUa:Quotas:MaxNodesPerMethodCall = 1000.
M2: ExecuteAlarmCommand carries the asker's deadline; an expired ask skips the
engine and is not remembered (the broadcast copy applies).
L1: revert guarded by a per-condition mutation counter; raw severity restored.
L5 + nits: docs, stale comment. SDK check: no Part 9 handler calls our delegate
before its own validation.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-28 12:47:08 -05:00
Joseph Doherty 6004a5a565 fix(alarms): #937 review r1 — revert a refused scripted method, broadcast to the peer only after the local verdict, settle a batch per request, in-flight cap
1. A post-dispatch refusal now puts the node back to its captured pre-call state
   with one corrective event (skipped when the node changed since) — the SDK had
   already applied and reported the change. Blank scripted AddComment is refused
   in the handler before the SDK runs.
2. ScriptedAlarmCommandDispatch: ask the local engine first, broadcast to the peer
   only on Applied/OutcomeUnknown — a refusal now reached no engine anywhere.
3. ApplyAsync no longer checks 'loaded' before _evalGate: a command racing the
   first load queues behind it; never loaded => refusal (nothing applied).
4. One Call's requests are settled sequentially (no request runs against a node
   state the engine refused); <= 64 asks in flight node-wide, else
   BadTooManyOperations before anything applies; per-request bound starts at send.
   Measured 300 acks through one host + LocalDb: 59 ms sequential, max 24 ms/ask
   with 64 outstanding.
5. Mixed-batch wire test (scripted refused + native + imported + scripted applied
   + core-manager method): per-item status in order, one scripted ask at a time.
L6: readiness from the engine's HasCompleteGeneration on a load fault.
L7: the verdict slot is closed when its SDK call returns (timer-captured
AsyncLocal can no longer park an ask). L10: remote budget never stretched.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-28 11:51:28 -05:00
Joseph Doherty 66b75aed0f Merge master into #937 (scenarios: keep A09 + F937) 2026-11-28 11:32:41 -05:00
Joseph Doherty 4ac8308510 Merge #920/#929: a demand disposed mid-publish no longer republishes a fresh baseline (retained proof-candidate leak); SDK async delivery race in test; memory figures re-measured with GC memory info (~79 KB/condition node tree)
v2-ci / unit-tests (push) Waiting to run
2026-11-28 11:28:20 -05:00
Joseph Doherty e45012b69d fix(alarms): a native condition's AddComment is not subject to the scripted verdict (#937)
Native AddComment shares HandleAlarmCommand but is applied at the node only;
asking the scripted host made it BadInvalidState (live A02 on fu937-1).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-28 11:01:47 -05:00
Joseph Doherty e076ceae64 test(grpc-data): #922 review r1 — batch, crowd-out, slow-origin, revoked/removed/invalidated; docs + evidence 2026-11-28 10:58:12 -05:00
Joseph Doherty 7e924deda9 fix(grpc-data): #922 review r1 — own renewal pool + queue, bounded HistoryRead wait, two-authority denial, per-op keys 2026-11-28 10:54:10 -05:00
Joseph Doherty b569d5c5dd Merge branch 'master' into worktree-agent-aad6291e992ef79ba 2026-11-28 10:48:21 -05:00
Joseph Doherty 1a4f16de5b Merge #916/#917: stop sending stable_source_id (field 10 deprecated, never encoded/decoded); alarm-bearing raw tags are unsupported value nodes hidden from browse; review fixes 2026-11-28 10:43:51 -05:00
Joseph Doherty 053c69f1c8 fix(grpc-data): #916/#917 review r1 — mapper never encodes/decodes stable_source_id (proto field deprecated); browse skip does not consume the scan bound (no empty incomplete pages); unsupported nodes never writable; comment fixes 2026-11-28 10:43:32 -05:00
Joseph Doherty f83cb24ed0 fix(runtime): arm the apply-wedge watchdog after the Applying-row write; capture telemetry counter before MeterListener (Runtime.Tests master failures)
ACompletedApply_NeverReportsAWedge failed whenever it ran first in its process: the
wedge timer was armed BEFORE the synchronous UpsertNodeDeploymentState(Applying), and
the cold EF Core model build on that first write (~350 ms) outlasted the 200 ms delay,
so the tick was enqueued ahead of the fetch's pipe-back and reported an immediately
answered fetch as WEDGED. The watchdog now arms immediately before the read/fetch starts
on both begin-paths, so it times what its Warning claims. New deterministic red/green
test ASlowApplyingRowWrite_IsNotReportedAsAWedgedFetch (row writes slowed to 4x delay).

OpcUaPublishActorWarmTests cluster-mode-mismatch test compared against
OtOpcUaTelemetry.RedundancyModeMismatch inside InstrumentPublished; when the static
initializer ran under the live listener the field still read null, so the counter was
never enabled. Capture the counter into a local before creating the listener.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-11-28 10:37:25 -05:00
Joseph Doherty 099238894c fix(grpc-data): #926 review r2 - deferred alarms and marks replay in arrival order; stale-record guard; F5 count on withdraw
- OpcUaPublishActor: deferred alarm states, qualities and condition marks replay as one
  arrival-ordered list (a withdrawal followed by a re-establishing transition ended
  unknown); marks held per (realm, condition) so withdrawals are bounded by the condition set
- OpcUaClientDriver: signal/withdraw re-check the registration under _alarmStateLock;
  removals take the lock
- DriverHostActor: a withdrawal under a raised F5 diagnostic updates its count
- docs: Unsignalable/backstop residual; AlarmInitialStatePublished must stay in-process
- tests: arrival-order replay (+ mirror), backstop positive control, F5 count
2026-11-28 10:26:39 -05:00
Joseph Doherty 4cf06261f1 fix(grpc-data): a demand disposed mid-publish no longer re-publishes a fresh baseline (#920)
Root cause of the Failed_sdk_item_construction flake: a failed SDK item
construction disposes its demand while the stream pump publishes that
registration's snapshot. The duplicate-baseline check read the dying demand's
IsValid as 'cache not fresh', so the same acquisition was re-published as a new
complete baseline to every item on the node, leaving an orphan proof candidate
(and shared budget charge) the SDK never consumes. HasFreshCachedLocked no
longer depends on demand validity; Publish re-checks the demand after it.
Regression test with a pump seam: red without the fix, green with it.

Bad_null different_timestamp flake is a test race: SDK 2.0.1 delivers node
changes to items asynchronously (MonitoredNode2 channel), so the published
sample could land after the mode cycle and overwrite the injected
notification. The test now waits until the SDK queued it.
2026-11-28 10:10:20 -05:00
Joseph Doherty 06da40a909 fix(opcuaclient): #926 review r1 - loss after the signal withdraws known; gaps outside a bracket, overlapping starts, failed refreshes
- a sequence gap outside a bracket is a loss (re-refresh, same budget); older/repeated
  sequence numbers are ignored and not recorded
- AlarmInitialStateEventArgs.Withdrawn (additive): the driver withdraws 'known' once per
  signalled episode on its first loss; DriverHostActor sends MarkConditionsKnown(Known:false)
  for those conditions, drops them from the backstop and re-arms F5
- a RefreshStart while a bracket is open is a loss (never erases the open bracket's)
- a failed ConditionRefresh call is retried through the same bounded retry
- retry generation token (a finished retry never clears a newer retry's pending flag)
- spent budget renews after a 5-min cool-down; RefreshRequired sweeps coalesced
Red/green per fix (7 mutations) + live opc-plc gate re-run.
2026-11-28 10:07:08 -05:00
Joseph Doherty 70539999f9 fix(grpc-data): Browse does not list unsupported value nodes (#917)
Live gate fu916-1 found that listing an alarm-bearing tag as
UnsupportedVariable made the consumer's whole remote-opc folder unbrowsable
(BadNoCommunication): ProjectedNamespaceApplier applies a page all-or-nothing
and TryEnsureProjectedVariable rejects any kind but Folder/Variable/Tag, on
every consumer build. The origin now skips unsupported value nodes in Browse;
they stay addressable (Unsupported) and exportable.
2026-11-28 09:49:12 -05:00
Joseph Doherty 092f62d3bc test(grpc-data): lapse tests — origin-down retryable, attribute read, synchronous absence counter (#922) 2026-11-28 09:42:58 -05:00
Joseph Doherty d6f2a1b5e2 fix(alarms): a scripted condition's Part 9 method returns the engine's verdict (#937)
Before: the alarm-commands topic is fire-and-forget, so an OPC UA method (and a
remote gRPC-data condition method) returned Good even when the engine rejected
the command because its last load failed.

- ScriptedAlarmCommandReadinessView: the host's latest load outcome; the node
  manager's handler refuses BadInvalidState before the SDK applies anything
  while the last load failed (lock-free read).
- Bounded ask: inside CallAsync (off Lock) each local request runs base.Call
  alone; the handler only STARTS AlarmCommandAsker (broadcast for the peer +
  DriverHostActor -> ScriptedAlarmHostActor.ExecuteAlarmCommand on the local
  engine, CommandId-deduplicated) and the Call awaits the verdict: refused =>
  BadInvalidState, no answer => BadTimeout OutcomeUnknown.
- Remote CallConditionMethod: ExecuteConditionMethodAsync => DriverConfirmedFailure
  / OutcomeUnknown on the origin.
- Host ownership uses the latest plan set (stable across a load in flight and a
  failed load's half-built set).
- Docs: ScriptedAlarms.md (verdicts, residual, duplicate-activation trade-off),
  DataConnections.md, rules/alarms.md. Live leg scenario F937 + seeder
  scripted_predicate mutation.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-28 09:40:35 -05:00
Joseph Doherty 3bd3761c12 fix(grpc-data): a lapsed projected metadata lease renews on demand instead of BadUserAccessDenied (#922) 2026-11-28 09:28:41 -05:00
Joseph Doherty b7ca71f188 fix(grpc-data): stop sending stable_source_id (#916); export alarm-bearing raw tags as UnsupportedVariable (#917)
#916: Metadata.stable_source_id carried the internal acquisition key
(<len>:<driverInstanceId><RawPath>) on every export, so a UNS-only peer learned
driver ids and RawPaths. No consumer uses the field beyond byte accounting; it is
optional on the wire and absent decodes as null. It is now never sent; the
internal BackingSourceKey is unchanged.

#917: alarm-bearing raw tags never get a value but were exported as Variables.
They are now the existing explicit UnsupportedVariable kind (browsable,
Unsupported on every value op). The node is kept so exports rooted at it still
compile and A1 condition placements are unaffected.

The real-origin v1 goldens are not re-recorded: GrpcDataV1RealOriginCorrections
applies exactly these two edits to the parsed goldens, pinned by a test.
Evidence: docs/plans/evidence/grpc-data-ext/V1-916-917.md
2026-11-28 09:23:34 -05:00
Joseph Doherty 05f431f5d8 Merge #933/#934/#936: bounded hold for keys held by a definitively refused mapping, off-loop root re-resolve, removal RefreshRequired reaches admitted holders
v2-ci / unit-tests (push) Failing after 2h34m59s
2026-11-25 12:36:56 -05:00
Joseph Doherty e61db01686 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.
2026-11-25 12:06:02 -05:00
Joseph Doherty 9d969c4724 fix(grpc-data): follow-ups review r1 — the unknown-mapping hold spares a transient mapping's own keys and pauses with no live stream (#933); cancel abandoned root fetches (#934)
S1: a held key that a transiently unknown mapping listed itself (_lastListed) is
held without a bound; only a definitive refusal of that mapping (Denied /
NotFound / Unsupported / ConditionCapacity, remembered across retries and stream
ends) starts its MaxUnknownHold clock. Consistent with a never-opening stream.
S2: the hold clock runs only while a stream is past its barrier (paused at the
stream end, shifted at the next barrier).
N1: in-stream root re-resolves run under a per-stream source cancelled when the
stream ends. N2: no held-expiry timer without a sink (spin). N3: MaxUnknownHold
must be positive. N5: #933 test lower bound taken before the hold starts; tests
for S1, S2, N1, N2, N3 and a second failed re-resolve — each red on revert.
2026-11-25 12:02:33 -05:00
Joseph Doherty 18154eeff4 fix(grpc-data): removal RefreshRequired reaches the holders after their mapping left the deployed set (#936)
QueueRefreshRequired decided per item with the CURRENT gate (CanSee over the
current mapping set), so when a deploy removed the mapping or its connection
nobody passed and the §5.2 removal + RefreshRequired was never delivered.
Each imported condition instance now records (weakly, per identity) every
identity the §5.4 gate admitted to it — the verdict cache's compute is the
only place a positive verdict is made, and every delivery, refresh replay and
Read/Browse goes through it. A removal's RefreshRequired goes to the collected
targets whose identity was admitted to the removed instance. The event carries
no condition data (SourceNode=Server); a never-admitted session still gets
nothing. OI test pins both: holders told after the gate admits nobody, the
ungranted session not (with a must-arrive RefreshEnd control).
2026-11-25 11:01:01 -05:00
Joseph Doherty 5d946fde55 fix(grpc-data): move the in-stream root re-resolve off the condition frame loop (#934)
RetryDueAsync awaited the root metadata request (10 s budget) inside the
frame loop, stalling every mapping's frames on that connection while the
origin's metadata was slow. The request now runs as a task (FetchRootsAsync
reads only the immutable root views); the task joins the loop's wake set
beside the retry timer, and its answer is applied on the loop
(ApplyResolvedAsync: RootView or MarkRefused, then the re-add). All runner
state stays loop-owned. While resolving the mapping is Unavailable (unknown,
T2) and is not re-scheduled. Test: a hung second metadata call no longer
blocks another mapping's delta; releasing it re-adds the item exactly once.
2026-11-25 10:58:28 -05:00
Joseph Doherty a310ba278f test(scripted-alarms): host-level redeploy restates an acked active alarm (#935) 2026-11-25 10:57:29 -05:00
Joseph Doherty 2eb31f62d2 fix(grpc-data): bound the unknown-mapping hold of imported conditions (#933)
A key no known mapping lists was kept stale for as long as ANY mapping of the
connection was unknown; a durably Denied/Unavailable mapping therefore kept
retired conditions forever. Scoping the hold to mappings that could list the
key is not provable on the consumer (placements are origin deploy-time config;
a dropped key may have moved into the unknown mapping's root), so the hold is
time-boxed per key: ProjectedConditionOptions.MaxUnknownHold (20 min) — past it
the key is removed (+ RefreshRequired at the sink), never known-inactive. The
since-time survives stream ends and hand-overs; the earliest expiry shares the
loop's retry timer. DataConnections.md: lifetime rule + troubleshooting row.
2026-11-25 10:56:23 -05:00
Joseph Doherty 6bdca132fe test(grpc-data): A4 review r2 NITs — F4 ungranted caller is refused without promoting the folder (fake gate honours ConditionBearing; control is BadUserAccessDenied), EventId retention across a held-set takeover
Adds the ProjectedFolderEventNotifier test observation.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-25 04:07:19 -05:00
Joseph Doherty d72f2d966d fix(grpc-data): A4 review r2 S1–S4 — the deploy hold reads one (placements, undecided) set, settles on any completion, is bounded (stale + MaxHold, reported as held), and its takeover sends RefreshRequired once
- S1: ProjectedMappingDeploymentRuntime publishes ProjectedMappingSet (placements + undecided + sequence) captured under
  its lock; DeployedConditionMappings keeps it as one volatile value (highest sequence wins); ReconcileRunners reads
  IProjectedConditionMappings.Snapshot. Deterministic window test via a Changed handler registered before the adapter.
- S2: a separate _undecided flag clears on ANY completion (failed/degraded/throwing build ⇒ settled empty ⇒ release);
  browse-anchor Suspended semantics unchanged. A held set goes BadNoCommunication on the stale timeout and is released
  past ProjectedConditionOptions.MaxHold (5 min); diagnostics report "held" and keep its counters; Dispose clears _held.
- S3: a runner that took over a non-empty held set sends RequireRefresh once at its first barrier.
- S4/NITs: runtime-level Began/Completed tests, F1 must-arrive control, linger-expiry-while-held.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-25 04:04:07 -05:00
Joseph Doherty e4b9998ca4 fix(grpc-data): A4 F4 — an admitted folder event item promotes a projected folder that materialised before its mapping was condition-bearing
OnProjectedFolderMaterialised promotes condition-bearing mapping folders to
SubscribeToEvents only at materialisation, and IsConditionBearingMapping needs the
mapping's authority active. On a freshly restarted consumer the projected pages
materialise before that authority activates, and nothing re-promoted them, so a
folder-first event item was refused BadNotSupported by the SDK
(MonitoredNodeMonitoredItemManager checks EventNotifier) until an i=2253 item
opened demand and a condition got wired there.

SubscribeToEvents: once the projected-notifier admission (mapping gate) passes,
PromoteProjectedEventFolder re-evaluates IsConditionBearingMapping and promotes
the folder before the SDK attach. Unauthorized callers are refused before it.

Test: F4_a_folder_materialised_before_its_mapping_was_condition_bearing_… (control:
refused while not condition-bearing; red with the promotion removed).
2026-11-25 03:08:09 -05:00
Joseph Doherty 1b7c69c6ec fix(grpc-data): A4 F1-F3 — a deploy's undecided empty mapping set holds imported conditions instead of removing and re-creating them
Every deploy begins a catalog attempt whose published mapping set is empty
(ProjectedMappingDeploymentRuntime.AttemptBegan → Notify([])). The consumer read
that as 'connection removed': runner Stop(removeConditions: true) tore down every
imported condition, and the post-deploy runner re-created them on fresh nodes —
one phantom event per condition (F2), an origin transition delivered twice (F3),
and every outstanding consumer EventId BadEventIdUnknown with no RefreshRequired
(F1; the removal's RefreshRequired was gated away because nothing was visible).
Root-caused live on a4dbg-1 (consumer applies a fresh-node 'marker null->M' record
right after its own deploy).

IProjectedConditionMappings.Suspended (DeployedConditionMappings → runtime
Suspended): while suspended a dropped connection's runner is stopped WITHOUT
removal and held; the next runner takes its materialised set over and
re-snapshots onto the same nodes (same marker ⇒ no event, EventIds kept). Only a
SETTLED set without the connection (or demand linger) releases the held runner,
which removes its conditions then.

Test: F1_a_deploys_empty_suspended_mapping_set_holds_the_conditions_… (red with
the hold disabled: removal on the suspended set).
2026-11-25 03:08:03 -05:00
Joseph Doherty 0cac09cee3 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 2026-11-25 00:22:54 -05:00
Joseph Doherty c93290d0a0 fix(grpc-data): A4 review r1 — B1 unique capacity-reset command id (fake now rejects reused ids); S1 retry timeout keeps buffer+claim; S2 late ack of a superseded re-add removes the orphan + InvalidArgument backstop; S3 overlap only for keys the mapping itself held; S4 SourceName independent of runtime status; NITs resyncs count opened streams, prune removed connections' counters 2026-11-25 00:20:26 -05:00