[WotCon] Add the WoT Connectivity 1.1 information model - #4139
[WotCon] Add the WoT Connectivity 1.1 information model#4139marcschier wants to merge 16 commits into
Conversation
Pins the combined WoT Connectivity 1.1 NodeSet2 and its NodeId companion file into the project and generates the model from them. The combined NodeSet contains the complete published OPC 10100-1 v1.02 model alongside the additive registry nodes in a single namespace, emitted under the same prefix, name and model URI the standalone 1.02 model used. Every existing 1.02 generated constant, NodeState and proxy therefore keeps its exact NodeId, so the model is additive rather than a replacement. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
The combined WoT Connectivity model generates DataTypeIds and the other identifier classes into the Opc.Ua.WotCon namespace, so an unqualified DataTypeIds in a file that imports that namespace now resolves to the generated class rather than to the standard one and the core identifiers stop resolving. Qualifies the affected references in the WoT Connectivity server so it keeps building against the new model. No behaviour changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
|
The combined WoT Connectivity model generates identifier classes in the Opc.Ua.WotCon namespace, which shadows core Opc.Ua classes such as DataTypeIds, so the affected server/test references are qualified. The model swap also required registering the xRegistry namespace and partitioning the combined predefined-node table so WotConnectivityNodeManager keeps only the v1.02 asset surface; otherwise the master asset-management tests fail at runtime when the table resolves xRegistry references. |
The combined WoT Connectivity model includes the deprecated 1.02 asset surface and the additive registry nodes that reference xRegistry base types. Register the xRegistry namespace before creating the combined table, then retain only the legacy node slice for WotConnectivityNodeManager. This keeps the existing asset-management NodeManager from claiming registry nodes or failing when xRegistry NodeIds are resolved. No behavior change outside the model partitioning needed by the combined NodeSet. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds the WoT Connectivity 1.1 information model while updating the source-generation pipeline to correctly handle combined NodeSets, placeholder names, method-argument identifiers, and structured argument decoding.
Changes:
- Introduces a combined WoT Connectivity 1.1 NodeSet (plus CSV) and wires it into the
Opc.Ua.WotConproject (includingOpc.Ua.XRegistrybase model consumption). - Improves source-generation correctness for placeholder browse names, DataTypeEncoding parenting, explicit method-type reuse, and stable/unique method-argument code identifiers.
- Extends generators/templates to decode structured argument values with message context and adds fluent builder support for variables discovered by DataTypeId.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/Opc.Ua.SourceGeneration.Core/Shared/SourceGenerationUtils.cs | Adds ToCSharpIdentifier and extends string literal escaping for Unicode line separators. |
| tools/Opc.Ua.SourceGeneration.Core/Schema/NodeSetToModelDesign.cs | Fixes import edge cases (placeholders, DataTypeEncoding parent) and method-type synthesis/reuse. |
| tools/Opc.Ua.SourceGeneration.Core/Schema/ModelDesignValidator.cs | Ensures method argument code names are assigned during import/validation. |
| tools/Opc.Ua.SourceGeneration.Core/Schema/ModelDesignExtensions.cs | Introduces scoped, collision-aware generated identifiers for method arguments. |
| tools/Opc.Ua.SourceGeneration.Core/Generators/ObjectTypeProxyGenerator.cs | Uses scoped argument identifiers; fixes structured output decoding and error message escaping. |
| tools/Opc.Ua.SourceGeneration.Core/Generators/NodeStateGenerator.cs | Uses scoped argument identifiers; decodes structured values with message context; fixes Description assignment target. |
| tools/Opc.Ua.SourceGeneration.Core/Generators/NodeManagerTemplates.cs | Adds a FindByDataTypeId traversal helper to support new fluent APIs. |
| tools/Opc.Ua.SourceGeneration.Core/Generators/MethodDesignArgumentResolver.cs | Resolves both input/output args together and assigns generated identifiers. |
| tools/Opc.Ua.SourceGeneration.Core/Generators/FluentBuilderGenerator.cs | Adds VariableFromDataTypeId pass-through methods; doc comment formatting tweak. |
| src/Opc.Ua.WotCon/Opc.Ua.WotCon.csproj | Switches to NodeSet2-based generation, references Opc.Ua.XRegistry, and links its NodeSet as ignored input. |
| src/Opc.Ua.WotCon/Design/Opc.Ua.WotCon.NodeSet2.csv | Adds NodeIds CSV for the combined WoT Connectivity model. |
| src/Opc.Ua.WotCon.Server/* | Aligns DataTypeIds references to Ua.DataTypeIds in server code. |
| src/Opc.Ua.ISA95/Design/Common/Opc.ISA95.NodeIds.csv | Renames placeholder nodes to *_Placeholder to match new placeholder naming convention. |
| tests/* | Adds/updates regression tests and fixtures for new generator behaviors and naming rules. |
Suppressed comments (1)
tools/Opc.Ua.SourceGeneration.Core/Shared/SourceGenerationUtils.cs:1
TrimStart('@')removes all leading '@' characters, which is potentially lossy if an authored UA name legitimately begins with multiple '@' characters (it will collapse them). If the intent is only to strip a single C# escape prefix, consider removing at most one leading '@' (e.g.,StartsWith('@') ? name[1..] : name) to avoid changing authored semantics unexpectedly.
The fluent builder generator emits calls to INodeManagerBuilder.VariableFromDataTypeId and to a NodeManagerBuilder constructor overload that carries the data-type lookup, but the runtime side of that API was missing, so every generated node manager failed to compile with CS1729 and CS1061. Adds the VariableFromDataTypeId resolution to the builder interface and implementation, along with NodeStateLookupExtensions.FindByDataType, which is the lookup the builder delegates to and has no other consumer. Resolution reports BadNodeIdInvalid for a null data type, BadNodeIdUnknown when nothing matches, BadBrowseNameDuplicated when the match is ambiguous, and BadTypeMismatch when the resolved node is not a variable. An optional browse name disambiguates a data type that is carried by more than one variable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
|
Fixed the net10.0 solution build failure on this PR. This branch carries the The fix lands in #4132 (where the generator change belongs) and is cherry-picked here so Verified locally: |
DiNodeManager constructed NodeManagerBuilder without the data-type resolver, so
VariableFromDataTypeId reported BadNodeIdUnknown ("no predefined variable has DataType")
for every DI node manager - a misleading error, since the lookup had simply never
been supplied rather than the variable being absent.
Delegates to NodeStateLookupExtensions.FindByDataType rather than hand-rolling the
scan a fourth time in this file.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
…-wotcon-model # Conflicts: # src/Opc.Ua.Di.Server/DiNodeManager.cs
Guard generated method argument name state with System.Threading.Lock so concurrent generator runs cannot mutate the ConditionalWeakTable state at the same time. Make argument resolution pure and assign generated code names only at emission sites that need those names, preserving scope-specific reserved names deterministically. Also suppress warnings for legacy-TFM no-op shell builds so generated consumer validation remains warning-free when CustomTestTarget points at a TFM the sample intentionally skips. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## marcschier/wot-04-generator-wot #4139 +/- ##
===================================================================
- Coverage 80.09% 80.08% -0.01%
===================================================================
Files 1539 1540 +1
Lines 214557 214958 +401
Branches 37070 37133 +63
===================================================================
+ Hits 171841 172159 +318
- Misses 29859 29921 +62
- Partials 12857 12878 +21
🚀 New features to boost your workflow:
|
…-wotcon-model # Conflicts: # tests/Opc.Ua.SourceGeneration.Core.Tests/Schema/NodeSetToModelDesignTests.cs # tools/Opc.Ua.SourceGeneration.Core/Generators/FluentBuilderGenerator.cs # tools/Opc.Ua.SourceGeneration.Core/Generators/MethodDesignArgumentResolver.cs # tools/Opc.Ua.SourceGeneration.Core/Generators/ObjectTypeProxyGenerator.cs # tools/Opc.Ua.SourceGeneration.Core/Schema/ModelDesignValidator.cs # tools/Opc.Ua.SourceGeneration.Core/Schema/NodeSetToModelDesign.cs
…-10-wotcon-model # Conflicts: # tools/Opc.Ua.SourceGeneration.Core/Generators/NodeStateGenerator.cs # tools/Opc.Ua.SourceGeneration.Core/Schema/ModelDesignExtensions.cs
|
Flagging a net48-only build break in Symptom
The generator emits the disambiguated delegate type name What I ruled outGenerated argument names leaking between the two TFM compilations in one process. Remaining hypothesisThe collision/disambiguation decision for generated delegate type names appears to depend on the A deterministic ordering (sort the candidate set before deciding whether to disambiguate) is the Not resolving; recording it here so it is not lost. |
The generator now emits a distinct handler delegate and result type per declaring type, so a method that appears on more than one type no longer shares a single generic name. CloseAndUpdate on the WoT file and the five WoTAssetConnectionManagement methods each have their own type now, and the server still referenced the generic names, so it no longer compiled. Points the asset file manager at the WoT file's CloseAndUpdate handler and the connectivity node manager at the management type's result types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9e6a5abf-3299-4cd1-9855-010fedbf0ad8
956f632 to
1ae01a3
Compare
…nt' into marcschier/wot-10-wotcon-model
This is PR 10 of the stacked split of integration PR #4093 into independently reviewable pieces.
Stack/dependency shape:
marcschier/wot-04-generator-wot).marcschier/wot-02-sourcegen), which is merged into this branch so the model can build.The #4132 dependency is functional, not cosmetic. Without #4132, building the WoT Connectivity model on #4134 alone fails with duplicate generated declarations, for example:
That occurs because the combined WoT-Con NodeSet ships the 1.02
CreateAssetMethodTypenode explicitly; without #4132's NodeSet-to-ModelDesign fix, the generator synthesizes a second declaration with the same name.Once #4132 and #4134 land, the extra diff from those dependencies disappears and this PR reduces to the three WoT Connectivity model files:
src\Opc.Ua.WotCon\Design\Opc.Ua.WotCon.NodeSet2.xmlsrc\Opc.Ua.WotCon\Design\Opc.Ua.WotCon.NodeSet2.csvsrc\Opc.Ua.WotCon\Opc.Ua.WotCon.csprojThe generated C# is produced from the pinned NodeSet2 at build time. I verified it builds from clean after deleting the WotCon
bin/obj, the source-generation toolbin/objdirectories, and shutting down dotnet build servers.