Commit Graph

5409 Commits

Author SHA1 Message Date
Joseph Doherty d72f2d966d fix(grpc-data): A4 review r2 S1–S4 — the deploy hold reads one (placements, undecided) set, settles on any completion, is bounded (stale + MaxHold, reported as held), and its takeover sends RefreshRequired once
- S1: ProjectedMappingDeploymentRuntime publishes ProjectedMappingSet (placements + undecided + sequence) captured under
  its lock; DeployedConditionMappings keeps it as one volatile value (highest sequence wins); ReconcileRunners reads
  IProjectedConditionMappings.Snapshot. Deterministic window test via a Changed handler registered before the adapter.
- S2: a separate _undecided flag clears on ANY completion (failed/degraded/throwing build ⇒ settled empty ⇒ release);
  browse-anchor Suspended semantics unchanged. A held set goes BadNoCommunication on the stale timeout and is released
  past ProjectedConditionOptions.MaxHold (5 min); diagnostics report "held" and keep its counters; Dispose clears _held.
- S3: a runner that took over a non-empty held set sends RequireRefresh once at its first barrier.
- S4/NITs: runtime-level Began/Completed tests, F1 must-arrive control, linger-expiry-while-held.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-25 04:04:07 -05:00
Joseph Doherty 5752243724 docs(grpc-data): A4 gates after F1–F4 fixes + full A01–A08 run (2) a4s-6 — 8/8 PASS 2026-11-25 03:45:02 -05:00
Joseph Doherty 0c253b66df docs(grpc-data): A4 F1–F4 root causes, design decision (consumer holds imported conditions across its own deploy; promote-on-admission), native ack freeze = opc-plc behaviour; #935 #936 filed 2026-11-25 03:10:38 -05:00
Joseph Doherty e4b9998ca4 fix(grpc-data): A4 F4 — an admitted folder event item promotes a projected folder that materialised before its mapping was condition-bearing
OnProjectedFolderMaterialised promotes condition-bearing mapping folders to
SubscribeToEvents only at materialisation, and IsConditionBearingMapping needs the
mapping's authority active. On a freshly restarted consumer the projected pages
materialise before that authority activates, and nothing re-promoted them, so a
folder-first event item was refused BadNotSupported by the SDK
(MonitoredNodeMonitoredItemManager checks EventNotifier) until an i=2253 item
opened demand and a condition got wired there.

SubscribeToEvents: once the projected-notifier admission (mapping gate) passes,
PromoteProjectedEventFolder re-evaluates IsConditionBearingMapping and promotes
the folder before the SDK attach. Unauthorized callers are refused before it.

Test: F4_a_folder_materialised_before_its_mapping_was_condition_bearing_… (control:
refused while not condition-bearing; red with the promotion removed).
2026-11-25 03:08:09 -05:00
Joseph Doherty 1b7c69c6ec fix(grpc-data): A4 F1-F3 — a deploy's undecided empty mapping set holds imported conditions instead of removing and re-creating them
Every deploy begins a catalog attempt whose published mapping set is empty
(ProjectedMappingDeploymentRuntime.AttemptBegan → Notify([])). The consumer read
that as 'connection removed': runner Stop(removeConditions: true) tore down every
imported condition, and the post-deploy runner re-created them on fresh nodes —
one phantom event per condition (F2), an origin transition delivered twice (F3),
and every outstanding consumer EventId BadEventIdUnknown with no RefreshRequired
(F1; the removal's RefreshRequired was gated away because nothing was visible).
Root-caused live on a4dbg-1 (consumer applies a fresh-node 'marker null->M' record
right after its own deploy).

IProjectedConditionMappings.Suspended (DeployedConditionMappings → runtime
Suspended): while suspended a dropped connection's runner is stopped WITHOUT
removal and held; the next runner takes its materialised set over and
re-snapshots onto the same nodes (same marker ⇒ no event, EventIds kept). Only a
SETTLED set without the connection (or demand linger) releases the held runner,
which removes its conditions then.

Test: F1_a_deploys_empty_suspended_mapping_set_holds_the_conditions_… (red with
the hold disabled: removal on the suspended set).
2026-11-25 03:08:03 -05:00
Joseph Doherty 688cff5812 docs(grpc-data): A4 live scenarios part 2 + full A01–A08 run (a4s-5) — A06/A07 PASS, A03 plan path PASS with findings F1–F3 (deploy-driven EventId invalidation, phantom re-assert event, duplicate transition across stream reset), F4 folder-first refusal; D6/D7 verdicts; CLI EventType line 2026-11-25 02:46:06 -05:00
Joseph Doherty 7425b4c4fe test(grpc-data): A03 native D7 probe uses AddComment (a forwarded native ack froze opc-plc's EastTankYellow at the origin for the rest of a4s-4) 2026-11-25 02:28:20 -05:00
Joseph Doherty 42e3800f2c test(grpc-data): A4 part 2 — A03 gap via pause+stop, origin watcher + re-assert mirror check, latest-EventId positive control; duplicate-transition checks (A03/A06/A07); docs: folder-first event item still refused BadNotSupported (workaround: i=2253 first) 2026-11-25 02:04:30 -05:00
Joseph Doherty 9ea50c11b2 test(grpc-data): A4 live scenarios part 2 harness — A03 origin failover (same-incarnation stream reset via mapping revision bump, clear-and-re-raise in the gap, RefreshRequired, BadEventIdUnknown, refreshed EventId acks), A06 consumer Primary change across both nodes + second CONSUMER principal fixture-cli-alt, A07 consumer restart refresh-vs-barrier; CLI alarms prints EventType (names RefreshStart/End/Required) 2026-11-25 01:44:58 -05:00
Joseph Doherty c82b8683b0 docs(grpc-data): A4 live scenarios part 1 — A01/A02/A04/A05/A08 PASS on a4s-2, observations, part-2 harness notes 2026-11-25 01:37:21 -05:00
Joseph Doherty 6bf7dc8930 test(grpc-data): A4 scenarios — native alarm on EastTank?Yellow (cycles live), condition mappings WriteThrough (DataMappingOperationsInvalid), folders subscribe after demand opens, ConfirmedState read, origin audit for A08 denial 2026-11-25 01:23:14 -05:00
Joseph Doherty 304e8b1b7d test(grpc-data): A4 live scenarios part 1 harness — run-owned opc-plc --alm, native alarm + 2 referencing equipment + 3 condition mappings, UNS-only origin principal, no-grant consumer principal; probe condition-records; node-probe alert-transitions; conditions_scenarios.py (A01/A02/A04/A05/A08) 2026-11-25 01:05:53 -05:00
Joseph Doherty 283790a646 docs(grpc-data): A4 review round 1 — findings table, red/green, S4 decision, gates, live a4r1-cond-1 PASS 2026-11-25 00:51:13 -05:00
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 3be51e3b13 Merge a4-docs into a4-code 2026-11-24 23:47:13 -05:00
Joseph Doherty 4d11787745 docs(grpc-data): A4 code evidence — #930/#931 red/green, diagnostics, live a4c-cond-1 PASS, L1 PASS, L5 docker-dev PASS (production blocked), gates
Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-24 23:46:37 -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 916c14eca1 docs(grpc-data): A4 docs — feature negotiation, imported conditions end to end, method status table, limits, security, ScadaBridge impact
DataConnections.md: x-otopcua-data-features negotiation; condition forwarding (key secret, bits 64/128/256, AllowGalaxyServiceAck,
methods + status codes, limits/defaults, troubleshooting); corrects the A2a 'deploy adds/removes arrive as deltas' claim (a deploy
ends the stream). AlarmTracking.md: Imported conditions. ScriptedAlarms.md: known after the first completed evaluation; what
forwards. security.md: imported-condition gate, per-caller method re-check, service principal, on_behalf_of, audit category.
Evidence A4-docs.md: plan-vs-code disagreements, TODO markers for the A4 code merge, ScadaBridge consumer impact.
2026-11-24 22:58:23 -05:00
Joseph Doherty 9143804987 Merge A3: consumer imported-condition registry, visibility, event delivery and lock-free remote condition methods (L2/L3 pass, live conditions_a3_smoke PASS)
v2-ci / unit-tests (push) Failing after 3h13m48s
2026-11-24 22:47:04 -05:00
Joseph Doherty 81ac1d5263 docs(grpc-data): A3 verification review round 2 — N1 fix + red/green, clone pin, gates, live a3v2-cond-1 PASS 2026-11-24 22:46:42 -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 5bece2a5a5 docs(grpc-data): A3 round 2 — pooled EventFieldList root cause, L2 re-measured (PASS), gates, live a3r2-cond-1 PASS 2026-11-24 22:11:28 -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 159ce9d13d docs(grpc-data): A3b review r1 — live a3br1-cond-1 PASS 2026-11-24 20:45:32 -05:00
Joseph Doherty c82ea04e4d docs(grpc-data): A3b review round 1 — finding → resolution → test → red-on-revert, real-path L3, worst-case L2 (fails 200 MiB), OI refresh-failure investigation, gates 2026-11-24 20:38:24 -05:00
Joseph Doherty e5e0780f5e perf(grpc-data): A3b review S5 — BytesPerCondition from the worst-case L2 harness (max 228,353 B ⇒ 230,000; cap ≈ 548 MiB) 2026-11-24 20:05:26 -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 01a4e8db9d docs(grpc-data): A3a review round 1 — finding → resolution → test → red-on-revert table, gates, live a3r1-cond-1 PASS 2026-11-24 19:24:54 -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 3c941458f5 docs(grpc-data): A3b evidence — implementation, A3a live defects, tests + red-on-revert, L2/L3 numbers, live a3b-cond-3 PASS, deviations, gates 2026-11-24 18:14:57 -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 404a664ca3 fix(grpc-data): A3 ProjectedConditionAccess logs through the host logger (was NullLogger in production) + stream/item/barrier diagnostics 2026-11-24 17:37:23 -05:00
Joseph Doherty 4e6535ee1d test(grpc-data): A3 live smoke — conditions profile makes the CONSUMER condition-bearing; conditions_a3_smoke.py acknowledges the imported ScalarHigh through the consumer 2026-11-24 17:25:31 -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 28098a8d32 feat(grpc-data): A3b consumer method port — per-caller AlarmAcknowledge/AlarmConfirm gate, mapping timeout, stream serving incarnation, lease condition methods, host wiring 2026-11-24 17:11:05 -05:00
Joseph Doherty c1be5725b9 feat(grpc-data): A3b ICallAsyncNodeManager — claim imported-condition calls, base.Call unchanged for the rest, lock-free remote dispatch, EventId registry gate + N6 re-binding 2026-11-24 17:11:05 -05:00
Joseph Doherty b5ab6e7cde docs(grpc-data): A3a evidence — progress, implementation, tests, mutation record, deviations, gates 2026-11-24 17:00:02 -05:00
Joseph Doherty 762b0fa15d test(grpc-data): A3 unit-phase manifest entry 2026-11-24 16:43:22 -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