Commit Graph

5228 Commits

Author SHA1 Message Date
Joseph Doherty 1237e9e6d1 fix(grpc-data): H3 review D1/D4/D6/D7 — probe cancel, sub-batches, flush wake-up, request-order budget
D1: a caller cancel (the projected deadline) during the connection's capability
probe escaped as RpcException(Cancelled) and faulted the whole HistoryRead; it
is now OperationCanceledException, the probe is capped by HistoryTimeout, and
ProjectedHistoryAccess fails any escaping fault per node (BadTimeout when the
deadline fired) and releases every cursor it owns. D4: calls are sub-batched at
min(the deployed connection's batch, the origin's advertised MaxBatchItems) and
at most one item per 256 B of the remaining assembly budget; a shortfall is
BadTooManyOperations per node, never an endpoint failure. D6: the release flush
is re-armed from a flag under its gate (no lost wake-up) and the stop source is
never disposed under a running flush. D7: calls are runs of consecutive request
positions read in request order, then the budget is charged in request order.
Float32 node over a Double-returning backend reads Good Singles end to end (no
KindMatches defect). Red/green for D1/D4/D7 by mutation; D6's race did not
reproduce red.
2026-11-24 01:48:12 -05:00
Joseph Doherty 585d5079eb fix(grpc-data): H3 review D2/D3/D5 — claimed cursors never leak; projected slot sub-limit
D2: Release() after TryClaimForResume() was a no-op, so a claimed cursor leaked
its origin continuation on every exit that never sent it (no gateway/identity,
deadline spent after the local half, limiter rejection, a gateway fault). New
ReleaseEvenIfClaimed() (at most once) on every post-claim exit; any exception
from the gateway now fails the projected half per node instead of escaping.
D3: projected reads hold at most N - max(1, N/4) of the N shared history batch
slots (OriginHistoryPort.RemoteSlots), Wait(0) => BadTooManyOperations for the
projected half, so a slow origin cannot starve local HistoryRead/HistoryUpdate.
D5: a Remote cursor presented to a local node (raw/modified/events take paths)
is released when it is taken. Red/green: each test fails with its fix reverted.
2026-11-24 01:40:18 -05:00
Joseph Doherty 99c873e514 docs(grpc-data): H3 evidence — gates and H01-H06 live on SqlServer and QuestDB origins 2026-11-24 01:21:57 -05:00
Joseph Doherty af06183412 fix(grpc-data): projected Processed values keep their aggregate's type
Found by the H3 live gate (H02): a Double Average of a UInt16 node was decoded
against the node's catalog kind and came back null + BadTypeMismatch per
interval (the result status stayed Good, which is why the wire test missed
it). Raw/AtTime values are still checked against the catalog kind; Processed
values accept any scalar kind. The wire test now asserts the interval's value.
Gate: re-browse the projected leaves after every deploy (a deploy retires cold
projected nodes; the same opaque ids come back).
2026-11-24 01:04:04 -05:00
Joseph Doherty 0a83c10ef6 fix(client): processed history reads ask for the server's aggregate defaults
Found by the H3 live gate (H02): Client.Shared sent the SDK's default
AggregateConfiguration (all false / 0), which the server refuses as a
non-default configuration (BadAggregateConfigurationRejected, #677) on local
and projected nodes alike, so CLI/UI --aggregate reads never worked against
it. Set UseServerCapabilitiesDefaults = true. OI regression test (red without
the fix) also covers HistoryReadPageAsync.
2026-11-24 00:55:52 -05:00
Joseph Doherty 763669562e docs(grpc-data): H3 OPC UA HistoryRead on projected nodes; rig H3 gate recipe 2026-11-24 00:44:04 -05:00
Joseph Doherty 8341c7f4ae test(grpc-data): H3 live gate harness (H01-H06, SqlServer and QuestDB origins)
rig.py up --history --history-backend questdb adds a run-owned QuestDB for the
SOURCE historian. History seed profile: mappings grant HistoryRead, the CLI
principal's CONSUMER HistoryRead comes only from mapping-scoped grants, text is
historized (per-type aggregate refusal), new acl_permissions mutation.
history_gate.py drives H01-H06 through the Client CLI on projected NodeIds
resolved by browse from the mapping anchor, compares with the origin, and
restores the baseline after every scenario. The node probe reports the
origin's open history continuations (LocalDataServices.HistoryOpenContinuations,
now public).
2026-11-24 00:42:46 -05:00
Joseph Doherty b50019db9c feat(cli): historyread --held-marker-file for hand-paged reads 2026-11-24 00:42:46 -05:00
Joseph Doherty 3b630ab1a9 feat(cli): historyread --page-size/--pause-after-page/--abandon/--release and --at-time
Hand-paged raw reads in one session print each page's status and continuation
(a refused resume is printed, not thrown), can hold the session across a
failover (resume when a file appears, then one fresh read), abandon a point
to the session close or release it explicitly. --at-time reads AtTime and
prints value types. Backed by IOpcUaClientService.HistoryReadPageAsync
(default-throwing interface member so existing fakes compile). Used by the
gRPC data H3 live gate on projected nodes.
2026-11-24 00:36:47 -05:00
Joseph Doherty 07eeea2bd5 test(grpc-data): H3 manifest key and OI end-to-end projected history wire tests
A real consumer OPC UA session HistoryReads a projected variable whose
projected half is forwarded to a real origin node manager's history port:
mixed batch keeps slots, page-through to completion, single use, session
close returns the origin store count to 0, mapped grant with ACLs on and off.
Manifest key H3 (OpcUaServer.Tests + Runtime.Tests; OI runs separately — the
runner accepts unit projects only).
2026-11-24 00:28:36 -05:00
Joseph Doherty 19b8163045 feat(grpc-data): H3 ProjectedHistoryAccess over deployed connections
Resolves, authorizes (HistoryRead demand: mapping bit + local grant on the
mapping scope, ACLs on or off) and pins each projected node, groups the batch
per connection / details / issuing endpoint and forwards through
IDataHistoryService. Remote cursors bind caller, mapping id+revision,
connection route, projection generation, origin view and serving identity, and
resend the ORIGINAL details; any change => BadContinuationPointInvalid with the
origin token released. Shared per-request assembly budget (min mapping
MaxHistoryAssemblyBytesPerRequest) => BadTooManyOperations for the remaining
nodes. Releases coalesce per connection. Replaces the H2 refusal pin with the
intended behaviour (granted => served, no grant => BadUserAccessDenied).
2026-11-24 00:28:17 -05:00
Joseph Doherty dc6cc7779d feat(grpc-data): H3 SDK side of projected history
Projected variables advertise Historizing + the HistoryRead access bit (never
HistoryWrite) only when the definition says so. The Raw/Processed/AtTime
overrides split authorized handles: local ones go to the H1 port unchanged,
projected ones to IProjectedHistoryAccess, each written back to its own slot;
nothing waits under Lock. HistoryCursorKind.Remote stores the projection's
cursor in the SDK session store; disposing the point (session close, eviction,
releaseContinuationPoints, faulted request) releases it at the origin. Mapped
HistoryRead is opened deliberately in DataPlaneAuthorizer; other mapped
operations outside the allowlist stay closed.
2026-11-24 00:27:51 -05:00
Joseph Doherty ef938b435b Merge H2: remote history over gRPC data connections (runtime consumers)
v2-ci / unit-tests (push) Failing after 2h48m40s
Phase H2 of docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md.
New HistoryRead RPC (Raw/Processed/AtTime) served through the H1 port via the
OriginHistoryPort facade; HistoryCapabilities/HistoryInfo negotiated by the
x-otopcua-data-features header (probe carries client features; header-less = v1
bytes). Ingress: Ready -> export grant -> origin ACL HistoryRead -> tagname, with
denied/unhistorized/unknown byte-identical. Byte-bounded origin memory, per-principal
sessions and remainders, single-use bound continuations, remote slots reserve local
capacity. Client failover/deadline mapping; LocalDataConnection history. Migration
AddDataConnectionHistory; validator bit + bounds; AdminUI fields + X0 banner.
Three Fable passes; live rig smoke on final HEAD passed (harness --history).
2026-11-23 23:56:21 -05:00
Joseph Doherty 180bd76578 docs(grpc-data): H2 live smoke on final HEAD (h2-history-smoke-final) 2026-11-23 23:46:50 -05:00
Joseph Doherty 1d3f172f83 test(grpc-data): H2 smoke asserts the no-grant capabilities shape (review fix 7a) 2026-11-23 23:35:41 -05:00
Joseph Doherty 99598637d5 docs(grpc-data): H2 evidence - second review pass and gates 2026-11-23 23:34:53 -05:00
Joseph Doherty f3f0af87a2 docs(grpc-data): missing export grant is PERMISSION_DENIED for the call; ACL-denied/unhistorized/unknown nodes are 0x80720000 2026-11-23 23:32:26 -05:00
Joseph Doherty a3e2f13815 test(grpc-data): H2 live smoke on the standalone rig - denied-principal modes, pinned-build check, parity; evidence 2026-11-23 23:31:30 -05:00
Joseph Doherty a4cd2a4b0e test(grpc-data): artifact projection test uses a response cap within the new 256 KiB minimum 2026-11-23 23:25:44 -05:00
Joseph Doherty 1d824da124 docs(grpc-data): precise wording for history limit changes 2026-11-23 23:21:11 -05:00
Joseph Doherty 3c89a49fa1 docs(grpc-data): H2 review2-7b/f - limiter share at N=1, limit changes clear live history sessions 2026-11-23 23:21:01 -05:00
Joseph Doherty 28de03783f fix(grpc-data): H2 review2-7d/e - caller cancel is OperationCanceledException; abandoned assembly releases chunk tokens
A caller cancel during a history call surfaced as RpcException(Cancelled); it now throws OperationCanceledException.
When an assembly is abandoned (timeout, communication failure, unsupported, cancel) after a follow-up, the origin chunk
tokens it carried are released best effort.
2026-11-23 23:20:53 -05:00
Joseph Doherty 808e1fe985 fix(grpc-data): H2 review2-7a - no aggregates or resolution for a peer without a HistoryRead grant
The history field still marks that the origin has a historian (negotiation rule unchanged), but a principal with no
HistoryRead export sees no aggregate names and resolution 0 (undisclosed).
2026-11-23 23:19:21 -05:00
Joseph Doherty fc8154289d fix(grpc-data): H2 review2-7c - MaxHistoryResponseBytes minimum 256 KiB (validator + AdminUI min)
Wire tests that relied on a 1-byte response cap now exercise chunking with wide string values at the minimum.
2026-11-23 23:18:08 -05:00
Joseph Doherty a3da73e1e7 fix(grpc-data): H2 review2-2..6 - byte-bounded pages, one deadline, no leaked cursors
Each node's Raw page is clamped from a per-value byte estimate of its catalog type (wide strings/arrays get small
pages plus a continuation) and sub-batches are sized by estimated bytes, so the in-flight read respects
MaxHistoryResponseBytes; AtTime/Processed whose values x estimate exceed the budget are refused per node with a
diagnostic. One deadline per request: nodes not started when it passes are deferred (transport) or BadTimeout
(direct). Every refusal releases the page cursor it was just given; releasing, invalidating or expiring a chunk
releases the page cursor behind it; results are disposed on the exception path. Chunk bindings use per-node details.
OpcUaServer IVT for Runtime.Tests/Host.Tests so tests can hold real page cursors.
2026-11-23 23:16:14 -05:00
Joseph Doherty eb29360d47 test(grpc-data): opt-in H2 history profile for the standalone rig (SqlServer historian overlay, history seed grants, probe HistoryRead, smoke runner) 2026-11-23 23:13:31 -05:00
Joseph Doherty abc6a1b068 fix(grpc-data): H2 review2-1 - a cancelled read never leaks its remote history slot
A pre-cancelled token throws before taking a slot, and the port delegate is dispatched with Task.Run(None) so its
finally always releases (a Task.Run on a cancelled token never runs the delegate).
2026-11-23 23:09:20 -05:00
Joseph Doherty d8712b871c docs(grpc-data): H2 evidence - gate results after review fixes 2026-11-23 23:04:43 -05:00
Joseph Doherty a6ca919fb2 docs(grpc-data): H2 evidence - review fixes, flake check 2026-11-23 22:31:48 -05:00
Joseph Doherty b66ee52086 test(grpc-data): H2 manifest gains the review-fix test classes 2026-11-23 22:31:15 -05:00
Joseph Doherty 9a808ba218 test(grpc-data): H2 review 10 - real Kestrel HTTP/2 proves the connection-close hook clears the session
In-process loopback h2c host: IConnectionLifetimeFeature.ConnectionClosed is exposed on the HTTP/2 stream context,
two requests on one connection share one session, and disposing the client connection clears it.
2026-11-23 22:12:28 -05:00
Joseph Doherty 7e22601ee7 test(grpc-data): H2 review 7 - mapped HistoryRead on a projected node stays BadHistoryOperationUnsupported until H3
With the mapping HistoryRead bit and a local HistoryRead grant, a real SDK HistoryRead on a projected variable is
refused (no HistoryRead access-level bit on projected nodes) with no data and no continuation.
2026-11-23 22:11:28 -05:00
Joseph Doherty 54d49e6cb6 fix(grpc-data): H2 review 9 - remote peers cannot starve local HistoryRead
Remote reads hold at most N - max(1, N/4) of the node manager's N process-wide history batch slots
(MaxConcurrentHistoryReadBatches); past that a remote request is BadTooManyOperations unsent, so local OPC UA clients
always keep at least one slot.
2026-11-23 22:09:49 -05:00
Joseph Doherty 6f1faaeb0b perf(grpc-data): H2 review 6 - Implemented(target) once per node; history serving cached per source
Metadata no longer rebuilds the history view per node x operation (and checks the ACL before the tagname, the
ingress order); OriginHistoryPort caches its served-aggregate set per historian source instance.
2026-11-23 22:06:02 -05:00
Joseph Doherty 3c5cbea931 fix(grpc-data): H2 review 2/3/4/9 - readiness is Ready()'s job; client faults never escape
Origin advertises history whenever it has a historian, so a not-ready/demoted endpoint answers HistoryRead
Unavailable (ungranted: PermissionDenied) and the consumer fails over like v1 Read instead of 'unsupported'.
Client: malformed/undecodable answers are endpoint failures (fresh read moves on); a resumed item is
ContinuationPointInvalid while a fresh item of the same batch is BadNoCommunication; a fresh read tries the next
endpoint when one lacks history; discovery backoff honoured; origin Cancelled without a caller cancel is BadTimeout
(no RecordFailure); caller cancel throws. The deployment lease maps inner/scope faults to BadNoCommunication.
The UnaryTimeout cap is documented next to the AdminUI field and in DataConnections.md.
2026-11-23 22:04:23 -05:00
Joseph Doherty 53e3970f27 fix(grpc-data): H2 review 1/5/9 - bound origin history memory per request and per principal
Nodes are read in sub-batches sized to the response budget and no sub-batch starts once it is spent: the rest are
DEFERRED chunk tokens (transport; read on resume from their original continuation) or BadTooManyOperations (direct
consumer). Processed intervals and AtTime times above MaxHistoryValuesPerPage are refused unsent. Remainder bytes are
charged to a per-principal budget across sessions (concurrent reads x max(response budget, one page)); sizes come
from the encoded CalculateSize; a single value above the response budget is a per-item BadTooManyOperations.
Sessions are capped per principal (own LRU evicted first) and globally (the heaviest principal pays); a release never
creates a session; channel-close registrations are unregistered on clear.
2026-11-23 21:59:59 -05:00
Joseph Doherty 82d34b84a8 fix(grpc-data): H2 review 9 - upper bounds on the history limits (validator + AdminUI max) 2026-11-23 21:54:38 -05:00
Joseph Doherty 6a621423f4 fix(grpc-data): H2 review 8 - history timeout rides the artifact, not the trust-scope fingerprint
DataConnectionScopeRevision covers consumer/connection/secret scope only; limits (TimeoutMilliseconds and now
HistoryTimeoutMilliseconds) reach DB-less nodes and the LocalDb cache in the artifact's entity JSON. Dropping the field
also avoids a one-time scope-version bump on upgrade. Plan 6 corrected.
2026-11-23 21:53:58 -05:00
Joseph Doherty e0956a55d6 docs(grpc-data): H2 evidence and docker-dev smoke recipe 2026-11-23 21:44:42 -05:00
Joseph Doherty 9bcdf92ff3 docs(grpc-data): remote history for runtime consumers; plan 4.1 probe-vs-RPC negotiation decision 2026-11-23 21:07:25 -05:00
Joseph Doherty 9b5bb29619 test(grpc-data): H2 manifest key and artifact projection of the history fields 2026-11-23 21:02:04 -05:00
Joseph Doherty 6fd4c2b0b5 feat(grpc-data): H2 AdminUI HistoryRead checkbox, history limit fields, X0 banner
Connection/export/mapping editors offer HistoryRead (DataOperationAuthoring, never ahead of the validator) and the
HistoryTimeoutMilliseconds / MaxConcurrentHistoryReads / MaxHistoryValuesPerPage / MaxHistoryResponseBytes /
MaxHistoryAssemblyBytesPerRequest fields; an informational banner shows while a post-v1 bit is ticked (plan 4.3).
2026-11-23 20:59:32 -05:00
Joseph Doherty b36c8d8716 feat(grpc-data): H2 consumer history client and deployed-connection history
GrpcDataConnection implements IDataHistoryService (explicitly; ReadHistoryAsync/ReleaseHistoryAsync avoid an overload
clash with ReadAsync): the capabilities probe always asks for history, other calls send it only when the selected
endpoint advertised it; per-call deadline min(remaining, HistoryTimeoutMilliseconds); FAILED_PRECONDITION/UNIMPLEMENTED
=> BadHistoryOperationUnsupported; chunks assembled within the request budget (BadTooManyOperations past it); page
tokens wrapped with the issuing endpoint + serving incarnation so a resumed read never moves; release forwarded. The
deployment lease gates history on the row's HistoryRead bit and carries HistoryTimeout. Decoded capabilities drop
HistoryRead without the history field. X0 tests that used bit 32 as the unknown bit now use a still-reserved bit.
2026-11-23 20:57:35 -05:00
Joseph Doherty d0756bb78e test(grpc-data): H2 wire suite; both v1 gates extended with history-shaped data
Both recorded-v1-client gates now run against origins that grant HistoryRead, advertise history capabilities and
carry HistoryInfo; header-less bytes stay identical to the goldens (not re-recorded). GrpcDataHistoryWireTests: probe
shapes, FAILED_PRECONDITION without the feature, denied/unhistorized/unknown byte-identical with no backend call,
admission, cancel, wiring fault, chunking + lost chunk, release, direct runtime consumer. Endpoint allowlist gains
HistoryRead (the auth middleware rejected it).
2026-11-23 20:48:56 -05:00
Joseph Doherty 025e6a075a Merge master (#918 real-origin compatibility gate) into H2 2026-11-23 20:42:51 -05:00
Joseph Doherty e7cacd2ac9 feat(grpc-data): H2 origin HistoryRead ingress, header gating, LocalDataConnection history
Service: HistoryRead rpc; history (field 16, Metadata.history, bit 32) emitted only on a call whose header requested
history AND whose origin can serve it, otherwise stripped to the v1 shape; un-negotiated HistoryRead is
FAILED_PRECONDITION. Origin: Implemented(target) grows by HistoryRead when a historian backend is configured;
per-item gate catalog -> export grant + origin ACL HistoryRead -> tagname, every refusal the same
BadHistoryOperationUnsupported; per-principal admission (BadTooManyOperations), per-page ceiling, response-byte chunking
with single-use chunk tokens; one session per (principal, credential, HTTP/2 connection) cleared on close; wiring
faults BadInternalError + error log; caller cancel never a backend outcome. DataOperationPolicy maps HistoryRead.
2026-11-23 20:42:51 -05:00
Joseph Doherty 0c86edc194 Merge #918: real-origin variant of the recorded-v1-client compatibility gate
v2-ci / unit-tests (push) Waiting to run
Goldens captured on pre-H2 master 1086593a over the real LocalDataServices,
LocalExportCatalog, DataCapabilitiesProvider, sample hub, write executor and
subscription service; only the physical driver write/acquisition, transport and
clock are faked. Closes #918.
2026-11-23 20:39:55 -05:00
Joseph Doherty 880cd89fe9 test(grpc-data): real-origin variant of the recorded-v1-client gate (#918)
Replays recorded v1 requests against the real DataConnectionGrpcService over the
real origin stack (LocalExportCatalog.Compile from a DraftSnapshot with Raw + UNS
exports, DataCapabilitiesProvider, PartitionedSampleHub, LocalDataServices,
DataWriteExecutor, LocalSubscriptionService/DataSubscriptionSession). Only the
physical driver write dispatch, upstream acquisition, transport and clock are
faked. Goldens captured on pre-H2 master 1086593a; nothing normalised.

Runtime gains InternalsVisibleTo Host.Tests for the Subscribe/Write seams.
Class added to the X0 manifest; X0.md section 2 records real vs faked,
determinism, the perturbation proof and the rule for H2/A2/A3.
2026-11-23 20:39:24 -05:00
Joseph Doherty b6895c19d4 feat(grpc-data): H2 AddDataConnectionHistory schema; authoring accepts HistoryRead
Migration per plan 6 (HistoryTimeoutMilliseconds 30000; MaxConcurrentHistoryReads 4, MaxHistoryValuesPerPage
10000, MaxHistoryResponseBytes 4 MiB; MaxHistoryAssemblyBytesPerRequest 16 MiB) with non-null defaults and widened
check constraints. Validator known set grows by HistoryRead (mapping bits still subset of connection bits; history
limits positive); scope revision includes the history timeout.
2026-11-23 20:38:31 -05:00
Joseph Doherty 9d194a7e97 feat(grpc-data): H2 SDK-free origin history facade over the H1 port
OriginHistoryPort (public, implements IOriginHistoryPort) keeps SDK types inside OpcUaServer instead of an
InternalsVisibleTo: runs the synchronous ReadHistory off the caller's thread, one PeerHistoryContinuationScope per
request, absent bounds -> port MinValue, miswired scope surfaced as WiringFault. Exposed through the SDK sink so
DeferredOriginHistoryPort resolves it after server start; aggregate wire table pinned to AggregateFunctionMap.
2026-11-23 20:36:02 -05:00