[opcuaclient] OpcUaClient — Type definition mirroring #360

Merged
dohertj2 merged 1 commits from auto/opcuaclient/8 into auto/driver-gaps 2026-04-25 20:40:51 -04:00
Owner

Summary

Opt-in type-definition mirroring for OpcUaClient — projects upstream Server.Types tree into the local address space.

  • IAddressSpaceBuilder.RegisterTypeNode(MirroredTypeNodeInfo) — new method with default no-op so existing builders (Galaxy, Modbus, FOCAS, S7, TwinCAT, AbCip, NestedBuilder) compile unchanged.
  • New MirroredTypeKind enum (ObjectType / VariableType / DataType / ReferenceType) and MirroredTypeNodeInfo record (UpstreamNodeId, BrowseName, DisplayName, SuperTypeNodeId, IsAbstract).
  • OpcUaClientDriverOptions.MirrorTypeDefinitions default false — opt-in flag preserves existing behavior.
  • OpcUaClientDriver.DiscoverAsync — new pass-3 (MirrorTypeDefinitionsAsync):
    • Batches Session.FetchTypeTreeAsync across the four standard type roots (ObjectIds.{ObjectTypes, VariableTypes, DataTypes, ReferenceTypes}Folder)
    • Recursively walks each via HasSubtype references
    • Cycle protection + MaxBrowseDepth / MaxDiscoveredNodes caps
    • Curation IncludePaths / ExcludePaths apply
    • Namespace remap applies to upstream NodeId rendering
    • Best-effort IsAbstract read per node; transient browse failures skip a branch rather than failing discovery

Scope decision: shipped structural mirror only. Session.LoadDataTypeSystem(NodeId, CT) was removed from the public ISession surface in OPCFoundation.NetStandard 1.5.378.106 (resolved version). Priming binary encodings now requires per-node HasEncoding walks — tracked as follow-up. Doc-strings call this out.

Test plan

  • dotnet build — Core.Abstractions, Driver.OpcUaClient, Core, Driver.OpcUaClient.Tests — all clean (0 / 0)
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests153 / 153 passed (6 new in OpcUaClientTypeMirrorTests: option default, opt-in path, record shape, enum coverage, default no-op back-compat, override recording)
  • Integration tests — skipped (live UA server required)

🤖 Auto-generated by the Mode-B execution loop. Closes #280.

Closes #280

## Summary Opt-in type-definition mirroring for OpcUaClient — projects upstream `Server.Types` tree into the local address space. - **`IAddressSpaceBuilder.RegisterTypeNode(MirroredTypeNodeInfo)`** — new method with **default no-op** so existing builders (Galaxy, Modbus, FOCAS, S7, TwinCAT, AbCip, NestedBuilder) compile unchanged. - New `MirroredTypeKind` enum (`ObjectType` / `VariableType` / `DataType` / `ReferenceType`) and `MirroredTypeNodeInfo` record (`UpstreamNodeId`, `BrowseName`, `DisplayName`, `SuperTypeNodeId`, `IsAbstract`). - **`OpcUaClientDriverOptions.MirrorTypeDefinitions`** default `false` — opt-in flag preserves existing behavior. - **`OpcUaClientDriver.DiscoverAsync`** — new pass-3 (`MirrorTypeDefinitionsAsync`): - Batches `Session.FetchTypeTreeAsync` across the four standard type roots (`ObjectIds.{ObjectTypes, VariableTypes, DataTypes, ReferenceTypes}Folder`) - Recursively walks each via `HasSubtype` references - Cycle protection + `MaxBrowseDepth` / `MaxDiscoveredNodes` caps - Curation `IncludePaths` / `ExcludePaths` apply - Namespace remap applies to upstream NodeId rendering - Best-effort `IsAbstract` read per node; transient browse failures skip a branch rather than failing discovery > **Scope decision**: shipped structural mirror only. `Session.LoadDataTypeSystem(NodeId, CT)` was removed from the public `ISession` surface in OPCFoundation.NetStandard 1.5.378.106 (resolved version). Priming binary encodings now requires per-node `HasEncoding` walks — tracked as follow-up. Doc-strings call this out. ## Test plan - [x] `dotnet build` — Core.Abstractions, Driver.OpcUaClient, Core, Driver.OpcUaClient.Tests — all clean (0 / 0) - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests` — **153 / 153 passed** (6 new in `OpcUaClientTypeMirrorTests`: option default, opt-in path, record shape, enum coverage, default no-op back-compat, override recording) - [ ] Integration tests — skipped (live UA server required) 🤖 Auto-generated by the Mode-B execution loop. Closes #280. Closes #280
dohertj2 added 1 commit 2026-04-25 20:40:47 -04:00
Adds an opt-in pass-3 walk of the upstream TypesFolder (i=86) so the OPC UA
Client driver can mirror upstream type definitions into the local address
space. Honours the curation rules from PR-7 (#359). Structural mirror only —
binary-encoding priming via LoadDataTypeSystem is tracked as a follow-up
because that helper was removed from the public ISession surface in
OPCFoundation.NetStandard 1.5.378+.

- IAddressSpaceBuilder.RegisterTypeNode (default no-op for back-compat)
- MirroredTypeNodeInfo + MirroredTypeKind in Core.Abstractions
- OpcUaClientDriverOptions.MirrorTypeDefinitions (default false)
- DiscoverAsync pass-3: FetchTypeTreeAsync + recursive HasSubtype walk per
  branch (ObjectTypes/VariableTypes/DataTypes/ReferenceTypes), best-effort
  IsAbstract read, IncludePaths/ExcludePaths still applied
- 6 new unit tests; all 153 OpcUaClient unit tests pass

Closes #280
dohertj2 merged commit 0f3abed4c7 into auto/driver-gaps 2026-04-25 20:40:51 -04:00
dohertj2 deleted branch auto/opcuaclient/8 2026-04-25 20:40:52 -04:00
Sign in to join this conversation.