Commit Graph

1852 Commits

Author SHA1 Message Date
Joseph Doherty dd1d02e25f fix(historian): #993 gateway read refusals no longer degrade health, QuestDB reverse events read finds its cut by backward scan, time-weighted aggregator stops allocating per sample
G-9: a gateway-answered InvalidArgument/OutOfRange/NotFound/Unimplemented read is a connectivity observation (open, streak ends), not a failure; outages still degrade.
G-17: capped reverse/end-only QuestDB events reads find the n+1-th latest ts with an early-exit backward scan, then read ts >= cut ordered (ts DESC, event_id DESC).
G-18: Distribute takes a bridged/nonGood flag instead of per-sample delegates (O(buckets) allocation).
QuestDB integration fixture waits up to 60 s for WAL visibility (shared host is CPU-saturated; the 5 s production default made alarm-writer tests read back fewer rows).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 10:24:50 -05:00
Joseph Doherty f47ff00c92 Merge #992: OpcUaClient indexed recovery re-publish, safe unsubscribe ordering, Bad publish for refused refs, post-dispatch BadTimeout, IPv6 probe preflight 2026-12-03 10:21:21 -05:00
Joseph Doherty 888bc73c0d fix(opcuaclient): #992 G-10..G-15 recovery re-publish indexed, unsubscribe ordering, subscribe refusals published Bad, non-condition events dropped, post-dispatch write failures BadTimeout, dual-mode probe preflight
Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 10:21:07 -05:00
Joseph Doherty d82d0ff1f3 Merge #971: script sandbox is an allow-list; narrowed BCL reference set (K-1 closed) 2026-12-03 10:18:28 -05:00
Joseph Doherty 9d1e6e8b86 Merge #989: MTConnect condition last-wins in /sample, subscription release on shutdown, restart re-baseline, parser skips bad observations, subscribe/unsubscribe races 2026-12-03 10:16:27 -05:00
Joseph Doherty af32984383 fix(mtconnect): #989 condition word last-wins on /sample, subscriptions released on shutdown, read-path restart re-baselines, malformed observation skipped not fatal, replay cannot overwrite a newer value, unsubscribe cannot kill a concurrent subscribe's pump
Review 2026-12-02 M-4, M-5, M-7, M-8, M-9 (MTConnect half), M-10.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 10:16:12 -05:00
Joseph Doherty abdb8f3ab0 Merge #975: AdminUI re-validates role grants every 5 min (cookie + open circuits), absolute session cap 2026-12-03 10:13:08 -05:00
Joseph Doherty 019ba96376 fix(adminui-auth): #975 AdminUI roles are re-validated on a timer (cookie OnValidatePrincipal + revalidating circuit provider); demoted users lose elevated policies within the window 2026-12-03 10:12:54 -05:00
Joseph Doherty cfd453ae34 fix(heidenhain): #990 deterministic control-loop stop, stable down-host status, throttled optional-role login, backoff survives re-init 2026-12-03 10:12:29 -05:00
Joseph Doherty c00ebf1320 fix(scripting): #971 the script sandbox is an allow-list — the K-1 bypasses (CreateDelegate, Expressions, XML/Tar I/O, X509Store, Timers/BackgroundWorker/AsParallel, Serilog.Log) are refused
ForbiddenTypeAnalyzer inverted from a BCL deny-list to an allow-list of types/members (ctx API, value/time/maths
types, collections, LINQ-to-objects, string/Regex/formatting; System.Type and CancellationToken with member
allow-lists). Every named type, expression type and used member (incl. return type and generic args) is checked;
__makeref/__arglist, lock and extern local functions refused syntactically. ScriptSandbox references only eight BCL
assemblies (defence in depth). The Monaco editor and the publish gate share both, so parity holds.

Tests: theory over the K-1 snippets (publish gate + analyzer alone against the full host), every-public-type
enumeration, shipped-sample + idiom regression, editor/publish parity. Differential over every script-shaped literal
in src/tests: all 511 previously-compiling scripts still compile (one expression-tree test intentionally refused).
PE cache signing by the host (option 4) deferred as a follow-up.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 10:09:39 -05:00
Joseph Doherty be5641fc06 Merge #985: FOCAS closes session on protocol desync, refusals keep health, dead CNC no longer stalls others, slot indexes kept 2026-12-03 10:05:04 -05:00
Joseph Doherty e68d856fcb fix(focas): #985 refusals stay Healthy, protocol faults close the session, dead CNCs no longer stall others
- P-6: the wire adapter throws refused fixed-tree calls as FocasWireException carrying the rc
  (was InvalidOperationException, so a refusing control looked silent, degraded and was
  reconnect-looped by the #527 watchdog); a refused axis is per-node BadNoData and the tick continues.
- P-7: bootstrap capability probes latch only an ANSWER (rc, or session still up); a transport
  failure/timeout or a session dropped mid-pass retries the bootstrap.
- P-21: CoalesceRejected latches only range-shaped codes (not EW_BUSY/EW_SOCKET/EW_UNEXP/EW_HANDLE/unknown).
  Macro/param multi-block batching deferred (unproven on hardware).
- P-10: any fault once a request is on the wire closes the session (bad magic/version, unexpected
  PDU, malformed blocks); replies must echo the request's command ids in order (verified against
  every 31i-B capture). A refusal never closes the session.
- P-8: close handshake bounded to 1 s and run under the request gate (sync + async dispose).
- P-11: data-path callers check the backoff before ConnectGate and fail fast behind an in-flight
  reconnect to a device whose last connect failed.
- P-9: axes/spindles carry their wire slot (FocasAxisName/FocasSpindleName.Slot); cnc_rddynamic2 and
  the spindle-meter lookup use it.
- P-20: a truncated (>= 32) alarm list never clears/retriggers a told-active condition unless it
  shows a new key; unseen told keys are kept.
- P-25: a refused connect-time sysinfo is not cached; a short PARAM payload reads BadTypeMismatch.

Tests: loopback MockFocasWireServer drives the real wire client; every fix mutation-checked
(reverting it fails its test). FOCAS.Tests 619/619, FOCAS.IntegrationTests 19/19 vs the sim on
10.100.0.35, Runtime.Tests FOCAS 7/7, FOCAS.Cli.Tests 57/57.
2026-12-03 10:04:42 -05:00
Joseph Doherty 864843e4d9 Merge #982: TwinCAT re-resolves symbols after online change/download, dead device fails fast, refusal ≠ comms fault 2026-12-03 10:04:34 -05:00
Joseph Doherty 0eb620a223 fix(twincat): #982 symbol-table changes re-resolve on a fresh client; one dead device no longer stalls the rest
Review 2026-12-02 (09-ab-twincat-focas.md) TwinCAT findings:

- P-1: a stale client (ADS symbol-version event, a 1809, an invalidated
  notification, a probe non-Run -> Run transition, or a moved OnlineChangeCnt
  sampled every healthy probe tick) is never handed out again: the next call
  retires it (fresh Beckhoff symbol cache), native registrations replay on the
  fresh client (background or probe tick), its pushes are dropped, refused
  registrations re-arm, rediscovery is raised once per event. Verified against
  decompiled Beckhoff.TwinCAT.Ads 7.0.172: SymbolCache cleans itself only on
  the symbol-version event, which an online change does not raise.
- P-3: devices are read concurrently; the first comms failure on a device is
  checked against its ADS state once - gone => remaining tags fail fast with no
  wire attempt, alive => per-tag failure. Probe-unreachable devices fail fast;
  native subscribe applies the same rule.
- P-4: the probe connects without replaying registrations, probes, and
  re-registers only after the device answered; a replay against a dead device
  stops dialling it; one Warning per device per outage, Bad published once.
- P-12: unlisted device-layer ADS codes (0x700-0x73F) map to BadDeviceFailure
  (refusal, no health write, refusal backoff); 1817 DeviceTimeOut = BadTimeout;
  marshal/type read exceptions = BadTypeMismatch; the read guard refuses a
  scalar over a struct/FB (pointers/references still read as their address).
- P-19: symbol name / bit index pre-computed at init; health re-derived once
  per device per read call (health updates now serialised under a lock).
- P-22: the ADS client always carries the driver Timeout; the probe bounds
  only its own ReadState with Probe.Timeout.
- P-25: bit-indexed BOOL poll reads resolve the parent and read it at its own
  width; poll / notification / write agree on BadOutOfRange / BadTypeMismatch.

Tests: TwinCATReview20261202Tests (39 cases; the behavioural ones failed before
the fix). TwinCAT.Tests 712/712.
2026-12-03 10:04:09 -05:00
Joseph Doherty 77ba6d5f2b Merge #976: historian outages never dead-letter alarm history; gateway transient codes retry; outbox ack never drops an unindexed append 2026-12-03 10:03:50 -05:00
Joseph Doherty 07ee9e4888 fix(historian): #976 a historian outage no longer dead-letters alarm history, and an outbox ack never truncates an un-indexed value
G-16 / K-2 (LocalDbStoreAndForwardSink): a RetryPlease counts toward MaxAttempts only on a
drain where some event was Ack'd. A drain with no Ack is an outage: RetryPlease rows are left
untouched (no attempt, no dead letter), the backoff climbs to its 60 s cap, LastError reports
the deferral; PermanentFail rows still dead-letter. An outage longer than ~6.5 min used to
dead-letter the oldest queued alarm events, 100 more every ~10 min.

G-8 (GatewayAlarmHistorianWriter): only InvalidArgument/FailedPrecondition/OutOfRange/
NotFound/AlreadyExists/Unimplemented and unmappable events are PermanentFail; Cancelled,
Unknown, DataLoss, every unlisted code and every non-RPC transport exception retry (the
default used to be dead-letter, so a gateway restart dead-lettered a whole drained batch).

G-16 secondary (AlarmBatchWrite, both SQL writers): a multi-event chunk failing with an
error that is neither a recognised data error nor a known transient is re-sent event by
event, so one unrecognised poison event no longer drags its chunk-mates with it.

G-7 (FasterLogHistorizationOutbox): RemoveAsync of the newest indexed entry truncates to
that record's own end (recorded by the peek, else a one-record scan), never to the live
tail that may already hold an enqueued-but-unindexed append; peeks return only indexed
records so every peeked entry can be acked.

Tests: simulated multi-hour outage (fake clock, 200 drain cycles) loses 0 events and
drains in order on reconnect; positive controls for PermanentFail and a RetryPlease-forever
poison row getting exactly its MaxAttempts budget; gRPC/transport classification theory;
AlarmBatchWrite isolation + known-outage control; G-7 parked-append race + peek-only-indexed.
2026-12-03 10:03:25 -05:00
Joseph Doherty 03e85ab752 Merge #972: ACL revalidation honours Security:Acl:Enabled=false (no flag-off stand-downs); dead SecurityFilteringActive removed 2026-12-03 10:01:19 -05:00
Joseph Doherty 40637b9954 Merge #983: AbCip dead device fails fast, BOOL arrays read in DWORDs, throttled logging, RMW lock + probe fixes 2026-12-03 10:00:15 -05:00
Joseph Doherty 85d479e23e fix(opcua-acl): #972 revalidation no longer stands down subscriptions while Security:Acl:Enabled=false
IsSubscriptionStillPermitted now asks Permits(identity, CreateMonitoredItems, node) — the creation
gate's own seam and the one place the flag-off bypass lives — instead of the bypass-less
IsAllowedCached. Since 8ad03e9c5 the pass ran with the flag off (SecurityFilteringActive's
'|| NamespaceIndexes.Count >= 4' term was always true: five namespaces are always registered) and
stood every ungranted/Anonymous subscription down within 60 s or on the next deploy (review U-1).

- SecurityFilteringActive deleted: it was a dead toggle, and the gated request paths it guarded are
  also the projected-data routing path; Permits alone decides the flag.
- pass-local verdict memo keyed by namespace index (realm folded projected/imported ids into Raw/UNS).
- _authorizer null-guarded in the pass (no authorizer wired => no NRE).
- AclRevalidationTimer / AclOptions remarks, docs/security.md and the data-plane-auth rule corrected.

Tests: unit flag-off (keyed + Anonymous, empty authority, no authorizer) x5 passes with a flag-on
positive control; wire flag-off data + folder-event subscriptions survive 5 ticks + a no-grant deploy,
with flag-on controls on the same items.
2026-12-03 10:00:02 -05:00
Joseph Doherty e6ca58148b fix(abcip): #983 packed structure reads, non-blocking lease release, allocation trims, docs (P-24)
Structure reads of a known size pack into one MSP; browse/template lease release no longer
blocks a thread-pool thread up to 2 s; scheduler packs with running totals; CipReply empty
extended-status array shared. AbCip.md documents P-2/P-13/P-16/P-22/P-23/P-24.
2026-12-03 10:00:00 -05:00
Joseph Doherty 7e3dbbb122 Merge #973: fleet diagnostics only dials known cluster members (SSRF closed) 2026-12-03 09:50:38 -05:00
Joseph Doherty b7d413366d Merge #984: AbLegacy unsupported types fail per-tag, bit arrays sized in words, Bit-without-/n RMWs bit 0 2026-12-03 09:47:29 -05:00
Joseph Doherty a9bc103eea fix(ablegacy): #984 per-tag family-type rejection + gate, bit arrays sized in words, Bit write RMWs bit 0, T/C/R read coalescing, answered-refusal/gate-race/null-write fixes
P-5 Long on MicroLogix/PLC-5 is BadConfigurationError per tag (init no longer throws), deploy gate warns via family-aware Inspect.
P-14 Bit array wire read sized in 16-bit words. P-15 Bit without /n RMWs bit 0; Bit on non-bit file refused.
P-18 native T/C/R sub-elements coalesce into one whole-element block read.
P-23f local OutOfBounds/TooLarge no longer count as answers, element/file >65535 is malformed; g block read re-resolves under the gate with identity-checked eviction; h null scalar write BadTypeMismatch.
2026-12-03 09:47:13 -05:00
Joseph Doherty 56fcc6e939 fix(adminui): #973 /fleet/diagnostics only dials Up driver members or enabled ClusterNodes; client refuses non-host:port targets
Closes the A-1 SSRF: ?node= / the typed box resolved straight into an Akka ActorSelection, so any
signed-in user could make the admin node open a remoting association to an arbitrary host:port.
Page policy stays AuthenticatedRead (same tier as /fleet and /hosts). Akka untrusted-mode audit
recorded in docs/security.md as an open follow-up.
2026-12-03 09:46:37 -05:00
Joseph Doherty 462dadc911 Merge #980: unexpected cluster exit exits non-zero for SCM, audit buffer survives DB outage, HTTPS listener misconfig fails boot 2026-12-03 09:43:27 -05:00
Joseph Doherty ccba570840 fix(host): #980 node exits non-zero when its ActorSystem terminates, audit flush keeps+retries on transient DB failure, HTTPS + dedicated listener fails host start
H-1: ActorSystemTerminationWatchdog flushes logs and exits the process with code 1 instead of StopApplication (clean SCM stop never triggers sc failure recovery).
H-2: AuditWriterActor re-buffers a batch when the DB did not answer; bounded 10k drop-oldest with counter; threshold flush suppressed while failing.
H-5: DedicatedListenerGuard throws instead of log-and-zero when an HTTPS binding blocks a requested dedicated h2c listener.
2026-12-03 09:43:11 -05:00
Joseph Doherty 388291d18a fix(modbus): #981 RTU-over-TCP discards the socket on caller cancel, re-subscribe republishes inside the deadband, DL205 non-octal C address is an error
S-1: ModbusRtuOverTcpTransport.SendOnceAsync tears the socket down on any exit after the write
without a validated reply (caller cancellation included), so a late reply can no longer answer
the next request at Good. S-2: SubscribeAsync/SubscribeAcquisitionAsync drop the deadband
baselines of their refs before polling starts. S-8: a family-recognised prefix whose body the
family parser rejects no longer falls through to the generic mnemonic table.
2026-12-03 09:42:30 -05:00
Joseph Doherty 65fd71de7a docs(review): 2026-12-02 full code review (10 slices, ~150 findings) + remediation plan
Tracked as #971-#1002.
2026-12-02 16:06:45 -05:00
Joseph Doherty e4740df2c9 fix(opcua): #970 a projected lookup racing back-to-back renewals never gives up and reports a live node missing
#968 made OtOpcUaNodeManager.TryResolve/TryResolveForRenewal re-evaluate a
definition replaced mid-check, but at most 16 times. A reader preempted while a
renewer swapped the definition back to back exhausted the bound and answered
'no such node' for a live node, which tears a physical stream down
(A_definition_replaced_by_a_renewal_never_resolves_as_missing failed 22/280
under load, on master too).

The bound is removed; the double read stays (it is what stops a removed node
being answered). The loop provably ends: the committed map compares values by
reference, so a retry happens only when a replacement of THIS node was
committed during that pass. Iterations are at most 1 + the replacements
committed during the call (lock-free progress; commits are serialized under
Lock and each needs a renewal or page apply); a removed node or a disposing
manager ends it at once.

Regression: A_lookup_outlasting_many_back_to_back_replacements_never_resolves_as_missing
(deterministic: the definition's authority check commits a replacement each time
it is evaluated, 64 times in a row; red on master, green now). Stress at the
same load: 280/280 runs of the 5 renewal tests pass (master: 22/280 failed).
2026-12-02 15:36:52 -05:00
Joseph Doherty a571a0fc99 fix(grpc-data): #969 concurrent cadence renewals of one predecessor share one metadata call and one commit
Two Subscribe cadences of one node reach the renewal window on the same tick
and each ran its own overlap renewal of the same predecessor: two origin
metadata calls, and the second commit adopted the first's successor yet
replaced the node's committed definition again (harmless since #968, wasted).

ProjectedDataAccess now keeps in-flight cadence renewals per predecessor proof
(reference identity, same node). A cadence that finds one waits for it; a
committed shared renewal is its success too (it adopts the committed successor
exactly as the existing already-committed shortcut does, its own caller
re-authorized by TryPrepareBinding). A shared renewal that did not commit is no
verdict: the joiner renews for itself, so one cadence stopping or being refused
only delays the other. No sink interface change.

Tests: Concurrent_cadence_renewals_of_one_predecessor_share_one_metadata_call_and_one_commit
(red: 2 metadata calls; green: 1 call, 1 definition replacement, both streams
kept) plus a variant where the shared renewal fails and the joiner renews
itself. The #968 adoption wire test keeps exercising the unshared path via a
test switch.
2026-12-02 15:10:02 -05:00
Joseph Doherty 464f8d4852 fix(grpc-data): #968 a projected node replaced by a metadata renewal mid-lookup no longer resolves as missing
OtOpcUaNodeManager.TryResolve/TryResolveForRenewal read the committed
definition map twice and answered false when a renewal replaced the
definition between the reads. Every subscription demand check racing a
renewal could then see its live node as gone and tear its physical stream
down (freshness check breaking the attempt, 'Source unavailable' on the
rebind baseline). Two cadences of one node made it likely: both renew on
the same tick and the second, redundant renewal replaces the definition
again while the first cadence rebinds - the residual ~1% hang of
Two_sdk_cadences_renew_before_expiry (the barrier timeout was a victim).

A lookup now re-evaluates a definition replaced mid-check (bounded).
Regression: A_definition_replaced_by_a_renewal_never_resolves_as_missing
(red: ~19% of lookups racing renewals answered missing), plus a wire test
for two cadences committing the same successor.
2026-12-02 14:46:34 -05:00
Joseph Doherty efd749da0f fix(grpc-data): #966 a modify's replacement no longer emits a live delta before its snapshot
The suspected ordering gap was real. A modify that replaces an item commits on the delivery side (the ack's
commit): the replacement enters _items (it was already registered with the delivery scheduler at staging) and its
snapshot job goes to _committedSnapshots, which only the NEXT tick moves to the pump. A tick already past that
dequeue that then reads a source change (e.g. from a sibling item on the same source, whose interest group survives
the modify) marks the source dirty. The scheduler hands it the replacement's handle, and ConsiderAsync sent the
newer value as a live delta before SnapshotBegin. The snapshot that followed carried the older captured value.

ConsiderAsync now defers an item whose interest group is not snapshot-complete. LastConsidered is left unchanged,
and the group's own lease (its cursor starts at the snapshot capture) yields the change once SnapshotEnd commits.
The same guard covers added and recovered items. Nothing starves: an undelivered SnapshotEnd stops the stream.

Deterministic test (BeforeDirtyTickForTests hold + gated modify ack + publish under the hold): red 3/3 before
(value:R:20 | begin | snapshot:R:10), green after, with a positive control that 20 is delivered after the end.
Parallel in-process stress of the unhooked scenario (2 items on one source, modify one under continuous publish):
60/40000 violations before (10000 x widths 2/4/6/8), 0/40000 after.
2026-12-02 13:12:27 -05:00
Joseph Doherty 366a92d768 Merge #962: Subscribe Modify no longer spuriously resets 'Source change history expired' when the replaced item's lease is released under an in-flight tick (real race, 167/45k -> 0/45k)
v2-ci / unit-tests (push) Waiting to run
2026-12-01 21:59:19 -05:00
Joseph Doherty 23b28e001f fix(grpc-data): #962 a modify's ack commit releasing a replaced item's interest mid-tick no longer resets the stream
The Runtime.Tests flake (Changing_the_filter_acknowledges_a_new_revision_before_its_snapshot) was a real
production race. DataSubscriptionSession.TickAsync captures the snapshot-complete interest-group leases
under the gate, awaits the snapshot/condition pumps, then reads each lease's changes. A Modify that replaces
an item is committed on the DELIVERY side (the ack's commit -> CommitStaged -> ReleaseItem), which disposes
the replaced item's SourceInterestLease. If that lands between the capture and the read, TryReadChanges
returns false exactly like a lost history and the session answered a successful modify with
Reset: "Source change history expired." (ack, then Reset instead of SnapshotBegin).

InterestGroup now carries Released (set under the gate in ReleaseItem before the lease is disposed); the
tick skips a failed read of a group the session itself released - the replacement has its own snapshot.
A failed read of a group the session still owns is still a reset.

Regression test holds a tick at the capture point (BeforeDirtyTickForTests), commits the modify under it
via a gated transport write, then lets the tick read: red 3/3 before, green after. Stress of the original
scenario (5000 iterations x 6 widths): 137/30000 Reset before, 0/30000 after.
2026-12-01 21:30:59 -05:00
Joseph Doherty 1724a175b6 fix(grpc-data): transport receive bound follows the call's decode limit (#963)
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).
2026-12-01 21:11:38 -05:00
Joseph Doherty 60e1328218 Merge #960/#961: projected reads reserve by declared type (16 KiB scalar) so up to 64 run concurrently, large-read anti-starvation, writes reserve 3x value bound; a refused projected item in CreateMonitoredItems is a per-item status
v2-ci / unit-tests (push) Failing after 10m20s
2026-12-01 20:41:43 -05:00
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 75e6ff9af8 fix(grpc-data): size projected unary reservations from the node's shape (#960); per-item status for projected items refused at create (#961)
#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.
2026-12-01 20:34:35 -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 601ade2243 docs(opcuaclient): #954 note AdminUI field 2026-12-01 20:18:19 -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