docs(grpc-data): A3a review round 1 — finding → resolution → test → red-on-revert table, gates, live a3r1-cond-1 PASS
This commit is contained in:
@@ -372,3 +372,66 @@ Each fix changed the image inputs, so each run was torn down and a fresh run id
|
||||
| OI `ImportedConditionMethodWireTests` ×3 | 7/7 each |
|
||||
| `git diff master -- '*Goldens.cs'` | empty |
|
||||
| Live `a3b-cond-3` | PASS (above) |
|
||||
|
||||
---
|
||||
|
||||
# A3 — Review round 1 (A3a adversarial review, `a3a-review-round1.md`, written against `b5ab6e7c`)
|
||||
|
||||
2026-11-24, branch `a3-consumer`, on top of A3b (`3c941458`). Not merged, not pushed. Commits: `69aeeb77` (runner + NM fixes,
|
||||
Runtime tests), `14343bf0` (folder promotion for folder-only demand, NM tests).
|
||||
|
||||
"Red on revert": the test was run with the fix removed (Runtime: the whole HEAD runner restored with interface stubs; NM: the
|
||||
single fix line(s) removed by a scripted mutation) and failed; the fix was then restored and the test passed.
|
||||
|
||||
| Finding | Resolution | Test(s) | Red on revert |
|
||||
|---|---|---|---|
|
||||
| **B1** in-stream re-snapshot removes conditions | `ProjectedConditionAccess.Runner.cs`: a begin opens a per-mapping `Buffer`; snapshot records fill it; the committed `Live` set (and every node) is untouched until `snapshot_complete`, which swaps and re-merges old ∪ new keys — only a key the complete set no longer lists (and no other mapping lists) is removed. Deltas apply to `Live` and the buffer. An in-stream capacity refusal removes the mapping's keys once (keys another mapping lists survive) and requires refresh | `B1_an_in_stream_multi_frame_re_snapshot…` (begin + 2 record frames + positive control on map-b, then complete); `B1_an_in_stream_re_snapshot_over_capacity…` | yes / yes (refresh assertion; the removal shape itself was already right) |
|
||||
| **B2** timed-out / non-Good mapping frozen Good | frames of a timed-out mapping keep being processed: a late `snapshot_complete` swaps in and re-runs the merge (full re-diff); at an incomplete barrier the keys no contributing mapping lists are `MarkConditionsStale` (new sink method, `BadNoCommunication`, one event each, never removed); after the barrier a still-`Unavailable` mapping ends the stream after a bounded wait (`ConditionSnapshotTimeout` × 1,2,4,8 backoff), cancelled by a late completion | `B2_a_snapshot_completing_after_the_timeout…`; `B2_an_incomplete_barrier_marks…`; `B2_S7_a_refused_item…` (new stream within 5 s) | yes / yes / yes |
|
||||
| **Deviation 9** Primary endpoint | new `IDataPrimarySubscriptionSource.SubscribePrimaryAsync` (Abstractions) on `GrpcDataConnection` (skips a non-Primary endpoint; a role-only miss is not a discovery failure, no probe backoff) and the deployment lease; the runner uses it and also drops any stream whose provenance role is not Primary | `Deviation9_a_condition_stream_served_by_a_Secondary…` | yes (hangs: the old runner keeps the Secondary stream) |
|
||||
| **B3** revalidation stands down folder items; demand leak | `RevalidateEventItems` asks `ImportedNotifierAdmits` for a projected notifier; the unsubscribe arm releases demand before both early returns; `_authorizer?.LogFiltered` (a rig without an authorizer NRE'd once an item was stood down) | `B3_revalidation_keeps_an_admitted_folder_item_and_deleting_a_stood_down_item_releases_its_demand` (real `RevalidateMonitoredItems()`, lease counter) | yes (revalidation mutation) / yes (demand-order mutation) |
|
||||
| **B4** host caps per connection / order / trust `total` | one node-wide `ConditionLedger`: connection charge = max(materialised keys, Σ mapping claims); a claim is the admitted `total` while snapshotting, the record count after (growth is charged); admission is against everything charged or claimed, order-independent. Records past `total`, `Live` past `MaxConditions`, or growth past the node caps ⇒ `ConditionCapacity` (item removed, keys removed, refresh). `ChargedConditions` observation | `B4_the_host_caps_are_node_wide_across_connections`; `B4_admission_is_order_independent…`; `B4_records_past_the_snapshot_total…`; `B4_post_snapshot_delta_growth…` | yes ×4 |
|
||||
| **S1** rebuild leaves stale wiring | `RebuildAddressSpace` calls `UnwireAllImportedFolders()` before clearing; `WiredByFolder` keeps the promoted folder INSTANCE — a re-created folder with the same NodeId unwires the dead instance and is promoted afresh | `S1_a_full_rebuild_unwires_and_the_re_created_folder_is_promoted_and_delivers_again` | yes (rebuild-unwire removed), yes (both removed) |
|
||||
| **S2** verdict cache outlives expiry / IsActive | `Verdict` stores `ValidUntil` = min(credential expiry, now + 5 s) for a positive verdict; `AuthorityGeneration` folds every current mapping's `Authority.IsActive` | `S2_a_cached_positive_verdict_is_re_proved…` (OpcUaServer.Tests); `S2_an_authority_deactivation_moves_the_authority_generation…` (Runtime) | yes / yes (by construction: the old formula ignores IsActive) |
|
||||
| **S3** removal races a new runner | a new runner of a connection awaits its predecessor's `Stopped` (loop end + removal) before opening a stream; stopped runners are kept per connection in `_stopping` | `S3_a_new_runner_waits_for_the_old_runners_removal…` (the sink holds the old removal open 400 ms) | yes |
|
||||
| **S4** `TakeMaterialised` cross-thread | the materialised set is handed over inside the new runner's loop after the predecessor stopped (no concurrent mutation, no orphaned key) | `S4_a_mapping_change_hands_the_materialised_set_over…` | **no** — the race window is one in-flight frame; the test pins the hand-over, it cannot force the interleaving |
|
||||
| **S5** Lock-hold bounds | `ProjectedFolderIndex()` scan replaced by the incremental `FolderIds`/`FolderKeys` index (maintained in `OnProjectedFolderMaterialised`/`Removing`, cleared on rebuild, resolved against the live projected maps); refresh targets gathered 128 conditions per hold, visibility decided off Lock | covered by every OI wiring test (index correctness); no timing test | n/a (not behaviour-observable) |
|
||||
| **S6** metadata failure swallowed | a root whose metadata is not Good (or a failed call) is `Unavailable` (logged), its item is not opened; all roots failing ends the stream | `S6_a_root_whose_metadata_fails…` | yes |
|
||||
| **S7** RefreshRequired only on timeout | any incomplete barrier (a mapping not `Known`: timed out, refused, metadata) requires refresh | `B2_S7_a_refused_item…` (`RefreshRequired == 1`) | yes |
|
||||
| **Deviation 3** folder-only demand | event items on any projected folder are admitted through `ImportedNotifierAdmits` = a wired condition the caller sees, OR the mapping gate on the folder's own (mapping, subject) key (`IProjectedConditionAccess.CanSubscribeFolder`); projected folders of a condition-bearing mapping (`IsConditionBearingMapping`) are `SubscribeToEvents` from materialisation (the SDK answers `BadNotSupported` before `SubscribeToEvents` otherwise) and never demoted by an unwire | `Deviation3_a_folder_only_client_opens_demand…` (granted Good + demand + the condition then delivered; anonymous denied) | yes (promotion removed ⇒ `BadNotSupported`) |
|
||||
| **Deviation 6** removal tells nobody | `RemoveConditions` captures the items that may see the conditions BEFORE unwiring, removes, then queues `RefreshRequired` (off Lock) to those passing the gate. `RequireRefresh`'s early return on a connection with no conditions stays: nothing of it can be held any more — the removal itself now notifies | `Deviation6_removing_an_imported_condition_sends_RefreshRequired_only_to_the_items_that_could_see_it` (Server + folder get it; a map-b folder item does not, after a must-arrive control) | yes |
|
||||
| **Deviation 8** one-hold replay | `ReplayImportedConditions` runs 128 conditions per Lock hold; each condition's snapshot and its queueing share a hold (ordering vs. live events kept) and one `EventDeliveryCache` per snapshot is shared across items | `Deviation8_ConditionRefresh_replays_hundreds…` (300 conditions inside RefreshStart/End) | **no** — chunking is not observable; the test guards correctness of the chunked replay |
|
||||
| **A3b open item** RefreshRequired scope after an EventId-invalidating resync | `ApplyConditions` collects the un-re-bindable CONDITIONS and refreshes only the items that may see one of them (shared `QueueImportedRefresh`) | via the shared targeting in `Deviation6_…` (a folder item of another mapping is not refreshed); the A3b re-binding test still passes | not separately reverted |
|
||||
| NIT `IsWiredTo` reads `Folders` off Lock | `ImportedCondition.WiredFolders` immutable array, replaced under Lock on wire/unwire | — | n/a |
|
||||
| NIT `Infos` never pruned | `ConditionSet.Apply` drops the info with a removed key; a swap discards the old set | — | n/a |
|
||||
| NIT stale callback after a fresh barrier | stale mark and barrier serialize on the runner's stale gate + generation | — | n/a (race) |
|
||||
| Test adequacy: vacuous absence assertions | `Applied.ShouldBeEmpty` / `Removed.ShouldBeEmpty` now follow a must-arrive control (a later frame's item removal; the barrier) | the three original tests rewritten | — |
|
||||
| Test adequacy: delivery gate not isolated | `ImportedConditionDeliveryGateTests` (non-parallel collection): the denied Server-object session gets nothing AND `ProjectedEventFieldList.DroppedOnPublish` does not move | `A3_SEC_the_delivery_gate_alone_withholds…` | yes — removing only the Server-object delivery gate turns it red while the original A3-SEC test stays green |
|
||||
|
||||
Residual / recorded:
|
||||
- A projected folder materialised while its mapping was NOT condition-bearing (or before `ProjectedConditionAccess` is bound) is
|
||||
not promoted until it re-materialises; the host binds access before any projection deploys.
|
||||
- The B2 retry ends the whole stream (complete mappings re-snapshot too), bounded by the backoff; a per-item re-add is A4 material.
|
||||
- In-stream capacity refusal removes the mapping's keys (all-or-nothing, §5.5) rather than keeping them stale.
|
||||
|
||||
## Gates (review round 1, at `14343bf0`)
|
||||
|
||||
| Gate | Result |
|
||||
|---|---|
|
||||
| `dotnet build ZB.MOM.WW.OtOpcUa.slnx --no-incremental` | 0 warnings, 0 errors |
|
||||
| `run-unit-phase.py A3` | passed (`20261124T234716…`) |
|
||||
| `run-unit-phase.py A2` | passed (`20261124T234814…`) |
|
||||
| `run-unit-phase.py A1` | passed (`20261124T234927…`) |
|
||||
| `run-unit-phase.py X0` | passed (`20261124T235258…`) |
|
||||
| Host.Tests `.DataConnections.` (both v1 gates) | 207 passed |
|
||||
| Runtime.Tests full (`Category!=E2E&Category!=LiveIntegration`) | 2049 passed, 3 skipped (no #920 rerun needed) |
|
||||
| OpcUaServer.Tests full (same filter) | 1456 passed, 1 skipped |
|
||||
| OI `Feature=GrpcData` + ConditionMethodEvent / NativeAlarmEventIdentityFieldDelivery / FolderConditionRefresh / ConditionRefreshDeferral | 129 passed, 1 skipped in 2 of 4 runs; the other 2 runs failed 2 and 6 of the #854 deferral stress tests (`ConditionRefreshDeferralWireTests` / `FolderConditionRefreshWireTests` `Deferred_events_older_than_a_refresh…`, `A_condition_removed_during_a_plain_refresh…`) — **pre-existing**: the same suite at the unchanged base `3c941458` failed 2 of them in 1 of 3 runs; the classes pass 3/3 in isolation on this branch; no imported-condition code is reached in those rigs (no `ProjectedConditionAccess`). Root cause not established (load-sensitive local-condition deferral) — to be filed as an issue, not closed as a flake |
|
||||
| `git diff master -- '*Goldens.cs'` | empty |
|
||||
|
||||
## Live — run `a3r1-cond-1` (build `14343bf0` + docs) — PASS
|
||||
|
||||
Same procedure as `a3b-cond-3` (`rig.py up --conditions`, seed, ~88 s, deploy, `conditions_a3_smoke.py`, `rig.py down`).
|
||||
Consumer: `stream 1 for connection consumer-source opened (2 mapping(s), serving source-1:4053)` (the Primary, now via
|
||||
`SubscribePrimaryAsync`); barrier `map-raw=Complete, map-uns=Complete; 1 record(s)`. Bogus EventId ⇒ `BadEventIdUnknown`; ack
|
||||
through the consumer `Acknowledge successful` (608 ms); origin subscriber and consumer subscriber each saw exactly one
|
||||
Active/Acknowledged. Teardown: no run-labelled containers or networks left.
|
||||
|
||||
Reference in New Issue
Block a user