Skip to content

[WotCon] Add the WoT Connectivity samples and complete the documentation - #4156

Open
marcschier wants to merge 28 commits into
marcschier/wot-14-materializationfrom
marcschier/wot-16-samples
Open

[WotCon] Add the WoT Connectivity samples and complete the documentation#4156
marcschier wants to merge 28 commits into
marcschier/wot-14-materializationfrom
marcschier/wot-16-samples

Conversation

@marcschier

Copy link
Copy Markdown
Collaborator

Adds the runnable WoT Connectivity samples and completes the documentation. This is PR 16 of a
stack
splitting #4093, and the last one.

Samples

Three projects under samples/WotCon/:

  • FlatTagServer — a plain OPC UA server exposing flat tags, used as an aggregation source.
  • AggregationServer — registers Thing Descriptions with the WoT registry and materializes two
    flat sources into a runtime-loaded DI/Machinery/Pumps Pump model. It also ships a small in-memory
    protocol binding, which is the worked example the binding contributor guide walks through.
  • AggregationClient — drives the aggregated model: commands, Refresh, monitoring, and
    generation replacement.

Documentation

  • New docs/WotBindings.md — the bindings that ship today (planner/executor architecture, bundled
    vs separate packages, operation coverage, target mapping, lazy channels, generation lifetime) plus
    the contributor guide for adding your own, with diagnostics, tests, packaging, TFM, trimming and
    NativeAOT guidance.
  • Expanded docs/WoTConnectivity.md covering the registry, dependency-closure materialization and
    runtime NodeSet projection.
  • docs/RuntimeNodeSets.md gains the shadow-reload section and docs/XRegistry.md the shared
    byte-store section. Both document APIs introduced earlier in the stack; they are collected here
    because this is the documentation PR.
  • docs/README.md links the new pages.

Solution registration

Registers the three samples and Opc.Ua.WotCon.Samples.Tests in UA.slnx so CI actually builds
and runs them.

Stack position

Sits on top of #4154 (materialization) and additionally merges #4142 (registry client) and
#4144 (protocol executors), because the samples exercise the whole stack — AggregationServer
needs the OPC UA executor and the client sample needs the registry client. Its diff therefore shows
their content until they land.

It also carries WotRegistryProjectionLiveTests.cs, which #4154 deliberately left out: those tests
need both the materialization runtime and the registry client, so this is the first branch where
they compile.

Validation

  • All three samples build clean on every target framework.
  • Opc.Ua.WotCon.Tests: 830 passed, 0 failed (769 from [WotCon] Materialize WoT Thing Descriptions into the server address space #4154 plus 61 from the live projection
    tests).
  • Opc.Ua.WotCon.Samples.Tests: 6 of 7 pass locally; the remaining one fails with
    CryptographicException: The system cannot find the path specified, a known certificate-store
    problem on this machine that was previously reproduced against a clean baseline worktree and is
    not related to this change. CI will confirm.
  • 0 warnings, 0 errors.

One fix was needed while bringing the sample across: its memory binding called ResolveCodec with
the pre-out WotPayloadDescriptor signature. The API gained the payload out-parameter and a
bool result during review of the binding PRs, so the sample now follows the same
if (!ResolveCodec(...)) return Unsupported(...) pattern as the shipped planners.

Integration PR: #4093.

marcschier and others added 12 commits August 1, 2026 08:47
…arcschier/wot-16-samples

# Conflicts:
#	src/Opc.Ua.Types/Utils/FileSystem/VirtualFileSystem.cs
Adds three runnable samples: two flat OPC UA tag servers and an aggregation server
that materializes them into a DI/Machinery/Pumps model through the WoT registry,
plus an aggregation client that drives the result. The AggregationServer also ships
a memory protocol binding, which doubles as the worked example for the binding
contributor guide.

Documents the WoT Connectivity surface end to end: a new protocol bindings guide,
the expanded WoT Connectivity overview covering the registry, materialization and
runtime projection, and the shadow-reload and shared byte-store sections for the
runtime NodeSet and xRegistry guides. Registers the sample and test projects in the
solution so they are built and run by CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
Brings across the binder registry, codec, planner and target-mapping tests, the
custom-binder sample test, the combined-model preservation tests and the
aggregation document tests, closing the last coverage gap against the integration
branch.

The custom-binder sample needed updating: WotEndpointPolicy now fails closed on
unknown URI schemes, so a binding that introduces its own scheme has to opt it in.
That is exactly the situation every custom binding author hits, so the sample now
shows it and the contributor guide documents the policy, the failure it produces
and the checklist item.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
TransferServicesExtensions.BindToTransferService already ships but had no tests.
Adds argument validation, required-method-children and routing coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
…alization

# Conflicts:
#	src/Opc.Ua.Types/Utils/FileSystem/VirtualFileSystem.cs
…16-samples

# Conflicts:
#	src/Opc.Ua.Types/Utils/FileSystem/VirtualFileSystem.cs
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

This PR lands the runnable WoT Connectivity (WoTCon) aggregation samples (two flat-tag source servers + one aggregation server + a loader/client) and rounds out the documentation and test coverage for the WoTCon 1.1 registry/materialization/binding stack, including wiring the new sample test project into UA.slnx.

Changes:

  • Add three runnable sample projects under samples/WotCon/ and a dedicated Opc.Ua.WotCon.Samples.Tests test project, and register them in UA.slnx.
  • Add/expand WoTCon integration and sample-document determinism tests (live registry client workflow, binding/mapping/codec tests, and sample topology tests).
  • Complete/extend documentation for WoTCon, runtime NodeSet lifecycle behavior, xRegistry storage, and docs index links.

Reviewed changes

Copilot reviewed 51 out of 53 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
UA.slnx Registers WoTCon sample projects and Opc.Ua.WotCon.Samples.Tests in the solution.
tests/Opc.Ua.WotCon.Tests/WotRegistryClientLiveServerTests.cs Adds live-server end-to-end registry client integration tests (upload/refresh/readback, concurrency).
tests/Opc.Ua.WotCon.Tests/Samples/WotAggregationDocumentTests.cs Adds determinism/canonicalization and round-trip tests for checked-in sample WoT documents.
tests/Opc.Ua.WotCon.Tests/Samples/WotAggregationDocumentGenerator.cs Adds generator helpers to deterministically regenerate sample WoT documents from NodeSet sources.
tests/Opc.Ua.WotCon.Tests/Resources/WotAggregation/StructuredPumpMappingExample.td.json Adds a dedicated structured mapping TD example used by tests/docs.
tests/Opc.Ua.WotCon.Tests/Properties/AssemblyInfo.cs Adds assembly-level attributes for the WoTCon test assembly.
tests/Opc.Ua.WotCon.Tests/CombinedModelPreservationTests.cs Adds tests guarding preservation of 1.02 NodeIds/surface and coexistence with 1.1 registry additions.
tests/Opc.Ua.WotCon.Tests/Binding/WotTargetMappingTests.cs Adds target-mapping validation/propagation tests for uav:mapToNodeId / uav:mapToType / uav:mapByFieldPath.
tests/Opc.Ua.WotCon.Tests/Binding/WotCustomBinderSampleTests.cs Adds an end-to-end test for the worked example custom mem:// binding and executor.
tests/Opc.Ua.WotCon.Tests/Binding/WotCodecTests.cs Adds tests for built-in payload codec encode/decode and codec selection behavior.
tests/Opc.Ua.WotCon.Tests/Binding/WotBindingTestSupport.cs Adds test helpers for generating TD fragments and extracting forms.
tests/Opc.Ua.WotCon.Tests/Binding/WotBinderRegistryTests.cs Adds protocol binder registry selection/version/capability tests.
tests/Opc.Ua.WotCon.Samples.Tests/WotSampleEnvironment.cs Adds in-process multi-host sample environment orchestration for end-to-end sample tests.
tests/Opc.Ua.WotCon.Samples.Tests/TestPorts.cs Adds helpers for acquiring free TCP ports in sample tests.
tests/Opc.Ua.WotCon.Samples.Tests/Properties/AssemblyInfo.cs Adds assembly-level attributes for the WoTCon samples test assembly.
tests/Opc.Ua.WotCon.Samples.Tests/Opc.Ua.WotCon.Samples.Tests.csproj Introduces the net10-only sample test project referencing the sample executables.
tests/Opc.Ua.WotCon.Samples.Tests/AggregationStartupTests.cs Adds tests ensuring sample TFMs and DI registration (e.g., OPC UA executor presence).
tests/Opc.Ua.Di.Tests/TransferServicesExtensionsTests.cs Adds/updates DI Transfer service binding tests (unrelated to WoTCon samples but included in this PR).
samples/WotCon/README.md Adds the full aggregation sample guide (topology, run steps, troubleshooting, tests, AOT publishing).
samples/WotCon/FlatTagServer/README.md Adds minimal documentation for the flat-tag source server.
samples/WotCon/FlatTagServer/Properties/AssemblyInfo.cs Adds assembly-level attributes for FlatTagServer sample.
samples/WotCon/FlatTagServer/Program.cs Adds FlatTagServer entry point calling the reusable host runner.
samples/WotCon/FlatTagServer/FlatTagServerOptions.cs Adds configuration model for the flat-tag source server (endpoints, namespace, deterministic values).
samples/WotCon/FlatTagServer/FlatTagServerHost.cs Adds reusable HostApplicationBuilder-based hosting for FlatTagServer.
samples/WotCon/FlatTagServer/FlatTagServer.csproj Adds the FlatTagServer sample project and references.
samples/WotCon/FlatTagServer/FlatTagNodeManager.cs Adds the flat-tag NodeManager implementation exposing a deterministic subset of Pump tags.
samples/WotCon/AggregationServer/README.md Adds documentation for the aggregation server and its sample in-memory binding example.
samples/WotCon/AggregationServer/Properties/AssemblyInfo.cs Adds assembly-level attributes for AggregationServer sample.
samples/WotCon/AggregationServer/Program.cs Adds AggregationServer entry point calling the reusable host runner.
samples/WotCon/AggregationServer/Bindings/MemoryWotBinding.cs Adds the worked example mem:// binder + executor + channel + store implementation used in docs/tests.
samples/WotCon/AggregationServer/AggregationServerOptions.cs Adds configuration model for AggregationServer (endpoint, PKI root, document size bounds).
samples/WotCon/AggregationServer/AggregationServerHost.cs Adds reusable host configuration for registry/materialization plus binding executors (HTTP/Modbus/OPC UA).
samples/WotCon/AggregationServer/AggregationServer.csproj Adds the AggregationServer sample project with restricted TFMs for runnable configs.
samples/WotCon/AggregationClient/README.md Adds brief documentation for the one-shot aggregation loader/client.
samples/WotCon/AggregationClient/Properties/AssemblyInfo.cs Adds assembly-level attributes for AggregationClient sample.
samples/WotCon/AggregationClient/Program.cs Adds AggregationClient CLI entry point running the workflow and printing results.
samples/WotCon/AggregationClient/Documents/documents.json Adds the manifest describing the sample document set and dependencies.
samples/WotCon/AggregationClient/AggregationClientRunner.cs Adds the in-process workflow (connect, upload docs, refresh, browse, read values).
samples/WotCon/AggregationClient/AggregationClientModels.cs Adds reusable options/result models for AggregationClient workflow output.
samples/WotCon/AggregationClient/AggregationClient.csproj Adds the AggregationClient sample project and includes documents as content.
docs/XRegistry.md Updates xRegistry documentation (ByteString write signature; adds WoTCon worked-example notes).
docs/WoTConnectivity.md Expands WoT Connectivity docs to cover the 1.1 registry/materialization/bindings architecture and usage.
docs/RuntimeNodeSets.md Updates runtime NodeSet docs with shadow/immediate reload sections and revised cross-links.
docs/README.md Links new WoTCon/WoT bindings/sample documentation pages from the docs index.
Suppressed comments (1)

docs/RuntimeNodeSets.md:234

  • The related-docs link SourceGeneratedNodeManagers.md is broken (file not found under docs/). This should link to the existing section in NodeManagers.md to avoid dead links in published documentation.
## Related documentation

- [Source-Generated NodeManagers](SourceGeneratedNodeManagers.md) — strongly typed alternative.
- [Dependency Injection](DependencyInjection.md) — `IOpcUaServerBuilder` and service registration.

Comment thread docs/RuntimeNodeSets.md Outdated
Comment thread docs/RuntimeNodeSets.md Outdated
Comment thread tests/Opc.Ua.WotCon.Samples.Tests/WotSampleEnvironment.cs Outdated
Comment thread tests/Opc.Ua.WotCon.Tests/Properties/AssemblyInfo.cs
Comment thread samples/WotCon/README.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
WoT binding executors validate every outbound endpoint against WotEndpointPolicy,
whose default blocks loopback so a server cannot be talked into reaching its own
listeners on behalf of a remote caller. The aggregation sample federates SourceA
and SourceB on the same host, so every materialized read was rejected with
BadSecurityChecksFailed and the end-to-end sample test could not pass.

Opt the sample in to loopback explicitly through the existing AddWotEndpointPolicy
builder API, leaving the scheme allow-list, blocked hosts and private-range checks
at their secure defaults, and document the knob in the sample README.

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

Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
Comment thread docs/README.md Outdated
The WoT protocol bindings and aggregation sample entries were indented as
sub-bullets while the two sibling WoT entries added alongside them were at the
top level, so the four new links did not read as one group.

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

Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
@marcschier marcschier added the ready Ready to merge once CI Passes label Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready Ready to merge once CI Passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants