Commit Graph

1624 Commits

Author SHA1 Message Date
Joseph Doherty 0cac09cee3 fix(grpc-data): A4 review r1 — AdminUI helpers null-safe + doc comments restored; metric descriptions name both sides; docs: S1/S2/S3 behaviour, RefreshRequired only on a changed incomplete set, SourceName vs runtime status (S4), scripted Good = applied, A4-docs citations 2026-11-25 00:22:54 -05:00
Joseph Doherty c93290d0a0 fix(grpc-data): A4 review r1 — B1 unique capacity-reset command id (fake now rejects reused ids); S1 retry timeout keeps buffer+claim; S2 late ack of a superseded re-add removes the orphan + InvalidArgument backstop; S3 overlap only for keys the mapping itself held; S4 SourceName independent of runtime status; NITs resyncs count opened streams, prune removed connections' counters 2026-11-25 00:20:26 -05:00
Joseph Doherty b2fab8b075 test(grpc-data): #928 — overflow test asserted one of two legal outcomes; deterministic Reset test + either-outcome contract test; DataConnections.md A4 reconcile (#930 retries, condition metrics, AdminUI fields)
The origin item sees a hub eviction only at its next hub read: Reset if the last snapshot chunk is
still undelivered, otherwise a silent fresh snapshot on the same stream (both per A2, both loss-free
since the A3 consumer swaps a buffered re-snapshot in as a full replacement). Since A2 review S5 the
3,000-record snapshot is 59 chunks and the silent path wins when run alone (fails 3/3 alone at the A2
merge too; passes in its class). No product change. Also fixes the stale ack/confirm/shelve comment on
ConditionMethodTimeoutMilliseconds.
2026-11-25 00:08:06 -05:00
Joseph Doherty 82cf7fe155 test(grpc-data): A4 L1 harness — origin SnapshotConditions Lock hold with 1,000 conditions while publishing (opt-in OTOPCUA_L1=1)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-24 23:24:24 -05:00
Joseph Doherty 969f3d4645 test(grpc-data): A4 manifest entry; condition-access tests wait for the barrier's RefreshRequired, not the barrier count
Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-24 23:11:39 -05:00
Joseph Doherty f1f9f49813 feat(adminui): A4 imported/served condition diagnostics on the data-connections page
Per connection: stream state, last snapshot, conditions and state-unknown count, node budget vs host caps, RefreshRequired,
resyncs, capacity rejections, method outcomes, per-mapping status / observed vs MaxConditions (80% warning) / refusal.
Per node (origin panel): open condition items, largest listing vs its limit, last snapshot, resyncs, capacity
rejections, unsignalled (state unknown), methods served.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-24 23:06:51 -05:00
Joseph Doherty 9adadd14b4 test(grpc-data): A4 condition diagnostics — side-labelled metrics without ids, origin/consumer evidence, cluster-serializer round trip and older-payload decode
Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-24 23:05:36 -05:00
Joseph Doherty 78eb98ea13 fix(grpc-data): A4 #930/#931 — in-stream condition retries (no refresh storm), ConditionCapacity recovery, reconnect backoff, ledger, single RefreshRequired, parked-runner release; condition diagnostics core
#930 N2: an Unavailable mapping (refused item, failed root, snapshot timeout) is retried on the OPEN stream by
re-adding its item (AddSubscriptionItems) on its own backoff — definitive refusals (Denied/NotFound/Unsupported)
on LongRetryDelay (5 min, doubling to 4x), transient ones on the snapshot timeout x 2^n (<= 8x) — so healthy
mappings are never re-snapshotted for it; an incomplete barrier whose incomplete set equals the previous barrier's
sends no RefreshRequired. N3: ConditionCapacity is retried in-stream on the long timer and recovers.
#931 N4 exponential reconnect backoff (MaxReconnectDelay 60 s); N5 held-but-unlisted keys charged beside known
claims (overlapping unknown ones) + SetMaterialised cap report; N6 method calls read Serving without _gate;
N7 a capacity reset that removed conditions sends no second RefreshRequired; N8 a parked runner is released once
its removal finished.
A4 diagnostics core: DataConnectionConditionDiagnostics (side-labelled items/resyncs/capacity/method metrics, new
refresh_required counter, consumer + origin evidence), Commons contracts, DI + deployment-runtime + driver-host wiring.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-24 23:03:53 -05:00
Joseph Doherty c8b35d494f fix(grpc-data): A3 verification r2 — N1 runner predecessor chain dropped after hand-over + stopped runner clears its record sets; correct the SentMessageQueue clone comment and pin the EventFieldList MemberwiseClone dependency 2026-11-24 22:26:09 -05:00
Joseph Doherty b884db5fb1 perf(grpc-data): A3 r2 L2 — EventId window back to the plan's 8; measure the retained heap, not GC.GetTotalMemory
GC.GetTotalMemory on .NET 10 regions reported +92 or +218 MiB (bimodal) for the same
state; GCMemoryInfo heap size and a heap dump (136 MB of objects, eeheap allocated
136,318,696 / committed 236,208,128) show the extra was committed-but-free regions.
The harness now takes HeapSizeBytes-FragmentedBytes after a full blocking GC and the
settled working set, and asserts BOTH <= 200 MiB. Worst case (2 placements, 8 slots,
3 event items, Live+Buffer): heap +106.5 MiB, WS +151.3 MiB max of 3 runs.
BytesPerCondition 230,000 -> 160,000 (max WS/condition 158,629, rounded up);
MaxImportedConditionBytes default 160,000 x 2,500 = 400,000,000 B (~381 MiB).
2026-11-24 21:46:21 -05:00
Joseph Doherty 6be0b8dc4b fix(grpc-data): A3 r2 — a released marked EventFieldList never re-enters the SDK's process-wide pool
SDK 2.0.1 pools EventFieldList (PooledEncodeableType); SentMessageQueue Reuse()s every
list of an acknowledged message and the base ReuseCore returns it, whatever its runtime
type, to the shared stock pool. A recycled ProjectedEventFieldList was then rented by any
server's GetEventFields (an unrelated session's RefreshStart/RefreshEnd or local event)
still carrying an imported condition's marker, and ProjectedNotificationRewriter dropped it
when that marker's gate denied. Root cause of the intermittent OI ConditionRefresh failures
(#854/#855 classes). Mirrors ProjectedSdkNotification on the data path: override ReuseCore,
clear the marker, never return to the pool; a released (marker-less) list fails closed.
2026-11-24 21:36:47 -05:00
Joseph Doherty 72dece7f45 fix(grpc-data): A3b review r1 — per-item results after base.Call (S1), mapping timeout honoured + transport-known BadTimeout (S2), unsent vs OutcomeUnknown + origin failure status (S3), per-connection sub-limit + dispatch floor (S4), N1/N2/N3/N7/N8; tests: real-path L3, worst-case L2 harness, RefreshRequired over the wire, Confirm guards isolated, gate placements/realm, slots, standby, faults, principals 2026-11-24 19:59:21 -05:00
Joseph Doherty 14343bf086 fix(grpc-data): A3a review r1 — condition-bearing projected folders are event notifiers from materialisation (folder-only demand), null-safe revalidation log; NM tests: B3 revalidation + demand release, S1 rebuild, deviation 3/6/8, S2 verdict TTL, A3-SEC delivery gate isolated (DroppedOnPublish 0) 2026-11-24 18:46:11 -05:00
Joseph Doherty 69aeeb770b fix(grpc-data): A3a review r1 — buffered in-stream re-snapshots, late completion + stale-on-incomplete + bounded retry, Primary-pinned condition streams, node-wide host-cap ledger, runner hand-over after stop, metadata failure Unavailable; NM: revalidation through the imported gate, demand released first, rebuild unwires, instance-keyed promotion, incremental folder index, verdict TTL + expiry, removal RefreshRequired, chunked refresh/replay, folder-only demand
Runtime tests: B1 multi-frame + capacity re-snapshot, B2 late completion / stale-on-incomplete / refused retry, B4 cross-connection / reverse order / records>total / delta growth, S3/S4 hand-over, S6, deviation 9, S2 IsActive generation; absence assertions now follow must-arrive controls.
2026-11-24 18:38:07 -05:00
Joseph Doherty 82ecc1164c fix(grpc-data): A3 condition items carry the origin's canonical root view (metadata asked like the browse resolver) — live a3b-cond-2 found map-uns refused Denied 2026-11-24 17:48:16 -05:00
Joseph Doherty fecb178efa perf(grpc-data): A3 L2 in-process memory harness (1,000 imported conditions, one mapping) + MaxImportedConditionBytes from the measurement (205,665 B × 2,500) 2026-11-24 17:23:40 -05:00
Joseph Doherty 2d0147f9da test(grpc-data): A3b consumer method port runtime tests (per-caller gate with real policy, mapping bit + timeout, serving incarnation, connection down unsent, lease refusal) + A3 manifest 2026-11-24 17:20:50 -05:00
Joseph Doherty de51886d6a test(grpc-data): A3b over-the-wire imported-condition methods (once + join, child Call gate, EventId/native Confirm unsent, N6 re-binding, L3 lock-freedom, mixed base.Call batch, timeout/outcome mapping) 2026-11-24 17:18:35 -05:00
Joseph Doherty bdc29ac25a test(grpc-data): A3 extends the recorded-v1-client gate — fake origin emits begin/total, info record, snapshot_complete, removed delta 2026-11-24 16:42:13 -05:00
Joseph Doherty 855f725660 test(grpc-data): A3a classifier guard across authorizer entry points + publish-time event rewriter 2026-11-24 16:40:43 -05:00
Joseph Doherty 4b74ac9cc2 test(grpc-data): A3a ProjectedConditionAccess runtime tests (capacity, barrier, host caps, 2000 conditions, version rule, lifetime, timeout, primary placement, gate, linger) 2026-11-24 16:38:57 -05:00
Joseph Doherty de381157cf test(grpc-data): A3a over-the-wire imported-condition events (exactly-once, identity, A3-SEC, child Read, N4, N7, resync, T2) + OwnsNamespace covers mapped/conditions 2026-11-24 16:35:01 -05:00
Joseph Doherty 91f1f72971 fix(grpc-data): A2b security review — outcome-unknown after dispatch, per-principal registry cap, audit category + sanitising, monotonic activation sequence, bounded Lock wait, consumer cancel = OutcomeUnknown 2026-11-24 15:41:24 -05:00
Joseph Doherty c709fbc1c4 test(grpc-data): A2 review N5 — the waiter test counts condition-queue waits only (red on revert: 19 vs ≤ 1) 2026-11-24 14:59:01 -05:00
Joseph Doherty 20bf937259 fix(grpc-data): A2 review S2/S3/S4/S5/N1/N2/N4/N5/N6 — bounded, effective-named, fair condition streams
S2: one condition item per (stream, root) (InvalidArgument + diagnostic), SubscriptionSessionLimits
    .MaxConditionItems (32) per stream (LimitExceeded), each snapshot's estimated bytes charged against
    the principal's snapshot memory budget until its last chunk is delivered (refused ⇒ retried).
S3: a native condition in a UNS listing is named by its placement's browse name (effective name);
    a raw-derived message (raw name, raw leaf, RawPath) is replaced by it.
S4: the item limit rides ConditionItemScope and is re-read with every listing.
S5: chunk budget = min(256 KiB, MaxPendingBytes, MaxMessageBytes) − frame overhead; an oversized
    record's free text is truncated (no split surrogate); one that cannot fit resets with a diagnostic.
N1: one queued v1 frame after every 8 condition frames.  N2: removal/snapshot-begin bypass rule documented.
N4: min(limit, DefaultMaxConditionsPerHold) per Lock hold.  N5: losing channel waits are reused.
N6: ConditionTestAssertions deleted; probe seams reduced to three primitives; class doc moved back.
S1 (tests): the fixture 'deploy' test renamed to what it is (a listing swap without an attempt);
    a real LocalCatalogCoordinator republish ends the stream.
2026-11-24 14:56:49 -05:00
Joseph Doherty 69014cc4f8 fix(grpc-data): A2 review B1 — a full condition queue back-pressures instead of resetting the stream
budget = Max(1, …) pulled a chunk on a full queue every 100 ms tick, TryWrite failed and the stream was
reset, so a backlog above MaxPendingFrames chunks never completed its snapshot. Max(0, …) produces
nothing until the consumer drains. Test: 25-chunk backlog, stalled sink, 20 ticks ⇒ no reset, snapshot
completes (red before).
2026-11-24 14:48:28 -05:00
Joseph Doherty fbf9f7b898 fix(grpc-data): a raised F5 diagnostic follows the pending set down after a late native transition
The A1 phase-run failure of A_native_transition_leaves_the_F5_pending_set was a real defect: when the
600 ms F5 window closed before the transition was processed (a loaded run), the diagnostic kept the
count from when it was raised (2) although the node manager held the condition established (1).
New deterministic test closes the window first; red before, green after.
2026-11-24 14:47:36 -05:00
Joseph Doherty 73c9f974d7 test(grpc-data): A2b — X0 staging test's unknown bit moves off AlarmConfirm 2026-11-24 13:57:11 -05:00
Joseph Doherty 7dfe517ff6 test(grpc-data): A2b — pre-authorization bound to its own context (role-less local session denied); mutation-checked 2026-11-24 13:49:28 -05:00
Joseph Doherty 4e1d46fd65 test(grpc-data): A2b recorded-v1 gate (fake origin) — CallConditionMethod only with conditions; goldens unchanged 2026-11-24 13:46:50 -05:00
Joseph Doherty 92f51b8dbc test(grpc-data): A2b recorded-v1 gate (real origin) — method bits granted, header-less golden unchanged, CallConditionMethod FAILED_PRECONDITION without conditions 2026-11-24 13:45:41 -05:00
Joseph Doherty d8d5487b21 test(grpc-data): A2b P + tolerance — Galaxy opt-in rides the artifact; 'unknown' bits move off 128/256 2026-11-24 13:44:30 -05:00
Joseph Doherty a75d15ad5d test(grpc-data): A2b U — method bits authorable, shelve not, Galaxy opt-in default off 2026-11-24 13:43:28 -05:00
Joseph Doherty 11b94ff2b2 test(grpc-data): A2b Runtime — origin facade (Primary, Galaxy opt-in, UNS subject, join, audit) and consumer client (no retry, OutcomeUnknown) 2026-11-24 13:38:36 -05:00
Joseph Doherty dcb9f8ccbd test(grpc-data): A2b NM — remote ack once, revert on origin+stream, AddComment stored, Primary/standby, T3 marker 2026-11-24 13:35:39 -05:00
Joseph Doherty f6c9c9d7fe feat(grpc-data): A2b — consumer CallConditionMethodAsync (no retry, OutcomeUnknown after send), validator + AdminUI method bits, Galaxy opt-in checkbox, capacity warnings at the deploy gate 2026-11-24 13:33:36 -05:00
Joseph Doherty 45a3eee9c8 test(grpc-data): A2a — revocation test awaits the worker teardown; README conditions profile 2026-11-24 12:42:17 -05:00
Joseph Doherty 6572ee83bc test(grpc-data): A2a — rig --conditions overlay (AlarmSubscribe exports + ScalarHigh scripted alarm), probe conditions scenario, conditions_smoke.py; X0/H2 tests move the 'future' bit off 64 2026-11-24 12:29:19 -05:00
Joseph Doherty 06c8740f94 test(grpc-data): A2a — unit-phase manifest key A2; probe carries history,conditions; metadata never carries AlarmSubscribe 2026-11-24 12:21:18 -05:00
Joseph Doherty b24af31e1a test(grpc-data): A2a — recorded-v1-client gates: fake and real origins serve conditions; header-less stays golden and never sees arm 9 2026-11-24 12:19:17 -05:00
Joseph Doherty 14ab6be37f test(grpc-data): A2a — condition stream R tests (priority, overflow reset, hub reset, revocation, deploy deltas, total first, slice cut, UNS no RawPath); delivered-snapshot overflow rule 2026-11-24 12:15:02 -05:00
Joseph Doherty 6272c7cfa0 test(grpc-data): A2a artifact — condition limits ride entity JSON; pre-A2 artifact parses with defaults
New GrpcDataConditionArtifactReadTests: defaults on a pre-A2 artifact, authored values + AlarmSubscribe round-trip, an
out-of-range deployed limit fails the row closed, AllowGalaxyServiceAck without AlarmAcknowledge fails closed and with it
(newer central) is tolerated and inert. GrpcDataArtifactReadTests' X0 reserved-bit rows move from 64 to 128 now that
AlarmSubscribe is understood.
2026-11-24 12:12:53 -05:00
Joseph Doherty ee1556ac5e feat(grpc-data): A2a AdminUI AlarmSubscribe checkbox, condition limit fields, capacity warning
Connection/export/mapping editors offer AlarmSubscribe (DataOperationAuthoring; method bits stay unauthorable until A2b);
export MaxConditions and mapping MaxConditions / ConditionStale / ConditionMethod / ConditionSnapshot timeouts with the
validator's min/max; the X0 banner already shows for any post-v1 bit. The Mappings panel lists the validator's
non-blocking ConditionCapacityWarnings for this cluster's consumer nodes. AllowGalaxyServiceAck is not in the UI (A2b).
2026-11-24 12:11:18 -05:00
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 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 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