Files
romanett 333de8305b Add kitchen-sink coverage NodeSet2 with three load pipelines (#4251) (#4272)
# Description

Regression fence for the NodeSet2 import + code-generation surface. This
adds a single, purpose-authored "kitchen-sink" NodeSet2
(`Opc.Ua.CoverageTest.NodeSet2.xml`) plus a small dependent secondary
model that deliberately flip a broad set of the knobs defined by
`UANodeSet.xsd` (every node class, every `Definition` shape, custom
reference types, all five modelling rules, scalar/array/matrix values, a
deep branching instance tree, and a wide set of reference relations).
The same bytes are then loaded into **real** servers (`ServerFixture<T>`
+ `ReferenceServer`) through three independent pipelines and validated
node-by-node, attribute-by-attribute, reference-by-reference:

1. **Source-generation, hand-written manager** - the XML is consumed at
compile time via `<AdditionalFiles
ModelSourceGeneratorPrefix="Opc.Ua.CoverageTest">`; the generated
`AddOpcUaCoverageTest(context)` composes the predefined nodes inside a
`CustomNodeManager2`, so every node materialises as its generated
`NodeState` subclass.
2. **Runtime import** - the identical XML is imported at startup through
`RuntimeNodeSetNodeManagerFactory` / `AddRuntimeNodeSet`.
3. **Source-generation, generated fluent manager** - a
`[NodeManager]`-attributed partial makes the generator emit the whole
`FluentNodeManagerBase` manager, factory and typed fluent-builder
surface.

A shared, data-driven `[TestCaseSource]` battery runs the identical
assertions against all three servers, and a cross-pipeline equivalence
fixture asserts the three address spaces agree. A dependent **second
namespace** (`.../Secondary/`) exercises cross-namespace
`HasTypeDefinition`, `HasSubtype` and `HasComponent` references in every
pipeline.

Authoring the model surfaced two latent source-generator bugs, both
fixed here:

- `NodeSetToModelDesign` crashed on a top-level `<ServerUris>` table
(`StringTable.Append(null)` for the reserved local-server slot). Added a
null guard plus a focused regression test (`NodesetServerUrisTests`).
- `FluentBuilderGenerator` emitted colliding typed-builder accessors for
any model with more than one structure encoding, because
`DataTypeEncoding` objects hang off their `DataType` and surfaced as
parent-less "root" instances sharing the reserved
`DefaultBinary`/`DefaultXml`/`DefaultJson` symbolic names. They are
encoding metadata, never fluent-wired, so they are now excluded from the
typed builder.

A few edges are intentionally not asserted for cross-pipeline
equivalence because the pipelines legitimately differ (documented in
`CoverageNodeSet/README.md`): type-dictionary / `DataTypeDescription`
nodes (the generator regenerates schema rather than emitting them), a
handful of ambiguous duplicate-hierarchical / View-`Organizes` edges,
and runtime structure stand-ins (structure definitions are validated via
the `DataTypeDefinition` round-trip instead).

## Related Issues

- Fixes #4251

## Checklist

_Put an `x` in the boxes that apply. You can complete these step by step
after opening the PR._

- [ ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [x] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [x] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [x] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
2026-08-17 14:59:58 -07:00

2.8 KiB

1CoverageHierarchicalReference5001ReferenceType
2CoverageSymmetricReference5002ReferenceType
3CoverageAbstractReference5003ReferenceType
4CoverageConcreteReference5004ReferenceType
5CoverageEnumeration5100DataType
6CoverageEnumeration_EnumValues5101Variable
7CoverageOptionSet5110DataType
8CoverageOptionSet_OptionSetValues5111Variable
9CoverageAbstractStructure5120DataType
10CoverageStructure5130DataType
11CoverageStructure_DefaultBinary5131Object
12CoverageStructure_DefaultXml5132Object
13CoverageStructure_DefaultJson5133Object
14CoverageOptionalStructure5140DataType
15CoverageOptionalStructure_DefaultBinary5141Object
16CoverageUnion5150DataType
17CoverageUnion_DefaultBinary5151Object
18CoverageAbstractObjectType5200ObjectType
19CoverageObjectType5210ObjectType
20CoverageObjectType_MandatoryVariable5211Variable
21CoverageObjectType_OptionalVariable5212Variable
22CoverageObjectType_MandatoryPlaceholder5213Object
23CoverageObjectType_OptionalPlaceholder5214Object
24CoverageObjectType_ExposesArrayVariable5215Variable
25CoverageObjectType_MandatoryMethod5216Method
26CoverageObjectType_MandatoryMethod_InputArguments5217Variable
27CoverageObjectType_MandatoryMethod_OutputArguments5218Variable
28CoverageEventType5230ObjectType
29CoverageInterfaceType5240ObjectType
30CoverageVariableType5300VariableType
31CoverageRoot5400Object
32CoverageRoot_TypedObject5402Object
33CoverageRoot_TypedObject_MandatoryVariable5403Variable
34CoverageRoot_TypedObject_MandatoryMethod5404Method
35CoverageRoot_TypedObject_MandatoryMethod_InputArguments5405Variable
36CoverageRoot_TypedObject_MandatoryMethod_OutputArguments5406Variable
37CoverageRoot_EventSource5410Object
38CoverageRoot_EventSource_SubNotifier5411Object
39CoverageRoot_EventSource_CoverageCondition5412Object
40CoverageRoot_BooleanValue5420Variable
41CoverageRoot_Int32Value5421Variable
42CoverageRoot_StringArrayValue5422Variable
43CoverageRoot_DoubleMatrixValue5423Variable
44CoverageRoot_DateTimeValue5424Variable
45CoverageRoot_EnumerationValue5425Variable
46CoverageRoot_OrderedValue5426Variable
47CoverageRoot_AddNumbers5450Method
48CoverageRoot_LockedMethod5451Method
49CoverageRoot_AddNumbers_InputArguments5452Variable
50CoverageRoot_AddNumbers_OutputArguments5453Variable
51CoverageView5460View
52CoverageRoot_CoverageStateMachine5470Object
53CoverageRoot_CoverageStateMachine_StateA5471Object
54CoverageRoot_CoverageStateMachine_StateB5472Object
55CoverageRoot_CoverageStateMachine_TransitionAB5473Object
56CoveragePlainStructure5160DataType
57CoveragePlainStructure_DefaultBinary5161Object
58CoverageRoot_TreeRoot5490Object
59CoverageRoot_TreeRoot_BranchA5491Object
60CoverageRoot_TreeRoot_BranchA_LeafA15492Variable
61CoverageRoot_TreeRoot_BranchA_SubBranchA5493Object
62CoverageRoot_TreeRoot_BranchA_SubBranchA_LeafA25494Variable
63CoverageRoot_TreeRoot_BranchB5495Object
64CoverageRoot_TreeRoot_BranchB_LeafB15496Variable