Commit Graph

1538 Commits

Author SHA1 Message Date
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 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 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 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 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
Joseph Doherty efea401915 test(grpc-data): H1 override paging over a real Session, override-path cross-kind refusal, deterministic limiter holder (verification 4-6, 7a) 2026-11-23 20:10:18 -05:00
Joseph Doherty 100dd5ca44 fix(grpc-data): H1 peer takes consume before verifying, scopes snapshot the incarnation per request, wiring faults are BadInternalError (verification 1-3, 7b)
- a take computes its expectation only after consuming the record, so a
  throwing incarnation source cannot leave a token replayable;
- a PeerHistoryContinuationScope is per request and reads the serving
  incarnation once, so a request straddling a failover binds its next
  token to the incarnation it started under (Save never answers null);
- a non-owner principal or a blank/throwing incarnation source raises
  PeerHistoryContinuationWiringException, answered BadInternalError (not
  BadHistoryOperationUnsupported); plan H2 note added;
- ConnectionIncarnation documented as identity only.
2026-11-23 20:09:01 -05:00
Joseph Doherty cfc051de21 test(grpc-data): H1 port coverage for index mapping, modified paging, limiter, deadline/cancel and the real session store (review 7) 2026-11-23 19:53:41 -05:00
Joseph Doherty 111c9c3566 fix(grpc-data): H1 history logs keep {NodeId} a NodeId on the local path (review 5) 2026-11-23 19:51:06 -05:00
Joseph Doherty 19a7c7af01 fix(grpc-data): H1 cursors bind an opaque namespace/view tag besides (realm, identifier) (review 2)
The realm folds mapped/raw into Raw (and every other index into Uns), so
(realm, identifier) alone could resume a raw node's cursor on the same
identifier in a mapped namespace. Items and cursor state now carry a
binding tag: the SDK adapter (and the events path) passes the node's
namespace URI, restoring the pre-port namespace-qualified binding; a peer
passes its view tag. The peer key binds it too.
2026-11-23 19:49:59 -05:00
Joseph Doherty 1bacabb24f fix(grpc-data): H1 peer cursors bind the caller's principal and the live serving incarnation (review 3)
The store used to build the expected key from its own fields, so the
principal/incarnation check could never fail. The scope now supplies the
caller's principal and reads the serving incarnation at save and at take, so
an in-process failover on a still-open connection invalidates its tokens; a
save for a non-owner principal is refused.
2026-11-23 19:47:17 -05:00
Joseph Doherty e04a8b419e fix(grpc-data): H1 details hash formats every field invariant-culture (review 4) 2026-11-23 19:45:55 -05:00
Joseph Doherty 561e6de52b test(grpc-data): H1 port fuzz holds every page to NumValuesPerNode, bounds included (review 6) 2026-11-23 19:45:14 -05:00
Joseph Doherty 7f32edf036 fix(grpc-data): H1 port outcome Status passes GoodNoData through (review 1) 2026-11-23 19:44:52 -05:00
Joseph Doherty b530692abb test(grpc-data): H1 port-vs-override parity cases and 10k-seed paged-vs-unpaged port fuzz 2026-11-23 19:36:21 -05:00
Joseph Doherty 8f59c0c6bc test(grpc-data): H1 PeerHistoryContinuationStore binding, expiry, eviction and token tests 2026-11-23 19:36:21 -05:00
Joseph Doherty 87c9f9c0b4 fix(grpc-data): X0 inert all-unknown export rule no longer lowers the principal's limits; ValidateDeployed doc 2026-11-23 19:01:53 -05:00
Joseph Doherty 5453c20d94 fix(grpc-data): X0 report dropped mapping bits only for enabled mappings (every mapping is still masked) 2026-11-23 19:01:53 -05:00
Joseph Doherty 9b29a5f652 test(grpc-data): X0 v1 gate pins Write without a write grant (per-item RejectedBeforeDispatch bytes, recorded on the pre-X0 service) 2026-11-23 19:00:41 -05:00
Joseph Doherty dac185a963 test(grpc-data): X0 review - v1 gate drives the service from golden request hex and pins rejection statuses 2026-11-23 18:28:48 -05:00
Joseph Doherty 4d29d539d8 feat(grpc-data): X0 review - tolerate any unknown bit at the artifact/catalog seam; drop diagnostics for exports and mappings
- ValidateDeployed ignores every bit outside Understood (understood subset still validated); P02's two
  1<<30 rows become 'tolerated, grants nothing'.
- UnknownOperationDrops: Warning + counter tagged kind=connection|export|mapping, counted once per row per
  accepted artifact change; collected under each lock, logged after release. Mappings masked at Stage.
- Surfaced via DataConnectionDiagnosticsSnapshot (DroppedUnknownOperations, MappingsWithDroppedOperations)
  and NodeDiagnosticsSnapshot.DroppedExportOperations.
- End-to-end test: 1<<30 through parse -> catalog compile -> mapping stage -> runtime apply.
- DataConnectionProtoContract.Validate() now runs at AddOtOpcUaDataConnections.
2026-11-23 18:28:48 -05:00
Joseph Doherty a5ef7ea6d8 feat(grpc-data): X0 node-side tolerant readers drop unknown operation bits per row (counted) instead of rejecting the snapshot
Covers the deployment runtime (plan site) plus two node-side validator passes the plan missed:
DeploymentArtifact data-row parse and LocalExportCatalog.Compile now use DataConnectionValidator.ValidateDeployed.
Authoring (Validate) still rejects the reserved bits.
2026-11-23 17:21:35 -05:00
Joseph Doherty d96eafd138 feat(grpc-data): X0 consumer derives x-otopcua-data-features per selected endpoint; never sent in X0 2026-11-23 17:21:35 -05:00
Joseph Doherty 331350e2f4 feat(grpc-data): X0 server parses x-otopcua-data-features on every RPC and records requested/effective (effective always empty) 2026-11-23 17:16:24 -05:00
Joseph Doherty 3279a7f9db test(grpc-data): X0 recorded-v1-client compatibility gate, goldens captured on pre-X0 master 2e4e4063 2026-11-23 17:11:59 -05:00
Joseph Doherty 9c8c1054fa test: complete grpc data solution validation 2026-11-23 09:55:04 -05:00
Joseph Doherty 4cf3acb1c5 perf: measure grpc fanout and recovery bounds 2026-11-23 09:55:04 -05:00
Joseph Doherty 29fec57fac test: validate grpc data connections with local docker and opcua cli 2026-11-23 09:55:04 -05:00
Joseph Doherty 1df29a3124 feat: author and inspect grpc data connections 2026-11-23 09:55:04 -05:00
Joseph Doherty 8ad03e9c5d feat: expose mapped raw and uns data through grpc adapters 2026-11-23 09:55:04 -05:00
Joseph Doherty 47960a6d57 feat: host tls data service and route node and cluster connections 2026-11-23 09:55:04 -05:00
Joseph Doherty af30a0266a feat: add bounded shared grpc subscriptions and delivery scheduling 2026-11-23 09:55:04 -05:00
Joseph Doherty 862dbc8e90 feat: preserve grpc write admission and uncertain outcomes 2026-11-23 09:55:04 -05:00
Joseph Doherty 8f28a0eabf feat: add immutable partitioned data publication hub 2026-11-23 09:55:03 -05:00
Joseph Doherty 078abfb250 feat: share grpc mapped authorization and authority leases 2026-11-23 09:55:03 -05:00
Joseph Doherty d5b3653012 feat: deploy scoped grpc data connection configuration 2026-11-23 09:55:03 -05:00
Joseph Doherty 88f0a57ab4 test: add focused grpc data phase gates and discovery isolation 2026-11-23 09:55:03 -05:00
Joseph Doherty 46d9a19bc5 fix(security): no role, no login — refuse zero-role and mapper-fault AdminUI sign-in and tokens (#913)
/auth/login signed users in with an empty role set (and did so when the role
mapper threw), and AuthenticatedRead / the fallback policy admit any
authenticated user — with a domain-root SearchBase any AD user would get AdminUI
read access and a token.

- Empty mapped role set: refused like bad credentials (JSON 401; form redirect to
  /login with a generic message), no cookie, Warning logged with the groups.
- Mapper throws: refused, fail closed (JSON 503 like an LDAP outage; form redirect
  with a generic "temporarily unavailable"), exception logged.
- /auth/token: refuses (401) a cookie session carrying no role claim.
- Replaces Login_when_role_mapper_throws_signs_in_with_no_role_claims with refusal
  tests (JSON + form), adds zero-role refused (JSON + form), one-mapped-role signs
  in, zero-role cookie gets no token. JwtConfigurationGateTests' stub user now holds
  a mapped group.

Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
2026-11-17 11:18:18 -05:00
Joseph Doherty c996b462c4 fix(security): pass FallbackServers/BindMode/UserBindTemplate/AcceptDomainQualifiedNames to the LDAP library, inject its logger (#913)
- LdapOptions gains the four properties (library defaults) and ToLibraryOptions()
  projects them; before this the AdminUI had no DC failover and the keys were
  silently ignored.
- OtOpcUaLdapAuthService builds the library service with ILogger<LdapAuthService>
  from DI, so failover Warnings, the sticky-preference line and stage diagnostics
  reach the log.
- LdapOptionsValidator ports only the library's FallbackServers parse rule and the
  BindMode=User -> UserBindTemplate {0}-exactly-once rule. ServiceAccountDn is NOT
  required: DEV boots on the empty default (plan review B2).
- Fix stale comments: no direct-bind path exists; code default server is localhost.
- Tests: two-way reflection completeness guard over the library LdapOptions
  (allow-list: ServerCertificateValidationCallback), JSON + env binding of the new
  keys, validator rules, DEV-shaped boot, and a DI-built service against two closed
  loopback ports proving library Warnings for primary AND fallback reach the log.

Claude-Session: https://claude.ai/code/session_01GT67AFKC45MBz1wPZnVbX8
2026-11-17 11:18:18 -05:00
Joseph Doherty 678498a4a6 fix(opcuaclient): split the per-endpoint connect budget into reachability + session phases (#912)
PerEndpointConnectTimeout (3 s) now bounds only TCP + discovery, so failover past a
dead endpoint stays fast. The new SessionCreateTimeout (10 s) bounds OpenSecureChannel
+ CreateSession on an endpoint that answered discovery, where the client-side cert and
crypto work lives (#910). 2 x (3 + 10) s stays inside the host's 30 s initialise bound.
Expiries name the budget that ran out; both budgets must be positive; AdminUI form
carries the new field so a save does not drop it; driver docs updated.

Closes #912
2026-11-15 16:55:22 -05:00
Joseph Doherty c8edd65f3e Keep driver address builders inline within their owning dialog 2026-11-14 02:14:13 -05:00