Commit Graph

417 Commits

Author SHA1 Message Date
Joseph Doherty 00ac75e33a Merge scripting follow-ups: one shared compile rule for editor + gate, CS0161/injection now flagged in the editor (#1063), worker applies the result materialisation cap (#1064), {{equip}} in Calculation scripts refused at gate + editor (#1065) 2026-12-03 16:49:40 -05:00
Joseph Doherty 73f49eaf32 fix(scripting): #1063 one compile-refusal authority for editor and deploy gate (ScriptCompileRules + the runtime's own wrapper text) — CS0161 and wrapper injection are now flagged in the editor; #1065 {{equip}} in a Calculation script is refused by the gate and by a new Calculation editor mode
#1063: the Monaco diagnostics dropped every Roslyn error located in the synthesized
wrapper as 'phantom', so CS0161 (not all code paths return a value, pinned on Run)
passed the editor and failed the deploy gate. ScriptCompileRules (Core.Scripting) now
states which diagnostics refuse (every Error, wherever located; LMX001/002 injection)
and which sources skip the compile (blank/passthrough value scripts); ScriptEvaluator
and the editor both use it, and the editor wraps with ScriptEvaluator.WrapperPreamble/
WrapperSuffix instead of its own copy. Wrapper-located refusals are drawn on the
script's last line. EditorGateParityTests runs one corpus through editor and gate in
all three modes.

#1065: a Calculation tag is raw/device-level with no equipment and its seam never
substitutes {{equip}}, so such a script deployed clean and read Bad forever. Refused
rather than substituted: EquipTokenLiteralScanner.FindInCalculation is run by
RoslynDeployScriptChecker for every Calculation use (before the passthrough shortcut,
outside the shared VT/Calc cache) and by the editor in the new 'calculation' mode
(Calculation tag editor; ScriptEdit defaults to it when a Calculation tag uses the
script).
2026-12-03 16:47:14 -05:00
Joseph Doherty 8230302765 perf(ablegacy): #1073 memoise the read plan per ordered reference list (bounded, dropped on reinit/shutdown, refusals applied at use) 2026-12-03 16:30: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 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 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 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 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 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 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 52d2acad25 fix(focas): #1036 a short macro/parameter payload publishes BadTypeMismatch, not BadCommunicationError 2026-12-03 14:56:28 -05:00
Joseph Doherty da467c9675 docs(sql): #1042 MySQL read-only session is not a boundary; #1043 ODBC to SQL Server trigger row count and its remedies 2026-12-03 14:54:34 -05:00
Joseph Doherty 4dbacd840c fix(mqtt): #1044 plain DateTime writes publish ISO-8601 UTC, not the invariant MM/dd/yyyy form 2026-12-03 14:54:02 -05:00
Joseph Doherty 763ca0eedd Merge security review fixes: sandbox refuses async/stackalloc/MethodImpl, unwinding-overflow guard, deep-data types (#971); T-SQL ScriptDom single-SELECT guard (#974); Auth 0.5.0 directory re-query on revalidation (#975); fleet-diagnostics target check (#973) 2026-12-03 12:27:35 -05:00
Joseph Doherty 35d14936ac fix(sql): #974 review — parse SqlServer/Odbc named queries as T-SQL; ';' is not a statement boundary
The named-query guard's only statement boundary was ';', but T-SQL runs
';'-less batches: 'SELECT 1 COMMIT KILL 55', '... COMMIT DISABLE TRIGGER ALL ON
DATABASE', '... COMMIT SHUTDOWN WITH NOWAIT' and a TEXTPTR/WRITETEXT write were
all accepted for SqlServer AND Odbc — a COMMIT ending the rolled-back
transaction, then anything not on the keyword list.

For SqlServer, and for Odbc / no provider (backend unknown: strictest reading),
SqlReadOnlyStatement now also parses the statement with
Microsoft.SqlServer.TransactSql.ScriptDom 180.154.0 (central package pin; both
QUOTED_IDENTIFIER settings) and requires exactly one batch holding exactly one
SelectStatement, no INTO, and no OPENQUERY/OPENROWSET/OPENDATASOURCE. Odbc '?'
markers are read as variables for the parse. The lexical guard stays as a
second layer.

Tests: SqlReadOnlyStatementTransactSqlTests (11 batch strings x SqlServer/Odbc/
none, pass-through rowsets — all failed first; CTE/subquery/window/param/UNION/
FOR XML/OPTION and ODBC '?' positive controls). SqlNamedQueryTests' SQLite-backed
Odbc stand-in used the T-SQL reserved word 'top' as an alias (renamed).
Live (SQL Server 10.100.0.35,14330): SqlServerNamedQueryBatchLiveTests proves
'SELECT 1 AS v COMMIT UPDATE ...' commits the old way, the guard refuses it,
and a CTE+window+subquery+@param query reads Good; SqlServerReadTests /
write-mode / trigger suites unchanged (30/30). Class comment and
docs/drivers/Sql.md corrected.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-12-03 12:21:23 -05:00
Joseph Doherty eb78875c24 fix(galaxy): #991 review — a re-advise pass never dials on a swapped session; dropped-event resync is rate-limited and coalesced
- ReadviseSubscriptionAsync: a reconnect completing between two subscriptions of a pass
  (dropped-event resync loop had no per-iteration check) sent the next SubscribeBulk to the
  NEW gateway session under the OLD session number; TryRebind refused it (SessionChanged)
  and the live new-session advises were never bound or released, then duplicated by the
  replay. The pass now refuses to dial once its session moved. Releasing afterwards was
  rejected: once the session moved, which session issued the reply's handles is ambiguous and
  old numbers are reused (#861); not dialling is the unambiguous fix.
- Dropped-event resync passes are at least 5 s apart (DropResyncMinInterval); drops reported
  meanwhile coalesce into the next pass, so repeated overflow bursts no longer churn
  re-advises into the overflowing channel.
- Test seams: ResyncDroppedHandlesForTestsAsync, NotifyEventsDroppedForTests,
  DropResyncMinIntervalForTests; AdvisingSubscriber gained after-subscribe/unsubscribe hooks.
2026-12-03 12:07:28 -05:00
Joseph Doherty 5dcb766fd1 fix(abcip): #983 review — probe timeout bounds only the probe read, not the cold initialisation
P-22 moved the probe's own short timeout (default 2 s) onto the probe runtime's cold
InitializeAsync too — on the native transport the TCP connect + RegisterSession + Forward
Open, which the pooled connection bounds with the driver's Timeout. A slow-but-healthy open
longer than the probe timeout never completed: the probe re-created and timed out every
tick and the host stayed Stopped. Initialisation now runs under the loop token only; the
probe timeout bounds the read.
2026-12-03 12:03:49 -05:00
Joseph Doherty 84a0226bfa fix(abcip): #983 review — per-call device latch only on real connection failures; never evict handles that were not attempted
- On libplctag each tag is its own request with its own timeout: one tag's Timeout latched
  the whole device for the call, failing (and evicting) every later sibling. The latch now
  fires on BadConnection/Abort/socket-IO failures always, and on Timeout only on the native
  transport, where a reply timeout faults the device's one shared channel
  (AbCipRefusals.LatchesDevice).
- Items latched out were never attempted: their handles are kept (evicting re-created, and
  for a sole lease holder re-Forward-Opened, each one next poll). The failed item's handle is
  still evicted, and a throttled cold create now latches the device so kept warm handles
  fail fast instead of each paying a timeout.
- AbCipDeadDeviceBatchTests recovery leg: the device's kept warm handles answer again.
2026-12-03 12:03:14 -05:00
Joseph Doherty 7374fdd0e4 fix(modbus): #981 review — MELSEC no longer claims the generic DI<n> discrete-input mnemonic
The S-8 gate (no generic mnemonic fallback once a family grammar claimed the address) made
the MELSEC D-register grammar, which claimed every D prefix, reject DI100 as a malformed
D-register. MELSEC has no DI device, so DI... is no longer claimed; every other D... stays
native and DL205's non-octal C rejection is untouched.
2026-12-03 11:58:15 -05:00
Joseph Doherty b74b5162d2 fix(ablegacy): #984 review — MicroLogix profile supports L files
MicroLogix 1100/1200/1400/1500 all have L (32-bit integer) files (only the ML 1000 lacks
them, and the family flag cannot tell it apart — an ML 1000 refuses an L read itself, per
tag). SupportsLongFile: false made the P-5 per-tag rule refuse every Long tag on the family
the parser, coalescer and L-bit RMW already handle. The per-tag rejection tests now pin
PLC-5, the one family without L files. Pending hardware confirmation: one L-tag read on an
ML 1400 (Vitamine press fleet).
2026-12-03 11:57:09 -05:00
Joseph Doherty 2d28f5ea8a fix(heidenhain): #990 review — host-facing state keyed by host:port survives re-init; dispose cancels before closing the session
- _facing was keyed by runtime instance: it grew one entry per re-init (watchdog every ~90 s
  while a control is down) and each new runtime restarted at Unknown, so a down control's
  status flapped Stopped -> Unknown -> Stopped across every re-init. Now keyed by host:port,
  pruned to the configured hosts at init and cleared at shutdown; a runtime no longer in
  _devices (being stopped by re-init/shutdown) announces nothing.
- DeviceRuntime.DisposeAsync cancels the loop BEFORE closing the session: closing first woke
  an in-flight read while the token was live, and the loop's normal tail set Backoff (host
  Stopped) for a plain stop. Seam AfterSessionCloseForTests makes the race deterministic.
2026-12-03 11:55:28 -05:00
Joseph Doherty 7a6e623485 fix(galaxy): #991 review — refuse SecuredWrite/VerifiedWrite locally with BadUserAccessDenied; gateway caller refusals are access refusals
G-1 routed secured/verified writes to WriteSecured, which cannot succeed (no AuthenticateUser
identity, no supervisory advise for it, the key needs invoke:secure), and the gateway's
refusal surfaced as BadCommunicationError.

- WriteOneAsync refuses SecuredWrite/VerifiedWrite BadUserAccessDenied before AddItem/advise/
  Write (one Warning per attribute, no health impact). InvokeWriteSecuredAsync removed until a
  real per-caller identity flow exists.
- gRPC PermissionDenied/Unauthenticated on the write or its supervisory advise ->
  BadUserAccessDenied (handle still forgotten; not counted as advise_failed).
- The classification seed is KEPT: it is what makes the refusal local. Unseeded, a secured
  attribute takes the supervisory raw path and the refusal would rest on MXAccess answering
  MX_E_SecuredWrite (1012) to a supervisory write, a code no live capture has shown.
- docs/drivers/Galaxy.md + Configuration.md updated.
2026-12-03 11:52:22 -05:00
Joseph Doherty f7a0dad7e3 fix(mqtt): #988 review — deterministic primary-host claim id per (hostId, group) + re-assert over a foreign OFFLINE
The M-3 fix made the blank-clientId claim id random per instance, breaking single-claim
exclusivity on a redundant pair: a Secondary cold-starting before its cluster join claimed
alongside the Primary, and its stand-down OFFLINE was left retained, newer than the
Primary's ONLINE, with nothing to correct it.

- Claim id = spbhost-<12 hex of SHA-256(hostId, groupId)>: a pair shares one id (broker
  takeover keeps the claim single; the evicted Primary reconnects and re-asserts), distinct
  groups/hosts differ; 20 chars.
- The claim subscribes to its own STATE topic. An OFFLINE seen while the claim is held (its
  own stand-down detaches first, so the echo is ignored) is re-asserted: ts <= session ts ->
  republish the session's ONLINE; newer ts -> fresh claim whose timestamp out-dates it
  (Sparkplug 3.0 edges ignore older STATE). Coalesced, <= 1 per 2 s. Reconnect re-subscribes
  before republishing so the takeover's leftover is seen.
- MiniBroker can inject a PUBLISH and records SUBSCRIBE filters; live pair test against the
  Mosquitto fixture.
2026-12-03 11:49:06 -05:00
Joseph Doherty 2827a4c3bf fix(calculation): #995 change-triggered evaluations coalesce latest-wins per calc tag, so a poll cycle evaluates once against all its new inputs and the queue is bounded by the tag count
At most one evaluation is pending per calc tag; a re-trigger only moves its
timestamp forward and the dependency snapshot is taken when the pump dequeues
it. Previously every dependency arrival enqueued a separate evaluation per
dependent with a trigger-time snapshot: k inputs of one cycle ran k times
(publishing intermediates computed from mixed old/new inputs) and the queue had
no bound when triggers outpaced the pump. The out-of-process batch pump now
dequeues every pending tag once per batch.
2026-12-03 11:05:32 -05:00
Joseph Doherty aecd2461c1 Merge #991: Galaxy secured-write map filled at init, dropped pump events resync, deploy-watch backoff, replay-gap handle release, HTTP/2 keep-alive on driver channels 2026-12-03 10:36:36 -05:00
Joseph Doherty b9955f6946 Merge #988: MQTT bad filter isolated per tag, Sparkplug primary-host unique id + re-claim, rebirth counter fixed, subscribe replay race, browse honours refusals 2026-12-03 10:35:43 -05:00
Joseph Doherty edec69eed0 docs(galaxy): #991 secured-write seeding, dropped-event resync, gap handle release, keep-alive channels, quality limit bits, deploy-watch pacing 2026-12-03 10:35:25 -05:00
Joseph Doherty 028e68edb0 fix(mqtt): #988 one bad filter/tag no longer takes the driver dark; Sparkplug rebirth cap, primary-host claim and browse verdicts behave correctly
- M-2: malformed topic filters are rejected at the reader + deploy gate (MqttTopicFilterRules);
  the manager re-checks, chunks SUBSCRIBEs at 100 filters and bisects content refusals only.
- Found while pinning M-2: retain handling rides only a 5.0 SUBSCRIBE; on 3.1.1 one
  retainSeed:false tag made MQTTnet refuse the whole batch.
- M-1: metadata rebirths capped per scope, counted when sent, re-armed only by clean data
  (not by the NBIRTH a request provokes); gap rebirths escalate to 5 min after 3 in a row.
- M-3: blank clientId => random per-instance spbhost-<12 hex> claim id (was literal -spbhost).
- M-6: a Faulted/Disposed claim connection is not held; it is disposed and re-claimed.
- M-9: subscribe-time replay re-raises a value pushed mid-replay (plain + Sparkplug).
- M-11: same-type Sparkplug arrays are served by copy, not boxed element by element.
- M-12: span JSONPath walk; span pre-filter for unauthored Sparkplug nodes; guarded Debug
  logs; WarnOnce without ConcurrentDictionary.Count.
- M-13: handles a later subscribe fully took over are retired.
- M-14: browse open fails on a refused CONNACK or root SUBACK.
- M-15: Scalar/Raw booleans publish true/false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 10:35:21 -05:00
Joseph Doherty c6dec9ed7f Merge #974 + #987: dialect-aware Sql read-only guard + read-only execution (13 bypasses closed), provider-semantics key matching, trigger-safe SQL Server rowcount 2026-12-03 10:34:08 -05:00
Joseph Doherty 65c4330a68 fix(sql): #974 #987 named queries are lexed per dialect and run read-only + single-statement; key rows attribute by server semantics; SQL Server writes count only the target statement
#974 (S-7) — the named-query guard had one lexer for five dialects and took live SQL for literal text
where a provider ends a literal earlier (MySQL backslash escapes, PostgreSQL dollar quotes, T-SQL ]],
nested comments, MySQL # / "--x", bare-CR line comments, Oracle q'..'). All 13 bypass strings were
accepted; the MySQL and PostgreSQL ones were executed against the live fixtures and the smuggled
UPDATE committed past the always-rolled-back transaction.
- SqlReadOnlyStatement (own file) lexes per provider and REFUSES constructs dialects disagree on;
  Odbc / no provider = every dialect must agree. Factory and AdminUI form pass the provider; the form
  re-validates queries on a provider change.
- ISqlDialect.BeginNamedQueryAsync / SealNamedQueryCommand / EndNamedQueryAsync: PostgreSQL and Oracle
  SET TRANSACTION READ ONLY; MySQL read-only session + transaction (restored after); PostgreSQL rewrites
  @name markers to positional $n (a parameterless query gets one unused typed $1) so Npgsql sends the
  text unsplit and the server refuses a second statement.

#987 (S-6) — key-value rows are attributed by SqlKeyMatcher (exact, then typed / padding-insensitive,
then case/accent-insensitive — only for rows the server matched); a named query's rowKey uses the
exact + representational stages only.
#987 (S-10) — SQL Server table writes read the target statement's own @@ROWCOUNT through an OUTPUT
parameter; SqlClient's ExecuteNonQuery sums trigger DML (reproduced: 1 + 2 audit rows = 3, every write
rolled back BadConfigurationError).

Tests: per-dialect bypass theory + positive controls, matcher + SQLite collation/affinity attribution,
Postgres seal, dialect-hook wiring, SQL Server write-plan capture; live NamedQueryBypassLiveTests
(PG/MySQL/Oracle), SqlServerTriggerWriteLiveTests, MySQL writing-function now refused.
2026-12-03 10:33:45 -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 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 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 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 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 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 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 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 601ade2243 docs(opcuaclient): #954 note AdminUI field 2026-12-01 20:18:19 -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 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