Commit Graph

3375 Commits

Author SHA1 Message Date
Joseph Doherty 762bcd7b8d feat(admin): #1078 headless POST /api/cluster/failover (key-gated, same service+audit) and unattended SCM-restart gate
fix(install): #1075 worker identity gets read+execute (not Modify) on <PeCacheDir>\pe; re-run replaces the old grant
2026-12-03 16:29:27 -05:00
Joseph Doherty fe4bbbe256 test(adminui): #1049 NodeEdit/ClusterEdit delete tests wait for the confirm dialog to render before clicking it 2026-12-03 16:25:27 -05:00
Joseph Doherty 7c78a4f456 Merge gRPC data follow-ups (#1057): refuse LimitExceeded before ack, sibling invalidation no longer resets a snapshot, per-stream snapshot slots, ~20% fewer bytes per projected value; R2_S2 hold-stale test timing 2026-12-03 16:05:03 -05:00
Joseph Doherty 62e39d5de5 test(grpc-data): R2_S2 hold test keeps its stale-before-release ordering under a loaded run (MaxHold 600 ms -> 5 s)
Intermittent failure in a full Runtime.Tests run. Test timing, not a production defect: the held runner's stale mark is
armed only after its loop has unwound (no late Good can follow it) and fires 100 ms later, while MaxHold runs from the
hold itself. Measured with the thread pool saturated: stale mark ~1.9 s after the hold, MaxHold release at ~0.9 s, so
the release ended the hold first (stale skipped / removal seen by the 'not removed before MaxHold' check). Production
MaxHold is 5 min. With 5 s the ordering holds under that load (stale ~1.9 s, release ~5 s).
2026-12-03 15:47:41 -05:00
Joseph Doherty 50a4887d83 Merge ControlPlane/core/authz follow-ups: coordinator DB writes off-thread + audit retry (#1051), resilience counts every failed attempt + zero-alloc scoped keys (#1052), AcquisitionSubscribe capability (#1047), audit drop metric + SCM restart test script (#1030), zero-alloc warm UNS ACL + unresolvable-ref backoff (#1053), flag-off revalidation fast path (#1033)
# Conflicts:
#	src/Server/ZB.MOM.WW.OtOpcUa.ControlPlane/AdminOperations/AdminOperationsActor.cs
2026-12-03 15:47:13 -05:00
Joseph Doherty 17dac6a536 Merge ConfigDb follow-ups: script FKs + ZTag/SAPID filtered unique indexes, ExternalIdReservation retired (#1040/#1049, migration ScriptForeignKeysAndExternalIdUniqueness with pre-check), SqlNamedQueryInvalid deploy rule (#1058), read-only otopcua-preflight upgrade tool (#1013/#1015/#1021)
# Conflicts:
#	docs/VirtualTags.md
2026-12-03 15:42:25 -05:00
Joseph Doherty 6cffffe673 feat(tooling): #1013 #1015 #1021 #1058 read-only upgrade preflight (otopcua-preflight)
One command, run from the NEW build against a ConfigDb BEFORE its migrations, that names every row
the upgrade or the next deploy would refuse; exit 1 if any, 2 if unreachable / not v3.
- migration:* — row-naming twins of the constraint-adding migrations' pre-checks
  (ConfigurationGapsIndexesAndRowVersions: duplicate NodeAcl / LdapGroupRoleMapping;
  ScriptForeignKeysAndExternalIdUniqueness: NULL ScriptId, dangling VT/alarm scripts, duplicate
  ZTag/SAPID, reservation rows). (#1021)
- deploy-gate — DeployGateRules, the gate's rule pass now extracted from AdminOperationsActor so
  both run the same code: every DraftValidator rule incl. VirtualTagNameInvalid /
  UnsEffectiveNameInvalid / *ScriptNotFound (#1015) and SqlNamedQueryInvalid (#1058), topology,
  TagConfig inspection.
- script-gate — DeployScriptGate through RoslynDeployScriptChecker, plus every unused stored
  script (Warning). (#1013)
An older schema is read through this build's model: tables a pending migration creates map to a
typed zero-row query, added columns are left out of the model (LegacySchemaTolerance). SNAPSHOT
read when allowed. Logic in ControlPlane/Preflight (Roslyn-free); the console shell binds Roslyn.
Real-SQL tests: an old-schema DB with every finding class (and nothing written), clean controls,
NULL ScriptId -> SnapshotUnreadable, non-v3 refused. docs/v2/upgrade-preflight.md records the dev
runs; production runs stay user-gated (wonder-box hold).
2026-12-03 15:41:30 -05:00
Joseph Doherty 288ca70c4a fix(sql): #1058 deploy gate refuses a named query the Sql driver would refuse at start (SqlNamedQueryInvalid)
The driver runs SqlNamedQueryRules.Describe over every queries entry with its provider at
construction, and one refused query fails the whole driver (every tag BadNodeIdUnknown). Since #974
that includes a T-SQL parse for SqlServer/Odbc/no-provider, so an Odbc query written in another
dialect (LIMIT, ILIKE, 'a'::text) that used to pass is refused after the upgrade. The gate now runs
the same rule over the same merged config (factory-equivalent JSON options), naming the instance.
Noted: a bare col::type PARSES as T-SQL static-member syntax and is accepted by both.
2026-12-03 15:41:21 -05:00
Joseph Doherty 36b90dfa31 Merge security follow-ups: host-side PE-cache signing, worker no longer holds the HMAC key (#1014); Akka remoting untrusted-mode + trusted-selection-paths by default, opt-in mutual TLS (#1003) 2026-12-03 15:40:32 -05:00
Joseph Doherty ef4e1668de feat(cluster): #1003 Akka remoting hardening — untrusted-mode on by default, mutual TLS opt-in
Follow-up of #973 (review 2026-12-02 A-1). New Cluster:Remoting section (AkkaRemotingOptions):

- UntrustedMode (default ON): akka.remote.untrusted-mode with trusted-selection-paths =
  every path this code base reaches by ActorSelection across nodes, enumerated from the Akka
  1.5.62 sources + src/: cluster core daemon + heartbeat receiver, remote-watcher, the DPS
  mediator, /user/{s} + /user/{s}/{s} for each ControlPlane singleton, /user/driver-host.
  Remote deployment and peer PoisonPill/Kill are dropped. Receive-side only, so a mixed
  old/new pair keeps working through a rolling upgrade. Drops (Akka logs them at Debug)
  become a Warning per path + otopcua.cluster.remoting.untrusted_drops.
  AdditionalTrustedSelectionPaths / UntrustedMode=false are the escape hatches.
- Tls (default OFF): mutual TLS on the DotNetty transport (PFX or store cert, mutual auth
  on by default, thumbprint pinning or chain validation, optional hostname check). Seeds and
  the diagnostics selection follow the transport scheme (akka.ssl.tcp); the bootstrap guard
  parses it. Validated at boot.

Proven on real clusters: pair formation, singleton via proxy + hand-over on leave, DPS, zero
drops; untrusted selection dropped (and delivered with the mode off); pinned TLS peers form,
an unpinned node cannot join; full two-node Host harness (deploys from both nodes,
diagnostics, node restart) with zero drops + positive control. Guards fail when a new
singleton or ActorSelection appears without its trusted path.
2026-12-03 15:35:56 -05:00
Joseph Doherty 355798cc8e Merge runtime follow-ups: timer VT drops scheduler catch-up tick bursts after a stall (#1061, real cause of the coalesce flake), late device confirmation after revert lands (#1041), artifact hash off the pinned thread + mux ConsumerRefs guard (#1054) 2026-12-03 15:32:07 -05:00
Joseph Doherty 7cda8dbb81 perf(opcua-acl): #1033 flag-off revalidation answers local items before the pass memo
With Security:Acl:Enabled=false a revalidation pass over local Raw/UNS items is an unconditional allow; it still paid a
(session, ns, id) memo entry and the full Permits walk per item. Measured over 10k items: ~6.5-7 ms and ~1.4 MB per pass
-> ~0.5-1 ms and ~0.2 KB. IsLocalNodeUngated mirrors exactly what Permits concludes there and excludes the one wiring
where it differs (mapped resolver without the projected predicate). The same shortcut inside the per-request Permits was
measured and NOT taken: a 1,000-node flag-off Read stayed ~1.5-1.9 ms either way (SDK read dominates).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 15:31:38 -05:00
Joseph Doherty 6ea0f09614 perf(acl,grpc-data): #1053 alloc-free warm UNS ACL decisions; unresolvable configured refs back off; restart keeps the comms latch (decided)
U-8: a warm cached decision on a UNS node allocated 416-680 B/call ahead of the cache (live id-chain list, identifier
split, LINQ, segment array, string.Join key, DataCallerIdentity). Now 0 B: the live chain is cached per folder instance
(re-verified against the live ancestry every call), the generation hands out one segment array per path, the authorizer
keys its resolved cache keys on that array, reference variables key on their own identifier (scope = its split), and
the caller identity is built once per session identity.

R-25: ConfiguredProjectedInterestOwner re-ran discovery for an unresolvable configured reference every 1 s sweep forever;
a failed resolve now backs off 1 s doubling to 30 s (60 s unreachable: 61 discoveries -> 6). Publishing into the source hub
only for sources with interest is DECLINED: that cache answers a new subscription's first snapshot and projected Reads.

Restart comms latch (decided: keep): the nodes stay Bad across an operator Restart and the respawned incarnation must
re-publish them; the stopped child's PostStop announcement already re-latches and cancels the old audit. Pinned by test.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 15:31:38 -05:00
Joseph Doherty a6e5ae8aa2 perf(grpc-data): #1057 trim the projected publish path's per-value allocation; allocation-free catalog/subject resolve
Measured with GrpcDataWave3PerfTests (10k-item cohort, 100 source versions at 1k/s; numbers in the issue report).
- Core: MappedSubjectResolver.Resolve returns shared immutable resolutions (built once per subject) and compares
  scope/ancestry by index (no MappedSubjectResolution + 2 enumerators per call, several calls per value);
  DataOperationPolicy checks segments by index and builds its local scope key with one exact-length string.Create.
- Origin: LocalExportCatalog.TryResolve compares the view field by field instead of building 'view with { Address }'
  (and LocalAddress no longer copies an exactly-spelled address); the frame Eligible check peeks the latest READY
  version (PartitionedSampleHub.TryPeekReadyVersion) instead of retaining a second sample per value; TickAsync reuses
  worker-owned lists (interest groups, changes via SourceInterestLease.TryReadChanges(into), delivery slice via
  DeliveryScheduler.TakeSlice(into), due items) and the delivery index reuses one ready-list node per source.
- Consumer: PublishPacedAsync is a ValueTask; the cohort and RemoteSubscription walk frame items by index; renewal
  prunes expired witnesses in place.
2026-12-03 15:31:31 -05:00
Joseph Doherty c64b5ec654 Merge Galaxy/AdminUI/Client follow-ups: opt-in SecuredWrite under the caller's API-key Galaxy identity, VerifiedWrite still refused (#1017), Galaxy form keeps KeepAlive keys (#1045), explicit empty ack password (#1050), Client.UI batched recursive subscribe + CLI --reconnect-timeout exit 3 (#1048) 2026-12-03 15:29:27 -05:00
Joseph Doherty 13521354cc feat(galaxy): #1017 SecuredWrite attributes can be written as the calling API key's Galaxy identity (opt-in); VerifiedWrite stays refused
- MxAccess.SecuredWrites = Refuse (default, unchanged #991 local BadUserAccessDenied) |
  ApiKeyIdentity. Opted in, a SecuredWrite runs as the calling key's own /api-keys Galaxy
  identity (ResolveKeyIdentityAsync: no fallback account; anonymous / no identity / broken
  identity refused before the wire): own plain-advised handle (apart from the raw path's
  supervisory handle) -> AuthenticateUser every write -> WriteSecured(userId, 0), the sequence
  mxaccessgw live-captured committing. Auth failure / user id 0 -> BadUserAccessDenied; password
  only in the AuthenticateUser command, scrubbed from every log. Identity resolved once per batch.
- VerifiedWrite is refused in every mode: an OPC UA Write carries no verifier (MXAccess refuses
  no verifier 1008 / self-verifier 8018), and a stored verifier would defeat the two-person rule.
- Caller plumbing: WriteCaller + optional ICallerAwareWritable (Core.Abstractions); node manager
  passes principal + key id -> IOpcUaNodeWriteGateway caller overload (default drops it) ->
  RouteNodeWrite.Caller -> WriteAttribute.Caller -> ICallerAwareWritable. The gRPC data-connection
  write path carries no caller yet (secured writes refused there).
- AdminUI Galaxy form 'Secured writes' select (owned path); enum serialises as its name; factory
  refuses an unknown value. Docs: Galaxy.md design + live-gate checklist. Not live-gated.
2026-12-03 15:29:02 -05:00
Joseph Doherty 9bdfe796f5 Merge driver follow-ups A: Modbus RTU response correlation + cancel redial + rebuild e2e (#1029/#1055), MTConnect malformed-item BadDecodingError + cross-chunk condition severity (#1055/#1037), TwinCAT write fail-fast + retired-client reads (#1035), OpcUaClient skipped-tag ledger append + zone-qualified IPv6 probe (#1039) 2026-12-03 15:25:42 -05:00
Joseph Doherty ca5ee2ac57 fix(virtualtags): #1061 a scheduler catch-up burst evaluates a timer tag once, not once per missed tick
Root cause of the intermittent VirtualTagActorTimerTests coalesce failure (full suite only):
Akka's HashedWheelTimer does not skip ticks it missed while its thread was stalled (GC pause,
CPU starvation) - it delivers them all in one burst when it resumes. Measured with a parked
scheduler thread: a 600 ms stall => 12 ticks within the same millisecond. Ticks that fell due
during the gated run therefore landed just after the release, each a fresh evaluation, and broke
the post-release bound. In production the same burst multiplied every timer tag's script runs by
stall/interval after any stall.

VirtualTagActor now drops a tick that lands within half an interval of the last timer
evaluation (scheduler monotonic clock); the regular cadence is unaffected. New deterministic
test parks the scheduler thread for 600 ms with the release inside the stall: failed 3/3
before the fix, passes after, with a cadence positive control. The in-flight assertion
(Calls == 1 while gated) has no such mechanism - ticks during a run are dropped - and did not
fail in 3 full-suite + 12 class-scoped trx runs under load average ~490.
2026-12-03 15:25:10 -05:00
Joseph Doherty 152ae44174 Merge scripting follow-ups: deploy gate warm + 45 s deploy ask (#1024), editor predicate mode (#1025), {{equip}} in verbatim/raw/interpolated literal refused (#1056), ScriptRunGuardTests timing cause (#1038), returned sequences materialised + capped (#1059) 2026-12-03 15:23:46 -05:00
Joseph Doherty eff2b8e573 fix(opcuaclient): #1039 subscribe-time refusals ride the skipped-tag report (SkippedTagLedger.Append/Withdraw); probe preflight keeps an IPv6 zone
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-03 15:20:27 -05:00
Joseph Doherty a24071405a perf(script-runner): #1052 K-11 remainder — scoped keys cached per (kind, key); in-process compile-failure cache keyed by (kind, source) tuple
Every evaluation through the in-process, shadow and out-of-process runners built its
"{kind}:{key}" string afresh, and InProcessScriptRunner also concatenated the WHOLE script
source into its negative-cache key per evaluation. ScopedKeys.For returns a cached string
(bounded 65,536 keys per kind, cleared on overflow); the compile-failure map is keyed by a
(kind, source) tuple.

Measured: 10,000 scoped-key lookups 1,520,000 B -> 0 B (ScopedKeyCacheTests);
InProcessScriptRunner.RunAsync with a ~2 KB source 9,161 -> ~4,900-5,000 B per evaluation.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 15:20:06 -05:00
Joseph Doherty 2a8bac5bf5 feat(audit,install): #1030 audit overflow drops exported as otopcua.audit.dropped; scripted SCM-restart-after-cluster-exit gate
- AuditWriterActor: every buffer-full drop is added to OtOpcUaTelemetry.AuditDropped
  (otopcua.audit.dropped{reason=buffer_full, actor}) — the count used to be readable only
  through the actor's own property.
- scripts/install/tests/Test-ScmRestartAfterClusterExit.Windows.ps1: the windev manual gate
  of 2026-12-03 as a script (qfailure restart action; failover/command trigger => non-zero exit,
  7031, Running under a new pid; Stop-Service stays stopped; optional kill control). Parse-checked
  with pwsh on macOS; must be run elevated on a Windows box hosting OtOpcUaHost.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 15:20:06 -05:00
Joseph Doherty 6b19f4add6 feat(resilience): #1047 non-retrying AcquisitionSubscribe capability wraps SubscribeAcquisitionAsync (breaker + /hosts telemetry), OTOPCUA0001 suppression removed
New DriverCapability.AcquisitionSubscribe (appended): RetryCount 0 in every tier and forced 0 by the parser, 30 s timeout
(outlasts the actor's 10 s acquisition timeout), breaker 5 (Tier C none). PendingAcquisition.Start routes through the
invoker keyed on the driver instance; an open breaker fails fast and the capacity reservation is released.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 15:20:02 -05:00
Joseph Doherty 3d73f4d7d5 fix(grpc-data): #1057 origin snapshot admission is per stream, so one principal's cohorts no longer starve each other
The origin admitted MaxStreamsPerPrincipal (8) concurrent snapshots per PRINCIPAL, shared by every stream that principal
held. A consumer opens one stream per (connection, identity, publishing interval) and each cohort keeps up to 4 commands
or snapshots outstanding, so a third cohort's add was refused and its whole stream reset ('Snapshot admission
exhausted'). SubscriptionTransportCapacity.ForDataPlane (used by LocalDataRuntimeComposition) now gives each stream 8
slots (SnapshotSlotsPerStream) and sizes the principal and node caps so every admitted stream can hold all of them; the
snapshot byte budgets still bound memory. A session's background waiting-item recoveries may take at most half its
slots, so the peer's outstanding commands always find theirs. Capacities built without a per-session cap (tests) keep
the old per-principal behaviour.
2026-12-03 15:20:00 -05:00
Joseph Doherty 49213e52e4 test(config): #1049 real-DB DanglingReference race + snapshot isolation; NodeEdit/ClusterEdit stale-token and delete against SQL Server
DanglingReferenceSqlServerTests: the review's emptiness-check/add/delete race interleaved on two
real connections commits both and the deploy snapshot names the orphan; a consistent device+tag
commit landing mid-read (after Devices, before Tags) is invisible under the factory's SNAPSHOT
transaction, while the same interleave read READ COMMITTED produces exactly the false
DanglingReference (positive control).

ClusterNodeEditConcurrencySqlServerTests (bUnit on the AdminUI SQL fixture — InMemory generates no
rowversion and has no FKs): stale-token saves on NodeEdit/ClusterEdit are refused and the other
user's edit survives, current-token saves succeed, a deployed node deletes with its
NodeDeploymentState rows, a cluster with nodes is not deleted and the page says why.
2026-12-03 15:18:16 -05:00
Joseph Doherty d8cf9723d1 fix(twincat): #1035 writes to a gone device fail fast per call; a read in flight on a retired client is re-read on a fresh one
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-03 15:14:49 -05:00
Joseph Doherty 90de55535d fix(config): #1040 #1049 script FKs, unique ZTag/SAPID indexes, reservation ledger retired
One migration, ScriptForeignKeysAndExternalIdUniqueness:
- FK_VirtualTag_Script / FK_ScriptedAlarm_Script (Restrict) onto Script.ScriptId, which becomes
  NOT NULL and an alternate key (unique constraint UX_Script_LogicalId replaces the index).
- UX_Equipment_ZTag / UX_Equipment_SAPID filtered UNIQUE indexes (blank = no identifier, the
  deploy gate's reading) replace the non-unique IX_ ones.
- ExternalIdReservation + sp_ReleaseExternalIdReservation dropped (decision: retire — no writer
  since the generation model; uniqueness is gate + indexes). The /reservations page, query,
  ReservationKind, DraftSnapshot.ActiveReservations and the reservation pre-flight rule go too.
- A read-only pre-check THROWs 51049 naming every offending row class (NULL ScriptId, dangling
  VirtualTag/ScriptedAlarm script, duplicated ZTag/SAPID, any reservation row) and changes
  nothing; Down restores the previous shape.

Authoring mirrors so the constraints are never the first to say no: UnsTreeService refuses a
missing script for VirtualTag/ScriptedAlarm create/update, and a ZTag/SAPID another equipment
holds on create/update/import (owner named; import keeps the clean rows); values stored trimmed.
ScriptEdit maps a concurrent-bind FK refusal to a message. Migration pre-check, Down round-trip,
FK and index behaviour pinned against real SQL with positive controls.
2026-12-03 15:14:26 -05:00
Joseph Doherty 7436e1af95 fix(grpc-data): #1057 a sibling source's invalidation no longer resets an in-flight snapshot on the same partition
#994 (R-9) taught the interest lease to tell its own sources' invalidation from a sibling's, but SnapshotLease still
compared the partition-wide control stamp, so any sibling invalidation, status barrier or plain lock contention reset
the snapshot and with it the stream. Each snapshot cursor now adopts a newer stamp once it proves none of ITS captured
sources moved (quiet version, invalidation version, binding/fence/gate retirement, same source state), read inside a
captured control window; an in-progress bracket is spun on briefly. Own-source invalidation, a partition-wide epoch bump,
a poisoned signal and history roll-off still reset.
2026-12-03 15:13:31 -05:00
Joseph Doherty f3f24f2984 fix(scripting): #1059 materialise a returned lazy sequence inside the guarded run with an element cap (Scripting:MaxResultElements); document the in-process sandbox boundary 2026-12-03 15:12:37 -05:00
Joseph Doherty bed9620e31 fix(scripting): #1014 host owns the compiled-PE cache; the worker never holds the HMAC key
Review 2026-12-02 K-1 option 4 (#971 follow-up). The ScriptWorker used to read, verify and
WRITE the PE cache with the key it received in Hello, and a verified image is loaded without
re-running the analyzer — so code that escaped inside a worker could sign an entry for any
script's source and persist across restarts and redeploys.

- Hello no longer carries pe_cache_dir / pe_cache_key (fields reserved).
- HostPeCache: the host verifies an entry under its host-only key and ships the image in
  ScriptSource.pe_image; on a miss the worker compiles as before and, only after that compile
  succeeded, the host queues its OWN compile (one background thread, de-duplicated) and writes
  the signed entry. The worker loads a supplied image or compiles; it never opens the directory.
- Images go only to a worker whose Ready.pe_image_abi equals ScriptSandbox.ImageAbi (runtime +
  pinned assembly names); pre-#1014 workers report none and just compile.
- Entry format v2: every worker-written (possibly forged) v1 entry is rejected and refilled.
- Scripting:Worker:PeCacheDir and the directory layout are unchanged.
2026-12-03 15:12:17 -05:00
Joseph Doherty 8225aaa18c test(scripting): #1038 hold the 2x-overrun orphan on a signal instead of a 200 ms wall-clock spin (a 150 ms test-thread stall reproduced the flake) 2026-12-03 15:12:07 -05:00
Joseph Doherty 258634c12b fix(grpc-data): #1057 an item the origin's delivery index cannot hold is refused LimitExceeded in its ack instead of stopping the session after it
Registration in the session's delivery index happened after the Open/Add acknowledgement had been queued as Good, so a
registration failure could only Stop() the whole session (every sibling item went with it). Items now register at
admission, before the ack is built; a refusal is the item's own LimitExceeded. Waiting-for-initial-data items register
at admission too (the index is keyed by source), so their later recovery can no longer reset the stream for capacity.
SubscriptionSessionLimits.DeliveryIndexCapacity is a test-only override of the index size.
2026-12-03 15:11:09 -05:00
Joseph Doherty 13ce6184f0 fix(mtconnect): #1037 condition value word from MTConnectConditionTracker (cross-chunk + same-chunk multi-code); #1055 malformed observation marks its item BadDecodingError
The value tag of a CONDITION item now reads the tracker's derived word (most severe active nativeCode across chunks),
so Warning(B) can no longer mask a still-active Fault(A) and a same-chunk Fault(A),Warning(B) no longer reads Warning.
A skipped observation that still names its dataItemId (unparseable/missing timestamp) is reported in
MTConnectStreamsResult.MalformedDataItemIds; the index marks the item BadDecodingError and the driver publishes it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-03 15:11:03 -05:00
Joseph Doherty e967042fbb fix(runtime): #1054 the artifact hash moves off the OPC UA pinned thread; new mux readers are guarded into ConsumerRefs
#995 follow-up 1: OpcUaPublishActor still SHA-256'd every rebuild's artifact once on its pinned
thread (WithArtifactRevision). DriverHostActor already hashes the same bytes for its catalog
attempt, so it now stamps RebuildAddressSpace.ArtifactRevision at all three send sites (deploy
apply, boot-from-cache, bootstrap restore) from a per-blob ConditionalWeakTable memo (one hash
per blob instance, no lifetime extension). The publish actor's fallback hash stays for unstamped
senders and is observable through TestHooks.OnArtifactHashed.

#995 follow-up 2: DependencyMuxConsumerRegistrationGuardTests scans src for every
DependencyMuxActor.RegisterInterest sender; an unlisted one fails with the instruction to fold
its refs into DriverHostActor.ConsumerRefs, and each listed replay-opting consumer's composition
term must still appear in ConsumerRefs (mutation-checked). The historization recorder is the one
exempt, non-replay registrant.
2026-12-03 15:10:24 -05:00
Joseph Doherty 79235bf593 fix(resilience): #1052 every failed attempt counts toward ConsecutiveFailures, no-retry capabilities included; non-idempotent write telemetry on the caller's host
Decided: an innermost recorder counts each attempt ending in a handled failure (not caller cancellation, not a
refusal; the pipeline timeout stays counted once by OnTimeout). OnRetry only logs now. Write/AlarmAcknowledge/
Initialize failures used to never raise the /hosts count, and a retried call's last attempt was never counted.
The ::non-idempotent write pipeline records failures + breaker under the caller's host (trackerHostName).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 15:10:21 -05:00
Joseph Doherty 186b5d696d fix(opcua): #1041 a device confirmation arriving after a newer write's revert lands instead of being dropped
#979 follow-up 1: write A then B, B refused first (node reverts to the pre-A value P), the
device confirms A afterwards. The revert closed the overlap window and A's success was dropped
as an outcome from a closed window, so the node showed P while the device held A until the
next driver publication. EquipmentVariableState.CloseWindowAfterRevert now keeps the window's
still-pending older attempts (bounded like the window, carried across later reverts above the
confirmed floor); a late success of one lands its tuple (LateConfirm) when nothing touched the
node since the revert, or becomes the confirmed tuple of a window opened since. A driver
publication or a newer owner's success discards them.

#979 follow-up 2 (dependents keep last value during operator Restart / config respawn): not a
defect - the stopped child's PostStop comms-loss fan (03/S15) reaches the dependency mux and
hands dependents BadNoCommunication until the new driver object publishes. Pinned by two new
DriverHostActorSourceRemovedTests (identical-value recovery); mutation-checked: removing the
PostStop ConnectivityChanged fails both.
2026-12-03 15:10:17 -05:00
Joseph Doherty 6dfaacecc6 Merge driver follow-ups B: MQTT ISO-8601 DateTime writes (#1044), FOCAS short payload BadTypeMismatch (#1036), AbCip alloc trims (#1032), AbLegacy address memo + bounded RMW gates + identity eviction (#1031), Sql docs (#1042/#1043) 2026-12-03 15:09:51 -05:00
Joseph Doherty 9496db9357 fix(client): #1048 Client.UI recursive subscribe + restore batch through SubscribeManyAsync; CLI subscribe/alarms exit 3 when a failover never recovers
- SubscriptionsViewModel collects the subtree's variables first (deduped, already-subscribed
  skipped) and creates them in one SubscribeManyAsync; per-node failures are named in
  StatusMessage, a whole-batch failure adds nothing. RestoreSubscriptionsAsync batches too.
- CLI: ConnectionLossWatch ends subscribe/alarms when the service lands Disconnected on its
  own, or stays out of Connected past --reconnect-timeout (default 300 s, 0 = no limit):
  WARNING line, summary (subscribe adds 'Connection: LOST'), exit code 3. A recovery inside
  the window re-arms the watch.
2026-12-03 15:07:30 -05:00
Joseph Doherty 69f475392c fix(controlplane): #1051 coordinator dispatch seed + terminal writes off the actor thread; driver-operation audit write retried
H-6 remainder: ConfigPublishCoordinator runs the dispatch guard/seed (incl. the #977 superseded close) and the
Sealed/PartiallyFailed/TimedOut writes through RunDbWork - a pool-thread task whose outcome is applied on the actor
thread while a Busy behaviour stashes everything else. A failed write is rethrown when it reports back (same
restart-and-recover contract as before); recovery runs the same work inline (failure = failed load).
H-3 remainder: a transient Restart/Reconnect ConfigEdit audit failure is retried (1 s doubling, 30 s cap, 6 attempts);
a ConfigDb rejection (poison allowlist) is not.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 15:07:25 -05:00
Joseph Doherty eb859fda52 perf(ablegacy): #1031 memoise the parsed address per authored tag; bound RMW gates and refusal log by the authored set; identity-checked single-tag eviction 2026-12-03 15:06:28 -05:00
Joseph Doherty e840ec1fbc fix(scripting): #1056 refuse a {{equip}} token in a verbatim/raw/interpolated path literal — editor diagnostic + deploy-gate refusal 2026-12-03 15:05:40 -05:00
Joseph Doherty 0245641720 fix(modbus): #1029 RTU reply must answer its request (FC + write-echo address); e2e rebuild-with-kept-driver; #1055 AutoReconnect=false redials once after a caller-cancel discard
#1029: ModbusRtuFraming.ReadResponsePduAsync takes the request PDU and refuses a CRC-valid, right-unit reply whose
function code (exception frames included) or write-echo start address differs (new DesyncReason.ResponseMismatch).
Runtime.Tests e2e: a full rebuild with a kept real ModbusDriver (deadbanded tag, same device value) leaves no node at
BadWaitingForInitialData; falsified by removing the S-2 baseline clear. V3ArtifactSeeder gained driverConfigByDriver.

#1055 (Modbus half): the RTU transport's caller-cancel teardown now grants ONE redial even with AutoReconnect=false, so
an unsubscribe/probe cancel no longer leaves the transport dead until the 90 s watchdog re-init; a link fault still stays down.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-03 15:04:36 -05:00
Joseph Doherty 0ef9a31b28 feat(historian): #1007 one-time revival of 'max attempts' dead letters; #1034 stalled alarm S&F queue detection (status, log, gauge, Degraded health)
#1007: LocalDbStoreAndForwardSink.ReviveMaxAttemptsDeadLetters requeues only rows whose last_error is exactly the pre-#976 'max attempts (N) exceeded' (idempotent, replicates through LocalDb); driven by AlarmHistorian:ReviveMaxAttemptsDeadLetters for one restart. Runbook in docs/AlarmHistorian.md.
#1034: AlarmHistorian:StallThresholdHours (default 2, 0 disables) -> HistorianSinkStatus.Stalled/LastProgressUtc, transition logs, otopcua.alarm_historian.queue.* gauges, Degraded 'alarm-historian' readiness check.
Both touch the same sink/options/registration files, hence one commit.
2026-12-03 15:04:03 -05:00
Joseph Doherty 65212dd471 fix(adminui): #1050 Galaxy ack identity gets an explicit 'Empty password' option
A blank password box means 'keep the stored password' (#997 A-4) and is refused first time,
so an account whose password is genuinely empty could not be mapped. The /apikeys editor
now has an 'Empty password' checkbox (disables + clears the box) that calls the new
IApiKeyGalaxyAckIdentityService.SetWithEmptyPasswordAsync: writes an empty password secret
first, then the user, audited like any set. The driver already accepts an empty password.
2026-12-03 15:03:27 -05:00
Joseph Doherty 16c8b7ffad fix(editor): #1025 analyse scripted-alarm predicates as bool Run(AlarmPredicateContext) — predicate mode on the analysis endpoints, Monaco and the ScriptEdit page 2026-12-03 15:03:22 -05:00
Joseph Doherty 870f7b28dd perf(abcip): #1032 reuse the constant offset-0 read request per tag runtime; no boxed tuple per cancellable scheduler request 2026-12-03 14:58:46 -05:00
Joseph Doherty 4a6dfe04b3 fix(adminui): #1045 Galaxy driver form keeps KeepAlive* keys and every unmodelled key on save
- KeepAlivePingDelaySeconds / KeepAlivePingTimeoutSeconds get form fields and round-trip
  through FromRecord/ToRecord (a 0 = no-pings opt-out used to reset to 15 on any save).
- Save overlays only the form-owned paths onto the stored JSON (DriverConfigJsonOverlay,
  as AbCip/AbLegacy do), so a key the form does not model survives.
- Guard test: every leaf the record serialises is an owned path.
2026-12-03 14:58:01 -05:00
Joseph Doherty 682ab34137 fix(uns): #1040 every effective-name computation goes through EquipmentReferenceMap.EffectiveName
The two sites the issue named (DataConnectionValidator, LocalExportCatalog line 56) were already
converted by #1002; the remaining inline copies were not. EquipmentReferenceMap.EffectiveNames itself
used '??', so an empty override dropped the reference instead of naming it after its tag; the
artifact-side ACL resolver used IsNullOrWhiteSpace. Both now agree with the one rule, as do the
UnsTreeService rows, the composer and the local-export alarm reservation.
2026-12-03 14:57:44 -05:00
Joseph Doherty 52d2acad25 fix(focas): #1036 a short macro/parameter payload publishes BadTypeMismatch, not BadCommunicationError 2026-12-03 14:56:28 -05:00
Joseph Doherty bd973f2ea7 feat(historian): #1046 a QuestDB WAL visibility give-up is a metric (counter + recent-failure gauge), not only a log line
Also records the #1008 finding in docs: the fixture's 0-row readback was the designed visibility timeout under host load, not a writer/reader defect.
2026-12-03 14:56:16 -05:00