Commit Graph

3196 Commits

Author SHA1 Message Date
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 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 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 f2757a52e2 Merge #944/#945: Galaxy clear-absent sweep on complete active-set reads recovers dropped Clears; provider_status/snapshot_status handled (counters), truncated snapshots withheld from known-state + sweep 2026-12-01 19:30:01 -05:00
Joseph Doherty 6d1d5ed559 fix(galaxy): clear told-active alarms absent from a complete snapshot (#944); handle provider_status/snapshot_status, withhold truncated snapshots (#945)
#944: a snapshot/QueryActiveAlarms lists active alarms only, so a Clear dropped while the
host's OnAlarmEvent handler was detached (or the stream was down) was never recovered. The
driver records which alarms it delivered as active; on a COMPLETE read (sentinel or re-read,
new IGalaxyAlarmFeed.ActiveSetDelivered, raised under the dispatch lock) it synthesises a
restatement Clear for told-active alarms of the live subscription the read does not name,
before the known-state signal. A re-read counts alarms the live stream restated meanwhile as present.

#945: provider_status / snapshot_status no longer fall to the decode-failure default (logged +
counters). A snapshot flagged truncated (snapshot_status or per-record flag) is not complete: no
sweep, no known-state signal; when the gateway clears the verdict the driver re-reads.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-01 19:29:41 -05:00
Joseph Doherty 5e956280db Merge #949: deploy trigger ask timeout -> 202 OutcomeUnknown with pre-allocated DeploymentId (+Location poll); 409 names the in-flight id; AdminUI shows outcome-unknown; >3 s compose phase-timing warning 2026-12-01 19:27:27 -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 0ccfd88a23 fix(opcuaclient): #946 rate-limit RefreshRequired sweeps; #947 refused per-ack status throws DriverOperationRefusedException
#946: AlarmRefreshRequiredMinInterval (default 10 s, 0 disables) spaces RefreshRequired-triggered ConditionRefresh sweeps per session; a request inside the window is deferred to its end and coalesced, never dropped.
#947: AcknowledgeAsync throws the breaker-exempt DriverOperationRefusedException for Bad per-ack statuses and unresolvable condition ids (BadConditionBranchAlreadyAcked is success) so the #760 revert fires. Docs reverse the O-8 decision.
2026-12-01 19:24:01 -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 c8b68940a8 Merge #926: OpcUaClient RefreshEnd signals initial alarm state only for a lossless bracket; post-signal loss withdraws known; deferred alarm/mark replay in arrival order; 2 review rounds 2026-11-28 10:26:58 -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 cda8221568 Merge #921/#927: live gates — H05 against a pinned pre-H2 origin (wire tap proves no new-shape frame) and A09 native-ack driver-failure revert under the service principal; CLI read --attribute 2026-11-28 10:26:05 -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 99f2b9d8b7 fix(opcuaclient): RefreshEnd signals initial alarm state only for a lossless refresh bracket (#926)
Track RefreshStart..RefreshEnd per alarm subscription. EventQueueOverflow (matched by
EventType before the source filter - it comes from the Server object), RefreshRequired,
a publish-sequence gap the SDK skipped (EventFieldList.Message.SequenceNumber; SDK 2.0.1's
Republish publish-state never fires for a gap that blocks delivery) or a missing
RefreshStart suppress the A1 signal and re-run ConditionRefresh, bounded (3, 2/4/8 s);
exhausted = conditions stay unknown (Uncertain), never Unsignalable. Alarm event queue
1000 -> 10000; new counters alarm_event_queue_overflow / alarm_refresh_lossy.
Unit + real-SDK gap tests, live overflow gate on opc-plc --alm; plan G2 text corrected.
2026-11-28 09:42:06 -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 14ca1b7168 fix(galaxy): an ack does not supersede a re-read entry; a stream reopen discards the re-read (#925 review r1)
- Only full-state live messages (snapshot entry, Raise, Retrigger, Clear) supersede a
  QueryActiveAlarms entry; an Acknowledge merges (Active => ActiveAcked) instead of
  skipping it and then signalling a cold condition known.
- Stream epoch bumped before StreamOpened; a changed epoch at replay drops the replay
  and the signal (an alarm cleared in the gap is absent, never touched); no re-read
  before the current stream's sentinel.
- Lows: dispose race returns false; teardown token on the RPC and the retry wait;
  an unexpected failure keeps a queued follow-up.
2026-11-28 09:34:24 -05:00
Joseph Doherty a2a1104f20 feat(cli): read --attribute reads one node attribute (e.g. Historizing, AccessLevel) (#921) 2026-11-28 09:28:59 -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 b4c27bd5b8 fix(galaxy): establish a changed alarm subscription by a QueryActiveAlarms re-read instead of waiting for a stream reopen (#925)
A sentinel comes only when StreamAlarms opens, so a subscription that became live
after the current stream's sentinel (or changed during its snapshot phase, F4)
stayed unknown until a reopen. The feed now re-reads the active set via the
gateway's existing QueryActiveAlarms (same monitor cache), replays entries as
restatements except where the live stream already delivered a newer message for
that alarm, and the driver then signals the still-live subscription. Coalesced
(one in flight + one follow-up), 3 bounded retries, Unimplemented not retried,
a failed re-read never signals.
2026-11-28 09:24:26 -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 02d227cc32 fix(scripted-alarms): #935 review round 1 — commands look up under the gate, a restatement writes nothing, a failed load ends the generation
S1: ApplyAsync looked its alarm up before taking _evalGate, so a command racing a
LoadAsync applied to the load's interim Fresh entry (an ack no-op that then saved Fresh
over the carried Active condition — the #935 re-Activate on the next push) or wrote an
old-generation state over the new one. The lookup is now under the gate: a command
queued behind a load applies to the generation that load produced. A command that
changes nothing (value-equal result) writes nothing.

S2: a load re-saved every alarm's post-predicate state, so a node that missed an
operator command upserted its stale carried state over the LocalDb last-writer-wins row
on every deploy. A held seed (carried or persisted) left value-equal is not written.
The push path's ReferenceEquals check (always false: ApplyPredicate returns a clone)
is now value equality too, so a no-op re-evaluation no longer writes/replicates.

S3: a failed load ends the generation. The engine is blind until the next good load,
so (decision, same rule as removed/disabled alarms) that load reads the store — a
still-true alarm is a new occurrence — instead of restating the pre-failure snapshot.
While blind, operator commands throw ScriptedAlarmCommandRejectedException (the host
logs it distinctly; the command topic is fire-and-forget, so that Warning is the
record) and queued re-evaluations / shelving checks are dropped.

N5: a timed shelve that expired before a load is unshelved through the shelving check
(AutoUnshelve audit + Unshelved emission), not silently by ApplyPredicate.

Tests (each red on revert, verified): ack racing a held load (S1), idempotent command
(S1), restatement vs real change saves (S2), no-op push saves (S2), command rejected
after failed load (S3), re-evaluation after failed load (S3), failed load -> new
occurrence + store fault mid-seed -> one Activated (S3/S4), runner Unavailable at
reload freezes carried state (S4), expired timed shelve at load (N5). N4: the Bad-input
reload test now waits on a Good-bucket QualityChanged.
2026-11-25 11:44:20 -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 ec245b84a9 fix(scripted-alarms): a same-process reload restates a surviving alarm from its in-memory condition (#935)
ScriptedAlarmEngine.LoadAsync runs on every deploy and used to seed each alarm
from IAlarmStateStore, which in production does not persist Active. A
still-true predicate then made every deploy an Inactive->Active transition:
Acked reset, Activated emission (duplicate alerts row), LastTransitionUtc moved.

Seed is now previous ?? persisted ?? Fresh: the last COMPLETED generation's
in-memory condition is captured under _evalGate before the clear and kept
across a failed load. Process restart is unchanged.
2026-11-25 10:54:45 -05:00