- 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.
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.
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.
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.
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.
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.
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.
Scheduler faults everything queued behind a failed channel exchange; per-device read
windows plus a per-call fault latch fail a dead device's remaining items fast; throttled
creates no longer throw+log per tag (one Warning per device per outage, Info on recovery).
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.
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.
#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).
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.
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.
- ProjectedDataAccess: internal queued/handled renewal-tick counters (RenewalTicksQuiescentForTests) so a test can wait until every tick a clock advance fired has been handled.
- ManualTimeProvider.AdvanceInOneStep: all timers see the final instant (successor lease is stamped from request start).
- Live_predecessor_cadence...: Task.Delay(20/100) pacing replaced by advance-and-settle; 10 s waits widened.
- Two_sdk_cadences...: 9 s jump in one step (deterministic successor issue time, fixes the 7.45 s margin flake); read each item's notifications until its expected value (8 vs 9 flake); barrier timeout widened.
Residual ~1% hang tracked in #968.
When the invoker threw without running the dispatch delegate (open breaker /
bulkhead) after the claim had already been completed RejectedBeforeDispatch
by someone else, Complete(RichRejected) returned false, the path answered
OutcomeUnknown and never completed the physical task. The late-write slot,
the (driver, reference) target and the ticket's byte lease stayed reserved
for the process lifetime, so every later write to that tag was refused as
'Outstanding driver write capacity exhausted'.
Both catch paths now go through FailRichAttempt: an undispatched terminal
claim can never dispatch (dispatch is a CAS from pending), so the physical
task completes with the claim's pre-dispatch outcome and the caller hears
RejectedBeforeDispatch. Only a dispatched claim stays Unknown and is left
to the driver's own completion.
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.
The late-write observer released the physical slot on its own continuation of
the driver task, while RunRichWriteAsync replied and told WriteCompleted on
another. A next write to the same target (queued, or sent right after the
reply) could reach TryReserve before the release and be rejected with
'Outstanding driver write capacity exhausted' although nothing was
outstanding. LateWriteReservation.Observe now returns a task that completes
after the slot is released; the actor awaits it (when the physical write has
finished) before replying and freeing the tag. The flaky unit test waited on
the lifetime counter, which is disposed just before the release - it now
awaits the settled task.
Repro: 200 sequential same-target actor writes failed 3/3 runs (no load);
0 failures in 15 runs at load avg ~468. Unit signal: lifetime-wait 22-39 /
2M false 'slot busy', settled-wait 0/2M.
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.
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).
#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.
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.