From e68e4cc8bf06d1f3492b99dde40dbd9c674daa90 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Wed, 25 Nov 2026 04:44:07 -0500 Subject: [PATCH] =?UTF-8?q?docs(grpc-data):=20A4=20review=20round=202=20?= =?UTF-8?q?=E2=80=94=20S1=E2=80=93S4=20+=20NIT=20outcomes=20with=20red/gre?= =?UTF-8?q?en,=20degraded-apply=20decision,=20gates,=20live=20a4s-7=208/8?= =?UTF-8?q?=20PASS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- docs/plans/evidence/grpc-data-ext/A4.md | 81 +++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/docs/plans/evidence/grpc-data-ext/A4.md b/docs/plans/evidence/grpc-data-ext/A4.md index 61e939994..bb6047753 100644 --- a/docs/plans/evidence/grpc-data-ext/A4.md +++ b/docs/plans/evidence/grpc-data-ext/A4.md @@ -593,3 +593,84 @@ in `artifacts/grpc-data/runs/a4s-6/evidence/` (`A4S-results.md`). **A4 exit gate Remaining open items, each filed: **#935**, a reload re-activates still-active scripted alarms (the origin un-acks an acked alarm and writes a duplicate `alerts` row on every deploy); **#936**, the removal RefreshRequired is gated by the current mapping set. + +## Review round 2 + +The review is `a4-review-round2.md` at `57522437`. Its verdict was approve-with-changes, with no blocker. Commits: +`d72f2d96` (S1–S4 and the runtime NITs), `6bdca132` (the F4 and EventId NITs) and `dc5ed011` (the A03 phase-1 check and +the docs). Each "red" below means the named test was re-run with that one change reverted, failed at the stated assertion, +and passed again once the change was restored and rebuilt. + +| Finding | Outcome | Test | Red on revert | +|---|---|---|---| +| **S1** `Suspended` read live next to an older `Current` copy | Fixed. `ProjectedMappingDeploymentRuntime` publishes `ProjectedMappingSet(Placements, Suspended, Sequence)`, captured under `_gate` in each transition and raised as `SetChanged` after every transition. `DeployedConditionMappings` keeps it as one volatile reference (the highest `Sequence` wins, so out-of-order notifications cannot regress it), and `ReconcileRunners` reads `IProjectedConditionMappings.Snapshot` as one pair. | Runtime `R2_S1_a_demand_acquired_between_the_settle_and_its_notification_keeps_the_held_set`: a real coordinator and runtime. A `Changed` handler registered **before** the adapter calls `AcquireEventDemand` inside the window (after `_gate` is released and before the adapter has seen the transition). | **red**. With the old adapter (live flag plus a copied list) it fails at `f.Sink.Removed should be empty` | +| **S2** a non-success deploy leaves the hold unbounded | Fixed (the decision is below). A separate `_undecided` flag is set by `AttemptBegan` and cleared by **any** `AttemptCompleted`, so a failed, degraded or throwing build settles the set as empty and the held runner is released. Browse-anchor `Suspended` is unchanged: it still clears only on success, so anchors stay retained. A hold is bounded: the held conditions go `BadNoCommunication` on the connection's stale timeout, chained after the runner's stop and disarmed under `_staleGate` before any takeover. Past `ProjectedConditionOptions.MaxHold` (default 5 min) the held set is released. Diagnostics report `held` (from a concurrent `_held`, without `_gate`), keep its counters (`RetainConsumers` includes held ids), and the set stays charged until release. | Runtime `R2_S2_an_unsuccessful_deploy_completion_releases_the_held_conditions` (real coordinator, `Complete(attempt, false)`), `R2_S2_a_hold_that_never_settles_goes_stale_then_is_released_past_MaxHold`, `R2_S4_…` | **red** for each part, reverted separately. `_undecided = !success`: the unsuccessful-completion test (no removal) and R2_S4. `MaxHold` timer infinite: the never-settles test (no removal). Hold stale mark removed: the never-settles test and F1 (its positive control). `held` diagnostics branch removed: both S2 tests (null diagnostics) | +| **S3** no resync signal after a hold | Fixed. A runner constructed with `tookOverHeld` (only when the predecessor came from `_held`) and handed a **non-empty** set sends `RequireRefresh(ConnectionId)` once at its first barrier, after the re-snapshot's `Reconcile`. It is visibility-gated in the registry, keeps EventIds, and is not a condition event. | Runtime `R2_S3_a_runner_taking_over_a_held_set_sends_RefreshRequired_once_at_its_first_barrier` (none before the barrier, exactly one after, none at a later complete resync of the same runner); `R2_S1_…` asserts 1 | **red** (`tookOverHeld: false`): both tests time out waiting for the RefreshRequired | +| **S4** the production switch was untested | Added. `GrpcDataCatalogStagingTests.R2_S4_the_published_set_is_undecided_only_between_AttemptBegan_and_any_completion` covers Began, success, Began, a failed or degraded completion (`Complete(attempt, false)`), a throwing build (invalid parent), and a never-completing Began. It checks `runtime.Set`, `runtime.Suspended` (browse retention: still true after a failure) and `DeployedConditionMappings.Snapshot`, with one notification per transition. The S1 interleave is the S1 test above. | — | **red** (`_undecided = !success`) at `runtime.Set.Suspended should be false` | +| NIT F1 second-phase absence check | Fixed: a must-arrive control. The hold's stale mark is chained after the held runner's stop, and any removal would run in that stop's continuation, so the test waits for `Sink.Stale` before `Removed.ShouldBeEmpty()`. | `F1_…` | **red** when the hold stale mark is removed (the control never arrives) | +| NIT linger expiry while held | Test added. | `R2_NIT_linger_expiry_while_held_releases_the_held_conditions` | **red** (`ReleaseHeld(_ => true)` dropped from `OnLingerExpired`) | +| NIT EventId retention across the takeover | Test added at the node-manager level. A takeover re-snapshot (versions restart, same marker, a restated newer record time, then `RequireRefresh`) keeps the condition instance, the current EventId and an older retained one (both acks Good, sent with the same marker), and reports no event. | OI `ImportedConditionMethodWireTests.R2_a_takeover_re_snapshot_with_the_same_marker_keeps_the_instance_and_every_retained_EventId` | Control, not a product revert: modelling the pre-F1 behaviour (`RemoveConditions` before the re-apply) fails at the `ReferenceEquals` instance check. The runtime half (no removal across the hold) is pinned by F1 and R2_S1 | +| NIT F4 negative case | Test extended. After `ConditionBearing = true`, an anonymous (ungranted) caller's folder item gets `BadUserAccessDenied`, the folder's `EventNotifier` is unchanged (read through a new `ProjectedFolderEventNotifier` test observation) and no demand opens. Then the granted item promotes it (positive control). | OI `F4_…` | **red**: swapping admission and promotion fails at `EventNotifier … should be` (unchanged) | +| NIT fake `CanSubscribeFolder` ignores `ConditionBearing` | Fixed. The fake now returns false while the mapping is not condition-bearing, as the real gate does, and the F4 control asserts `BadUserAccessDenied` (it was `BadNotSupported`). | OI `F4_…` | — | +| NIT `Dispose` ignores `_held` | Fixed: `Dispose` ends each held runner's hold (disposing its timers) and clears `_held`. | — | — | +| NIT promotion is never demoted | Recorded, not changed. It matches materialisation-time promotion, and removal or a rebuild clears it. A folder that stays a notifier after its mapping stops being condition-bearing admits nobody: the mapping gate refuses the item. | — | — | +| Round-1 leftover `unknown = states.Any(x => !x.Known)` | Already filed as **#933** in round 1 (the "NIT permanent removal block" row above). | — | — | + +**Degraded-apply decision: settled (with the empty set), not "settled with the new set" and not held.** `FinishRebuild` +calls `LocalCatalogCoordinator.Complete(attempt, topologySucceeded: !outcome.Degraded)`. A degraded apply makes `valid` +false, so `_published` goes null, `CatalogActivation.Complete` reports not completed, and `AttemptCompleted(attempt, +completed: false)` publishes **no placements**. +- The published mapping set after a degraded apply really is empty. No `CanSee` can pass, projected browse has no current + placement, and the new set never became the deployed one. +- Treating it as "settled with the new set" would claim mappings the node is not serving. +- Holding until the next deploy is the unbounded case the review describes. Holding with a timeout keeps invisible state + for no reader. +- So any completion settles. The empty set releases the held conditions (a removal, the same class as a mapping removal or + a linger expiry, never "known inactive"). The retry deploy that follows re-creates them. +- The cost is one remove and re-create per failed or degraded deploy (new EventIds). That is accepted: a failed deploy has + already withdrawn every projection on that node. +- Browse anchors keep their old retention (`Suspended` stays set after an unsuccessful attempt). That is a separate flag + with separate semantics, deliberately unchanged. + +**A03 phase-1 check and the RefreshRequired (S3).** Phase 1 bumps a mapping revision, which deploys the consumer, so the +connection is held and then taken over. The consumer's Server-object watcher now receives **one** `RefreshRequiredEventType` +at the takeover barrier. The rig has one condition-bearing connection (`consumer-source`). +- `p1_consumer_events_mirror_origin` (unchanged) still requires the consumer's ScalarHigh events during the reset to equal + the origin's, so any extra **condition** event fails it. That is F2's check. +- The new `p1_exactly_one_refresh_required_after_held_takeover` counts RefreshRequired across all of the watcher's blocks + since the mutation and requires exactly one. +- This is safe for F1–F3 for three reasons: + - RefreshRequired carries no condition and no EventId. + - A client that refreshes gets the same EventIds (the takeover re-bound nothing). + - `duplicate_transitions` ignores non-condition events. +- Phase 2 marks its own window (`mark_all`) after phase 1, so the phase-1 RefreshRequired cannot satisfy + `p2_refresh_required_received`. + +### Gates after review round 2 (`a4-code` at `dc5ed011`) + +| Gate | Result | +|---|---| +| `dotnet build ZB.MOM.WW.OtOpcUa.slnx --no-incremental` | 0 warnings, 0 errors | +| `run-unit-phase.py A4` / `A3` / `A2` / `A1` / `X0` | all exit 0 (`20261125T090847…`, `…090936…`, `…091038…`, `…091149…`, `…091516…`) | +| Host.Tests `DataConnections` | 207 passed | +| Runtime.Tests full (`Category!=E2E&Category!=LiveIntegration`) | 2083 passed, 3 skipped, 0 failed (#920 did not fire) | +| OpcUaServer.Tests full | 1458 passed, 2 skipped | +| OI combined (`Feature=GrpcData` + ConditionMethodEvent / NativeAlarmEventIdentityFieldDelivery / FolderConditionRefresh / ConditionRefreshDeferral / ImportedConditionEventWireTests), once | 140 passed, 1 skipped (opt-in L2 harness) | +| `git diff master -- '*Goldens.cs'` | empty (no proto, mapper or golden touched) | + +### Full A01–A08 run (3) — run `a4s-7` (after review round 2) + +The sequence was `rig.py up --run-id a4s-7 --conditions` → `seed` → 85 s → `deploy --timeout 300` → `conditions_a3_smoke.py` +(`passed: true`) → `conditions_scenarios.py` (all eight in one session) → `rig.py down` (0 run containers left). Evidence is +in `artifacts/grpc-data/runs/a4s-7/evidence/` (`A4S-results.md`). **A4 exit gate: 8/8 PASS.** + +| Scenario | Result | Checks | Notes | +|---|---|---|---| +| A01 | PASS | 13/13 | | +| A02 | PASS | 10/10 | | +| A03 | **PASS** | 20/20 | Phase 1: consumer `events_during_reset` = `[]` and origin = `[]` (still no extra condition event); the pre-reset EventId comment is Good. The new `p1_exactly_one_refresh_required_after_held_takeover` passed: one `RefreshRequiredEventType` (Source `Server`, 09:35:12.267) right after the takeover barrier (09:35:12.265). A second barrier at 09:35:15 (the source-side deploy reset the stream) sent none, so the signal is one-shot. Phase 2 (failover/G4) unchanged and passing; `duplicate_transitions` = `[]`. | +| A04 | PASS | 16/16 | | +| A05 | PASS | 4/4 | The denied session still saw zero imported events (RefreshRequired is visibility-gated). | +| A06 | PASS | 11/11 | | +| A07 | PASS | 8/8 | | +| A08 | PASS | 10/10 | |