Grpc.Net.Client has no per-call receive limit, so Read/GetMetadata/Browse now go
through receive-bounded sibling channels (power-of-two size classes, min 16 KiB,
sharing the endpoint channel's handler). An oversized response to a scalar read is
refused from its length prefix instead of buffering up to MaxMessageBytes; such a
refusal stays a decode refusal (ArgumentException, no failover).
#960: a projected read reserves 16 KiB for a fixed-size scalar (16 KiB + 256 B/element for a
fixed-length fixed-size array) instead of the whole MaxPendingBytes, so the default 1 MiB admits
64 concurrent scalar reads; String/Bytes/variable arrays keep the whole cap, and a waiting
whole-cap read holds back smaller ones for 100 ms (anti-starvation). Writes reserve
16 KiB + identifiers + 3 x the value bound (what the origin's DataWriteExecutor admits the batch
against). Monitored-item renewals reserve 256 KiB. Measured: 4 x 250 ms maxAge=0 reads 1016 ms /
1 in flight -> 285 ms / 4 in flight.
#961: TryAcquireProjectedItem reports BadResourceUnavailable for a stream-capacity refusal; the
node manager's CreateMonitoredItem override turns the item manager's ServiceResultException into
that item's status (was a whole-request fault), and an authority race is re-classified outside
Lock like the per-item probe.
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.
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).
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.
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.
#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.
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>
#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>
#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.
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.
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).
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>
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>
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>
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>
- 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
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.
- 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.
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.
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>
#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
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.
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.
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).
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.
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.
- 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>
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).