docs(grpc-data): A4 evidence — follow-ups review round 1 (#933/#934/#936): outcomes, red/green, S3 SDK evidence, gates, live fu933-2 8/8
This commit is contained in:
@@ -783,3 +783,131 @@ The sequence was `rig.py up --run-id fu933-1 --conditions` → `seed` → 85 s
|
||||
|
||||
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.
|
||||
|
||||
## Follow-ups review round 1 (#933/#934/#936)
|
||||
|
||||
The review (approve-with-changes) found two gaps in #933, two in #936 and five NITs. Every fix below has a test that was
|
||||
run red with the fix reverted and green with it restored.
|
||||
|
||||
### S1 (#933) — the bound removed the unknown mapping's own conditions
|
||||
|
||||
A key held because ANOTHER mapping is unknown is still bounded by `MaxUnknownHold`. A key the unknown mapping listed
|
||||
itself the last time it was known (`_lastListed`: its previous stream, or before a capacity reset) is held with no bound
|
||||
while that mapping is only transiently unknown (`Pending`, `Unavailable`, retrying). Its clock starts only when the
|
||||
mapping's refusal is definitive (`Denied` / `NotFound` / `Unsupported` / `ConditionCapacity`).
|
||||
|
||||
- The definitive verdict is kept in a runner set (`_definitiveRefused`). It survives in-stream retries (a retry resets
|
||||
`Refusal` to null), stream ends and hand-overs, and is cleared when the mapping completes a snapshot. Without it, each
|
||||
long retry of a durably denied mapping would make it transient again, restart its keys' clocks, and they would never
|
||||
expire, because the retry backoff tops out at 20 min.
|
||||
- When the set of transient mappings changes, the loop re-decides the held keys (`ReconcileUnlisted`). Exempt keys drop
|
||||
their clock; the others start it.
|
||||
- **The single-mapping and never-opening-stream cases are now consistent.** A connection whose stream never opens holds
|
||||
its keys stale indefinitely. A mapping that is only transiently unknown now does the same with its own keys. Only a
|
||||
definitive refusal leads to the bounded removal.
|
||||
|
||||
### S2 (#933) — the hold clock counted time when no stream was open
|
||||
|
||||
The clock now runs only while a stream is past its barrier. The stream's `finally` records `_heldPausedAt` if that stream
|
||||
passed its barrier. The next barrier shifts every `_heldSince` forward by the paused time before its full re-diff.
|
||||
`_heldPausedAt` is handed over with `_heldSince`.
|
||||
|
||||
### S3 (#936) — admission was keyed on the identity object
|
||||
|
||||
SDK evidence comes from `Opc.Ua.Server` 2.0.1 `lib/net9.0`, decompiled with ilspycmd:
|
||||
|
||||
- `Session.UpdateUserIdentity`, which runs on every ActivateSession, assigns `Identity` and `EffectiveIdentity` the new
|
||||
objects.
|
||||
- `MonitoredItem.EffectiveIdentity` returns `m_subscription?.EffectiveIdentity`.
|
||||
- `Subscription.EffectiveIdentity` returns `Session.EffectiveIdentity`, or the saved owner identity when it has no session.
|
||||
|
||||
So a re-activated session, or a subscription transferred to another session, presents a new `RoleCarryingUserIdentity`
|
||||
object. `OpcUaApplicationHost` builds that object per activation. The OI test also asserts directly that
|
||||
`EffectiveIdentity` is a different object after `ReconnectAsync`.
|
||||
|
||||
- **Decision:** admission is keyed on `RoleCarryingUserIdentity.AdmissionKey` = principal + `\0` + API key id. It is
|
||||
computed once per identity object, and the set references the identity's string.
|
||||
- The session id was rejected because it does not survive a subscription transfer to a new session.
|
||||
- Sessions sharing one key share its grants, so they also share the record. A sibling session of an admitted key may
|
||||
receive a content-free RefreshRequired. That is the same audience the old current-gate check had.
|
||||
- A removal now sends RefreshRequired when `WasAdmitted(identity) || ImportedVisibleNow(identity, c)`. `ImportedVisibleNow`
|
||||
is the current gate, uncached, so nothing is cached for the removed instance.
|
||||
|
||||
### S4 (#936) — one ConditionalWeakTable per condition
|
||||
|
||||
`ImportedCondition` now holds a `HashSet<string>?`.
|
||||
|
||||
- It is allocated by CAS on the first admission and locked on itself. A condition nobody was admitted to allocates
|
||||
nothing. There are no finalizable containers and no dependent handles.
|
||||
- **Bound:** one entry per distinct credential admitted, capped at `MaxAdmittedCredentials` = 1024 per condition. Past the
|
||||
cap, a holder falls back to the current gate at removal. A Server-object ConditionRefresh by S sessions of K keys adds at
|
||||
most C × K entries, where K ≤ deployed API keys + anonymous. The old structure grew S × C.
|
||||
- The record is dropped (`ForgetAdmitted`) once the removal's RefreshRequired has been decided. Other removal paths drop
|
||||
the instance itself.
|
||||
|
||||
### NITs
|
||||
|
||||
- **N1 (#934):** in-stream root re-resolves run under a per-stream `fetches` source. It is linked to the stream token and
|
||||
cancelled in the stream's `finally` however the stream ends. Cancelling the stream token itself was rejected: it would
|
||||
also abort the subscription's graceful dispose.
|
||||
- **N2 (#933):** no held-key expiry is armed when there is no sink.
|
||||
- **N3 (#933):** a `MaxUnknownHold` of zero or less makes the `ProjectedConditionAccess` constructor throw
|
||||
`ArgumentOutOfRangeException`.
|
||||
- **N4 (#936):** `Verdict` writes back only while `_byInstance` still holds that instance. `Remove` drops the instance from
|
||||
`_byInstance` before purging under the same gate.
|
||||
- The existing S2 TTL unit test now `Add`s its condition first. Verdicts are only cached for live instances.
|
||||
- **N5:** the #933 test's lower bound is taken BEFORE the record that starts the hold. It is asserted `≥ hold` with no
|
||||
tolerance.
|
||||
|
||||
### Tests (red on revert → green)
|
||||
|
||||
| Test | Revert used | Red |
|
||||
|---|---|---|
|
||||
| `Issue933_r1_S1_…held_past_the_bound_until_that_mapping_is_definitively_refused` (map-b listed x, then transiently refused on the next stream ⇒ x not removed after 2.5 × hold; positive control: a Denied re-add ack ⇒ removed ≥ hold after it) | exemption disabled | **red** (x removed while map-b transient) |
|
||||
| `Issue933_r1_S2_time_with_no_stream_past_its_barrier_does_not_count…` (held, stream ends, next stream sits 2 × hold before its barrier ⇒ not removed at the barrier; removed later on the live stream) | gap shift disabled | **red** ("Removed should be empty") |
|
||||
| `Issue933_r1_N2_with_no_sink_an_expired_hold_does_not_spin_the_loop` (sink lookups in 500 ms after expiry < 50) | `HeldExpiry()` armed without a sink | **red** |
|
||||
| `Issue933_r1_N3_a_non_positive_MaxUnknownHold_is_refused` | guard removed | **red** |
|
||||
| `Issue934_r1_N1_a_root_re_resolve_in_flight_is_cancelled_when_the_stream_ends` (natural end ⇒ the blocked metadata call observes cancellation; next stream resolves; the abandoned answer is never applied) | `fetches.Cancel()` removed | **red** (10 s wait) |
|
||||
| `Issue934_r1_a_second_failed_in_stream_re_resolve_is_rescheduled…` | — (new coverage, no fix) | green |
|
||||
| OI `Issue936_r1_S3_a_session_re_activated_on_a_new_channel_is_still_told_of_the_removal` | `AdmissionKey` = a per-object GUID (object keying) | **red** |
|
||||
| unit `Issue936_r1_S3_S4_admission_is_recorded_lazily_per_credential…` | GUID key / eager allocation | **red** for each |
|
||||
| unit `Issue936_r1_N4_a_verdict_computed_while_its_condition_was_removed…` | write-back guard removed | **red** |
|
||||
|
||||
The `|| ImportedVisibleNow` removal fallback has no test of its own. Once admission is keyed on the credential, the
|
||||
fallback is reachable only past the 1024-credential cap, or for an identity the gate admits now but never admitted
|
||||
before.
|
||||
|
||||
Commits: `9d969c47` (#933 S1/S2/N2/N3/N5, #934 N1), `e61db016` (#936 S3/S4/N4 + docs), plus this evidence commit.
|
||||
|
||||
### Gates (`fu-consumer-933` at `e61db016`)
|
||||
|
||||
| Gate | Result |
|
||||
|---|---|
|
||||
| `dotnet build ZB.MOM.WW.OtOpcUa.slnx --no-incremental` | 0 warnings, 0 errors |
|
||||
| `run-unit-phase.py A4` / `A3` / `A2` | all `passed`: A4 Runtime 90 + AdminUI 14; A3 Runtime 90 + OpcUaServer 33 + Host 82; A2 157 + 83 + 32 + 30 + 12 + 12 + 5 (`20261125T170708…`, `…170812…`, `…170934…`) |
|
||||
| Host.Tests `DataConnections` | 207 passed |
|
||||
| Runtime.Tests full (`Category!=E2E&Category!=LiveIntegration`) | 2091 passed, 3 skipped, 0 failed (#920 did not fire) |
|
||||
| OpcUaServer.Tests full | 1460 passed, 2 skipped |
|
||||
| OI combined (`Feature=GrpcData` + ConditionMethodEvent / NativeAlarmEventIdentityFieldDelivery / FolderConditionRefresh / ConditionRefreshDeferral / ImportedConditionEventWireTests), once | 142 passed, 1 skipped (opt-in L2 harness) |
|
||||
| `git diff master -- '*Goldens.cs'` | empty |
|
||||
|
||||
### Full A01–A08 run — run `fu933-2` (after review round 1)
|
||||
|
||||
The run was taken under the shared rig lock. The sequence was `rig.py up --run-id fu933-2 --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, lock released). Evidence is in `artifacts/grpc-data/runs/fu933-2/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` and `p2_refresh_required_received` pass |
|
||||
| A04 | PASS | 16/16 | |
|
||||
| A05 | PASS | 4/4 | The denied session still sees no imported event (removal now = admitted credential OR the current gate) |
|
||||
| A06 | PASS | 11/11 | |
|
||||
| A07 | PASS | 8/8 | |
|
||||
| A08 | PASS | 10/10 | |
|
||||
|
||||
As in `fu933-1`, the live scenarios do not exercise a 20 min hold, a stream outage during a hold, a session re-activation
|
||||
before a removal, or a slow metadata answer. The unit and OI tests above pin those.
|
||||
|
||||
Reference in New Issue
Block a user