docs(grpc-data): Gateway origin remote history verified live (H01–H08 vs real AVEVA, read-only) — drop the unverified wording (#923)

This commit is contained in:
Joseph Doherty
2026-11-28 11:47:21 -05:00
parent 7d9818cf18
commit ac96d1f3d3
5 changed files with 95 additions and 16 deletions
+1 -1
View File
@@ -275,7 +275,7 @@ ids are stable across deploys, but a deploy retires a projected node the client
(and after the node has been idle past its metadata lease, #922), or the read answers `BadNodeIdUnknown` / `BadUserAccessDenied`.
History is served by the ORIGIN's historian, verbatim (values, statuses, timestamps, its paging); `--aggregate` is limited to what
the origin's backend serves (otherwise `BadAggregateNotSupported`), and `--modified` / `--events` are refused
`BadHistoryOperationUnsupported`. Verified with SqlServer and QuestDB origins; a Gateway (AVEVA) origin is unverified (#923).
`BadHistoryOperationUnsupported`. Verified with SqlServer, QuestDB and Gateway (AVEVA) origins (#923).
The consumer's **Data connections** page shows the projected history counts and open continuations a read leaves behind
(`DataConnections.md` §"Remote history diagnostics and metrics").
+4 -4
View File
@@ -178,10 +178,10 @@ open; see the plan's §1.1.
## Remote history (runtime consumers)
**Status: supported** (H4). Verified end to end (live gate H01–H06) with the origin on the **SqlServer** and **QuestDB**
historian backends. The **Gateway** backend (AVEVA Historian via HistorianGateway) is **unverified** pending its live leg,
#923 (blocked on the VPN to the historian) — the code path is the same origin history port, but no live read against it
has been run.
**Status: supported** (H4). Verified end to end (live gate H01–H06) with the origin on the **SqlServer**, **QuestDB** and
**Gateway** historian backends — the Gateway leg (#923, 2026-11-28) read the real AVEVA Historian through a read-only
HistorianGateway and also covered reverse and end-only raw reads (H07) and a strict gateway row ceiling (H08:
ceiling-sized pages with continuations, equal to the unconstrained answers); `docs/plans/evidence/grpc-data-ext/H4.md`.
Since H2 a consumer can read the origin's history (HistoryRead Raw, Processed, AtTime) over a data connection. The origin
serves it from its own historian backend (`ServerHistorian:Backend`) through the same pipeline its OPC UA clients use, so
+6 -4
View File
@@ -2647,10 +2647,12 @@ from a peer.
connections page — `docs/DataConnections.md` §"Remote history diagnostics and metrics".
**Verified backends.** Remote history is verified end to end (live gate H01–H06, `scripts/validation/grpc-data/history_gate.py`)
with the origin on **`SqlServer`** and **`QuestDb`**. The **`Gateway`** backend (AVEVA Historian via HistorianGateway) is
**unverified** remotely, pending its live leg (#923, blocked on the VPN to the historian). Nothing in the remote path is
backend-specific, but the Gateway's own differences (the four-plus-raw-evaluated aggregate set, the strict row ceiling, the
reverse-read walk-back) have not been observed through a data connection.
with the origin on **`SqlServer`**, **`QuestDb`** and **`Gateway`** (AVEVA Historian via HistorianGateway, #923, 2026-11-28).
The Gateway leg also observed the Gateway's own differences through a data connection: the raw-evaluated Average, the
reverse/end-only walk-back (#686, `H07`) and a strict row ceiling (`MaxValuesCeiling=40`, `AllowStreamingBeyondCeiling=false`,
`H08` — ceiling-sized pages with continuations, the raw-evaluated Average over more rows than the ceiling refused
`BadTooManyOperations` identically on origin and consumer). Recipe: `scripts/validation/grpc-data/README.md`; evidence
`docs/plans/evidence/grpc-data-ext/H4.md`.
---
+59 -7
View File
@@ -88,13 +88,63 @@ Fresh run `h4a-sqlserver` (OrbStack, macOS, normal build-hash checks, 2026-11-24
after the gate it read `Ready` with features `History`.
- `down` ⇒ 0 run containers, 0 run volumes.
## Gateway leg — BLOCKED (#923), substituted by doc scoping
## Gateway leg (#923) — PASSED 2026-11-28
The plan's required Gateway leg (origin `ServerHistorian:Backend=Gateway` against a local read-only HistorianGateway reading the
real AVEVA Historian over VPN; H01–H04 with reverse/end-only and ceiling-bounded cases) was **not attempted**: the VPN to the
historian is down. Per the plan's fallback, **#923** (`type:deploy-gate`, `blocked`) tracks it, and the docs say remote history is
verified on the **SqlServer and QuestDB** origin backends only, with the **Gateway backend unverified pending #923**
(`DataConnections.md`, `Historian.md`, `Client.CLI.md`).
First run 2026-11-24 was blocked (VPN down; the docs were scoped to SqlServer/QuestDB pending #923). Run 2026-11-28 with the VPN
up (`wonder-sql-vd03` :32565 and :1433 reachable).
**Posture — read-only end to end.**
- **Gateway:** a separate, local HistorianGateway instance (`historiangw` `main` at `6a74f1e`, freshly published), compose project
`zb-historiangw-923`, ports bound to the host **loopback only** (`127.0.0.1:5231` gRPC h2c, `:5230` health), its own fresh volume.
`ApiKeys:Mode=Disabled` (the issue's posture — no key minted, no key store touched), `Historian:LiveWritesEnabled=false`,
`RuntimeDb:Enabled=false` / `EventReadsEnabled=false` (no SQL write or event path), Redundancy/StoreForward off. Historian
credentials from the existing gitignored `histgw.secrets.env`; the long-running `zb-historiangw` container was left untouched, and
nothing in the HistorianGateway repo changed (published into a scratch build context).
- **Origin (SOURCE pair):** `ServerHistorian:Backend=Gateway` → `http://host.docker.internal:5231` (`UseTls=false`),
`ProvisionTags=Off`, `ContinuousHistorization:Enabled=false`, a placeholder key (the client refuses an empty one; a Disabled
gateway never checks it). The fixture's historized tags are bound **`historianReadOnly`** (#899) to existing AVEVA system tags:
`counter` (UInt16) → `SysTimeSec` (UInt2, 1 Hz), `flt` (Float32) → `SysDataAcqOverallItemsPerSec` (Float, 10 s), `text` (String)
→ `SysString`.
- **Evidence it stayed read-only:** the strict-ceiling gateway's log (it logs each RPC) shows only `HistorianRead/ReadRaw` (180) and
`HistorianStatus/Probe` (16) — no `WriteLiveValues`, `EnsureTags`, `SendEvent(s)` or `AddHistoricalValues`; the SOURCE logs carry
no provisioning or recorder line. (The first gateway container's log was dropped when it was recreated for the ceiling leg.)
**Rig support** (commits `a6ae08146`, `6ab7050c3`, `7d9818cf1`): `rig.py up --history --history-backend gateway` layers the new
`compose.history.gateway.yml`; the endpoint allowlist admits `http://host.docker.internal:<port>` **only** under
`ServerHistorian__Endpoint` on a gateway run (`HostGatewayEndpointTests`, with a positive control); `up` fails before any build when
nothing listens on the loopback port; the seeder takes `GRPC_DATA_HISTORY_GATEWAY_TAGS` (`name=historianTag,…`). `history_gate.py`
on the gateway uses a fixed past window (120 s ending 15 s ago — nothing is accumulated), adds **H07** (reverse + end-only,
gateway-only) and **H08** (strict ceiling, run alone with `--gateway-ceiling C`), and stores the unconstrained answers in
`H-gateway-baseline.json` for H08 to compare with.
**Run `h923b-gateway`** (OrbStack, normal build-hash checks, window `16:38:04Z–16:40:04Z`):
| ID | Result |
|---|---|
| H01 Raw paging, Raw + UNS | PASS (75): page size 3 ⇒ 40 pages, **120 rows per realm** (SysTimeSec 4…3), last page no CP, row-for-row = origin; single read = origin; Float32 12 Good Singles (42.527664, 64.76546, …) = origin |
| H02 Processed | PASS (34): Average on String `text` ⇒ `BadAggregateNotSupported` both sides (refused unsent, #897); Average 10 s on `counter` 12 intervals = origin (raw-evaluated on the Gateway, #681) |
| H03 AtTime | PASS (35): `counter` 7/11/15 `UInt16` = origin; Float32 at +2 s / +20 s 42.527664 / 59.027344 (interpolated) Good `Single` = origin |
| H04 failover | PASS (71): page 1 held, `source-1` stopped ⇒ `source-2` primary, resumed page `BadContinuationPointInvalid`, fresh read Good |
| H05 not advertised | PASS (58) |
| H06 | PASS (238): unhistorized vs origin-denied identical `0x80720000`; local deny `BadUserAccessDenied`; origin continuations 1 held ⇒ 0 after session close; rebuild mid-page ⇒ invalid, fresh Good |
| H07 reverse / end-only | PASS (43): reverse (`start = W1 > end = W0`) paged by 7 (18 pages) and whole: 120 rows **(W0, W1]** newest first (16:40:04 … 16:38:05) = origin = an independent forward read reversed; end-only (`StartTime` unspecified, `EndTime = W1`, page 5, max 20): 4 Good pages, the latest 20 rows at/before W1 (16:40:04 … 16:39:45) = origin = the forward reference |
| H08 strict ceiling | PASS (41), gateway recreated with `MaxValuesCeiling=40`, `AllowStreamingBeyondCeiling=false` (⇒ page limit L = 24): one read capped at 1000 returns all 120 baseline rows on the origin and through the projection; 100-row pages come back **23, 22, 22, …** (6 pages, = L − 1 then L − k − 1, #694) and equal the baseline; reverse 100-row pages likewise ceiling-sized and = baseline; end-only = baseline; AtTime = baseline; raw-evaluated Average over the 120-row window ⇒ `BadTooManyOperations` on **both** origin and projection (the documented #691.3 rule: a ceiling-bounded stream not provably complete is refused, never truncated) |
Teardown: `rig.py down`, `docker compose down -v` for the gateway; 0 run containers / volumes left; lock released.
**Gate corrections found by the run (harness, not product):**
- The first H07 draft compared a reverse read with the forward `[W0, W1)` rows reversed. Part 11: a reverse read's StartTime (the
later bound) is inclusive and EndTime exclusive, so the answer is `(W0, W1]` — the projection and the origin agreed; the reference
was wrong. Now built from an independent forward read past W1.
- H01's UNS leg was refused `BadUserAccessDenied` on one run: the UNS node sat idle past its 15 s metadata lease during the longer
(40-page) raw leg — **#922** exactly. The gate now renews before the UNS leg (deploy + re-browse, the documented workaround).
**Seen once, not reproduced (control plane, backend-independent — reported, not fixed here):** in one full run H06's rebuild deploy
got HTTP 500 from CONTROL's `/api/deployments` — `AskTimeoutException` after 10 s in `AdminOperationsClient.StartDeploymentAsync`.
The deployment WAS composed (row `CreatedAtUtc` 16:35:49.954, request at 16:35:39.48, applied and sealed right after), i.e. the
compose itself (Serializable transaction + snapshot + `DraftValidator`) took ~10.5 s where the other ~30 deploys of the run took
60–630 ms. No SQL autogrow in the default trace and nothing in `system_health`; the cause is not established. The caller sees a
500 for a deployment that then goes ahead. Proposed follow-up below (coordinator to file).
## Review (Fable, approve-with-changes) — fixes
@@ -135,7 +185,9 @@ manager; a new DI-built provisional origin state), so the SqlServer leg was re-r
## Not verified / notes
- **Gateway backend** remotely (#923, above).
- **Gateway backend** remotely: verified 2026-11-28 (#923, above). Not covered there: tie clusters (the bound AVEVA tags store one
value per timestamp and the leg cannot write one), Gateway events history (never served remotely), the native TimeAverage/Total
modes through a projection (H02 reads Average only).
- **QuestDB** was not re-run for H4: the H4 change is backend-independent (counting around the same port), and the H3 rounds
passed H01–H06 on QuestDB at `713cbfb21`. The brief asked for one SqlServer leg.
- **Browser-rendered** page not driven (no Chrome session used); verified from the server-prerendered HTML, which runs the same
+25
View File
@@ -139,6 +139,31 @@ primary. The continuation scenarios use the CLI's hand-paged mode (`--page-size`
(`originAccounting.historyOpenContinuations`). Every scenario restores the baseline. Results:
`evidence/H3-history-<backend>-results.json`.
### Gateway origin backend (#923, needs the VPN to the AVEVA historian)
`--history-backend gateway` points SOURCE at a **host-run, read-only** HistorianGateway (not run-owned; start it first) through
`http://host.docker.internal:<port>` — the only non-run-owned endpoint the allowlist admits, and only under
`ServerHistorian__Endpoint`. The gateway must run with `ApiKeys:Mode=Disabled`, `Historian:LiveWritesEnabled=false`,
`RuntimeDb:Enabled=false`, ports bound to `127.0.0.1` (the 2026-11-28 run used a scratch compose project `zb-historiangw-923` from a
fresh `dotnet publish` of `historiangw` main, gRPC on `127.0.0.1:5231`). The seeder binds the historized tags `historianReadOnly`
to existing historian tags (`GRPC_DATA_HISTORY_GATEWAY_TAGS`, default `counter=SysTimeSec,flt=SysDataAcqOverallItemsPerSec,text=SysString`);
provisioning and continuous historization are off. `GRPC_DATA_HISTORY_GATEWAY_ENDPOINT` overrides the default
`http://host.docker.internal:5231`.
```bash
python3 scripts/validation/grpc-data/rig.py up --run-id h923-gw --history --history-backend gateway --timeout 900
python3 scripts/validation/grpc-data/rig.py seed --run-id h923-gw
sleep 75
python3 scripts/validation/grpc-data/rig.py deploy --run-id h923-gw --timeout 300
python3 scripts/validation/grpc-data/history_gate.py --run-id h923-gw # H01..H07 (H07 = reverse + end-only, gateway only)
# restart the gateway with Historian__ReadLimits__MaxValuesCeiling=40 and __AllowStreamingBeyondCeiling=false, then:
python3 scripts/validation/grpc-data/history_gate.py --run-id h923-gw --scenario H08 --gateway-ceiling 40
python3 scripts/validation/grpc-data/rig.py down --run-id h923-gw
```
On the gateway the window is a fixed 120 s of the recent past (nothing is accumulated). H08 re-reads the window and answers the
previous full run stored in `evidence/H-gateway-baseline.json`, so run it after a full run on the same run id.
## Scenario authoring and node probes
The seeder is available through `LocalRig.seed_helper(action, *arguments)`. Its