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

253 lines
27 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# H2 evidence — wire, ingress, client, schema (first deployable increment)
Phase H2 of `docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md`, 2026-11-23.
## What changed
- **Contract (§4.2, field numbers as planned).** `rpc HistoryRead`, `HistoryReadRequest/Item/Result/Response`,
`HistorySample`, `RawDetails/ProcessedDetails/AtTimeDetails`, `AggregateConfiguration`,
`CapabilitiesResponse.history = 16` (`HistoryCapabilities`), `Metadata.history = 14` (`HistoryInfo`). §4.2 left
`HistoryReadItem`, `HistoryReadResponse`, the `HistoryCapabilities` field numbers and `AggregateConfiguration` unnumbered;
they are `HistoryReadItem{correlation_id=1, view=2, optional bytes continuation=3}`,
`HistoryReadResponse{items=1, serving=2}`, `HistoryCapabilities{raw=1, processed=2, at_time=3, aggregates=4,
timestamp_resolution_ticks=5, max_values_per_page=6, max_concurrent_reads=7, continuation_idle_ticks=8}`,
`AggregateConfiguration{use_server_capabilities_defaults=1, treat_uncertain_as_bad=2, percent_data_bad=3,
percent_data_good=4, use_sloped_extrapolation=5}`. Aggregate names are the `HistoryAggregateType` names; the name ↔ ns=0
id table (`DataHistoryAggregates`) is pinned to the server's `AggregateFunctionMap` by `OriginHistoryPortTests`.
`DataHistoryAtTimeDetails` gained `UseSimpleBounds` (carried verbatim; the origin's AtTime evaluator applies its own rules).
- **Negotiation (coordinator decision, recorded in plan §4.1).** The `GetCapabilities` probe always carries the features
the consumer supports (`history`). The server advertises field 16 and bit 32 only when the probe asked for `history` AND
the origin has a historian backend. Every other call carries the negotiated set (consumer ∩ what that endpoint
advertised). The server's effective set = header ∩ `SupportedFeatures` (History) ∩ origin-servable. Without it:
capabilities, Browse and GetMetadata responses are stripped to the v1 shape (no field 16/14, no bit 32), and
`HistoryRead` is `FAILED_PRECONDITION("feature not negotiated")`. The decoder drops bit 32 when field 16 is absent.
- **Origin ingress** (`LocalDataServices.History.cs`). Order: target ready and role allowed (ReadyReplica allowed), the
RPC-level `Ready(…, HistoryRead)`, then per item: view resolves to an exported value node → export grant + origin ACL
`HistoryRead` (`Allowed`, which always walks the origin ACL) → tagname (`IOriginHistoryPort.IsHistorized`). Every
refusal is the same `Bad_HistoryOperationUnsupported` with no diagnostic and no backend call (byte-identical on the wire,
`Denied_and_unhistorized_and_unknown_are_byte_identical…`). Authority is re-checked after the backend answers.
Metadata `historizing` = historized AND granted, so metadata does not separate them either.
- **Limits** (bounded per request and per principal since review fix 1, below). Per-principal admission (`MaxConcurrentHistoryReads` ⇒ every item `BadTooManyOperations`); Raw pages at
`MaxHistoryValuesPerPage` (0 or more ⇒ the ceiling, with a continuation); answers above
min(`MaxHistoryResponseBytes`, listener max) − 64 KiB are split into chunks (`chunk_continues`) held as single-use
remainders in the session; a remainder the session cannot hold is `BadTooManyOperations`, never a truncation.
- **Facade, not InternalsVisibleTo.** `OpcUaServer/OriginHistoryPort.cs` (`IOriginHistoryPort`, `OriginHistoryCursors`)
keeps SDK types inside OpcUaServer; exposed through `SdkAddressSpaceSink`, resolved by `DeferredOriginHistoryPort` once
the SDK server is up. `ReadAsync` runs the synchronous `ReadHistory` on `Task.Run`.
- **Store/scope lifecycle.** One `OriginHistorySession` (H1 `PeerHistoryContinuationStore` + chunk remainders) per
(principal, API key, credential version, transport channel). The gRPC channel is the HTTP/2 connection
(`HttpContext.Connection.Id`), cleared when Kestrel's `IConnectionLifetimeFeature.ConnectionClosed` fires (idle expiry
60 s is the backstop; the hook is proven on a real Kestrel HTTP/2 host); a direct `LocalDataConnection` is its own
channel, cleared on `DisposeAsync`. Bounded at 64 sessions per principal and 4096 overall (review fix 5). ONE `PeerHistoryContinuationScope` per request; the serving incarnation it
snapshots is `incarnation/serving-generation/role`, so a restart, failover or role change invalidates tokens. A miswired
scope ⇒ `BadInternalError` + "Origin history continuation wiring fault." + an error log — never unsupported/denied.
- **Consumer** (`GrpcDataConnection.History.cs`). `IDataHistoryService` implemented explicitly (`ReadHistoryAsync` /
`ReleaseHistoryAsync` are the public names — an implicit `ReadAsync(DataHistoryReadRequest)` made every
`ReadAsync(new(...))` call site ambiguous). Deadline per call = min(remaining, `HistoryTimeoutMilliseconds`);
`FAILED_PRECONDITION`/`UNIMPLEMENTED` ⇒ `Bad_HistoryOperationUnsupported`; chunks assembled within the request
`MaxBytes` (past it ⇒ `BadTooManyOperations`). Page tokens are wrapped with the issuing endpoint index + serving
incarnation: a resumed read never moves endpoint and is `BadContinuationPointInvalid` without a call when that endpoint's
incarnation changed; a fresh read may move. `DataConnectionDeploymentLease` gates history on the row's `HistoryRead`.
- **Grow sites.** `DataOperationSets.Understood`, `DataConnectionValidator` known set, `LocalDataServices.Implemented(target)`
(only while a historian backend is configured) all gain `HistoryRead`; `DataOperationPolicy` maps OPC UA HistoryRead →
the mapping's `HistoryRead` bit. `ProjectedDataAccess.cs:157` is untouched (H3).
- **Schema.** `20261124013651_AddDataConnectionHistory`: `DataConnection.HistoryTimeoutMilliseconds` (30000),
`DataExport.MaxConcurrentHistoryReads` (4), `MaxHistoryValuesPerPage` (10000), `MaxHistoryResponseBytes` (4194304),
`RemoteNamespaceMapping.MaxHistoryAssemblyBytesPerRequest` (16777216); NOT NULL with those SQL defaults, check
constraints widened (`> 0`). Artifact rows are entity JSON, so the fields project with no code change (a pre-H2 artifact
parses with the defaults); `DataConnectionScopeRevision` includes `HistoryTimeoutMilliseconds`.
- **AdminUI.** HistoryRead checkbox + the five limit fields on the connection/export/mapping editors
(`DataOperationAuthoring`), and the banner "Every node of both clusters must run X0+ before authoring this…" whenever a
post-v1 bit is ticked. `<PageErrorBoundary>` kept.
- **Found on the way:** `DataConnectionEndpoints.Methods` (the listener's method allowlist) did not include the new RPC, so
the auth middleware rejected every HistoryRead before the service saw it.
## Review fixes (Fable, approve-with-changes)
| # | Finding | Resolution |
|---|---|---|
| 1 | Origin memory unbounded | Nodes are read in sub-batches sized so one sub-batch at the per-page ceiling fits the response budget; once the budget is spent no further sub-batch starts. Unread nodes get a **deferred** chunk token (transport; on resume the node is read from its original continuation — any variant, not only Raw) or `BadTooManyOperations` (direct consumer). Processed intervals and AtTime times above `MaxHistoryValuesPerPage` are `BadTooManyOperations` unsent. Remainder bytes (encoded `CalculateSize`) are charged to a per-principal budget across sessions = concurrent reads × max(response budget, page × 64 B); past it a node is `BadTooManyOperations`. Proven by `Origin_memory_is_bounded…` (100 nodes × uncapped Raw: ≤ 10 nodes materialised per response, retained bytes ≤ budget at every step, every value delivered exactly once); a mutation removing the stop makes it fail |
| 2 | Not-ready origin ⇒ "unsupported" | `CapabilitiesResponse.history` is present whenever the origin has a historian; `Ready(…, HistoryRead)` answers Unavailable (not ready / demoted) or PermissionDenied (no export grant), so the client fails over like v1 Read |
| 3 | Client exceptions escape | Malformed/undecodable answers are endpoint failures (a fresh read moves on); resumed items ⇒ `BadContinuationPointInvalid`, fresh items of the same batch ⇒ `BadNoCommunication`; caller cancel throws; the deployment lease maps inner/scope faults to `BadNoCommunication` |
| 4 | HistoryTimeout capped by the origin's UnaryTimeout | Origin `Cancelled` without a caller cancel ⇒ `BadTimeout`, no endpoint failure recorded; the cap is documented next to the AdminUI field and in `DataConnections.md` |
| 5 | One principal can evict others | 64 sessions per principal (its own LRU evicted first); at the global 4096 the principal holding the most pays; a release never creates a session |
| 6 | Per-node rebuilds | `Implemented(target)` once per node, ACL before tagname; `OriginHistoryPort.Serving` cached per historian source instance (`A_v1_metadata_call_does_not_rebuild…`) |
| 7 | Mapped HistoryRead authorisable | Pinned: a real SDK HistoryRead on a projected variable with the mapping bit and a local HistoryRead grant is `Bad_HistoryOperationUnsupported`, no data, no continuation (projected nodes carry no HistoryRead access-level bit until H3) |
| 8 | Scope fingerprint | Limits ride the artifact's entity JSON like `TimeoutMilliseconds`; `HistoryTimeoutMilliseconds` removed from `DataConnectionScopeRevision` (no upgrade scope bump); plan §6 corrected |
| 9 | Nits | Upper bounds (timeout 1 h, reads 64, values/page 1,000,000, response 64 MiB, assembly 1 GiB; validator + AdminUI `max`); encoded sizes; a single oversized value is a per-item `BadTooManyOperations`; discovery backoff on the history path; a fresh read tries the next endpoint when one lacks history; channel-close registrations unregistered; remote reads hold at most N − max(1, N/4) of the node manager's N history batch slots (`OriginHistoryLimiterTests`). `UseSimpleBounds` is **kept on the wire** (it is in the §4.2 contract) but not plumbed: the H1 port's AtTime variant has no such flag and the evaluator applies its own bounds rule — documented as carried and ignored |
| 10 | Kestrel close hook | Proven with a real in-process Kestrel HTTP/2 (h2c loopback) host: `IConnectionLifetimeFeature.ConnectionClosed` is exposed on the stream context and disposing the client connection clears the session |
**Flake check (coordinator request).** `GrpcDataConfiguredDiscoveryWireTests` ×10 on this branch: 6 clean runs;
`Failed_sdk_item_construction_releases_candidate_and_fanout_ownership` failed 2/10, `New_primary_renews_same_monitored_item_after_a_prior_mapped_read(warmByRead: True)`
1/10, `Two_sdk_cadences_renew_before_expiry_without_reviving_old_notification_evidence` 1/10. Master (coordinator, 14 runs)
failed `Bad_null_sdk_notification_cannot_borrow_unproven_sample_evidence` 2/8. The `Failed_sdk_item…` path uses an origin
fixture without a history port and a direct (non-gRPC) peer connection, so no H2 history code, probe header or capability
change is on it; the only H2 delta it sees is the extra (null) `DataMetadata.History` field. Its assertion compares the
shared projected candidate budget's `RetainedEntries` before and after a failed second item while the first item stays live;
a candidate the live item holds between sampling ticks (`WarmStandby.AddCandidate`) makes it 1 at the second read — a race
in the test, not an H2 cause. Not changed here (the class flakiness is the coordinator's issue).
### Second review pass (approve-with-changes)
Remote slot released on a cancelled dispatch (`Task.Run` no longer takes the token); byte-bounded pages (per-value
estimate from the catalog type: wide strings/arrays get small pages + a continuation; sub-batches sized by estimated
bytes; AtTime/Processed refused per node when values × estimate exceed the budget); one deadline per request (unstarted
nodes deferred / `BadTimeout`); every refusal and every chunk release/invalidation/expiry releases its page cursor;
results disposed on the exception path; no aggregates/resolution for an ungranted peer; `MaxHistoryResponseBytes`
minimum 256 KiB; caller cancel is `OperationCanceledException`; an abandoned assembly releases its chunk tokens; docs
for the limiter at N = 1 and for limit changes. Gates after the pass: build 0/0; H2, X0, H1 passed; full suites
Core.Abstractions 853, Commons 505, Configuration 323, OpcUaServer 1408 (+1 skip), Runtime 1859 (+3 skips), Host 479,
AdminUI 2693 — all green.
## Recorded-v1-client gate
Both gates extended per X0.md §2 BEFORE asserting, goldens untouched (`git diff master -- …Goldens.cs` is empty):
- `GrpcDataV1CompatibilityTests` (fake origin): the origin now grants HistoryRead, advertises `HistoryCapabilities`
and marks its scalar `HistoryInfo(true)`. Header-less ⇒ golden bytes on all six RPCs. With `history` on a
history-capable origin ⇒ field 16, bit 32 and `Metadata.history` appear (`H2_a_history_capable_origin…`); with
`history,conditions` on an origin without history, or `conditions` alone ⇒ golden bytes.
- `GrpcDataV1RealOriginCompatibilityTests` (#918, real `LocalDataServices`/`LocalExportCatalog`): every export also grants
HistoryRead and the origin has a historian (`FakeHistoryPort`: Flow + FlowRate historized). Header-less ⇒ golden bytes on
all seven scenarios; the history shapes are present with the header (`GrpcDataHistoryWireTests`).
## Gates (after the review fixes)
| Gate | Result |
|---|---|
| `dotnet build ZB.MOM.WW.OtOpcUa.slnx` | 0 warnings, 0 errors |
| `run-unit-phase.py` H2, X0, H1, P01–P09 | all passed (H2 includes both recorded-v1-client gates) |
| Full unit suites (`Category!=E2E&Category!=LiveIntegration`) | Commons 505, Configuration 323, Core 385 (+1 skip), OpcUaServer 1407 (+1 skip), Runtime 1856 (+3 skips), Host 476, AdminUI 2693 — all green; Core.Abstractions 853 (unchanged since the first run) |
| Migration up/down/up on SQL Server (`10.100.0.35,14330`, scratch DB, then dropped) | passed; the five SQL defaults verified in `sys.default_constraints` |
**Earlier Runtime failure (first full run).** `Failed_sdk_item_construction_releases_candidate_and_fanout_ownership` fails about 1 in 3
runs of its collection (`projected candidate budget RetainedEntries should be 0 but was 1`) and passes alone and in the
P-phase gates. Its origin (`LocalDataFixture`) has no history port, so no H2 history shape is emitted on its path; the
only H2 change it sees is the capabilities probe carrying `x-otopcua-data-features: history` (answered v1-identically).
Not reproduced on master here (no second checkout from this worktree) — coordinator to confirm it is pre-existing.
## Docker-dev smoke recipe (direct runtime-consumer read; run by the coordinator)
1. Origin cluster: a historian backend (`OTOPCUA_HISTORIAN_BACKEND=SqlServer` + `docker-compose.questdb.yml` or the SQL
recipe in `docs/Historian.md`), `DataConnections__Enabled=true` on both clusters, a historized raw tag
(`"isHistorized": true`) with some recorded history.
2. AdminUI `/clusters/{origin}/data-connections`: an export (Raw, the tag's ancestor) for the consumer's service principal
with Browse/Metadata/Read/**HistoryRead** — the banner appears. On the consumer: a connection with **HistoryRead**
(keep `HistoryTimeoutMilliseconds` 30000). Deploy both.
3. Probe the origin listener directly (the harness probe `scripts/validation/grpc-data/probe` or grpcurl with
`src/Core/ZB.MOM.WW.OtOpcUa.Commons/Protos/data_connection.proto`), headers `authorization: Bearer <service key>`,
`x-data-target-mode`, `x-data-consistency`, `x-data-cluster-id`, `x-data-node-id`:
- `GetCapabilities` with `x-otopcua-data-features: history` ⇒ `history` present, `operations` has 32; without the header ⇒ neither.
- `HistoryRead` with the header, `raw{end=<now>, num_values_per_node=5}` on the tag's view ⇒ Good, ≤ 5 newest values
newest-first plus a `continuation`; resume it once ⇒ the next page; resume the same token again ⇒ `0x804A0000`.
- The same on an unhistorized tag, on an unknown view, and on a tag the origin ACL denies HistoryRead ⇒ identical
`0x80720000` results. A second key whose export lacks HistoryRead ⇒ `PERMISSION_DENIED` for the whole call (review
fix 2, as v1 Read; nothing per node). Without the header ⇒ `FAILED_PRECONDITION`.
4. Consumer side: a runtime consumer holding the deployed connection (`IDataConnectionDeploymentSource` lease) calls
`IDataHistoryService.ReadAsync` with the same window ⇒ the same rows/statuses as step 3 / an OPC UA historyread on the
origin node.
## Live smoke (rig)
### Final HEAD — run `h2-history-smoke-final`
2026-11-24 04:37–04:52 UTC, standalone rig, clean tree. The build is `1d3f172f8` = final `99598637d` + one harness-only commit (the probe
asserts the review-fix-7a capabilities shape); `git diff 99598637d 1d3f172f8 -- src tests` is empty. Recorded `source_tree_hash`
`1796e93b3a4fdf61…`, equal to the checkout's at smoke time. **Normal build-hash checks**: `ScenarioRunner.verify_candidate`
matched every Host stamp and the device fixture; no `--pinned-build`. The second principal is seeded with an origin ACL without HistoryRead
(`ReadOnly − HistoryRead`). Its export lacks HistoryRead in phase A; phase B grants it through the seeder `mutate`
(`export_id=export-raw-nohistory`, `export_allowed_operations=63`) and a normal deploy.
```bash
python3 scripts/validation/grpc-data/rig.py up --run-id h2-history-smoke-final --history --timeout 900
python3 scripts/validation/grpc-data/rig.py seed --run-id h2-history-smoke-final
sleep 75 # CONTROL's ClusterNode contact refresh (see the harness note below); the first deploy then applied on all six
python3 scripts/validation/grpc-data/rig.py deploy --run-id h2-history-smoke-final --timeout 300
python3 scripts/validation/grpc-data/history_smoke.py --run-id h2-history-smoke-final --label export-denied --denied-expect permission-denied
# ScenarioRunner.mutate(export_id="export-raw-nohistory", export_allowed_operations=63) → deploy
python3 scripts/validation/grpc-data/history_smoke.py --run-id h2-history-smoke-final --label acl-denied --denied-expect unsupported
python3 scripts/validation/grpc-data/cli_gate.py --run-id h2-history-smoke-final --scenario D01
python3 scripts/validation/grpc-data/cli_gate.py --run-id h2-history-smoke-final --scenario D03
python3 scripts/validation/grpc-data/rig.py down --run-id h2-history-smoke-final
```
| # | Item | Observed (both SOURCE listeners unless noted) | Result |
|---|---|---|---|
| 1 | `GetCapabilities` with / without the `history` header (granted key) | without: `operations` 31 (source-1 Primary) / 23 (source-2 Secondary), no field 16, 158/160 B. With: 63 / 55, field 16 = `{raw, processed, atTime, 19 aggregates, resolution 1 tick, 10000 per page, 4 concurrent, idle 60 s}`, 388/390 B | PASS |
| 2 | Raw `end=now, num_values_per_node=5` on `counter` | `0x00000000`, 40…36 newest first + continuation. Resume ⇒ `0x00000000`, 35…31. Same token again ⇒ `0x804A0000`, no samples, no continuation. Phase B: 80…76 / 75…71 / `0x804A0000` | PASS |
| 3a | Unhistorized `scalar` | `0x80720000`, no samples/continuation/diagnostic, item bytes `108080C88308` | PASS |
| 3b | No-grant key (export without HistoryRead) — HistoryRead | RPC `PERMISSION_DENIED` | PASS |
| 3b′ | No-grant key — `GetCapabilities` with the header (review fix 7a) | `history` present = `{maxValuesPerPage 10000, maxConcurrentReads 4, continuationIdle 600000000}`; raw/processed/atTime false, **no aggregates, resolution 0**, `operations` 31 / 23 (**no bit 32**) | PASS |
| 3c | Same key, export granted, origin ACL denies | `0x80720000`, **byte-identical** to 3a (`108080C88308`). Its capabilities are now the full granted shape (63 / 55) | PASS |
| 3d | Granted key without the header | `FAILED_PRECONDITION` | PASS |
| 4 | Values vs Client CLI `historyread` on `ns=2;s=modbus/plc/counter`, same window | 30 values (A) / 31 values (B). The forward Raw on each SOURCE listener and the consumer reads are row-for-row identical (µs timestamp, value, quality). CLI on `scalar` ⇒ `BadHistoryOperationUnsupported (0x80720000)` | PASS |
| 5 | Runtime consumer: CONSUMER node probe on the deployed `consumer-source` lease (Cluster/Primary) → `IDataHistoryService` | consumer-1 and consumer-2: Raw and UNS newest 5 = item 2's values + continuation, resume Good. Window = the CLI rows. `scalar` ⇒ `0x80720000` | PASS |
| 6 | D01, D03 with history on (normal `cli_gate.py`) | D01 PASS (48 assertions), D03 PASS (377), both restored | PASS |
Teardown: `rig.py down`; label-filtered `docker container/volume/network/image ls` for the run ⇒ 0/0/0/0. No product defect found.
### Earlier run — `h2-history-smoke` (pre-final build, kept as history)
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; since resolved in docs by `f3f0af87a`).** 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** (superseded: the final run confirms 7a, item 3b′). 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 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
the decoder tests; the projection still ignores both until H3.