diff --git a/docs/plans/evidence/grpc-data-ext/A4.md b/docs/plans/evidence/grpc-data-ext/A4.md index cbec9fa33..53899f74e 100644 --- a/docs/plans/evidence/grpc-data-ext/A4.md +++ b/docs/plans/evidence/grpc-data-ext/A4.md @@ -252,3 +252,112 @@ Commits: `c93290d0` (runner fixes + tests), `0cac09ce` (AdminUI, metric descript | 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-.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. diff --git a/scripts/validation/grpc-data/README.md b/scripts/validation/grpc-data/README.md index 1bad3acdd..8b94ee0b9 100644 --- a/scripts/validation/grpc-data/README.md +++ b/scripts/validation/grpc-data/README.md @@ -103,6 +103,16 @@ on both SOURCE listeners: the Primary must stream a snapshot (`total`, the activ probe clears the alarm, a delta; the Secondary must refuse the condition item (`Unavailable`, Primary-only). Without `--conditions` the rig, the seed and every D-scenario are unchanged. +**A4 live scenarios (part 1).** The conditions profile also starts a run-owned `opcplc` container (`opc-plc:2.14.10 --alm`, no +published port; the rig's endpoint guard admits run-owned service DNS only, so the shared `10.100.0.35:50000` fixture is not +used) and seeds a SOURCE `OpcUaClient` driver `opcua` → device `opcplc` with a native alarm tag `EastTankYellow` +(`nodeId` = the upstream condition node `ns=6;s=1:Colours/EastTank?Yellow`, which cycles Active/Inactive by itself) plus a +`FastUInt1` value tag; two equipment `pumpa`/`pumpb` reference the alarm tag; exports + CONSUMER mappings `map-opc` (Raw), +`map-pumpa`, `map-pumpb` (UNS) place it three times; an origin principal `fixture-unsonly` holds one UNS export only; a CONSUMER +principal `fixture-cli-nogrant` has no NodeAcl row. `python3 scripts/validation/grpc-data/conditions_scenarios.py --run-id +[--only A01,A02,A04,A05,A08]` runs the scenarios (results `evidence/A4S-.json`, `A4S-results.{json,md}`); see +`docs/plans/evidence/grpc-data-ext/A4.md` "Live scenarios (part 1)". `conditions_a3_smoke.py` still passes on this profile. + ## H3 projected-history gate (opt-in) `rig.py up --run-id --history [--history-backend sqlserver|questdb]` — `questdb` layers `compose.history.questdb.yml`: