Files
lmxopcua/docs/plans/evidence/grpc-data-ext/A4.md
T

53 KiB
Raw Blame History

A4 evidence — code part (diagnostics, #930, #931, L1, L5)

Phase A4 of docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md, 2026-11-24/25, branch a4-code (from master 91438049). Not merged, not pushed. The docs part (DataConnections.md, AlarmTracking.md, ScriptedAlarms.md, security.md) is a separate worktree; the A01–A08 fleet scenarios are not part of this code pass.

#930 — a permanently refused mapping no longer storms (N2), ConditionCapacity recovers (N3)

ProjectedConditionAccess.Runner.cs:

  • In-stream retry. A mapping that is Unavailable (item refused, root metadata failed, snapshot timed out) or ConditionCapacity is retried ON THE OPEN STREAM: its root is re-resolved if it never resolved, any still-open item is removed, and its item is re-added (AddSubscriptionItems, a fresh command id; acks are matched on (mapping, command id)). The stream is no longer ended for it, so the healthy mappings are never re-snapshotted and methods are not answered BadNoCommunication in a reconnect gap.
  • Backoff per mapping. Definitive refusals (Denied, NotFound, Unsupported, item or root) and ConditionCapacity: ProjectedConditionOptions.LongRetryDelay (new, default 5 min) × 2ⁿ, ≤ 4×. Transient: the snapshot timeout × 2ⁿ, ≤ 8× (the old B2 schedule). A retry whose snapshot has not completed by its deadline goes back to Unavailable (claim released); a late completion of that item is still taken. A completed snapshot resets the retry count.
  • RefreshRequired only on a changed incomplete set. Each barrier records the set of mappings not known; an incomplete barrier whose set equals the previous barrier's (e.g. a stream that ended for another reason with the same mapping still refused) sends no RefreshRequired. A mapping that completes in-stream leaves the recorded set, so a later relapse is told again.
  • T2 holds: a retried mapping is Pending (unknown) while its retry runs, so nothing it might list is removed or marked known-inactive meanwhile; a capacity mapping's retry likewise blocks removals until it is known again.

Decision: a ConditionCapacity mapping is "known-empty" while parked but "unknown" during its retry window. Conservative (removals by other mappings in that window are held as BadNoCommunication instead of removed) — never the T2-unsafe direction.

#931 — nits N4–N8

Nit Fix
N4 A stream that ended before its barrier (every root failing, no Primary) backs off ReconnectDelay × 2^(n−1) up to the new MaxReconnectDelay (60 s); reset when a barrier passes. The repeated end logs at Debug after the first.
N5 The ledger charges max(Materialised, Σ known claims + max(Unlisted, Σ unknown claims)): held-but-unlisted keys (an Unavailable mapping's stale keys) are charged beside a known mapping's new claim (the under-count), but overlap an unknown mapping's claim (it may be re-listing those very keys — no false capacity rejection of a retry). The swap commits its count via Commit (never refused). SetMaterialised now reports when the node is over a cap (logged; materialising is never refused — bounded by Σ MaxConditions).
N6 _runners is a ConcurrentDictionary (mutated under _gate only); CallAsync and the diagnostics poll read a runner's Serving without _gate. No test (a lock-ordering change with no observable seam; reviewed by reading).
N7 A capacity reset whose reconcile removed conditions sends no second RefreshRequired — the removal already carried one to every item that held them (the sink's §5.2 "removal + RefreshRequired"); it still asks when nothing was removed.
N8 A parked (_stopping) runner is dropped once its removal finished (it hands over an empty set); new test observation IsParked.

Red/green (each reverted alone, the named test re-run, then restored)

Fix Revert Test Red
N2 in-stream end the stream when a retry is due B2_S7_a_refused_item… (rewritten: Add arrives, no new stream, map-b not re-applied) and N3_a_ConditionCapacity_mapping_is_re_added_in_stream… both red
N2 unchanged set alreadyTold = false N2_an_unchanged_incomplete_set_on_a_new_stream… red
N2 definitive Definitive ignores the refusal status N2_a_definitive_refusal_waits_the_long_backoff… red
N4 fixed ReconnectDelay N4_streams_that_never_reach_a_barrier_back_off_exponentially (< 12 metadata calls in 2 s; ~40 without) red
N5 known + unknown (old under-count) N5_held_stale_keys_are_charged_beside_a_known_mappings_new_claim… red
N7 if (outcome.Refresh) RequireRefresh() B1_an_in_stream_re_snapshot_over_capacity… (now asserts one RefreshRequired per reset: the removal's) red
N8 continuation never removes the parked entry N8_a_stopped_runner_is_not_kept_parked… red

Also new: N3_a_retry_still_over_capacity_stays_ConditionCapacity… (backoff doubles, map-b's key never removed).

Test-only fix found on the way: the condition-access tests waited for BarriersCompleted and then asserted RefreshRequired, but the barrier count moves before the barrier's refresh (the A4 manifest's first run caught it in N2_an_unchanged…); they now wait for the refresh itself, with the third stream's refresh as the positive control for the second stream's absence.

Diagnostics and metrics (plan §6)

  • Runtime/DataConnections/DataConnectionConditionDiagnostics.cs (new DI singleton, no dependencies — the H4 shape): shared by the origin condition items (ConditionItemStream, via LocalDataServices.ConditionDiagnostics), the consumer runtime (ProjectedConditionAccess.Diagnostics) and the readers (DataConnectionDeploymentRuntime.ConditionDiagnostics, DriverHostActor). The condition hub's unsignalled count is attached at DI time (no lazy-composition gap like H4 review 2).
  • Metrics (OtOpcUa meter, every one with side = origin | consumer, no ids): otopcua.dataconn.conditions.items{side} (consumer side new: one per acked mapping item), …conditions.resyncs{side}, …conditions.capacity_rejections{side}, …condition_methods{method,outcome,side} (consumer side new: every forwarded call), and the new otopcua.dataconn.conditions.refresh_required{side=consumer}. The A2 instruments were reused (only side added).
  • Contracts (Commons, additive optional members; older senders ⇒ null = "unavailable"): DataConnectionDiagnosticsSnapshot.Conditions (ConsumerConditionDiagnostics: stream state idle|connecting|snapshotting|live, last snapshot, materialised, state_known=false count, RefreshRequired, resyncs, capacity rejections, per mapping status / observed / MaxConditions / refusal, node budget vs host cap, method outcome classes), NodeDiagnosticsSnapshot.OriginConditions (OriginConditionDiagnostics: open items, the item nearest its limit, last snapshot, resyncs, capacity rejections, unsignalled, methods served). Arrays in production (H4 Akka JSON note); no bool flag was added.
  • AdminUI ClusterDataConnections.razor (already in <PageErrorBoundary>) + DataConnectionDiagnostics helpers: an "Imported conditions" line per connection (notice style when a mapping is Unavailable/ConditionCapacity or any count ≥ 80 % of its limit) and a served-conditions segment in the origin panel.

Decisions: the consumer RefreshRequired count is requests made by the runtime (explicit + each removal batch), not per client item; method outcome classes: DriverConfirmedSuccess = succeeded, RejectedBeforeDispatch = rejected, DriverConfirmedFailure = failed, the rest (AcceptedUnconfirmed, OutcomeUnknown) = unknown. A method the node manager refuses before forwarding (no local grant) is not counted on the consumer side.

Tests: Runtime GrpcDataConditionDiagnosticsTests (3), GrpcDataConditionDiagnosticsSerializationTests (2: cluster-serializer round trip; an older payload decodes Conditions/OriginConditions null), GrpcDataProjectedConditionAccessTests.A4_consumer_diagnostics…; AdminUI GrpcDataConditionDiagnosticsDisplayTests (4). Manifest key A4 in unit-phases.json.

AdminUI live — run a4c-cond-1 (prerendered HTML from control-1's admin, login disabled)

/clusters/CONSUMER/data-connections after the smoke:

  • consumer-1: "Imported conditions: stream live · last snapshot 2026-11-25 04:44:51Z · conditions 1 (state unknown 0) · node budget 1/2500 · RefreshRequired 0 · resyncs 0 · capacity rejections 0 · methods succeeded 1 · … · mappings map-raw Complete 0/1000; map-uns Complete 1/1000".
  • consumer-2 (no event subscriber): "stream idle · … · mappings map-raw Pending 0/1000; map-uns Pending 0/1000".
  • origin panel for consumer-1/2: "condition items open 0 · last snapshot none since start · … · state unknown (unsignalled) 0".

/clusters/SOURCE/data-connections origin panel: source-1 "condition items open 2 · largest listing 1/1000 · last snapshot 2026-11-25 04:44:51Z · resyncs 0 · capacity rejections 0 · state unknown (unsignalled) 0 · methods served succeeded 1"; source-2 (Secondary) zeros. /metrics: consumer-1 conditions_items{side="consumer"} 2, condition_methods_total{method="Acknowledge", outcome="DriverConfirmedSuccess",side="consumer"} 1; source-1 conditions_items{side="origin"} 2, the same method series with side="origin" 1 — page and metrics agree. Not driven in a browser (Chrome tools not used); prerender runs the same render.

L1 — origin SnapshotConditions Lock hold (§9.3) — PASS (A1 had not measured it)

A1-core.md/A1-L4.md record only L4 (X0 measured a field copy outside the server). Measured now with the opt-in harness OpcUaServer.Tests/ConditionSnapshotLockHoldMeasurementTests (OTOPCUA_L1=1): a running SDK server, 1,000 native conditions + 500 variables, two publisher threads (WriteValue, WriteAlarmCondition, both under Lock), 500 snapshots after 20 warm-up. The hold is an upper bound (keys-enumerated hook → post-hold hook; 1,000 = one hold at DefaultMaxConditionsPerHold). macOS (developer Mac), Debug build:

Run hold p50 / p99 / max (ms) WriteValue p99 / max (ms) WriteAlarmCondition p99 / max (ms)
1 1.61 / 4.65 / 5.89 1.93 / 6.39 1.94 / 6.42
2 1.44 / 4.32 / 5.00 1.71 / 6.34 1.71 / 6.38
3 1.45 / 4.53 / 5.90 1.65 / 6.81 1.66 / 6.76

p99 ≤ 10 ms and no publish delayed > 50 ms: pass. In-process, not on docker-dev (deviation: the brief allowed in-process).

L5 — condition counts vs defaults

  • docker-dev export (run a4c-cond-1, from the new diagnostics): map-raw 0/1000, map-uns 1/1000 (0.1 %); consumer node 1/2500 conditions (host caps 122,500 nodes / 400 MiB ⇒ 2,500); origin largest listing 1/1000. All ≤ 80 %: pass, defaults unchanged.
  • Production export: BLOCKED. No production ConfigDb is reachable read-only from configuration in the repo (production ConfigDbs are on the wonder boxes, which this brief forbids touching), and the data-connections feature is not deployed in production (v1 merged, undeployed), so no production export exists to count yet. To be filed.

Gates (at a4-code HEAD)

Gate Result
dotnet build ZB.MOM.WW.OtOpcUa.slnx --no-incremental 0 warnings, 0 errors
run-unit-phase.py A4 (new) passed (20261125T040920…)
run-unit-phase.py A3 / A1 / H4 / X0 passed
run-unit-phase.py A2 first run failed Overflow_before_the_snapshot_is_drained_resets_the_stream (below); re-run passed (20261125T042208…)
Host.Tests .DataConnections. 207 passed
Runtime.Tests full (Category!=E2E&Category!=LiveIntegration) 2066 passed, 3 skipped, 2 failed: GrpcDataConfiguredDiscoveryWireTests (#920) and Overflow_before_… (below)
OpcUaServer.Tests full 1458 passed, 2 skipped (the L1 harness is one)
AdminUI.Tests full 2707 passed
OI combined (139) 138 passed, 1 skipped
Live conditions_a3_smoke.py, run a4c-cond-1 passed: true (imported ScalarHigh ns=6;s=c1.…, 32-char EventId; bogus EventId ⇒ BadEventIdUnknown; ack via consumer 635 ms; exactly one Active/Acknowledged on origin and consumer); rig.py down ⇒ 0 run containers / networks
git diff master -- '*Goldens.cs' empty
Configuration.Tests not touched

Classification (b): test defect, no product change. The origin item notices a hub eviction only when it next reads the hub, which it does not do while it is producing snapshot chunks. At that read it takes one of two paths (ConditionItemStream.ReadDeltas):

  • the previous snapshot's last chunk is still undelivered (_deliveredSnapshot < Snapshots) ⇒ Overflowed ⇒ the session sends a stream Reset ("Condition stream overflow; retry later.");
  • otherwise ⇒ ResetSnapshot: a fresh snapshot (new begin) on the same stream, counted as a resync.

Both are what A2 specified (A2.md "Overflow" item 3: "a hub reader reset ⇒ the item re-snapshots … a reset while the item's previous snapshot is still undelivered ⇒ stream Reset"). Which one an eviction during a long delivery gets depends on whether the pump reads the hub before the session commits the last chunk (DirectReader.MoveNextAsync commits before returning the frame, so a consumer that has caught up commits it first). Neither loses a change. The Reset path makes the consumer reconnect and take a complete snapshot. The silent path's new snapshot is taken from the source, so it includes every evicted change. The A3 consumer (ProjectedConditionAccess.Runner.cs, the IsSnapshot && Total branch and the SnapshotComplete swap) buffers any snapshot begin into a new ConditionSet, keeps applying live deltas to both, and at snapshot_complete swaps it in as a full replacement: old ∪ new keys are re-merged and a key only the old set listed is removed. So a silent re-snapshot is safe, and the Overflowed rule protects the snapshot memory lease and back-pressure (no snapshot is taken behind an undelivered one). It is not a correctness signal the consumer depends on.

Evidence (instrumented copy of the test, alone, a4-code): 3,000 records came in chunks of 51 records, not the 24 × ~125 the test comment assumed: since A2 review S5 (20bf9372) the chunk budget is min(256 KiB, MaxPendingBytes = 200,000 in the fixture, MaxMessageBytes), and a record with info estimates ≈ 3.9 KB. Frames #1–#59 were snapshot 1 (complete on #59). #60 was a new begin (total=3000), then snapshot 2 was complete at #120, with Snapshots=2, Resets=1, Overflowed=false and no Reset control. So the test waited for a Reset that the legal silent path never sends. The original contract test, with its outcome instrumented, took the silent path 10/10 alone.

Why it "started" failing: it did not. Neither ConditionItemStream.cs, DataSubscriptionSession.Conditions.cs nor the test changed between the A2 merge (83c7e586) and master 91438049 (A3 touched only consumer files). At 83c7e586 (detached worktree, built clean) the test fails 3/3 alone but its class (22 tests) passes. It has been order- and JIT-warmth-dependent since S5 made the snapshot 59 chunks. A2 gated it only inside the class or suite. A3 and A4 add tests and change the scheduling of suite runs, so full-suite failures became more frequent.

Fix (tests only, GrpcDataConditionStreamTests.cs):

  1. Overflow_before_the_snapshot_is_drained_resets_the_stream is now deterministic. 300 records (begin + 6 chunks) fit the 16-frame condition queue. The consumer reads nothing after the ack. The test waits until the snapshot is taken and charged (ChargedBytes > 0, so the start cursor precedes the raises), raises 6 times (capacity 2 ⇒ eviction above the cursor), ticks until Overflowed, and then asserts the Reset ("overflow") and Snapshots == 1.
  2. New An_eviction_during_a_long_snapshot_delivery_resets_or_resnapshots_without_losing_a_change keeps the 3,000-record race and asserts the contract for either outcome. On Reset ⇒ Overflowed, and a reconnected stream's complete snapshot (3,000) holds the source's final state for the raised condition. On re-snapshot ⇒ begin total=3000, only snapshot chunks until snapshot_complete, 3,000 records with the final state, Resets == 1, Snapshots == 2, Overflowed == false, and the stream not ended. Any other outcome fails.

Red/green (mutations of ConditionItemStream.ReadDeltas, each restored):

Mutation Deterministic Overflow test Contract test
none green 10/10 alone green 10/10 alone (silent path 10/10)
M1: Overflowed rule disabled (false && …) red (Condition not reached — no Reset) green (silent path, which is legal)
M2: eviction swallowed (_cursors[p] = read.Floor; continue), Overflowed kept green (Overflowed still set) green (took the Reset path)
M3: eviction swallowed and no Overflowed (a lost change) red red ("Neither a Reset nor a fresh snapshot.")

Gates after the #928 fix + docs reconcile (tests + docs, and one XML doc comment in RemoteNamespaceMapping.cs; no behaviour change, so OpcUaServer.Tests full and the live smoke were not re-run):

Gate Result
dotnet build ZB.MOM.WW.OtOpcUa.slnx --no-incremental 0 warnings, 0 errors
The two #928 tests alone, 10× 10/10 green
run-unit-phase.py A2 / A3 / A4 passed (20261125T050036…, 20261125T050157…, 20261125T050252…)
Runtime.Tests full (Category!=E2E&Category!=LiveIntegration) 2068 passed, 3 skipped, 1 failed: GrpcDataConfiguredDiscoveryWireTests.Two_sdk_cadences_… (#920), which passed when re-run alone
Host.Tests .DataConnections. 207 passed

Left over

  • File: production L5 count (blocked, above). #928 resolved above (test defect, tests fixed).
  • Not done here: A01–A08, reviewer approval, the ScadaBridge consumer-impact record, docs (other worktree).

Review round 1

Review written at 3be51e3b (approve-with-changes: 1 blocker, 4 should-fix, NITs). Fixed on a4-code after b2fab8b07. "Red" = the fix reverted alone (scratch copy, file restored afterwards), the named test re-run alone.

Finding Outcome Test Red when reverted
B1 second capacity reset reused "remove-{mapping}" ⇒ transport refuses it, stream ends Fixed: "remove-{mapping}-{guid}". Every command id the runner builds was checked: open (once per stream), retry-{mapping}-{guid}, remove-retry-{guid}, and the new remove-late-{guid} (S2) are unique. The test fake (FakeStream.SendAsync) now refuses any command id already used on the stream, as GrpcDataConnection does (_usedCommands) — this is what hid the defect. N3_a_retry_still_over_capacity… (+ asserts no new stream and two removes) red (the strict fake alone, before the fix, and the fix reverted)
S1 retry timeout dropped buffer + claim, so a retry snapshot slower than the timeout never completed Fixed: a retry deadline keeps the buffer and claim, like the initial barrier timeout; the late completion swaps in. The buffer (and its claim) are dropped only when the next retry removes the item and re-adds it. Comment, RetryDueAsync doc and DataConnections.md now say so. R1_S1_a_retry_snapshot_slower_than_the_timeout_still_completes_late… red
S2 a late ack after the retry was replaced left an orphaned origin item; re-adds refused InvalidArgument forever Fixed both ways: (1) a command replaced before its ack is remembered (Superseded, ≤ 8 per mapping); a late Good ack of it sends RemoveSubscriptionItems for that handle at once; (2) backstop: 3 consecutive InvalidArgument refusals of a mapping's in-stream re-adds end the stream (MaxInvalidArgumentRefusals). R1_S2_a_late_ack_of_a_superseded_retry_removes_the_orphaned_origin_item… (fake origin acks retry #1 after #2 was sent); R1_S2_consecutive_InvalidArgument_refusals…backstop red / red
S3 N5 overlap allowance let another mapping's held stale keys count as overlap, exceeding the host caps Fixed: an unknown mapping's claim is reduced only by the held-unlisted keys it listed when last known on this runner (_lastListed, kept only while it has no committed set; HeldOverlap). Charge = max(Materialised, known + Unlisted + Σunknown − min(Unlisted, Σ min(claim, overlap))). Unlisted is now reset to everything held at each stream start (nothing contributes yet) — before, it carried the last barrier's value (0 after a complete one), which is how the review's counter-example got in on a new stream. Residual (documented in DataConnections.md): a mapping whose origin retired its old keys and lists new ones, while another mapping is unknown, can exceed by at most its own previous count until known; logged and on the AdminUI budget line. R1_S3_another_mappings_held_stale_keys_are_not_overlap… (the review's counter-example at 3-condition scale); N5_… still green red (old formula)
S4 SourceName depended on runtime mapping status Decision: keep SourceName stable. Merge remembers per key the mapping that chose its SourceName; while that mapping is deployed, higher in the deployed order, and merely not contributing (refused / Unavailable / retrying / ConditionCapacity / Pending on a new stream), the held SourceName is kept. Placements and notifiers still follow the contributing mappings (visibility unchanged: SourceName is a display field, no access decision reads it); no removal or known-inactive decision involved (T2 unaffected). It moves when that mapping is known again and no longer lists the key, when it is no longer deployed (new runner ⇒ recomputed: the A3 "disabling the primary mapping moves SourceName" behaviour holds), or when a higher-priority mapping lists the key. Residual: a key first seen while the Raw mapping is unavailable starts with the UNS SourceName. AlarmTracking.md and A4-docs.md ScadaBridge item 1 updated (add both cases to ScadaBridge#147). R1_S4_SourceName_stays_on_the_deployed_primary… (with a positive control: Raw known again without the key ⇒ moves) red
Docs: DataConnections step 5 / follow-ups / metrics side + refresh_required Already fixed by b2fab8b07; verified. Line on retry timeout corrected (S1), S2/S3 behaviour and the resync definition added. — —
Docs: AlarmTracking RefreshRequired "every incomplete barrier" Fixed: only when the incomplete set changed (#930). — —
Docs: ScriptedAlarms "accepted and routed" vs DataConnections "applied" Code (LocalDataServices.ConditionMethods.cs): scripted ⇒ DriverConfirmedSuccess when the origin's handler applied it; native ⇒ AcceptedUnconfirmed. ScriptedAlarms.md now says "applied" (DataConnections.md table was already right). — —
Docs: A4-docs.md stale Runner.cs citations Updated to current lines (:703, :521, :951, :955-962, :966-974). — —
Metric descriptions said "on this origin" OtOpcUaTelemetry.cs descriptions for items / resyncs / capacity_rejections / condition_methods name both sides. — —
NIT resyncs{side=consumer} over-count Fixed: counted only for a stream that opened. R1_NIT_consumer_resyncs_count_streams_that_opened… (+ positive control) red
NIT AdminUI null-safety ConditionsNeedAttention uses Mappings?.; MethodCounts takes null ⇒ "unavailable". AdminUI A_partial_payload_without_mappings_or_methods_renders… red (HEAD file)
NIT misplaced doc comments NearLimit has one summary; HasDrops has its #919 summary back. — —
NIT in-loop ResolveRootsAsync stall (≤ 10 s) Not fixed — recorded, #934. Moving it off the loop changes the loop's concurrency shape (a second wake source, results applied on the loop); frames are delayed, not lost. — —
NIT unpruned _consumer map Fixed: RetainConsumers on every mapping change drops connections no deployed mapping references. R1_NIT_consumer_counters_of_a_removed_connection_are_pruned red
NIT permanent removal block Filed as #933 (not fixed here, per brief). — —
NIT L1 measured on macOS Debug Accepted as recorded. — —

Commits: c93290d0 (runner fixes + tests), 0cac09ce (AdminUI, metric descriptions, docs), this evidence commit. Follow-up filed: #934 (in-loop root re-resolve).

Gates after review round 1

Gate Result
dotnet build ZB.MOM.WW.OtOpcUa.slnx --no-incremental 0 warnings, 0 errors
run-unit-phase.py A4 / A3 / A2 / A1 / X0 passed (20261125T052352…, …052438…, …052546…, …052655…, …053025…)
Host.Tests .DataConnections. 207 passed
Runtime.Tests full (Category!=E2E&Category!=LiveIntegration) 2076 passed, 3 skipped, 0 failed (#920 did not fire)
OpcUaServer.Tests full 1458 passed, 2 skipped
AdminUI.Tests full 2708 passed
OI combined (Feature=GrpcData + ConditionMethodEvent / NativeAlarmEventIdentityFieldDelivery / FolderConditionRefresh / ConditionRefreshDeferral), once 138 passed, 1 skipped (opt-in L2 harness)
Live conditions_a3_smoke.py, run a4r1-cond-1 passed: true (all 7 checks; imported ns=6;s=c1.…, 32-char EventId; bogus EventId ⇒ BadEventIdUnknown; ack 597 ms; exactly one Active/Acknowledged on origin and consumer)
AdminUI /clusters/{CONSUMER,SOURCE}/data-connections (curl, control-1 admin) 200 both; consumer-1 "Imported conditions: stream live · … · resyncs 0 · … · methods succeeded 1 · … · mappings map-raw Complete 0/1000; map-uns Complete 1/1000"; source-1 "condition items open 2 · largest listing 1/1000 · … · methods served succeeded 1"
rig.py down 0 run containers / networks
git diff master -- '*Goldens.cs' empty

Live scenarios (part 1) — A01, A02, A04, A05, A08: all PASS (run a4s-2)

Harness: scripts/validation/grpc-data/conditions_scenarios.py (commits 304e8b1b, 6bf7dc89) on rig.py up --conditions at 6bf7dc89 (seed → 85 s → deploy --timeout 300 → conditions_a3_smoke.py → scenarios → rig.py down, 0 run containers left). It reuses scenarios.ScenarioRunner (publish, mutate+deploy, restore+deploy, configuration experiments, redacted evidence). Ids are resolved, never built: projected folders by browse -r of the consumer from i=85, imported ConditionIds/EventIds from the ConditionNodeId/EventId lines the CLI alarms prints. Every absence check has a positive control in the same window. Each scenario is restored before the next one runs. A08 runs restore + deploy, A05 restarts the consumer pair back onto compose.yml, and every scenario ends with scalar := 0.

Fixture additions (conditions profile only; v1 rig unchanged).

  • A run-owned opcplc container (opc-plc:2.14.10 --alm), the image the OpcUaClient integration fixture pins.
  • A SOURCE OpcUaClient driver opcua with device opcplc.
  • A native alarm tag EastTankYellow, whose nodeId is the upstream condition node ns=6;s=1:Colours/EastTank?Yellow.
  • Equipment pumpa/pumpb, both referencing that tag.
  • Raw mapping map-opc and UNS mappings map-pumpa/map-pumpb, with matching exports.
  • An origin principal fixture-unsonly that holds only the pumpa UNS export.
  • A CONSUMER principal fixture-cli-nogrant with no NodeAcl.

Deviation from the brief: no shared 10.100.0.35:50000 fixture. The rig's endpoint guard (validate_fixture_endpoints, implementation plan "validate resolved compose/seed has no shared-host endpoints") admits run-owned DNS only. The scenarios also ack and comment upstream conditions, which must not leak into a shared simulator.

ID Result Evidence (run a4s-2, evidence/A4S-<id>.json)
A01 PASS (13 checks) Scripted ScalarHigh raised (scalar 150), imported Active/Unacked with an opaque ns=6;s=c1.… id. The consumer ack succeeds, then confirm with the acked EventId succeeds. Origin and consumer each show exactly one Active/Acknowledged ack event and exactly one confirm event (Active, Acknowledged, "scalar high"). ConfirmedState was resolved by browsing each condition node and read Confirmed on both the origin (ns=3;s=source-scalar-high) and the consumer. Both clear to Inactive, Acknowledged. Same sequence on both sides: Unacked → Acked → Acked(confirm) → Inactive.
A02 PASS (10 checks) Native EastTankYellow (driver → opc-plc) is imported. A bogus EventId gets BadEventIdUnknown. The consumer ack and comment (CLI "Comment added") both succeed, and the origin audits both: Acknowledge … AcceptedUnconfirmed 0x00000000 and AddComment … AcceptedUnconfirmed, each on Raw:…:opcua/opcplc/EastTankYellow on behalf of fixture-cli. confirm gets BadNotSupported [0x803D0000], and the origin audit has no Confirm line, so it was unsent; the two audited calls are the positive control.
A04 PASS (16 checks) See the A04 notes below.
A05 PASS (4 checks) The consumer pair was restarted with Security__Acl__Enabled=false (rig configuration experiment). In the same window the granted fixture-cli session saw 3 ScalarHigh and 6 EastTankYellow events. fixture-cli-nogrant at i=2253 (two sessions, each with ConditionRefresh) saw 0 imported events. Its RefreshStart/End markers (2) arrived, which shows the session and subscription were alive.
A08 PASS (10 checks) See the A08 notes below.

A04 notes.

  • The three branch folders were resolved by browsing: OtOpcUa/remote-opc, /remote-pumpa and /remote-pumpb.
  • Two rounds ran with different folder-subscription orders, (pumpa, raw, pumpb) then (raw, pumpb, pumpa), and the 30 s demand linger was allowed to expire between them.
  • In each round the Server object showed exactly one consumer ConditionId, and that id was the same in both rounds.
  • No i=2253 EventId was duplicated after all subscribers were up.
  • All three folders were live notifiers: each carried the same single ConditionId, with no duplicates.
  • Every live Server-object event after the window reached every folder, and no folder carried an event the Server object lacked.
  • fixture-unsonly records (probe condition-records, UNS pumpa item) are UNS-only. The placement is area/line/pumpa/EastTankYellow, and opcua/opcplc appears nowhere in them.
  • Positive control: the full principal's Raw item names opcua/opcplc/EastTankYellow.

A08 notes.

  • The setup was acl_permissions source-peer := Admin without AlarmAcknowledge (3839), then deploy.
  • ScalarHigh still streams: it was imported Active and cleared Inactive on the consumer.
  • The consumer ack returned BadUserAccessDenied [0x801F0000]. The origin audit records Acknowledge … RejectedBeforeDispatch 0x801F0000, so the denial came from the origin, not the consumer gate. The origin never showed Acknowledged.
  • The alert-transitions node probe listened on each Primary's own authenticated telemetry stream (the /alerts + alarm-history feed) for 110 s:
    • SOURCE: 71 envelopes, 15 transitions (ScalarHigh Activated/Cleared plus native ones). This is the positive control.
    • CONSUMER: 0 transitions.
  • Restoring 4095 and deploying makes the same consumer ack Good. This is the positive control for the denial.

Also re-run on a4s-2: conditions_a3_smoke.py passed, all 7 checks; exactly one Active/Acknowledged event on each side.

Observations (no product defect found in part 1)

  1. A folder event item created before demand is open is refused BadNotSupported. The CLI exits with an error. This is A3 deviation 3 ("a folder is a notifier only while a condition is wired there") and was observed live on the debug run a4s-1. The consequence is that a client that subscribes only at an equipment or device folder, with no Server-object item anywhere on that consumer node, never gets imported conditions, and the CLI cannot retry. A04 therefore opens demand at i=2253 first.
    • Worth a ScadaBridge note: its DCL subscribes at the Server object, so it is unaffected.
    • Worth a docs line in AlarmTracking.md "Imported conditions".
  2. Native ack against opc-plc is never confirmed upstream. opc-plc's --alm conditions return Good to Acknowledge, but they keep reporting AckedState=false, with all-zero EventIds (EastTank?Red).
    • The origin's driver dedups on the last-told state, so after a consumer ack the origin and consumer show Active, Acknowledged and then stay silent. For Red, which never leaves Active, nothing more ever arrives.
    • This is the AcceptedUnconfirmed contract working as specified: the consumer doesn't claim the upstream applied it. It is also a simulator limitation.
    • That is why the alarm tag binds Yellow, which cycles. The first run (a4s-1, a debug run with a hand-written fixture.json, not evidence) used Red.
  3. A native AddComment produces no event. It is forwarded and audited AcceptedUnconfirmed, but opc-plc emits no comment event, so neither side re-reports anything. This is expected for AcceptedUnconfirmed.
  4. The origin /alerts writes Activated rows for opc-plc's repeated "severity has increased" events on an already-Active condition. That is one row every ~8 s, seen in the A08 SOURCE stream. The cause is the OpcUaClient restatement rule (#656): only the same message and the same severity is suppressed. This is pre-existing origin-side behaviour, unrelated to forwarding, and is recorded only.
  5. A08's consumer telemetry stream carried 0 envelopes. The consumer has no drivers, so there is no driver-health priming. The "stream open" check therefore proves an authenticated subscribe that ran to its deadline without error, not that traffic was received. The SOURCE stream from the same probe code is the positive control. The rig runs no alarm historian, so the "no alarm-history rows" leg is asserted at the feed the historian adapter consumes (the alerts transitions), not at a historian table.
  6. Harness defect found and fixed during the run. With Write in their operations, condition mappings need WriteThrough=true (DataMappingOperationsInvalid). The first seed (a4s-1) was rejected; that run id is poisoned.

Harness notes for part 2 (A03, A06, A07)

  • Add scenario_A03/A06/A07 methods to ConditionScenarios and their ids to SCENARIOS/TIMEOUTS. run() already handles per-scenario restore and result rows. Add the id to the baseline() set in run() if the scenario mutates.
  • Building blocks:
    • Watch (a CLI alarms subscription per node/notifier/key, with parsed blocks);
    • projected_folders (resolved by browse);
    • condition_child (browse a condition, then read a child);
    • audit(node, since) (origin method audit lines);
    • node_probe_async(node, op, seconds) (a non-blocking node-file probe);
    • probe_records(...) (origin condition snapshot under any data_key_files principal);
    • self.r.stopped(...) / self.r.paused(...) / self.r.wait_primary(...) from ScenarioRunner for failover and restarts.
  • A03 should use a failover in which the record time changes (D7), i.e. raise/clear across the gap. The scripted ScalarHigh is the controllable alarm. EastTankYellow cycles every ~48 s by itself, which is useful as a "standing active" native alarm.
  • A06/A07: watch both consumer-1 and consumer-2 (each with Watch(..., node)) and compare the printed ConditionIds. For RefreshRequired, the CLI prints every event, so look for the RefreshRequired event type in the block's Message/Source. The CLI does not print EventType; add it to AlarmsCommand if A07 needs it, which is a CLI .cs change and so must land before rig.py up.
  • Any .cs change (seed, probe, node-probe, CLI) changes source_tree_hash and needs a fresh up and run id. Python-only harness edits do not.

Live scenarios (part 2) — A03, A06, A07

Harness: conditions_scenarios.py scenario_A03/A06/A07 (commits 9ea50c11, 42e3800f, and the A03 native-probe change after a4s-4). There were debug runs on a4s-3 (experiments X-MARK, X-RESET and X-REASSERT, described below) and a4s-4. The evidence runs are on a4s-5 (see "Full A01–A08 run").

Harness and fixture additions.

  • The CLI alarms command prints an EventType: line and names RefreshStart, RefreshEnd and RefreshRequired. That change is in Client.Shared AlarmEventArgs.EventType (select clause 1) and in AlarmsCommand. Unit tests: Execute_PrintsEventType_NamingRefreshRequired and an assertion in OnAlarmEvent_TruncatedFields_StillRaisesEvent. It is documented in Client.CLI.md.
  • The seed adds a second granted CONSUMER principal, fixture-cli-alt (cluster Admin, manifest cli_alt).
  • The seed adds a mutation bump_mapping_revision. It increments one mapping's Revision, and through the runner signature that resets the consumer's condition stream.
  • New harness helpers:
    • duplicate_transitions: two live events with the same (condition, Time, State, Severity, Message). The EventId check cannot see these, because each copy gets a fresh EventId.
    • log_lines: the runner's stream … opened (serving …) and snapshot barrier passed lines, with timestamps.
    • start_watch: retries the CLI until a starting node accepts it.
ID Result (a4s-5) Evidence (evidence/A4S-<id>.json)
A03 FAIL (16/19). Phase 2, the plan's failover/G4 path: all PASS. Phase 1 (deploy-driven stream reset) and duplicate check: 3 product findings, F1–F3 below Phase 2 checks run in this order; each passed. Gap: source Primary source-1 was docker paused. ScalarHigh was cleared and re-raised at the device, then the node was unpaused and stopped at once. The consumer never saw the clear (scripted_events_after_failover = []). Failover: source-2 became Primary, and the runner logged stream 4 … opened (serving source-2:4053). RefreshRequired: the Server-object watcher received RefreshRequiredEventType (i=2789). Old EventId: an ack with the pre-failover ScalarHigh EventId got BadEventIdUnknown and was not sent; the record time changed, so it was not re-bound. ConditionRefresh: a new --refresh subscription replayed ScalarHigh with the same ConditionId, a new EventId and Active, Unacknowledged, and that EventId's ack was Good (origin audit: DriverConfirmedSuccess). The native EastTankYellow was still present with the same ConditionId, so nothing still active was retired. Positive control: a clear after the resync arrived exactly once (Inactive, Acknowledged). No duplicate EventIds after failover.
A06 PASS (11/11) Consumer Primary consumer-1. Before the change, four clients watched: consumer-1 as fixture-cli (with -F → consumer-2), consumer-1 as fixture-cli-alt, consumer-2 as fixture-cli, and consumer-2 as fixture-cli-alt. All four showed the same ConditionIds for ScalarHigh and EastTankYellow. consumer-1 was then stopped and consumer-2 became Primary. Its two clients each saw the clear exactly once and then the re-raise, with no duplicate EventIds. The -F client failed over and also saw the clear once. After restart, consumer-1 (as fixture-cli) and consumer-2 (as fixture-cli-alt) both converged: the same ConditionIds as before, Active, Unacknowledged, and one clear each. No duplicate transitions on any client.
A07 PASS (8/8) consumer-1 (non-Primary) was restarted. The "early" client subscribed with --refresh as soon as the node accepted it. RefreshEnd was at 07:41:33.16 and the first barrier at 07:41:48.22, so the refresh preceded the snapshot. It replayed 0 imported conditions, and no RefreshRequired arrived (the barrier was complete). ScalarHigh and EastTankYellow then arrived as ordinary events as their records applied. A "late" --refresh after the barrier replayed both, with the pre-restart ConditionIds and the origin's state. The early client's final view equalled the late client's view. Positive control: one clear on each client, and no duplicates.

A03 and A07 plan-vs-code verdicts (A4-docs.md D6, D7).

  • D7 (A03): the code and the docs are right. The plan's "pre-failover EventId ⇒ BadEventIdUnknown" holds when the record time changes. That is what happened to ScalarHigh in every run. When the time is unchanged, the old EventId re-binds and stays usable.
    • Both outcomes were seen live for the native EastTankYellow, which the scenario does not drive.
    • On a4s-4 its pre-failover EventId was accepted (ack Good, audited AcceptedUnconfirmed).
    • On a4s-3 (its time moved) it was BadEventIdUnknown.
    • On a4s-5 the AddComment probe was accepted.
  • D6 (A07): the code is right; the plan's wording should change. A ConditionRefresh made before a complete first barrier gets no RefreshRequired, and it replays nothing imported. The client is not left with a wrong view: each condition arrives as an event when its record applies, so a client that keeps its subscription converges to the same view as a post-barrier refresh (a4s-3 and a4s-5).
    • RefreshRequired after a refresh is only sent at an incomplete barrier, which this rig does not produce.
    • Suggested plan wording: "ConditionRefresh before the first snapshot returns nothing imported; conditions follow as events (RefreshRequired only if that barrier is incomplete)."

Findings (product, not fixed here)

F1 — a deploy invalidates outstanding consumer EventIds of a still-active scripted condition, with no RefreshRequired.

Repro (a4s-3 X-RESET, and A03 phase 1 on a4s-3, a4s-4 and a4s-5):

  1. Raise ScalarHigh.
  2. On the consumer, comment with its EventId E1. Result: Good (the control).
  3. Make any fleet deploy: bump_mapping_revision on map-pumpb, or (X-REASSERT) a SOURCE-only ACL change.
  4. comment with E1 again. Result: BadEventIdUnknown, refused locally with no origin audit line. The newest EventId is still accepted.

What the deploy does:

  • Every deploy ends the consumer's condition stream ("stream … ended; re-snapshotting") and reopens it on the same origin node.
  • The origin's ScriptedAlarmHost "re-asserted 1 non-normal condition node(s) after (re)load", with a new record time.

Why this looks like a consumer-side defect:

  • The origin's activation marker does not change across the deploy. The X-MARK probe read c8ef…:10 before and after, through the condition-records probe.
  • So the docs' "a re-assert invalidates nothing" and "a stream reset against the same incarnation keeps old EventIds ackable" do not hold live. A03 checks p1_pre_reset_eventid_still_accepted.
  • The consumer's condition.Activation must differ from E1's binding even though the origin snapshot marker is unchanged. One suspect is a live record on the ending or opening stream that carries a different marker. This needs code investigation.
  • Impact is limited: the client receives a fresh event with a fresh, ackable EventId, so it acks with the latest one. An operator acking an older event across a deploy gets BadEventIdUnknown.

F2 — the consumer reports the origin's post-deploy re-assert as a new event; origin clients see none.

  • On every deploy the consumer emits one extra ScalarHigh event, Active, Unacknowledged, with a new Time and a new EventId.
  • The origin's own OPC UA clients get no event for it (origin_events_during_reset = []) on a4s-4 and a4s-5. A03 checks this as p1_consumer_events_mirror_origin.
  • Consumer clients therefore see a transition that did not happen.

F3 — one origin transition can be delivered twice to consumer clients across a stream reset.

  • On a4s-5 the origin reported EastTankYellow at 07:35:55.3554429Z (Active, Unacknowledged, "The alarm is active.") once (origin EventId 8D27…).
  • The consumer's Server-object client received it twice, with consumer EventIds 960F… and 0702… and an identical Time, state, severity and message. This was during the phase-1 deploy and stream reset.
  • The same pattern appeared on a4s-3 (07:01:36.8679509Z, "severity has increased") and on a4s-4 (07:12:00.9922332Z, Inactive, Acknowledged).
  • A03 checks this as no_duplicate_transitions_whole_scenario.
  • Part-1 A04's "no duplicated i=2253 EventId" check could not catch it, because each copy has its own EventId. The new duplicate_transitions check found no duplicates in A06 or A07 (no deploy in those windows).

F4 — a folder event item on a consumer with no open demand is still refused BadNotSupported (part-1 observation 1, re-checked).

  • On a4s-3 and a4s-5, A06 put the first subscriber on a freshly restarted consumer at the remote-opc branch folder (ns=4;s=p1.…map-opc…). It was refused BadNotSupported and the CLI exited.
  • This contradicts A3 Deviation 3 and OnProjectedFolderMaterialised, which promote condition-bearing mapping folders to SubscribeToEvents at materialisation.
  • One suspect: the promotion predicate IsConditionBearingMapping requires Authority.IsActive. It is evaluated only at materialisation, and nothing re-promotes a folder when the authority activates later. This is not verified.
  • The workaround is documented in AlarmTracking.md "Imported conditions": open an i=2253 item first. ScadaBridge does.

Observations

  1. A forwarded native ack to opc-plc froze EastTankYellow at the origin (a4s-4).
    • A03 acked the pre-failover native EventId, which re-bound (D7), and the ack was Good (AcceptedUnconfirmed).
    • After that, both source nodes showed EastTankYellow at Active, Acknowledged (07:12:42) for the rest of the run (≥14 min, re-probed at the end), with no further transitions. A04 then failed: no late events, 6 checks.
    • In part 1 an A02 ack did not stop the cycling. The cause (OpcUaClient driver dedup versus opc-plc's --alm simulation) is not established.
    • The harness now probes the native EventId with AddComment (the same binding check), and A04 passed on a4s-5.
  2. The -F failover-capable CLI client on the stopped consumer resumed on the partner and saw the clear (A06). The non-failover client on the stopped node stayed alive and received nothing, as expected.
  3. A consumer restart's first barrier came about 15 s after the first subscription. This is the window in which a ConditionRefresh returns nothing imported (A07).

Full A01–A08 run — run a4s-5

rig.py up --run-id a4s-5 --conditions → seed → 85 s → deploy --timeout 300 → conditions_a3_smoke.py (PASS: one Active/Acknowledged event each side) → conditions_scenarios.py (all eight, one session; restore after A03/A08, A05's experiment restart) → rig.py down (0 run containers left). Evidence artifacts/grpc-data/runs/a4s-5/evidence/ (A4S-results.md).

Scenario Result Checks Notes
A01 PASS 13/13
A02 PASS 10/10
A03 FAIL 16/19 Plan path (failover, G4) all PASS. Fails: p1_consumer_events_mirror_origin (F2), p1_pre_reset_eventid_still_accepted (F1), no_duplicate_transitions_whole_scenario (F3).
A04 PASS 16/16
A05 PASS 4/4
A06 PASS 11/11
A07 PASS 8/8
A08 PASS 10/10

Earlier full run, a4s-4:

  • A04 also failed, because of observation 1.
  • A03 failed with the same three checks as a4s-5.
  • Every other scenario passed.

Findings F1–F4 fixes

Debug run a4dbg-1 (instrumented build, never committed): the consumer logged every imported-condition apply (fire / no-fire, marker before→after, node state before) and the origin logged every condition record. A03 alone reproduced the same three failures as a4s-5.

Root cause of F1, F2 and F3 (one consumer defect).

  • The consumer's own deploy (every fleet deploy, including a SOURCE-only ACL change) begins a catalog attempt. ProjectedMappingDeploymentRuntime.AttemptBegan publishes an empty mapping set (Notify([])) until AttemptCompleted.
  • ProjectedConditionAccess.ReconcileRunners read that as "connection removed": Stop(removeConditions: true) removed every imported condition. The runner after the deploy re-created them on fresh nodes. Live evidence at the deploy instant: marker null->M5 before={Active=False, Acknowledged=True, …, Message=EastTankYellow, Quality=BadWaitingForInitialData} (a fresh node) for both conditions, then stream 2's records applied as genuine deltas.
    • F2: the fresh node makes the re-snapshotted ScalarHigh a delta, so one event per active condition.
    • F3: EastTankYellow's last transition (delivered just before the deploy) is applied again to a fresh node. The result is a second event with the same Time and state.
    • F1: the condition object, and with it the EventId registry, is new, so every older EventId is BadEventIdUnknown. The removal's RefreshRequired was queued but gated away: visibility is decided against the current mapping set, which was empty (filed #936 for genuine removals).
  • The origin side is a contributing factor, not the cause. The origin record across the deploy had the same marker and state, with a new time. ScriptedAlarmEngine.LoadAsync restores Active=Inactive (the LocalDb store does not persist it) and re-activates a still-true alarm, so LastTransitionUtc moves. The origin node stays the same state, so the origin reports no event. That is what the brief's hypothesis saw. With the consumer holding its nodes, the consumer mirrors this silently: there is no delta, the marker is unchanged, and old EventIds stay bound. The same reload also un-acks an acked active alarm and writes a duplicate alerts row on every deploy. That is an origin engine defect outside condition forwarding, filed as #935 (not fixed here).

Design decision (consumer side). The plan's T2/G4 contract holds unchanged: a resync against the same incarnation keeps EventIds, an unchanged occurrence reports nothing, and an un-re-bindable change sends RefreshRequired. The defect was the consumer treating an undecided mapping set as a removal. That also violated T2: an active condition was removed while it was still active at the origin.

  • IProjectedConditionMappings.Suspended (DeployedConditionMappings reads the runtime's Suspended): while it is set, a connection that drops out is stopped without removal and held.
  • The connection's next runner takes the held materialised set over, through the existing S3/S4 hand-over, and re-snapshots onto the same nodes.
  • Only a settled set without the connection (or the demand linger) releases the held runner, which then removes its conditions.
  • The origin is not changed. A restatement keeps its marker, so comparing the marker (not the time) is already how the consumer re-binds. Time-only differences fire nothing, because the delta gate excludes Time.
  • Docs: AlarmTracking.md §Notifiers and delivery and DataConnections.md §condition stream lifetime.

F4 root cause. On a restarted consumer the projected pages, including the remote-opc anchor, materialise before the mapping's authority activates. IsConditionBearingMapping needs Authority.IsActive, so OnProjectedFolderMaterialised did not promote the folder, and nothing re-promoted it later. The SDK's MonitoredNodeMonitoredItemManager then refused the item BadNotSupported (it checks EventNotifier & SubscribeToEvents). Our CreateMonitoredItems override is too late for event items, because the master has already processed them. Fix: in the SubscribeToEvents override, once the projected-notifier admission (the mapping gate) passes, PromoteProjectedEventFolder re-checks the mapping and promotes the folder before the SDK attach. Callers who are not authorized are refused before this step. The i=2253-first workaround text in AlarmTracking.md is replaced.

Native ack freeze (a4s-4 observation 1): opc-plc's own behaviour, not ours. A standalone opc-plc:2.14.10 --alm container was run with no OtOpcUa. The CLI alarms watched 127.0.0.1:50999, and ack -n "ns=6;s=1:Colours/EastTank?Yellow" -e 00…00 was sent at 07:58:19.

  • Before the ack, EastTank/Yellow transitioned every 8 s (severity 300 → 500 → 700).
  • After the ack it emitted one Active, Acknowledged event (07:58:20.40), then nothing for the rest of the watch (≥ 10 min).
  • Over the same window NorthMotor/Yellow, which was never acked, kept cycling (61 events).
  • opc-plc's alarm simulation stops driving a condition once it has been acknowledged. Our forwarding and the OpcUaClient driver relay that faithfully. Recorded; the harness keeps its AddComment probe for the native EventId.
Fix Commit Test (red on revert → green)
F1–F3 hold across a deploy 1b7c69c6 Runtime F1_a_deploys_empty_suspended_mapping_set_holds_the_conditions_and_only_a_settled_set_without_the_connection_removes_them: with suspended forced false it fails at "a deploy's undecided empty set is not a removal" (Removed had x); restored, it passes
F4 promote on admission e4b9998c OI F4_a_folder_materialised_before_its_mapping_was_condition_bearing_still_admits_a_folder_first_event_item. Its control asserts BadNotSupported while the mapping is not condition-bearing. With the promotion call removed it fails at "folder-first item admitted" (0x803D0000); restored, it passes