diff --git a/docs/plans/evidence/grpc-data-ext/A3.md b/docs/plans/evidence/grpc-data-ext/A3.md index 51d333540..ccac46fab 100644 --- a/docs/plans/evidence/grpc-data-ext/A3.md +++ b/docs/plans/evidence/grpc-data-ext/A3.md @@ -694,3 +694,55 @@ Active/Acknowledged; `passed: true`. Teardown: no run-labelled containers or net - File: the `GrpcDataConditionStreamTests.Overflow_before_the_snapshot_is_drained_resets_the_stream` load sensitivity (above). - The plan's L2 / X0 figures (≈ 157–161 KiB per condition node, §5.5 table) came from `GC.GetTotalMemory` and are likely inflated by the same region accounting; the plan's §5.5 table was not edited (evidence only). + +# A3 — Verification review round 2 + +2026-11-25, branch `a3-consumer`. Not merged, not pushed. **Verdict: approve-with-changes** — one must-fix (N1) and one +comment/test fix; both done in `c8b35d49`. N2/N3 filed as #930; N4–N8 filed as #931. + +## N1 — the runner predecessor chain leaked one runner per demand cycle — fixed + +`ConnectionRunner._predecessor` was `readonly` and never cleared, and every runner kept `_states` (its last stream's Live/Buffer +record sets). Each linger expiry + re-subscribe, or mapping change, added a link R3 → R2 → R1, so memory grew without bound. +Fix (`ProjectedConditionAccess.Runner.cs`): the hand-over moved into `HandOverAsync` (its own state machine, so no hoisted +`previous` local outlives it), which awaits the old runner's `Stopped` (loop end + removal), takes its materialised set, and only +then sets `_predecessor = null` — the S3/S4 ordering is unchanged. A stopping runner's continuation now resets `_states = []` +before (optionally) removing its conditions, so a runner parked in `_stopping` until the next demand holds no record sets. +New test observation `ProjectedConditionAccess.RunnerReference(connectionId)` (a `WeakReference`, never a strong one). + +**Red/green** — `GrpcDataProjectedConditionAccessTests.N1_demand_cycles_and_mapping_changes_do_not_chain_runners_so_an_old_runner_is_collectable` +(Runtime.Tests): first runner completes a snapshot, then 3 linger-expiry + re-demand cycles and 2 mapping changes, each with a +complete snapshot; asserts the hand-over still holds (`Sink.Live == [x]`) and, after forced GCs, that the first runner's weak +reference is dead. Red with the original `Runner.cs` restored (`first.IsAlive should be False`); green with the fix, 5/5 repeats. +S3/S4 hand-over tests still pass. + +## Pool-fix comment corrected + clone dependency pinned + +The `ProjectedEventFieldList` summary claimed the SDK never clones a queued list. Wrong: SDK 2.0.1 `SentMessageQueue` returns +`CoreUtils.Clone` of the stored message on Publish and Republish, so the rewriter never sees the queued instance. The gate works +because `EventFieldList.Clone()` is `MemberwiseClone`, which keeps the subclass, the marker and the handle. The comment now says +that. New test `ImportedConditionClassifierTests.Cloning_a_marked_event_list_the_way_the_SDK_does_keeps_the_subclass_and_the_marker` +(OpcUaServer.Tests): `Clone()` and `CoreUtils.Clone(NotificationMessage)` both yield a `ProjectedEventFieldList` with the same +marker and handle, and the rewriter still drops the copy when its re-check fails. Shown to discriminate: a temporary +`Clone()` override returning a stock `EventFieldList` (what an activator-based clone would do) turns it red +(`marked.Clone() should be of type ProjectedEventFieldList`); reverted. + +## Gates (verification round 2, at `c8b35d49`) + +| Gate | Result | +|---|---| +| `dotnet build ZB.MOM.WW.OtOpcUa.slnx --no-incremental` | 0 warnings, 0 errors | +| `run-unit-phase.py A3` | passed (`20261125T032703…`) | +| `run-unit-phase.py A2` | passed (`20261125T032802…`) | +| Runtime.Tests full (`Category!=E2E&Category!=LiveIntegration`) | 2055 passed, 3 skipped | +| OpcUaServer.Tests full (same filter) | 1458 passed, 1 skipped | +| Host.Tests `.DataConnections.` | 207 passed | +| OI combined (139) | clean: 138 passed, 1 skipped (the opt-in L2 harness) | +| `git diff master -- '*Goldens.cs'` | empty | + +## Live — run `a3v2-cond-1` (build `c8b35d49`) — PASS + +Same procedure as `a3b-cond-3` (`rig.py up --conditions`, seed, 90 s, deploy, `conditions_a3_smoke.py`, `rig.py down`). Imported +ScalarHigh at the consumer (`ns=6;s=c1.…`, 32-char EventId); bogus EventId ⇒ `BadEventIdUnknown [809A0000]`; ack through the +consumer `Acknowledge successful` (540 ms); origin subscriber and consumer subscriber each saw exactly one Active/Acknowledged; +`passed: true`. Teardown: no run-labelled containers or networks left.