Skip to content

[WotCon] Materialize WoT Thing Descriptions into the server address space - #4154

Open
marcschier wants to merge 17 commits into
marcschier/wot-15-clientfrom
marcschier/wot-14-materialization
Open

[WotCon] Materialize WoT Thing Descriptions into the server address space#4154
marcschier wants to merge 17 commits into
marcschier/wot-15-clientfrom
marcschier/wot-14-materialization

Conversation

@marcschier

Copy link
Copy Markdown
Collaborator

PR 14 of the stacked series splitting the large WoT Connectivity integration PR #4093.

This PR adds the server-side materialization runtime that turns WoT Thing Description resources from the xRegistry snapshot into OPC UA address-space projections. The coordinator builds the dependency closure for each resource, plans binding metadata, activates binding channels, and publishes the resulting projection through the registry NodeManager so refresh, retire, and reload operations remain observable and deterministic.

Projection intentionally goes through the NodeManager lifecycle reload API instead of mutating live nodes directly. That keeps complex type reload, runtime NodeSet publication, shadow reload, immediate reload, and retirement on the same lifecycle path as other dynamic server address-space changes.

This branch has a triple dependency. It is based on #4146 (registry), and additionally needs #4147 (lifecycle reload API) and #4128 (2-argument TryGetStructure). Both #4147 and #4128 are merged into this branch, so this PR's diff will show their content until those dependencies land.

Validation performed:

  • dotnet build src\Opc.Ua.WotCon.Server\Opc.Ua.WotCon.Server.csproj -c Release -f net10.0 -v:m
  • dotnet build tests\Opc.Ua.WotCon.Tests\Opc.Ua.WotCon.Tests.csproj -c Release -p:CustomTestTarget=net10.0 -v:m
  • dotnet test tests\Opc.Ua.WotCon.Tests\Opc.Ua.WotCon.Tests.csproj -c Release -p:CustomTestTarget=net10.0 --no-build
  • dotnet build tests\Opc.Ua.WotCon.Tests\Opc.Ua.WotCon.Tests.csproj -c Release -p:CustomTestTarget=net48 -v:m
  • dotnet test tests\Opc.Ua.WotCon.Tests\Opc.Ua.WotCon.Tests.csproj -c Release -p:CustomTestTarget=net48 --no-build
  • dotnet build tests\Opc.Ua.Server.Tests\Opc.Ua.Server.Tests.csproj -c Release -p:CustomTestTarget=net10.0 -v:m
  • dotnet test tests\Opc.Ua.Server.Tests\Opc.Ua.Server.Tests.csproj -c Release -p:CustomTestTarget=net10.0 --no-build (one known inherited failure: LiveNodeManagerAddRefreshesTheClientNamespaceTable)

marcschier and others added 5 commits August 1, 2026 08:08
…to marcschier/wot-14-materialization

# Conflicts:
#	src/Opc.Ua.Types/Utils/FileSystem/LocalFileSystem.cs
#	src/Opc.Ua.Types/Utils/FileSystem/VirtualFileSystem.cs
Adds the materialization runtime that turns registered WoT Thing Descriptions into
live OPC UA nodes: a dependency graph over the registered documents, a coordinator
that drives resolution and projection, and a binding runtime that attaches protocol
channels to the projected variables.

Projection runs through the NodeManager lifecycle rather than mutating a running
address space in place, so a refresh either commits a complete new generation or
leaves the previous one untouched. The resolver, converter, contributor and target
variable seams are interfaces so a host can substitute its own document sources.

Also adds the registry NodeManager that exposes the registry itself in the address
space, and the hosting extensions that register the whole runtime with dependency
injection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
Bring the PR14 materialization, dependency graph, binding runtime, registry projection lifecycle, and NodeManager coverage across from the stacked integration branch.

Keep the tests compiling for both net10.0 and net48 by naming ImmutableDictionary.Empty on the binding plan models and updating the memory binding test seam to the current codec resolver contract.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
@marcschier
marcschier force-pushed the marcschier/wot-14-materialization branch from 6f3e667 to cd84294 Compare August 1, 2026 11:45
…alization

# Conflicts:
#	src/Opc.Ua.Types/Utils/FileSystem/VirtualFileSystem.cs
@marcschier
marcschier force-pushed the marcschier/wot-14-materialization branch from cd84294 to 777e0a8 Compare August 1, 2026 11:47
…alization

# Conflicts:
#	tests/Opc.Ua.WotCon.Tests/Registry/WotBlobResourceStoreTests.cs
@marcschier
marcschier changed the base branch from marcschier/wot-13-registry to marcschier/wot-15-client August 1, 2026 11:55
Copilot AI review requested due to automatic review settings August 1, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the WoT Connectivity server-side materialization runtime that projects registry Thing Descriptions/Thing Models into the OPC UA address space via the NodeManager lifecycle (add/shadow/immediate reload), including per-generation binding runtime wiring and supporting utilities. This PR also expands the WoT Con test suite and DI hosting/registration to validate the new materialization surfaces.

Changes:

  • Introduce projection hosting abstractions (IWotProjectionHost, handles/documents/sources) and a lifecycle-based host (LifecycleWotProjectionHost) to materialize runtime NodeSets through NodeManager reload APIs.
  • Add binding runtime wiring components (channel slot caching/disposal, structured field-path planning/state) plus Refresh-Method argument decoding (WotRefreshArguments).
  • Add extensive NUnit coverage for dependency graph closure planning, conversion, refresh argument decoding, lifecycle/binding wiring, and DI registration.

Reviewed changes

Copilot reviewed 45 out of 45 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Opc.Ua.WotCon.Tests/Support/MemoryWotBinding.cs Sample in-memory binder/executor/channel used for documentation/tests.
tests/Opc.Ua.WotCon.Tests/Opc.Ua.WotCon.Tests.csproj Adds project references needed for bindings + test frameworks/common test utilities.
tests/Opc.Ua.WotCon.Tests/Materialization/WotTargetVariableResolverTests.cs Unit tests for deterministic target-variable resolution and error statuses.
tests/Opc.Ua.WotCon.Tests/Materialization/WotStructuredGroupStateTests.cs Validates structured mapping lazy-resolution and concurrency semantics.
tests/Opc.Ua.WotCon.Tests/Materialization/WotRefreshArgumentsTests.cs Tests Refresh input-argument decoding for common encodings/forms.
tests/Opc.Ua.WotCon.Tests/Materialization/WotRefreshArgumentsExtendedTests.cs Covers edge cases for coercions and ExtensionObject forms in Refresh decoding.
tests/Opc.Ua.WotCon.Tests/Materialization/WotMaterializationTestSupport.cs Test doubles for projection host + document conversion + NodeSet generation helpers.
tests/Opc.Ua.WotCon.Tests/Materialization/WotMaterializationExtensibilityTests.cs Tests contributor/resolver extension points and dependency ordering.
tests/Opc.Ua.WotCon.Tests/Materialization/WotMaterializationCoordinatorExtendedTests.cs Supplemental coordinator tests (cycles, remove-all, selection filters, events).
tests/Opc.Ua.WotCon.Tests/Materialization/WotDocumentConverterTests.cs Tests conversion output factories and production document converter behavior.
tests/Opc.Ua.WotCon.Tests/Materialization/WotDependencyGraphTests.cs Core dependency graph closure extraction/ordering tests.
tests/Opc.Ua.WotCon.Tests/Materialization/WotDependencyGraphExtendedTests.cs Dependency graph edge cases/diagnostics/value-object tests.
tests/Opc.Ua.WotCon.Tests/Materialization/WotBindingChannelSlotTests.cs Tests channel slot disposal hardening and single-flight behavior.
tests/Opc.Ua.WotCon.Tests/Materialization/LifecycleWotProjectionHostBindingTests.cs Verifies runtime NodeSet ConfigureAsync wiring to binding runtime factory.
tests/Opc.Ua.WotCon.Tests/Hosting/OpcUaWotRegistryServerBuilderExtensionsTests.cs Ensures DI registration order yields a single shared binder registry instance.
tests/Opc.Ua.WotCon.Tests/Hosting/OpcUaWotRegistryServerBuilderExtensionsCoverageTests.cs Exercises all AddWotRegistryServer overloads and service registrations.
src/Opc.Ua.WotCon.Server/WotRegistryServerOptions.cs New bindable options surface for registry node manager/materialization behavior.
src/Opc.Ua.WotCon.Server/WotRegistryNodeManagerFactory.cs Factory that creates the stable registry NodeManager with injected services.
src/Opc.Ua.WotCon.Server/Opc.Ua.WotCon.Server.csproj Updates package description and adds bindings project reference; clarifies NoWarn rationale.
src/Opc.Ua.WotCon.Server/Materialization/WotStructuredGroupState.cs Lazy, retryable structured-target resolution/cache for field-path mappings.
src/Opc.Ua.WotCon.Server/Materialization/WotStructuredFieldBinding.cs Validates/builds field-path plans and navigates IStructure values without reflection/object APIs.
src/Opc.Ua.WotCon.Server/Materialization/WotRefreshArguments.cs Decoder for WoTRegistryType.Refresh method arguments across supported encodings.
src/Opc.Ua.WotCon.Server/Materialization/WotProjectionBindingRuntimeFactory.cs Default factory building and wiring a per-generation projection binding runtime.
src/Opc.Ua.WotCon.Server/Materialization/WotMaterializationTypes.cs Public result/request/event types used by coordinator and NodeManager mapping.
src/Opc.Ua.WotCon.Server/Materialization/WotBindingChannelSlot.cs Single-flight channel open/cache with disposal race hardening.
src/Opc.Ua.WotCon.Server/Materialization/LifecycleWotProjectionHost.cs Production host using runtime NodeSet lifecycle add/shadow/immediate reload paths.
src/Opc.Ua.WotCon.Server/Materialization/IWotTargetVariableResolver.cs Resolver seam + default implementation for spec-compliant target mapping resolution.
src/Opc.Ua.WotCon.Server/Materialization/IWotProjectionHost.cs Host abstraction, projection handle/document/source types, retirement policy enum.
src/Opc.Ua.WotCon.Server/Materialization/IWotProjectionBindingRuntimeFactory.cs Factory seam invoked from RuntimeNodeSetOptions.ConfigureAsync post-import.
src/Opc.Ua.WotCon.Server/Materialization/IWotNodeSetResolver.cs Resolver seam for missing companion-spec NodeSets.
src/Opc.Ua.WotCon.Server/Materialization/IWotNodeSetContributor.cs Contributor seam for programmatic DataType/node augmentation pre-materialization.
src/Opc.Ua.WotCon.Server/Materialization/IWotDocumentConverter.cs Converter seam + production converter wrapping WotNodeSetConverter with snapshot resolution.
src/Opc.Ua.WotCon.Server/Hosting/OpcUaWotRegistryServerBuilderExtensions.cs Adds DI registration surface for hosting registry/materialization on an OPC UA server.
src/Opc.Ua.WotCon.Server/EventIds.cs Adds event-id bucket for WotRegistry node manager.
Suppressed comments (1)

tests/Opc.Ua.WotCon.Tests/Materialization/WotMaterializationCoordinatorExtendedTests.cs:344

  • This test is marked async Task but has no awaits, which triggers CS1998 (async method lacks 'await') and will fail the build when warnings are treated as errors.

Comment thread tests/Opc.Ua.WotCon.Tests/Materialization/WotDependencyGraphExtendedTests.cs Outdated
Comment thread src/Opc.Ua.WotCon.Server/Materialization/WotRefreshArguments.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants