From 939ad2337d474e647519d279cf913574713adc44 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Wed, 25 Nov 2026 11:51:03 -0500 Subject: [PATCH] =?UTF-8?q?docs(grpc-data):=20A4=20evidence=20=E2=80=94=20?= =?UTF-8?q?follow-ups=20#933/#934/#936=20decisions,=20red/green,=20gates,?= =?UTF-8?q?=20live=20fu933-1=208/8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/plans/evidence/grpc-data-ext/A4.md | 109 ++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/docs/plans/evidence/grpc-data-ext/A4.md b/docs/plans/evidence/grpc-data-ext/A4.md index bb6047753..262d7e358 100644 --- a/docs/plans/evidence/grpc-data-ext/A4.md +++ b/docs/plans/evidence/grpc-data-ext/A4.md @@ -674,3 +674,112 @@ in `artifacts/grpc-data/runs/a4s-7/evidence/` (`A4S-results.md`). **A4 exit gate | A06 | PASS | 11/11 | | | A07 | PASS | 8/8 | | | A08 | PASS | 10/10 | | + +## Follow-ups #933/#934/#936 (consumer side, branch `fu-consumer-933`) + +"Red" = that one change reverted in place (file restored afterwards), the named test re-run alone; it failed at the stated +assertion and passed again once restored. + +### #933 — a durably unknown mapping no longer blocks removals forever + +**Decision: a bounded per-key hold, not scoping.** Scoping the unknown check to "mappings whose placements could list the +key" would need a proof that the unknown mapping cannot list it. The consumer has none: a mapping lists a key when the +origin's *current* catalog places the condition under that mapping's root in its realm +(`LocalExportCatalog.Compilation.cs` builds condition placements at origin deploy time; raw placements by device scope, UNS +placements by `UnsTagReference` / equipment). An origin deploy can add a UNS reference or move a tag, so the very drop that +made a known mapping stop listing a key may be a move into the unknown mapping's root. Neither a disjoint root nor a +different realm is provable from the consumer's last-known placements. + +- `ProjectedConditionOptions.MaxUnknownHold` (default **20 min**, fixed like `LongRetryDelay`). A materialised key that no + known mapping lists, held `BadNoCommunication` because another mapping is unknown, records when the hold began + (`_heldSince`, loop-owned, kept across stream ends and hand-overs so a flapping stream cannot restart it). Past the bound + `Reconcile` removes it: a removal with RefreshRequired (the sink's §5.2 path), never "known inactive". A later listing + re-creates it (new EventIds). Logged Warning "held past MaxUnknownHold" with the unknown mappings and their status. +- Why 20 min: about 4× the longest transient retry cycle at the default 30 s snapshot timeout (× 8 = 4 min, plus the + retry's own timeout), and it spans the first two in-stream re-checks of a definitive refusal (`LongRetryDelay` 5 min, + then 10 min). A transient outage or a grant corrected within that window removes nothing; only a durable one does. +- The earliest expiry shares the loop's retry timer (`HeldExpiry` in the wanted deadline), and `ExpireHeld` runs on the + loop when it fires, so no frame is needed to settle it. An expiry entry for a key no longer materialised is dropped, + so the timer cannot re-arm at zero. +- Docs: `DataConnections.md` lifetime rule (step 6) and a troubleshooting row. + +| Test | Red on revert | +|---|---| +| Runtime `Issue933_a_key_held_for_a_durably_denied_mapping_is_removed_past_MaxUnknownHold_not_kept_forever`: map-b `Denied`, map-a retires x ⇒ stale mark arrives (must-arrive control), nothing removed; past 1.5 s x is removed once, with no frame, stream kept, map-b still Unavailable; a later listing re-creates x | **red** with the bound disabled (`< TimeSpan.MaxValue`): fails at the removal wait. Also **red** with only the timer-driven `ExpireHeld` removed (the expiry then waits for a frame that never comes) | + +### #934 — the in-stream root re-resolve no longer runs on the frame loop + +- `ResolveRootsAsync` was split. `FetchRootsAsync` (static, reads only the immutable `MappingState.Root` views, never + throws except cancellation) issues the metadata request. `ApplyRoots` sets `RootView` or calls `MarkRefused`, on the loop. +- `RetryDueAsync` starts the fetch for due mappings whose root never resolved, marks them `Resolving`, and records it in + the stream's `Resolves` list. The loop's wake set is `WhenAny(retry timer, pending fetches)` after the barrier. + `ApplyResolvedAsync` (on the loop, each iteration) applies every finished fetch and re-adds the resolved mappings + (`ReAddAsync`, the old re-add body unchanged). +- While resolving, the mapping stays `Unavailable` (unknown, T2: nothing it may list is removed or marked inactive), and + `ScheduleRetry` skips it, so it is not retried twice. A failed answer re-schedules it on its backoff. A fetch outliving + its stream is abandoned (cancelled with the stream's token; the next stream has fresh states). +- The stream-open resolve still awaits (no frames exist yet). All runner state stays loop-owned. + +| Test | Red on revert | +|---|---| +| Runtime `Issue934_a_slow_in_stream_root_re_resolve_does_not_stall_frames_of_the_other_mappings`: map-a's root fails at open; its in-stream re-resolve (2nd metadata call) hangs; map-b's delta y is applied meanwhile, map-a not re-added and Unavailable; released ⇒ re-added exactly once and Complete (positive control), 2 metadata calls | **red** with the fetch awaited inline in `RetryDueAsync` (the old shape): fails at the y wait (10 s) | + +### #936 — the removal RefreshRequired reaches holders after their mapping left the deployed set + +**Decision: visibility for a removal is "this identity was admitted to this condition instance", recorded at admission.** +Not "send to every collected target without a check": the targets include every Server-object item of every session, so an +ungranted session would learn that an imported condition it never saw was removed (and A05's "denied session sees nothing" +would no longer hold). + +- `ImportedCondition` keeps a `ConditionalWeakTable` of admitted identities (weak keys: a closed session's identity is + collected). `ImportedVisibleTo` records the caller inside the verdict-cache compute when `CanSee` is true. That compute + is the only place a positive verdict is made, and every delivery (publish-time marker), refresh replay and Read/Browse + of an imported condition goes through it. Cached positives were recorded when computed; `Remove` clears the NodeId's + verdicts, so a re-created instance (same NodeId) is admitted afresh. +- `RemoveConditions` → `QueueRefreshRequired(…, removal: true)`: a collected target (Server-object item, or direct item at + a folder the condition was wired to) is sent one RefreshRequired when its identity was admitted to a removed instance. + The non-removal paths (incomplete barrier, un-re-bindable resync, takeover) keep the current gate. +- **What the event carries:** `RefreshRequiredEventState` with `SourceNode = Server`, `SourceName = "Server"`, + `Message = "RefreshRequired"`, Severity Low, a fresh EventId and times. It has no ConditionId, ConditionName, + Active/Acked state or any origin data (asserted on the wire). It goes only to identities that could see the condition. + Residual: an identity admitted earlier and revoked by an ACL edit since is still told (content-free, about a condition it + saw). +- Docs: `AlarmTracking.md` §ConditionRefresh and RefreshRequired. + +| Test | Red on revert | +|---|---| +| OI `Issue936_a_removal_after_the_mapping_left_the_deployed_set_still_tells_its_holders_and_only_them`: the granted session holds the condition (server + device items); then the gate admits nobody (`Allowed.Clear()`, generation bumped — what `CanSee` does with the mapping gone) and the condition is removed ⇒ both items get RefreshRequired (count 2), with no condition fields; the anonymous session's Server item gets none, after a must-arrive control (its own ConditionRefresh's RefreshEnd) | **red** with `removal: false` (the old current-gate check): fails at the RefreshRequired wait. **Red** the other way too: an unconditional send fails at the count (3, the ungranted session was told). `Deviation6_…` still green | + +Commits: `2eb31f62` (#933), `5d946fde` (#934), `18154eef` (#936), plus this evidence commit. + +### Gates (`fu-consumer-933` at `18154eef`) + +| Gate | Result | +|---|---| +| `dotnet build ZB.MOM.WW.OtOpcUa.slnx --no-incremental` | 0 warnings, 0 errors | +| `run-unit-phase.py A4` / `A3` / `A2` | all exit 0 (`20261125T160154…`, `…160249…`, `…160447…`) | +| Host.Tests `DataConnections` | 207 passed | +| Runtime.Tests full (`Category!=E2E&Category!=LiveIntegration`) | 2085 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 | 141 passed, 1 skipped (opt-in L2 harness) | +| `git diff master -- '*Goldens.cs'` | empty | + +### Full A01–A08 run — run `fu933-1` (after #933/#934/#936) + +The sequence was `rig.py up --run-id fu933-1 --conditions` → `seed` → 85 s → `deploy --timeout 300` → +`conditions_a3_smoke.py` (`passed: true`) → `conditions_scenarios.py` (all eight, one session) → `rig.py down` (exit 0, +0 run containers left). Evidence is in `artifacts/grpc-data/runs/fu933-1/evidence/`. **8/8 PASS.** + +| Scenario | Result | Checks | Notes | +|---|---|---|---| +| A01 | PASS | 13/13 | | +| A02 | PASS | 10/10 | | +| A03 | PASS | 20/20 | `p1_exactly_one_refresh_required_after_held_takeover` still exactly one; phase 2 RefreshRequired + new-EventId ack Good | +| A04 | PASS | 16/16 | | +| A05 | PASS | 4/4 | The denied session still saw zero imported events (the #936 removal path sends only to admitted identities) | +| A06 | PASS | 11/11 | | +| A07 | PASS | 8/8 | | +| A08 | PASS | 10/10 | | + +The live scenarios do not exercise a 20 min unknown hold, a slow origin metadata answer, or a mapping removal while a +client holds a condition. Those three behaviours are pinned by the unit/OI tests above; the live run shows no regression.