test(grpc-data): H2 live smoke on the standalone rig - denied-principal modes, pinned-build check, parity; evidence

This commit is contained in:
Joseph Doherty
2026-11-23 23:31:30 -05:00
parent a4cd2a4b0e
commit a3e2f13815
5 changed files with 147 additions and 18 deletions
+58 -1
View File
@@ -134,9 +134,66 @@ Not reproduced on master here (no second checkout from this worktree) — coordi
`IDataHistoryService.ReadAsync` with the same window ⇒ the same rows/statuses as step 3 / an OPC UA historyread on the
origin node.
## Live smoke (rig)
Run `h2-history-smoke`, 2026-11-24 04:17–04:33 UTC, standalone rig (`scripts/validation/grpc-data`, OrbStack), not docker-dev.
**Build inputs:** HEAD `eb29360d4` plus the review-2 work then uncommitted in the worktree
(`LocalDataServices.History.cs`, `OpcUaServer.csproj`; diff SHA-256 `b1e0fda7…`); recorded `source_tree_hash` `fff3094c6d2dd694…`.
The branch moved on during the run (`808e1fe98`…`1d824da12`), so every smoke step ran with
`history_smoke.py --pinned-build`: the running Host stamps were checked against the run's RECORDED hash, not the moved checkout.
**Harness (opt-in, v1 runs unchanged):** `rig.py up --history` records `GRPC_DATA_HISTORY=1` and adds `compose.history.yml`.
SOURCE gets `ServerHistorian:Backend=SqlServer` (schema `hist`, auto-created, in the run's own SQL container) and continuous
historization. The seeder's history profile does four things. Raw `counter` is `isHistorized`; `scalar` is not. `consumer-source` and
`export-raw`/`export-uns` gain HistoryRead (63); mappings keep 31. A second principal `fixture-nohistory` gets its own key
(`seed/source-nohistory.key`) and exports with 31. The probe has a `--scenario history` (raw origin RPCs with the rig headers)
and a `history` operation (`IDataHistoryService` through whatever connection holds it). `history_smoke.py` advances the counter
1/s for 40 s, then runs the probe, the CLI `historyread` and the consumer node probe.
```bash
python3 scripts/validation/grpc-data/rig.py up --run-id h2-history-smoke --history --timeout 900
python3 scripts/validation/grpc-data/rig.py seed --run-id h2-history-smoke
python3 scripts/validation/grpc-data/rig.py deploy --run-id h2-history-smoke --timeout 300 # 2nd attempt, see notes
python3 scripts/validation/grpc-data/history_smoke.py --run-id h2-history-smoke --pinned-build --label export-denied --denied-expect permission-denied
# then: NodeAcl source-peer-nohistory := 135 (ReadOnly − HistoryRead, sqlcmd -I) + mutate export-raw-nohistory → 63 + deploy
python3 scripts/validation/grpc-data/history_smoke.py --run-id h2-history-smoke --pinned-build --label acl-denied --denied-expect unsupported
# D01 + D03 via ScenarioRunner.run (same pinned check), then:
python3 scripts/validation/grpc-data/rig.py down --run-id h2-history-smoke
```
| # | Recipe item | Observed | Result |
|---|---|---|---|
| 1 | `GetCapabilities` with / without `x-otopcua-data-features: history` (both SOURCE listeners) | without header: `operations` 31 (source-1 Primary) / 23 (source-2 Secondary, no Write), no field 16, 158/160 B. With header: 63 / 55, field 16 = `{raw, processed, atTime, 19 aggregates, resolution 1 tick, maxValuesPerPage 10000, maxConcurrentReads 4, idle 600000000 ticks}`. Otherwise identical | PASS |
| 2 | Raw `end=now, num_values_per_node=5` on `modbus/plc/counter` | `0x00000000`, 5 values newest first (80…76, 1 s apart) + continuation. Resume ⇒ `0x00000000`, 75…71, older than page 1. Resuming the same token again ⇒ `0x804A0000`, no samples, no continuation. Same on both SOURCE nodes; the last token released | PASS |
| 3a | Unhistorized `modbus/plc/scalar` | `0x80720000`, no samples, continuation or diagnostic; encoded item (correlation id cleared) `108080C88308` | PASS |
| 3b | Second key, export without HistoryRead | **RPC `PERMISSION_DENIED`**, not a per-item `0x80720000` (see "Recipe mismatch") | differs from recipe; consistent with review fix 2 |
| 3c | Second key, export with HistoryRead, origin ACL without it | `0x80720000`, **byte-identical** to 3a (`108080C88308`) on both nodes | PASS |
| 3d | Without the feature header | `FAILED_PRECONDITION` | PASS |
| 4 | Values vs OPC UA `historyread` on the SOURCE node (Client CLI, `ns=2;s=modbus/plc/counter`, same second-aligned window) | 29 values (first run) and 30 (second). The probe's forward Raw (`num_values_per_node=0`) on each SOURCE listener and the consumer reads match the CLI rows exactly (source timestamp to the µs, value, quality). CLI on `scalar` ⇒ `BadHistoryOperationUnsupported (0x80720000)` | PASS |
| 5 | Runtime consumer: CONSUMER node probe, deployed `consumer-source` lease (Cluster/Primary) → `IDataHistoryService.ReadAsync` | on consumer-1 and consumer-2, Raw and UNS (`area/line/plc/counter`): newest 5 = the same 80…76 / 120…116 as item 2, plus a continuation; resume Good. Window = the CLI rows (parity above). `scalar` ⇒ `0x80720000`. Lease capabilities carry `History` + bit 32 | PASS |
| 6 | v1 scenarios with history enabled | D01 PASS (48 assertions); D03 PASS (377: Cluster + Node, raw + uns, recursive browse, read parity, subscribe on CONSUMER). Both restored baseline | PASS |
Teardown: `rig.py down` removed every run-labelled container, network, volume and image. Label-filtered `docker … ls` afterwards: 0/0/0/0.
**Recipe mismatch (not a code change; for the coordinator).** The recipe (step 3 above) and `DataConnections.md` ("not exported, denied … answers the
same `BadHistoryOperationUnsupported`") say that a key whose **export** lacks HistoryRead gets the per-item
`0x80720000`. Live, the RPC is refused with `PERMISSION_DENIED` before any item is evaluated. This is review fix 2
(`Ready(…, HistoryRead)` ⇒ PermissionDenied with no export grant, like v1 Read). It is per-principal and node-independent,
so it does not separate unhistorized nodes from denied ones. The per-node indistinguishability holds where it matters (3c). The
recipe/doc wording should say "export grant missing ⇒ `PERMISSION_DENIED`; ACL-denied / unhistorized / unknown ⇒ identical
`0x80720000`".
**Observed on the pre-review2-7a build.** For the no-grant principal, the capabilities still carried field 16 with the full
aggregate list and resolution (`operations` 31, no bit 32). `808e1fe98` (review2-7a, landed after this build) addresses exactly that.
It was not re-verified live.
**Harness note.** The first `deploy` straight after `seed` timed out with 0/6 acks. CONTROL logged "No mesh gRPC targets —
dropping DispatchDeployment": its contact refresh had not yet seen the freshly seeded `ClusterNode` rows. The same ~65 s
refresh appears in the README's D07 note. An immediate re-deploy applied on all six nodes. Pre-existing; it does not depend on history.
## Not verified
- The docker-dev smoke above (coordinator-run).
- The docker-dev smoke above (coordinator-run). The standalone-rig smoke is under "Live smoke (rig)".
- The real `OriginHistoryPort` behind the gRPC service end to end: the wire suite fakes the port; the port facade is
tested against a real node manager separately (`OriginHistoryPortTests`).
- A consumer projection (H3) receiving negotiated metadata with bit 32/`HistoryInfo` from an H2 origin: covered only by