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>
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>
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).
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).
The origin item sees a hub eviction only at its next hub read: Reset if the last snapshot chunk is
still undelivered, otherwise a silent fresh snapshot on the same stream (both per A2, both loss-free
since the A3 consumer swaps a buffered re-snapshot in as a full replacement). Since A2 review S5 the
3,000-record snapshot is 59 chunks and the silent path wins when run alone (fails 3/3 alone at the A2
merge too; passes in its class). No product change. Also fixes the stale ack/confirm/shelve comment on
ConditionMethodTimeoutMilliseconds.
Per connection: stream state, last snapshot, conditions and state-unknown count, node budget vs host caps, RefreshRequired,
resyncs, capacity rejections, method outcomes, per-mapping status / observed vs MaxConditions (80% warning) / refusal.
Per node (origin panel): open condition items, largest listing vs its limit, last snapshot, resyncs, capacity
rejections, unsignalled (state unknown), methods served.
Co-Authored-By: Claude <noreply@anthropic.com>
#930 N2: an Unavailable mapping (refused item, failed root, snapshot timeout) is retried on the OPEN stream by
re-adding its item (AddSubscriptionItems) on its own backoff — definitive refusals (Denied/NotFound/Unsupported)
on LongRetryDelay (5 min, doubling to 4x), transient ones on the snapshot timeout x 2^n (<= 8x) — so healthy
mappings are never re-snapshotted for it; an incomplete barrier whose incomplete set equals the previous barrier's
sends no RefreshRequired. N3: ConditionCapacity is retried in-stream on the long timer and recovers.
#931 N4 exponential reconnect backoff (MaxReconnectDelay 60 s); N5 held-but-unlisted keys charged beside known
claims (overlapping unknown ones) + SetMaterialised cap report; N6 method calls read Serving without _gate;
N7 a capacity reset that removed conditions sends no second RefreshRequired; N8 a parked runner is released once
its removal finished.
A4 diagnostics core: DataConnectionConditionDiagnostics (side-labelled items/resyncs/capacity/method metrics, new
refresh_required counter, consumer + origin evidence), Commons contracts, DI + deployment-runtime + driver-host wiring.
Co-Authored-By: Claude <noreply@anthropic.com>
GC.GetTotalMemory on .NET 10 regions reported +92 or +218 MiB (bimodal) for the same
state; GCMemoryInfo heap size and a heap dump (136 MB of objects, eeheap allocated
136,318,696 / committed 236,208,128) show the extra was committed-but-free regions.
The harness now takes HeapSizeBytes-FragmentedBytes after a full blocking GC and the
settled working set, and asserts BOTH <= 200 MiB. Worst case (2 placements, 8 slots,
3 event items, Live+Buffer): heap +106.5 MiB, WS +151.3 MiB max of 3 runs.
BytesPerCondition 230,000 -> 160,000 (max WS/condition 158,629, rounded up);
MaxImportedConditionBytes default 160,000 x 2,500 = 400,000,000 B (~381 MiB).
SDK 2.0.1 pools EventFieldList (PooledEncodeableType); SentMessageQueue Reuse()s every
list of an acknowledged message and the base ReuseCore returns it, whatever its runtime
type, to the shared stock pool. A recycled ProjectedEventFieldList was then rented by any
server's GetEventFields (an unrelated session's RefreshStart/RefreshEnd or local event)
still carrying an imported condition's marker, and ProjectedNotificationRewriter dropped it
when that marker's gate denied. Root cause of the intermittent OI ConditionRefresh failures
(#854/#855 classes). Mirrors ProjectedSdkNotification on the data path: override ReuseCore,
clear the marker, never return to the pool; a released (marker-less) list fails closed.
S2: one condition item per (stream, root) (InvalidArgument + diagnostic), SubscriptionSessionLimits
.MaxConditionItems (32) per stream (LimitExceeded), each snapshot's estimated bytes charged against
the principal's snapshot memory budget until its last chunk is delivered (refused ⇒ retried).
S3: a native condition in a UNS listing is named by its placement's browse name (effective name);
a raw-derived message (raw name, raw leaf, RawPath) is replaced by it.
S4: the item limit rides ConditionItemScope and is re-read with every listing.
S5: chunk budget = min(256 KiB, MaxPendingBytes, MaxMessageBytes) − frame overhead; an oversized
record's free text is truncated (no split surrogate); one that cannot fit resets with a diagnostic.
N1: one queued v1 frame after every 8 condition frames. N2: removal/snapshot-begin bypass rule documented.
N4: min(limit, DefaultMaxConditionsPerHold) per Lock hold. N5: losing channel waits are reused.
N6: ConditionTestAssertions deleted; probe seams reduced to three primitives; class doc moved back.
S1 (tests): the fixture 'deploy' test renamed to what it is (a listing swap without an attempt);
a real LocalCatalogCoordinator republish ends the stream.
budget = Max(1, …) pulled a chunk on a full queue every 100 ms tick, TryWrite failed and the stream was
reset, so a backlog above MaxPendingFrames chunks never completed its snapshot. Max(0, …) produces
nothing until the consumer drains. Test: 25-chunk backlog, stalled sink, 20 ticks ⇒ no reset, snapshot
completes (red before).
The A1 phase-run failure of A_native_transition_leaves_the_F5_pending_set was a real defect: when the
600 ms F5 window closed before the transition was processed (a loaded run), the diagnostic kept the
count from when it was raised (2) although the node manager held the condition established (1).
New deterministic test closes the window first; red before, green after.