Commit Graph

3092 Commits

Author SHA1 Message Date
Joseph Doherty b2ad10c1f0 test(grpc-data): A1 — the live mark-order test awaits the log, not IsKnown (flaked under load: the fake's alarm write sets known) 2026-11-24 11:45:43 -05:00
Joseph Doherty d377e3775a fix(grpc-data): A1 review round 2 N3 — FOCAS does not signal a condition a truncated alarm list shows inactive
A list cut off at the per-read cap may hide the alarm a selector matches; a condition that matched nothing on such a
read stays unknown instead of being signalled known-inactive.
2026-11-24 11:35:01 -05:00
Joseph Doherty 4a6c894268 fix(grpc-data): A1 review round 2 N1 + N2 — withdrawals are never dropped; a discarded mark re-arms F5
N1: the deferral keeps every withdrawal (Known: false) regardless of capacity; a known mark beyond capacity is
dropped (unknown is safe) and its source remembered.
N2: a G3-discarded (or overflowed) deferred mark is reported to its sender as OpcUaPublishActor.ConditionMarksDiscarded
(the scripted host is skipped); DriverHostActor puts those conditions back in the F5 window from now, so a driver
that does not re-signal gets the diagnostic.
2026-11-24 11:34:12 -05:00
Joseph Doherty 4c8539b897 fix(grpc-data): A1 review round 2 F4 — a Galaxy sentinel signals only a stream opened under the live subscription
The feed raises a new IGalaxyAlarmFeed.StreamOpened (default no-op accessors) before each stream's first message;
GalaxyDriver records the live subscription then, and its sentinel signals only if that is still the live one —
so refs whose snapshot entries arrived before (or without) the subscription are never signalled. The handle is
now added before the feed starts, so the first stream opens under it.
2026-11-24 11:30:30 -05:00
Joseph Doherty ea19c3ed4f fix(grpc-data): A1 review round 2 F3 — an MTConnect delta signals the conditions it touched
A condition Unavailable at baseline never became known: its later Normal is a quality-only emission and only full
emissions signalled. A delta emission now signals its touched conditions whose level is not Unavailable, after the
events and under the same lock (tracker baseline required). Sample_delta_does_not_signal… (which pinned the old
behaviour) is now Sample_delta_signals_its_touched_conditions_and_a_rebaseline_signals_all.
2026-11-24 11:28:14 -05:00
Joseph Doherty 4d21ccafa1 fix(grpc-data): A1 review round 2 F1 + F2 — an ack-revert establishes nothing; every Good edge withdraws; Bad edge forgets unsignalable
F1: RevertNativeAlarmAck projected through WriteAlarmCondition, which re-marked a comms-withdrawn native condition
known; with the Good edge's conditional withdrawal skipped (GoodSinceUtc null) it read known-inactive-Good until the
replay. AlarmStateUpdate.EstablishesState (false for the revert) rides a new default sink overload
WriteAlarmCondition(..., establishesState) through the deferred and SDK sinks to the node manager, and every Good
edge now withdraws unconditionally.
F2: the Bad edge clears the unsignalable set, so a stale report cannot arm the backstop on the next Good edge.
The rig's CollectAlarmTraffic skips withdrawals (every edge now sends one).
2026-11-24 11:26:56 -05:00
Joseph Doherty 7489456843 test(grpc-data): A1 real-driver test fishes the known mark, not a withdrawal 2026-11-24 11:03:52 -05:00
Joseph Doherty 27a59716aa Merge A1 review round 1 fixes 2026-11-24 11:03:44 -05:00
Joseph Doherty 2fdf9d87c2 fix(grpc-data): A1 review nit — colliding condition placements are logged at Warning (locally)
DistinctPlacements still drops every placement of an address claimed twice (fail closed); Compile takes an
optional logger (the coordinator passes its own) and the drop is reported in the local log only.
2026-11-24 10:44:00 -05:00
Joseph Doherty 16166c21e5 fix(grpc-data): A1 review S3 + S4 + nits — snapshot start cursor, readiness cut with the snapshot, failed applies
- S3a: SnapshotConditions reads a start cursor under Lock before enumerating keys; every slice carries it, so a
  condition materialised and activated between the enumeration and slice 1's hold is covered by deltas after it.
- S3b: each hold captures the apply generation (bumped when a rebuild begins) and the complete flag; slices carry
  them and ConditionSnapshotSlice.IsCompleteSnapshot / ConditionStateHub.IsSnapshotCompleteFor detect a rebuild
  that straddles a multi-slice snapshot. An empty scope still takes one hold.
- S3c: maxConditionsPerHold is clamped to MaxConditionsPerHoldLimit (5,000).
- S4: CompleteAddressSpaceApply(bool succeeded) (new default sink member, forwarded by the deferred and SDK sinks);
  the publish actor passes !Degraded. A failed/degraded rebuild keeps readiness false and its pending removals,
  emitting no removal records; the next successful apply completes it.
- Nits: ConditionStateRecord.UnshelveTimeUtc (timed-shelve expiry); ConditionStateHub.Read has a bounded default.
2026-11-24 10:43:04 -05:00
Joseph Doherty 3b242f5839 docs(grpc-data): plan §5.2 condition_key formula matches ConditionKeys.Derive (realm byte, upper-cased cluster) + golden-vector test 2026-11-24 10:37:02 -05:00
Joseph Doherty f08ca7d9e3 fix(grpc-data): A1 review S2 + F5 re-arm + nits — native known is withdrawn on comms loss
- The Bad connectivity edge (and a Good edge with no Bad edge since the last Good one, or from a new child
  incarnation) sends MarkConditionsKnown(Known: false) for the driver's condition nodes, ahead of the quality
  annotation, so an alarm raised during an outage never reads known-inactive, Good after the reconnect. Stopping a
  child (a respawn) withdraws too.
- DriverInstanceActor stamps a connection epoch (bumped on every Connected entry) on the initial-state signal and
  on ConnectivityChanged(Connected); a signal raised under an earlier connection is dropped by the child and the host.
- G3 never discards a deferred withdrawal.
- F5 'still unknown' follows the node manager: a native transition takes its ref out of Pending.
- Re-arm F5 at the alarm-ref reindex for refs a deploy adds while connected (defensive: today such a deploy
  respawns the driver because its RawTags are folded into its config).
- Nits: signals/edges from a retired or non-current child never (re)create a tracker; the injected clock replaces
  DateTime.UtcNow.
- Primary demote/re-promote: checked, not a stale-known window — drivers and their condition writes run ungated on
  both pair members.
2026-11-24 10:37:02 -05:00
Joseph Doherty 3c2cf96af2 test(grpc-data): A1 L4 — signal-latency LiveIntegration harness + measured evidence (OpcUaClient, FOCAS, MTConnect, AbCip; Galaxy/Heidenhain blocked) 2026-11-24 10:32:14 -05:00
Joseph Doherty 141e4412d2 test(grpc-data): A1 — real-driver signal rig (StartRig over IDriver), FOCAS end-to-end; driver test classes in the A1 manifest 2026-11-24 10:25:47 -05:00
Joseph Doherty 9167ea2323 feat(grpc-data): A1 — MTConnect signals after each full condition emission over a /current baseline 2026-11-24 10:22:18 -05:00
Joseph Doherty add4bc81e0 feat(grpc-data): A1 — Heidenhain signals per control after each Good alarm walk 2026-11-24 10:19:35 -05:00
Joseph Doherty 6ba5185f10 fix(grpc-data): A1 review S1 — a scripted condition is established only by a completed predicate
NoteInputsEstablishment raised 'established' before AreInputsReady, the evidence check and the predicate, so a
pushed-but-Bad input (driver down), a runner that was not up or a predicate timeout produced a known-inactive
record though no predicate had completed. The flip is now raised after the first predicate evaluation that
completes since the load or a revert; reverting an input to never-pushed still withdraws it.
2026-11-24 10:19:03 -05:00
Joseph Doherty 8f1be25673 feat(grpc-data): A1 — AbCip signals per node at the end of each ALMD/ALMA poll tick 2026-11-24 10:18:29 -05:00
Joseph Doherty e9d82a6a5a fix(grpc-data): A1 review B1 — a scripted projection never marks its condition known
WriteAlarmCondition set _conditionStateKnown for every projection. Scripted Active is not persisted, so the
post-restart re-assert of a restored unacked/shelved/disabled alarm (or the re-projection of an operator ack
before the inputs arrived) produced a known=true, Active=false record no predicate decided (T2 case i).
Only native transitions are established states now; scripted known-ness comes only from MarkConditionsKnown.
2026-11-24 10:17:34 -05:00
Joseph Doherty dbbc35e83d feat(grpc-data): A1 — FOCAS signals per device after each successful alarm read 2026-11-24 10:16:39 -05:00
Joseph Doherty 4e984b160e feat(grpc-data): A1 — OpcUaClient signals on RefreshEnd, sequential alarm publishing, Unsignalable without ConditionRefresh 2026-11-24 10:14:56 -05:00
Joseph Doherty b7f742efda feat(grpc-data): A1 — Galaxy raises InitialAlarmStateDelivered on every snapshot_complete sentinel 2026-11-24 10:10:30 -05:00
Joseph Doherty eb688a4ee0 Merge A1 keys/placements/ids into A1 core 2026-11-24 10:02:34 -05:00
Joseph Doherty 0eb533991b test(grpc-data): A1 — a strict publish-probe test ignores the new input-establishment mark 2026-11-24 09:53:36 -05:00
Joseph Doherty a248616761 feat(grpc-data): A1 scripted OnInputsEstablished — engine flip queued last in pending, host holds flips during a load until after the re-assert, MarkConditionsKnown on the alarm chain 2026-11-24 09:38:51 -05:00
Joseph Doherty 47bf3a1cad test(grpc-data): A1 native initial-state signal through the real driver actors — known only on signal, F2 delayed ordering, F5, backstop, G5; reusable NativeAlarmSignalTestBase + FakeSignallingAlarmDriver 2026-11-24 09:35:05 -05:00
Joseph Doherty d64578b1c5 feat(grpc-data): A1 MarkConditionsKnown in OpcUaPublishActor — deferred beside alarm states, replayed after them (F2), discarded on a source's dropped/skipped projection (G3) 2026-11-24 09:27:53 -05:00
Joseph Doherty 923c2511a3 feat(grpc-data): A1 ConditionStateHub — bounded partitions, per-reader reset, snapshot_complete readiness, F5 diagnostic; wired to the node manager 2026-11-24 09:24:28 -05:00
Joseph Doherty 066372ce41 test(grpc-data): A1 — condition ids, condition_key (m-T6), secret validation, UNS-only no-RawPath property test; A1 manifest key 2026-11-24 09:23:06 -05:00
Joseph Doherty 6836efaeb9 feat(grpc-data): A1 origin condition state in the node manager — delta callback, state_known, activation marker, sliced snapshot, MarkConditionsKnown sink seam, IAlarmInitialStateSignal 2026-11-24 09:22:08 -05:00
Joseph Doherty 7498f1ce82 test(grpc-data): H4 review 7 — diagnostics snapshot round-trips on the cluster serializer; old-shape payloads decode
Round-trips NodeDiagnosticsSnapshot (OriginHistory, HistoryVariants and the other H4 members) through
the serializer Akka picks for the fleet-diagnostics reply, and decodes payloads stripped of the H4
members. The origin flag is renamed NoPeerTrafficYet (default false): Akka's JSON serializer fills a
missing constructor argument with the CLR default, so a payload without it must never claim it.
2026-11-24 08:41:52 -05:00
Joseph Doherty 2fba036176 fix(grpc-data): H4 review 5+6 — AdminUI display: 'unavailable' without handshake evidence; every bit rendered
HistoryServed reads 'unavailable' when neither features nor variants were reported. Features()
and DroppedBits() render every set bit across all 32 (bit 31 included), named when known and hex
otherwise, so an unknown bit is never hidden beside a known one (#919).
2026-11-24 08:39:46 -05:00
Joseph Doherty 79cf50d50e fix(grpc-data): H4 review 4 — an origin chunk holding its page cursor is one open continuation, not two 2026-11-24 08:39:02 -05:00
Joseph Doherty 005720bd02 fix(grpc-data): H4 review 2 — a fresh origin reports 'no peer traffic yet', not 'unavailable'
The origin services are composed on the first peer call (they need the driver host actor), so
CaptureOrigin returned null until then and a fresh H4 origin read like a pre-H4 build. The DI
singleton now probes the same deferred history port for backend availability and reports zeros
with PeerServicesStarted=false; the page says 'no peer has called since start'.
2026-11-24 08:37:38 -05:00
Joseph Doherty 2f11a9c609 fix(grpc-data): H4 review 1 — count every projected history answer where its status is set
The consumer reads counter was fed from the gateway's outcomes, so limiter refusals, a spent
deadline, a count mismatch and refusals before the gateway were never counted, and a serve-time
fault after the gateway returned counted Good. The node manager now reports each projected node
once with the status the client sees (IProjectedHistoryAccess.RecordAnswered); a fault that
escapes to the SDK counts every projected node of the request Bad. Variant gains 'modified'.
2026-11-24 08:35:55 -05:00
Joseph Doherty e3f21cb86c feat(grpc-data): H4 remote-history diagnostics and metrics
Consumer and origin history evidence for data connections (plan §6):
- DataConnectionHistoryDiagnostics: otopcua.dataconn.history.reads{variant,status_class,side} and
  otopcua.dataconn.history.continuations.active{side} on the exported OtOpcUa meter (the H2 origin
  counter sat on a private meter the host never exported); the plan's unknown-bits counter is the
  existing X0 otopcua.dataconnection.unknown_operations_dropped, reused
- per-connection projected answers by status class and open consumer continuations (settled on
  resume claim or release); origin sessions, open continuations and answers by status class
- negotiated features and advertised history variants/aggregates per connection
- AdminUI data-connections page renders them plus the dropped unknown-operation bits (#919)
- H4 unit-phase manifest key
2026-11-24 08:01:57 -05:00
Joseph Doherty f1b23abcb4 fix(grpc-data): H3 review round 3 nits b/c/d — no origin cursor stranded on Bad, scope moves or a serve-time throw
- b: ProjectedHistoryAccess releases the prior origin cursor on any Bad answer
  to a resumed node (and on a mismatched answer) — an unsent refusal left it
  open at the origin; idempotent.
- c: DataConnectionDeploymentLease, when its scope moves while a history
  answer is in flight, releases the dropped answer's new continuations (best
  effort); resumed items are BadContinuationPointInvalid, fresh ones
  BadNoCommunication.
- d: ProjectedHistoryRead: a throw while serving outcome i (FromClr on an
  unconvertible value, a store fault) releases outcome i's cursor unless the
  store already owns it, and every later outcome's.

Each red on revert (mutation).
2026-11-24 07:15:16 -05:00
Joseph Doherty 30d66fdc7c fix(grpc-data): H3 review round 3 S5 — a cancel by redeploy/shutdown is not a timeout
GrpcDataConnection.ServeAsync mapped RpcException(Cancelled) without a caller
cancel to BadTimeout even when the linked channel-retired / scope / shutdown
token fired. That case is now BadNoCommunication (resumed:
BadContinuationPointInvalid), releases held chunk tokens and stops a split
request sending further sub-batches. ProjectedHistoryAccess's outer catch no
longer reads any escaped OperationCanceledException as a timeout: only the
caller's cancel or the deadline is BadTimeout, otherwise classified as
FailCancelled does. Red on revert (client test: scope moved mid-call); the
outer-catch change has no dedicated test (nothing reachable throws past
ReadGroupAsync's own catch).
2026-11-24 07:11:06 -05:00
Joseph Doherty 9c2d6273aa fix(grpc-data): H3 review round 3 S1/S2/S3/S6 — sub-batch split never strands tokens or breaks the origin's admission
GrpcDataConnection.ServeSplitAsync / ServeAsync:
- S2: each sub-batch carries at most one item per 256 B of the budget left
  (the origin's count <= MaxBytes/256 admission rule); the rest is
  BadTooManyOperations marked ConsumerBudgetRefused, unsent, and an unsent
  resumed item's origin token is released. Was: an RpcException, a recorded
  endpoint failure and BadNoCommunication.
- S3: a budget refusal inside a sub-batch's own assembly latches the budget
  spent; nothing more is sent.
- S1: anything escaping a later sub-batch (a caller cancel, a fault) disposes
  the collected answers and releases their new continuations.
- S6: an escape from the assembly (Verify failure, item mismatch) releases
  finished nodes' continuations, held chunk tokens and the rejected
  response's tokens; a later sub-batch's endpoint fault is RecordFailure'd,
  never swallowed.
- Nit a: after a sub-batch endpoint failure nothing more is sent to that
  endpoint; the rest is BadNoCommunication / BadContinuationPointInvalid.

Each test is red on revert of its fix (mutation).
2026-11-24 07:08:12 -05:00
Joseph Doherty 34e72de3d8 fix(grpc-data): H3 review round 3 S4 — budget stop keys on a typed consumer marker, not the diagnostic
ProjectedHistoryAccess stopped the request on any BadTooManyOperations whose
diagnostic contained "budget", which also matched the ORIGIN's "remainder
budget is full" refusal and then refused later nodes, including Good ones.
DataHistoryReadResult gains an internal ConsumerBudgetRefused flag (never on
the wire) set only by the gRPC connection's own assembly refusal. Red on
revert: the origin refusal of A refused B.
2026-11-24 07:01:28 -05:00
Joseph Doherty 7aaa98751a fix(grpc-data): H3 review round 2 — no batch probe; budget stop; orphan tokens; lease-retired status
1: the separate capability probe is gone (through the unary path a cancelled
probe recorded an endpoint failure and put the connection into discovery
backoff). Projected calls split at the deployed connection's batch size;
GrpcDataConnection splits again at the origin's advertised MaxBatchItems from
the capabilities the history call already negotiated, sharing the assembly
budget across sub-batches. 3: once the connection reports the assembly budget
spent, no further origin call is made. 4: an answer that never became an
outcome (mismatch, exception mid-answer) releases its new origin token. 5: a
cancel that is neither the caller's nor the deadline (a lease retired by a
redeploy) is BadNoCommunication / BadContinuationPointInvalid, not BadTimeout.
Flush delay on the access's clock. Docs: the request deadline covers the local
half too; shared non-local slots; split. Red/green for each by mutation.
2026-11-24 06:25:19 -05:00
Joseph Doherty 37cbeff480 fix(grpc-data): H3 review round 2 — one non-local history slot share; claim loop never leaks
Remote peers reading this node (OriginHistoryPort) and this node's projected
reads now draw on ONE N - max(1, N/4) semaphore, created together with the
N-slot batch limiter from the same N, so both together can never take the
last (local) slot (two independent first-use sizings could also disagree —
which made OriginHistoryLimiterTests order-dependent and hang the earlier
run). The projected claim loop releases every claimed cursor if anything
throws while the batch is assembled. Red/green: the shared-slot assertion
fails with a per-port semaphore.
2026-11-24 06:25:19 -05:00
Joseph Doherty 86c0934ad6 refactor(client): HistoryReadPageAsync is abstract; docs for the H3 review fixes
The page API is a required member of IOpcUaClientService / ISessionAdapter (the
fakes implement it). DataConnections.md: projected slot sub-limit, per-node
fault handling, request-order runs and sub-batches. Client.CLI.md: --aggregate
now asks for the server's default aggregate configuration.
2026-11-24 01:49:46 -05:00
Joseph Doherty 1237e9e6d1 fix(grpc-data): H3 review D1/D4/D6/D7 — probe cancel, sub-batches, flush wake-up, request-order budget
D1: a caller cancel (the projected deadline) during the connection's capability
probe escaped as RpcException(Cancelled) and faulted the whole HistoryRead; it
is now OperationCanceledException, the probe is capped by HistoryTimeout, and
ProjectedHistoryAccess fails any escaping fault per node (BadTimeout when the
deadline fired) and releases every cursor it owns. D4: calls are sub-batched at
min(the deployed connection's batch, the origin's advertised MaxBatchItems) and
at most one item per 256 B of the remaining assembly budget; a shortfall is
BadTooManyOperations per node, never an endpoint failure. D6: the release flush
is re-armed from a flag under its gate (no lost wake-up) and the stop source is
never disposed under a running flush. D7: calls are runs of consecutive request
positions read in request order, then the budget is charged in request order.
Float32 node over a Double-returning backend reads Good Singles end to end (no
KindMatches defect). Red/green for D1/D4/D7 by mutation; D6's race did not
reproduce red.
2026-11-24 01:48:12 -05:00
Joseph Doherty 585d5079eb fix(grpc-data): H3 review D2/D3/D5 — claimed cursors never leak; projected slot sub-limit
D2: Release() after TryClaimForResume() was a no-op, so a claimed cursor leaked
its origin continuation on every exit that never sent it (no gateway/identity,
deadline spent after the local half, limiter rejection, a gateway fault). New
ReleaseEvenIfClaimed() (at most once) on every post-claim exit; any exception
from the gateway now fails the projected half per node instead of escaping.
D3: projected reads hold at most N - max(1, N/4) of the N shared history batch
slots (OriginHistoryPort.RemoteSlots), Wait(0) => BadTooManyOperations for the
projected half, so a slow origin cannot starve local HistoryRead/HistoryUpdate.
D5: a Remote cursor presented to a local node (raw/modified/events take paths)
is released when it is taken. Red/green: each test fails with its fix reverted.
2026-11-24 01:40:18 -05:00
Joseph Doherty af06183412 fix(grpc-data): projected Processed values keep their aggregate's type
Found by the H3 live gate (H02): a Double Average of a UInt16 node was decoded
against the node's catalog kind and came back null + BadTypeMismatch per
interval (the result status stayed Good, which is why the wire test missed
it). Raw/AtTime values are still checked against the catalog kind; Processed
values accept any scalar kind. The wire test now asserts the interval's value.
Gate: re-browse the projected leaves after every deploy (a deploy retires cold
projected nodes; the same opaque ids come back).
2026-11-24 01:04:04 -05:00
Joseph Doherty 0a83c10ef6 fix(client): processed history reads ask for the server's aggregate defaults
Found by the H3 live gate (H02): Client.Shared sent the SDK's default
AggregateConfiguration (all false / 0), which the server refuses as a
non-default configuration (BadAggregateConfigurationRejected, #677) on local
and projected nodes alike, so CLI/UI --aggregate reads never worked against
it. Set UseServerCapabilitiesDefaults = true. OI regression test (red without
the fix) also covers HistoryReadPageAsync.
2026-11-24 00:55:52 -05:00
Joseph Doherty b50019db9c feat(cli): historyread --held-marker-file for hand-paged reads 2026-11-24 00:42:46 -05:00
Joseph Doherty 3b630ab1a9 feat(cli): historyread --page-size/--pause-after-page/--abandon/--release and --at-time
Hand-paged raw reads in one session print each page's status and continuation
(a refused resume is printed, not thrown), can hold the session across a
failover (resume when a file appears, then one fresh read), abandon a point
to the session close or release it explicitly. --at-time reads AtTime and
prints value types. Backed by IOpcUaClientService.HistoryReadPageAsync
(default-throwing interface member so existing fakes compile). Used by the
gRPC data H3 live gate on projected nodes.
2026-11-24 00:36:47 -05:00
Joseph Doherty 07eeea2bd5 test(grpc-data): H3 manifest key and OI end-to-end projected history wire tests
A real consumer OPC UA session HistoryReads a projected variable whose
projected half is forwarded to a real origin node manager's history port:
mixed batch keeps slots, page-through to completion, single use, session
close returns the origin store count to 0, mapped grant with ACLs on and off.
Manifest key H3 (OpcUaServer.Tests + Runtime.Tests; OI runs separately — the
runner accepts unit projects only).
2026-11-24 00:28:36 -05:00