Commit Graph
12 Commits
Author SHA1 Message Date
romanettandClaude Opus 5.5 9b034f8291 Enable nullable reference types centrally; migrate all unset and annotations-only projects (#4700)
# Description

Nullable reference types are now enabled once, in `common.props`, and
every project in the repository builds warning-clean with them.

**Configuration**
- `<Nullable>enable</Nullable>` lives in `common.props`. All per-project
`<Nullable>` settings are removed: 178 project files (enable,
annotations, and the `disable` in the three Aot test projects).
- 419 per-file `#nullable enable`/`restore` directives and the 4
`#nullable disable` directives are removed.
- Kept on purpose:
- The 5 `<auto-generated>` schema files (`UANodeSet.cs`, `UA Type
Dictionary.cs`, `OPCBinarySchema.cs`, `SecuredApplication.cs`,
`PInvokeHelper.cs`) keep `#nullable enable`. The compiler ignores the
project setting in generated code, so the directive is required there.
- `tests/Opc.Ua.Interop.LegacyPeer` keeps `disable`. It builds against
the 1.5.378 packages and does not import the repository props.
- `docs/DeveloperGuide.md` and `.github/copilot-instructions.md` now
describe the central setting.

**Migration** (the 43 unset and 13 annotations-only projects, roughly
10k diagnostics)
- **Production code: annotated at the declarations.** Covers
`tools/Opc.Ua.SourceGeneration.Core`, `src/Opc.Ua.Lds.Server` and the
LDS sample.
- Members, parameters and returns are nullable where null actually
flows.
- Null-check helpers carry `[NotNullWhen]` (`IsNull`, `IsValidXmlName`,
`IsMethodTypeDesign`).
- `CoreUtils.Format`, `Utils.Format`, `ITemplateWriter.WriteLine` take
`params object?[]`. `Template.AddReplacement` takes `string?` (rendering
already skips null replacements).
- `IRegisteredServerStore.RegisterAsync` returns
`Task<RegistrationEntry?>`: it returns null when a registration is
removed.
- Dereferences backed by an invariant (for example, the validated model)
use `!`, so runtime behaviour is unchanged.
- **Behavioural changes in production code** (small, deliberate):
- `NodeSetToModelDesign` throws `InvalidOperationException` when the
file is not a NodeSet. Before, it threw a NullReferenceException on the
next line.
- `ModelDesignValidator` starts its lookup tables empty instead of null.
A redundant `if (m_nodes == null) return;` guard is gone.
- **Test code: minimal annotations.**
  - `?` on values that can be null, `!` where the test asserts non-null.
  - `= null!` for fixture members assigned in SetUp.
- `TryGetStructure<T>(out T? x)` where the inferred `T?` broke the
`IEncodeable` constraint.
- A few redundant `== null` checks on structs (`NodeId`, `ArrayOf<T>`)
folded into the adjacent `IsNull`/`Count` checks.

**Notes for reviewers**
- The diff is large (~1,500 files) but almost entirely mechanical: `?`,
`!` and directive removal. The non-annotation changes are listed above.
- Known follow-up, not done here:
`IModelDesign.Namespaces/TargetNamespace/NamespaceUris` stay
non-nullable even though the validator returns null before it loads a
dictionary. Making them nullable would ripple through every generator
call site.

## Related Issues

- Fixes #4439

## Checklist

- [ ] 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.
- [ ] 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.
- [ ] 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.

The "no new warnings" box covers net10.0 and net48: full non-incremental
builds of `UA.slnx`, `tools/SourceGeneration.slnx`,
`tools/MigrationAnalyzer.slnx` and the Aot test projects finished with 0
warnings and 0 errors under the repository's warnings-as-errors
settings. net9.0 and net8.0 also had no nullable diagnostics, but they
were not rebuilt after the final fixes. Tests have not been run locally
yet.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 08:48:13 +02:00
romanettandClaude Opus 5.5 7212607f16 OPC UA Part 3 compliance: permissions, Write semantics, NodeManagement, NodeSet DataTypes, locales (#4675)
# Description

Fixes the High and Medium findings of an OPC UA Part 3 (OPC 10000-3,
Address Space Model) compliance audit. Each finding was checked against
the full spec text (Parts 3, 4, 5, 6, 14 and 18) before it was fixed.
Every fix comes with regression tests that fail without it.

### Role permissions (Part 3 §8.55, Part 4 §5.12.2.2)
- The type-hierarchy exemption in
`MasterNodeManager.ValidateRolePermissions` /
`ValidateAccessRestrictions` now covers only Browse, Read and
ReadRolePermissions. Type nodes stay visible to generic clients, which
was the intent of #3705; every other permission bit is now enforced on
them.
- `ReceiveEvents` is enforced on the EventType node. The standard
NodeSet grants it on `AuditEventType` and its subtypes only to
SecurityAdmin, so only SecurityAdmin sessions now receive audit events.
- Call checks the `Call` permission and AccessRestrictions on the Object
as well as on the Method.
- When a Call's `methodId` is the Method declaration of the ObjectType,
the Object's Method with the same BrowseName is permission-checked and
invoked. The declaration is used only if the Object has no such Method.
This applies to `AsyncCustomNodeManager`, `CustomNodeManager2` and the
sample node manager.

### Write service (Part 3 §5.6.2, §8.40, §8.57; Part 4 §5.11.4)
- The synchronous `OnWriteValue` path (fluent `OnWrite`) checks DataType
and ValueRank first (`Bad_TypeMismatch`). After an IndexRange write it
merges the slice into the cached value instead of replacing it.
- StatusWrite / TimestampWrite are enforced (`Bad_WriteNotSupported`).
- Undefined enumeration values and invalid OptionSet writes return
`Bad_OutOfRange`. OptionSet writes merge only the valid bits into the
stored value.
- New `ReportPropertyValueChanged` / `ReportSemanticChange` let server
code raise SemanticChangeEvents for changes it makes itself.
- Required follow-up (Part 14 §6.2.11.1): if an external target rejects
a timestamp, the PubSub subscriber's TargetVariables writer retries
without it.

### NodeManagement and Call arguments (Part 3 §5.5.2, §5.7.3, §6.4.2;
Part 4 §5.8, §5.12.2)
- AddNodes creates the Mandatory InstanceDeclarations of the
TypeDefinition and rejects abstract or Interface types
(`Bad_TypeDefinitionInvalid`).
- AddReferences, DeleteReferences and DeleteNodes bump NodeVersion and
raise GeneralModelChangeEvents.
- Clients may omit trailing optional input arguments
(`HasOptionalInputArgumentDescription`).

### NodeSet DataTypes (Part 3 §5.8.3, §8.48; Part 6 Annex F.12)
- `UANodeSet.Import` completes structure definitions with the base
type's fields (base fields first). It creates definitions for structures
without fields and sets `DefaultEncodingId`.
`StructureDefinition.FirstExplicitFieldIndex` marks the subtype's own
fields.
- `DataTypeState` no longer mutates the stored definition on read.

### Locales (Part 3 §5.2.5, §8.5; Part 4 §5.4)
- Read, Browse and data change notifications return the translation that
best matches the session's LocaleIds, or all translations for `mul`. The
selection lives in the server dispatcher and is built on
`ResourceManager`: the new `TranslateValue` calls the overridable
`Translate`.
- Locale ids are matched case-insensitively, and fallback translations
carry their real locale.

### Client complex types (Part 6 §5.1.7)
- The Reflection.Emit builder encodes only `IsOptional` subtyped fields
as ExtensionObject. It also supports OptionSet subtypes: an unsupported
type is skipped instead of aborting the whole load.
- `TypeInfo.GetXmlName` uses the data type's XML name for dynamic
structures and OptionSets (the XML body element was `<Structure>`). Both
builders now produce identical XML.

## Behaviour changes
All are documented in `docs/MigrationGuide.md`.
- **Audit events:** only SecurityAdmin receives them. The CTT "Auditing
Connections" unit needs a SecurityAdmin user (e.g. sysadmin);
`AuditingOperationTests` was updated.
- **Write timestamps and status:** clients writing a SourceTimestamp or
a non-Good StatusCode get `Bad_WriteNotSupported` unless the Variable
has StatusWrite/TimestampWrite. No variable in `src/` sets these bits.
- **AddNodes:** it rejects abstract types (including `BaseVariableType`
and `BaseEventType`), and new instances now come with child nodes.
- **Call:** the Object needs the Call permission. The Object's own
Method runs even when the call names the type declaration.

## Not included
- Low-severity findings: missing validation on optional services and
author-side NodeSet rules.
- LocalizedText nested inside structures or Variant arrays, and in
HistoryRead or Call outputs.

## Testing
net10.0, Debug, one suite at a time on the merged branch. All suites
below pass:

| Suite | Passed |
|---|---|
| Types | 11430 |
| Core.Encoders | 2947 |
| Core.Schema | 179 |
| Core.Security | 558 |
| Client | 2761 |
| Server | 8210 |
| InformationModel | 1080 |
| Features | 145 |
| History | 536 |
| Di | 455 |
| Machinery | 167 |
| Robotics | 661 |
| Robotics.Intent | 22 |
| Pumps | 75 |
| Scales | 122 |
| Positioning | 69 |
| ISA95 | 144 |
| Vision | 484 |
| PubSub | 1490 |
| PubSub.Adapter | 151 |
| PubSub.Server | 177 |
| Redundancy.Server | 856 |
| Lds | 173 |
| Configuration | 241 |
| WotCon | 1496 |

- **Client.ComplexTypes:** one test wrote a SourceTimestamp to a
variable without TimestampWrite. It is fixed in this PR, and the suite
has not been re-run since.
- **Core:** 6068 passed, 1 failure in
`ActivityTraceFlags_Metrics_ShouldRecordMetricsOnly`. That telemetry
test passed when re-run alone, so it looks flaky.
- **Still running:** Sessions, Subscriptions (Classic, Durable,
standard) and Interop. Results will follow on this PR.
- `UA.slnx` builds with 0 errors for net10.0 and net48, with no new
analyzer warnings in changed files.

## Related Issues

- Part 3 compliance audit (no tracking issue)

## Checklist

- [x] 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.
- [ ] 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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 12:43:59 +00:00
romanettandClaude Opus 5.5 6f55500577 Server diagnostics: let every session browse its own subscriptions in SubscriptionDiagnosticsArray (#4664)
# Description

`Server.ServerDiagnostics.SubscriptionDiagnosticsArray` denied Browse
and Read to every session except a SecurityAdmin on a SignAndEncrypt
channel. A regular session, such as the CTT's default SecurityMode None
session, got `Bad_UserAccessDenied` when it browsed the array, so it
could not find its own subscription diagnostics. Part 5 §6.3.5 lets a
session see its own diagnostics, and the CTT maintainer asked that the
server return only the entries a session may see instead of blocking the
whole array ([Mantis
11445](https://mantis.opcfoundation.org/view.php?id=11445)).

**Change** (`DiagnosticsNodeManager.OnReadUserRolePermissions`):
non-admin sessions now get `Browse` on the server-wide
`SubscriptionDiagnosticsArray`. Each subscription diagnostics node
already carries the permissions of its owning session, and Browse drops
references to targets the caller may not browse. So a session browsing
the array gets only its own subscriptions, and an administrator gets all
of them.

**Intentionally unchanged:**
- Reading the array **value** stays admin-only. The value holds every
session's subscriptions. Making it readable with per-session filtering
would also need two other fixes: within one second of a diagnostics
scan, `OnReadDiagnosticsArray` returns the stored, unfiltered array, and
monitored items on the array receive the unfiltered scan value.
- `SessionDiagnosticsArray`, `SessionSecurityDiagnosticsArray` and
`ServerDiagnosticsSummary` keep their permissions. No session nodes are
linked under `SessionDiagnosticsArray`, so opening Browse there would
return nothing.

**Note for reviewers:** CTT `Subscription Durable/012.js` now gets past
the Browse and Read in Step 3, but it still fails because of a script
bug (missing braces on line 37 set `result = false` unconditionally).
That part is a CTT fix tracked in Mantis 11445.

## Related Issues

- Mantis 11445 (CTT Subscription Durable 012.js, Step 3)

## Tests

- New end-to-end test
`DiagnosticsTests.SubscriptionDiagnosticsArrayBrowseReturnsOnlyOwnSubscriptionsAsync`.
Two anonymous SecurityMode None sessions each create a subscription. The
fixture session's Browse returns only its own subscription, reading the
array value returns `BadUserAccessDenied`, and the sysadmin session sees
both subscriptions. Against the old permissions, the test fails with
`BadUserAccessDenied` on the Browse.
-
`DiagnosticsNodeManagerTests.ReadUserRolePermissions_AdminAndSessionHandlingAsync`
now also checks that a non-admin gets Browse only on the subscription
array, an admin can Read it, and the two session arrays still give a
non-admin no permissions.
- Local net10.0: `DiagnosticsTests` + `BaseInfoEnabledFlagToggleTests`
14/14 passed, `DiagnosticsNodeManagerTests` 22/22 passed. The test
projects build on net48.

## Checklist

- [x] 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.
- [ ] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] 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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 19:14:43 +02:00
romanettandClaude Opus 5.5 61edaa1ed0 Remove netstandard2.1 and net472 target frameworks (#4624)
# Description

Drops support for **netstandard2.1** and **.NET Framework 4.7.2**.
Libraries now target `net48`, `net8.0`, `net9.0` and `net10.0`.
`Opc.Ua.Types` and `Opc.Ua.SourceGeneration.Core` still also target
`netstandard2.0`, but only because the Roslyn source generators load
them. There is no general netstandard2.0 support.

**Preprocessor directives** (112 files)
- Every `#if`/`#elif` mentioning `NETSTANDARD2_1*`, `NET472*`,
`NET_STANDARD_TESTS`, `SKIP_ECC_CERTIFICATE_REQUEST_SIGNING` or
`NETSTANDARD*` was evaluated against the remaining TFM set (net48,
net8/9/10, plus netstandard2.0 inside `Opc.Ua.Types`/`tools`) and
simplified. Dead branches were removed.
- Example: `NETSTANDARD2_1 || NET8_0_OR_GREATER` → `NET8_0_OR_GREATER`.
- Example: `NET8_0_OR_GREATER || NET472_OR_GREATER` → removed (always
true).
- Netstandard-only code was removed: `UnixFileModeShim`, the CRDT
reflection path in `ReplicatedGossipOptions.CreateReaderOptions`, and
the netstandard2.1-only test variants.

**Custom test logic**
- `targets.props` drops the `net472`, `netstandard2.0` and
`netstandard2.1` `CustomTestTarget` profiles, `NetStandardTests` and
`SKIP_ECC_CERTIFICATE_REQUEST_SIGNING`. Supported values are now
`net48`, `net8.0`, `net9.0`, `net10.0`.
- The `NET_STANDARD_TESTS` define is removed from 29 test projects.
- The "build netstandard shells as net10.0" overrides are removed from
18 projects.
- `RestrictForLegacyTfm` now only applies to `net48`.
- `tests/customtest.bat` is updated to the new values.

**Build / packaging / CI**
- MSBuild TFM conditions are simplified: Kestrel package choice, MQTTnet
v4 (net48 only), BouncyCastle, Di/OpenUsd/Vision/Stress test excludes,
and `System.IO.FileSystem.AccessControl` (dropped from Core).
- The MigrationAnalyzer nuspec drops its net472/netstandard2.1 lib
groups. The Azure signing lists are updated.
- `get-ci-matrix.ps1` removes the net472/netstandard test profiles
(including the PR-gating `linux-netstandard2.1`) and the matching build
legs.

**Breaking API change (2.0 preview):** removed
`HttpsTransportListener.IsWssTransportSupported` and
`ReplicatedGossipOptions.IsGossipStateDecodingSupported`. They only
returned `false` on netstandard2.1 and are now always `true`. The test
guards that used them were removed as well.

**Docs**
- NuGet READMEs, `README.md`, `DeveloperGuide.md`, `PubSub.md`, the
certificate/ECC/identity docs and the 2.0 migration guide (plus its
`.agents` skill mirror) are updated.
- The migration guide notes that 4.7.2 consumers must move to 4.8 and
netstandard2.1 consumers to net8.0+.

### Reviewer notes
- The `System.IO.FileSystem.AccessControl` `PackageVersion` pin is left
in `Directory.Packages.props`. It has no direct reference any more, but
transitive pinning is on, so it was kept to avoid shifting resolved
versions.
- The `#if` rewrite was done mechanically by a truth-table evaluator.
The diff in the `.cs` files is limited to directive lines, removed dead
branches, and stale-comment updates.

### Verified locally
- `dotnet build UA.slnx -p:CustomTestTarget=net48`: 0 errors.
- `dotnet build UA.slnx -p:CustomTestTarget=net10.0`: 0 errors.
- Default multi-target builds (no `CustomTestTarget`) of Opc.Ua.Types,
Bindings.Https, PubSub.Mqtt and Redundancy.Server succeeded.
- net10.0 tests:
  - Opc.Ua.Redundancy.Server.Tests: 840/840 passed.
  - Opc.Ua.Types.Tests: 11363 passed, 1 skipped.
  - ModelDependencyScanner tests: 20/20 passed.
- The full test suite was **not** run locally.

## Related Issues

- None

## Checklist

- [ ] 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.
- [ ] 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.
- [ ] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] 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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:09:49 +02:00
2415503ab9 Close CTT skips in the reference server sample address space, diagnostics EnabledFlag and project settings (#4485)
Closes #4479

The CTT skipped a number of reference-server test cases because the
sample address space, the diagnostics EnabledFlag or the CTT project
settings did not provide what the scripts need. This PR fixes the sample
data and the server behaviour behind those skips, updates
`samples/UAReferenceServer.ctt.xml`, and records the CTT script defects
that the newly running cases expose.

## Changes

### Sample address space (`ReferenceServer.NodeSet2.xml`,
`ReferenceNodeManager`)

| # | Skip | Fix |
| --- | --- | --- |
| 1 | Base Info Engineering Units `004.js`: ArrayItemType
`EngineeringUnits` have an empty NamespaceUri | UNECE `mV` (12890)
EUInformation, and the axis definitions use `s` (5457219) instead of
UnitId 0. |
| 2 | Data Access PercentDeadband `006/016/017`:
`DataAccess_AnalogType_Float` EURange 0..0 | EURange 0..100 like the
other analog items. |
| 3 | Attribute Read `033.js` (19 nodes): second dimension of 3 | All
`Scalar_Static_Arrays2D_*` are 5x5 (generated values; the Variant matrix
holds scalar Int32 elements). The code-seeded Integer/Number/UInteger
matrices are 5x5 too. |
| 4 | View Minimum Continuation Point 01 `012.js`, View Basic 2
`018.js`: Method/View nodes need two references of their own NodeClass |
`Methods_Void` HasCause/HasEffect to two methods, `Views_Operations`
HasCause/HasEffect to `Views_Engineering`. |
| 5 | Base Info Server Capabilities 2 `002.js`: no node without
MinimumSamplingInterval | `DataAccess_DataItem_String` reports
`Bad_AttributeIdInvalid` for the optional attribute (Part 3 §5.6.2). A
DA item is used because Address Space WriteMask writes every attribute
of the static scalars back. |
| 6 | Historical Access Read Raw `Err-025.js`: no non-historizing Static
Scalar | New `Scalar_Static_NonHistorizing_Boolean` (HistoryRead access,
Historizing = false). See the historian change below. |
| 10 | Address Space Atomicity `001.js`: no NonatomicRead node found |
New `AccessRights_AccessAll_NonatomicReadWrite`. The script examines
only the first 10000 variables sorted by NodeId string; the 5000 mass
variables sort before `Scalar_Static_NonatomicReadWrite`. |

### Server library

- **Diagnostics EnabledFlag (item 7, Base Info Diagnostics
`018-1/2/3`).** `Server.ServerDiagnostics.EnabledFlag` is writable for
SecurityAdmin or ConfigureAdmin over SignAndEncrypt (UserAccessLevel
hook, asynchronous write handler); other users get
`Bad_UserAccessDenied`. Transitions are serialized, including the node
removal. Disabling returns `Bad_NotReadable` for
ServerDiagnosticsSummary, its children and the diagnostics arrays, and
removes the session and subscription diagnostics nodes (Part 5 §6.3.3).
The server keeps the registrations: enabling restores the nodes of the
live sessions and subscriptions with the same NodeIds (sessions created
while disabled included) and resets the arrays to Good. Counters stay
cumulative (required by `018-1.js`). Subscriptions created while
diagnostics are disabled still get no diagnostics node.
- `DiagnosticsNodeManager.IsDiagnosticsStructureNode` had an inverted
NodeId check, so monitored diagnostics nodes never started the scan
timer; `OnMonitoringModeChangedAsync` counted every node and replaced a
running timer. Both fixed.
- **Non-historized nodes (item 6).** `HistorianDispatcher` raw/modified,
processed and at-time reads ask the resolved provider
`IsHistorizingAsync` and return `Bad_HistoryOperationUnsupported` for a
node it does not historize, instead of the empty result the in-memory
historian gave for any node.
- **Browse order (item 8).** `ReferenceDictionary.Find` returned
references of a type from hash-based target maps, so a Browse filtered
by ReferenceType returned references in a different order than an
unfiltered Browse. It now returns them in insertion order (no extra
allocation; a single match keeps the fast path). View Basic 2 `015.js`
compares both lists by index. The characterization test in
`NodeStateReferenceStorageTests` is updated accordingly.

### CTT project settings (`samples/UAReferenceServer.ctt.xml`)

| Setting | Old | New |
| --- | --- | --- |
| `/Server Test/NodeIds/Static/All Profiles/Scalar/Bool` |
`ns=2;s=Scalar_Static_Boolean` |
`ns=2;s=Scalar_Static_NonHistorizing_Boolean` |
| `/Server Test/NodeIds/References/Has References of a ReferenceType and
SubType` | `ns=2;s=References_HasReferenceTypeAndSubType` | `i=2253` |
| `/Server Test/NodeIds/NodeClasses/Object` | `ns=2;s=Scalar` | `i=2253`
|

`References_HasReferenceTypeAndSubType` loses its
HasComponent/HasOrderedComponent references in the source generator;
that is tracked in #4484 and not changed here. The Server object has
HasComponent and HasAddIn references.

### Decisions

- **Item 11, Attribute Write StatusCode & Timestamp `003/006/008`
(writing ServerTimestamp): unchanged.** The stack rejects writes that
contain a ServerTimestamp (`NodeState`/`BaseVariableState`), which Part
4 §5.11.4.2 allows (`Bad_WriteNotSupported`); the CTT reports it as "Not
Supported", not as an error. Side finding, not changed: the
StatusWrite/TimestampWrite AccessLevel bits are not enforced.
- **Item 6:** Part 4 §5.11.3.4 (Table 52) specifies
`Bad_HistoryOperationUnsupported`; `Err-025.js` accepts only
`Bad_NotSupported`, so the case now runs and reports that as an error.
Recorded as a CTT defect in `plans/ctt-issues.md`.
- **Item 12:** removed the stale Historical Access `Err-012.js` entry
(fixed by #4026).

`plans/ctt-issues.md` adds C32 (`Err-025.js` status code), C33
(Atomicity `001.js`: 10000 cap, operator precedence, substring matching
of `UaNodesToIgnore`) and C34 (View Basic 2 `015.js` index comparison),
and replaces the Err-025/Err-012 configuration notes with the new
settings and the EnabledFlag access requirement. Monitor Basic `039.js`
is already C17. The run procedure in `plans/ctt-testing.md` is
unchanged.

## Verification

CTT 1.05.06, scripts 1.05.513, `ConsoleReferenceServer --ctt -a`, fresh
server per conformance unit/group. "master" = 5362ec5e5 with the
unchanged project settings.

**Targeted CUs (skips before → after):** Attribute Read `033` Pass; Base
Info Diagnostics `018-2`, `018-3` Pass, `018-1` Warning (*"Session
diagnostics not available"* for the session the script creates while
diagnostics are disabled); Base Info Engineering Units `001`
Inconclusive→Pass, `004` Pass; Base Info Server Capabilities 2 `002`
Pass; Data Access PercentDeadband `016`, `017` Warning→Pass; View Basic
2 `005`, `015`, `016`, `018`, `020` Pass; View Minimum Continuation
Point 01 `010`, `011` Pass, `012` Warning→Pass; Address Space Atomicity
`001` Pass; Monitor Value Change V2 `042` Error→Pass; Historical Access
Read Raw `Err-025` runs (CTT status-code defect above); `013` fails on a
varying number of results per run (1–12, also 11 on master), the
documented continuation-point defect #16. Unchanged: Monitor Basic `039`
(CTT script error), Monitor Value Change V2 `020` skip
(`Arrays/ByteString` elements shorter than 4 bytes, not part of #4479),
Historical Access Delete Value all pass.

**Saved selection (1,882 cases) per group, errors:** Address Space Model
0 → 0, Aggregates 4558 → 4558 and Base Information 19 → 19 (identical
messages) measured master (5362ec5e5) → this PR; after merging master
(#4478) and the review fixes, Aggregates 4210 and Base Information 19;
Attribute Services, Base Services, Data Access, Method Services and View
Services 0 errors with this PR (0 in the recorded baseline).

**Tests** (net10.0): Opc.Ua.Types.Tests 10395 passed,
Opc.Ua.Server.Tests 5561 passed, Opc.Ua.InformationModel.Tests 1082
passed, Opc.Ua.History.Tests 519 passed, Opc.Ua.Client.Tests 2266
passed; no failures. New regression tests: `ReferenceServerTests`
(units/ranges, 5x5 matrices, missing MinimumSamplingInterval,
non-historizing HistoryRead, NodeClass references, Server object
reference subtypes, both nonatomic nodes),
`DiagnosticsNodeManagerTests.SetDiagnosticsEnabledAsync_Toggle_HidesAndRestoresDiagnosticsAsync`,
`BaseInfoEnabledFlagToggleTests` (admin-only write, Bad_NotReadable
while disabled, restore after enable),
`ReferenceTableTests.FindReturnsReferencesInInsertionOrder`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.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-09-15 16:59:04 +00:00
romanettandClaude Opus 5 6313e38a06 Fix Part 13 aggregate status and FindAlias validation defects found by CTT runs (#4478)
# Description

Headless CTT runs (UA 1.05.06, scripts 1.05.513) against
`ConsoleReferenceServer --ctt` surfaced server-side defects in the Part
13 aggregate calculators and in the Part 17 FindAlias argument
validation. This PR fixes them and documents the CTT workflow and
findings.

## Aggregate fixes (`src/Opc.Ua.Server/Aggregates`)

- **Partial bit on reverse reads.** `m_startOfData`/`m_endOfData`
followed queue order, which is newest-first when `StartTime > EndTime`,
so the start-of-data check tested the wrong end.
- Both are now tracked chronologically, and only for values that pass
the queue-order check.
- The end-of-data check, previously disabled for backward reads for the
same reason, now applies in both directions (Part 13 §5.3.3.2).
- **Time-based status with TreatUncertainAsBad.**
`GetTimeBasedStatusCode` counted Uncertain regions as neither Good nor
Bad when `TreatUncertainAsBad = true`.
- They now count as Bad, and the Bad ratio is evaluated before the Good
ratio.
- A Bad result keeps its aggregate bits, like the Good and Uncertain
results (§5.4.3.2.1).
- Affects TimeAverage2, Total2, Minimum2, Maximum2, Range2 and the
ActualTime2 variants.
- **DurationGood / DurationBad / PercentGood / PercentBad first
region.** The first region inherited the status of the interpolated
simple bound (e.g. Uncertain when Bad data follows). It now takes the
status of the raw value at or before the interval start, or Bad if there
is none (§5.4.3.31/32).
- **WorstQuality2 on backward reads.** The start bound was taken at the
late time and values were scanned newest-first. A backward interval is
now calculated like the forward interval over the same range, with the
start bound at the early time (§5.4.2.2, §5.4.3.36).
- **Behavior change:** this reverses the reverse-direction semantics
added in #3978. Part 11 §6.5.4.2 can be read as making the late time the
interval start, but Part 13 §5.4.2.2 and the CTT oracle agree on the
forward-equivalent calculation. The two `StatusAggregateCalculatorTests`
cases that encoded the old behavior were updated.
- The WorstQuality and WorstQuality2 loop is shared, so backward
**WorstQuality** now also reports the chronologically first of equally
severe statuses, like the forward calculation. This is covered by
`DirectAndLiveWorstQualityBackwardSelectsChronologicallyFirstStatusAsync`.

## FindAlias argument validation (`src/Opc.Ua.Server/AliasNames`)

- **Found by:** CTT AliasName Base `Err-001.js`–`Err-004.js`. FindAlias
returned Good for malformed search strings (`A[`, `A\`, `A\\\`) and for
a `HasComponent` ReferenceTypeFilter.
- **Spec:** Part 17 §6.3.2 Table 4 requires `Bad_InvalidArgument` for an
invalid search string, and the ReferenceTypeFilter shall be `AliasFor`
or one of its subtypes.
- **Matcher:** `AliasNameWildcardMatcher.IsValidPattern` rejects a
trailing escape character, an unterminated or empty `[..]` list, and
list contents that are not a valid character class (these previously
threw). `IsMatch` no longer matches malformed patterns.
- **Dispatcher:** `AliasNameMethodDispatcher` returns
`Bad_InvalidArgument` for FindAlias and FindAliasVerbose on an invalid
pattern or a non-AliasFor filter. A null filter and `References` still
match every alias.

## Tests

- **Aggregates:**
- `AggregateCttRegressionTests` gains 18 cases. Each runs the calculator
directly and through `HistorianDispatcher` with the in-memory historian.
- Covered: the Partial bit forward and backward at the start and end of
data; rejected out-of-order values; Minimum2 status with
TreatUncertainAsBad true and false; the Duration and Percent
first-region case; WorstQuality2 and WorstQuality backward vs forward.
- With the aggregate source fixes reverted, every bug-targeted case
fails and the controls pass.
- **FindAlias:** new matcher and dispatcher unit tests. The
InformationModel integration tests for these cases now require
`Bad_InvalidArgument` instead of accepting an empty result.
- **Local results (net10.0):**
  - `Opc.Ua.Server.Tests` aggregate/historian filter: 848/848.
  - `Opc.Ua.Server.Tests` AliasName: 147/147.
- `Opc.Ua.History.Tests` aggregate/historical access/history client:
263/263.
  - `Opc.Ua.InformationModel.Tests` Alias: 54 passed, 5 skipped.
  - `Opc.Ua.Features.Tests` Alias: 11/11.
  - `Opc.Ua.Client.Tests` AliasName: 28/28.
- **CTT reruns against the fixed server:**
- Aggregate errors: 4,560 → 4,226. Server-vs-oracle DataValue
mismatches: 10,067 → 9,415.
- Every targeted aggregate mismatch pattern is gone, except the new
DurationGood/PercentGood rows. Those are a CTT oracle defect, documented
as C6.
- AliasName Base `Err-001.js`–`Err-004.js` now pass. The remaining
Hierarchy `002.js` error is a known CTT defect, Mantis 11262.

## Documentation (`plans/`)

- **`ctt-testing.md` (new):** running the CTT headless against the
reference server, generating selection files, reading results, capturing
the aggregate values behind failures, and triaging CTT vs server
defects.
- **`ctt-issues.md`:** an issue register with the current Mantis status
of every filed issue. It adds:
  - the not-yet-filed CTT defects (C1–C18);
  - clarification items;
- open server findings to investigate (Auditing, A&C Refresh and
Comment, GDS Like filters and AliasName Discovery);
  - CTT project configuration and coverage notes.
  - Skipped tests caused by sample-data gaps are tracked in #4479.

## Related Issues

- Relates to #3978 (earlier CTT aggregate conformance work) and #4479
(CTT coverage gaps).

## Checklist

- [x] 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.
- [ ] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] 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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 11:26:38 +00:00
Marc SchierandCopilot da7412c429 Add native xRegistry events and distinct Resource versions (#4396)
## Summary

- support the xRegistry 0.6.0 distinct Resource/Version hierarchy:
  `Registry -> Group -> Resource -> Versions -> Version`
- instantiate stable logical Resource nodes separately from exact
Version nodes
  while preserving existing Version NodeIds
- delegate logical Resource FileType operations and Version-view
metadata to the
selected default Version with handle pinning and shared writer
reservations
- make Resource and Version delete behavior role-stable and use
`MetaEpoch` /
  `Epoch` respectively
- use stable Resource SourceNodes, exact Version SourceNodes and the
  `Server -> Registry -> Group -> Resource -> Version` notifier chain
- keep a model-metadata-gated client fallback for 0.5 flat Servers; 0.6
Servers
  expose no legacy aliases
- target `HasWoTProjection` at the real stable logical Resource node
- use `AsyncCustomNodeManager` for the registration, fast-path, and
federation managers,
  with awaited lifecycle, node mutations, event delivery, and cleanup
- handle startup rollback, reentrant deletion callbacks, undisclosed
file handles,
  and retryable cleanup without blocking unrelated file operations

## Authoritative dependencies

- companion specification: OPCF-Members/spec-drafts#32 at
  `d3399fca025025a73e5a6b599f850a81d985c060`
- OPC UA binding: xregistry/spec#568
- xRegistry event semantics: xregistry/spec#563, merged as
  `66ee31e47fbadff6ab982ae1516f7d9065e46b64`
- companion NodeSet SHA-256:
  `369f5f3f1814b333e4eeb52bfb4b6a730cdff372505a5f91a54c94f0016ac4cf`

## Review feedback

- keep the WoT Connectivity information-model designation at `1.1`;
draft revisions update the publication date without changing the model
version
- eliminate all 198 unique CA1861 diagnostics across 54 files and remove
seven obsolete project suppressions
- fix the analyzer-clean touched-path CA1307 and the hierarchy follow-up
CA1846/CA1851 diagnostics without dropping legacy-TFM compatibility

- recover the reconcile queue after callback faults/cancellation and
continue accepted pending changes
- remove migration guidance for the xRegistry managers, which are new in
2.0

## Compatibility

- public WoT Connectivity model designation remains `1.1`
- generated event-record ABI, constructors, options, NodeIds, and stored
documents remain compatible
- the generic xRegistry managers are new in 2.0 and implement
`IAsyncNodeManager`;
use `IAsyncNodeManagerFactory` and the async lifecycle hooks (see
`docs\XRegistry.md`)
- persistence schema and document blobs remain compatible unless noted
below

## Validation

- merge validation at `980422f76` with upstream `e8bec27d5`: 454
targeted WoT/materialization/model/registry cases and all 327 XRegistry
cases passed on both net10.0 and net48; all 29 net10 aggregation sample
cases passed
- feedback regressions at `308e8ba74`: 55 targeted queue and live
registry event/projection/lifecycle cases passed on each of net10.0 and
net48
- prior CI: all 266 checks passed at `6489a0908`; the unchanged Ubuntu
Core certificate-counter test and dependent jobs passed on the one-time
retry ([run 34117304035, attempt
2](https://github.com/OPCFoundation/UA-.NETStandard/actions/runs/34117304035/attempts/2))
- `Opc.Ua.XRegistry.Tests` — 327 passed on net10.0 and net48 for
migration commit `32c914aaf`
- `Opc.Ua.WotCon.Tests` net10.0 — 1348 passed
- `Opc.Ua.WotCon.Bindings.Tests` net10.0 — 683 passed
- `Opc.Ua.SourceGeneration.Core.Tests` net10.0 — 3807 passed, 8 skipped
- `Opc.Ua.SourceGeneration.Tests` net10.0 — 145 passed
- `Opc.Ua.SourceGeneration.Stack.Tests` net10.0 — 94 passed
- affected XRegistry and WoT client/server projects build successfully
- xRegistry NodeSet is byte-identical to the companion artifact
- repository-wide CA1861 inventory — 198 unique diagnostics across 54
files reduced to zero
- targeted changed-fixture validation — 1,098 passed, 3 skipped, 0
failed
- constrained full `UA.slnx` net10.0 Release build — CA1861 = 0
- `Opc.Ua.XRegistry.Client` net472 and netstandard2.1 builds — 0
warnings, 0 errors
- independent shared-array safety review — no significant issues
- `git diff --check`

The final review regressions cover concurrent reconcile/open, synthetic
logical
handle collisions across default switches, cross-session Close
isolation,
shared writer reservations, logical FileType property/change
propagation,
logical Labels delegation, role-fixed deletion, event sources,
model-version
gating, and stable `HasWoTProjection` targets.

The companion specification and protocol binding are reviewed in the
linked PRs above.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5c79a1ed-6dab-4522-a9fc-6548caa78ad5
Copilot-Session: b605797f-a97a-4cd0-8f12-016d33c2fd88
Copilot-Session: 7ef369a5-2307-4f71-8a11-15af0e72f240
Copilot-Session: e716d455-8397-4d22-9c5a-398847ab7317
2026-09-08 04:46:40 +00:00
651beaee1e Fully support AliasNames in ConsoleReferenceServer (#4012) (#4321)
# Description

The CTT AliasName conformance units skip or fail against the
ConsoleReferenceServer. `AliasName Base` skips with *"No instance of
AliasNameType has been found in the address space"*; `Category Tags`,
`Category Topics` and `Hierarchy` fail. Part 17 support landed in #3779,
but aliases live only inside the `IAliasNameStore` — nothing is
browsable, no `AliasNameCategoryType` is nested under another, and the
Topics aliases point at the Server object rather than at a
`PublishedDataSetType` instance.

Part 17 §6.2 clients — the CTT among them — discover aliases by
browsing, not only by calling `FindAlias`. This PR materializes the
store contents as real nodes and fills the three gaps.

### SDK — `Opc.Ua.Server`

* **`DiagnosticsNodeManager.MaterializeRegisteredAliasNameNodesAsync`**
(new, opt-in) walks every registered `IAliasNameStore` and creates one
`AliasNameType` instance per alias — BrowseName carrying the alias name,
`AliasFor` references to its targets, and the inverse `HasAlias`
reference on each local target (via `externalReferences`, since targets
usually live in another node manager) — plus an `AliasNameCategoryType`
instance for every store category the standard NodeSet does not already
ship. Categories whose NodeId belongs to another node manager are
skipped, so an `AliasNameNodeManager` that also registers its store with
the server-wide registry does not get its NodeIds claimed twice.

Opt-in: servers that only need the well-known `FindAlias` to answer from
their store pay nothing. The nodes are a snapshot taken at address-space
creation — later mutations change what `FindAlias` returns but do not
add or remove nodes.

* **Optional Part 17 methods on the well-known categories.** The same
pass instantiates whatever a category declares through
`AliasNameCapabilities`: `FindAliasVerbose` (§6.3.3),
`AddAliasesToCategory` (§6.3.4), `DeleteAliasesFromCategory` (§6.3.5)
and `LastChange` (§6.3.1). Mutations require a `SecurityAdmin` caller on
a `SignAndEncrypt` channel; the gate previously private to
`AliasNameNodeManager` moved to `AliasNameMethodDispatcher` so both
paths share one implementation.

* **`LastChange`** is now tracked per category rather than only for the
standard `Aliases` node, and the duplicated seeding logic collapsed into
one helper.

### Reference server

* A nested **`Devices`** category under `TagVariables` holds
`Pump1_Status` and `Heater_Power`. `FindAlias` on `TagVariables` still
returns all six names through subtree recursion, while `FindAlias` on
`Devices` returns exactly two — which is what the Hierarchy unit checks.
* `ReferenceServerConfigurationNodeManager` creates three
**`PublishedDataSet` instances** under `PublishedDataSets` (`i=17371`)
and the Topics aliases now target them, satisfying the *"is a Dataset"*
check. These are address-space instances only — no PubSub runtime is
added, and the CTT only inspects the target's type definition.

## Note for reviewers — the reserved NodeIds

The optional children are created at the NodeIds the OPC Foundation
reserves for them (`Aliases.FindAliasVerbose` = `i=24054`,
`TagVariables.LastChange` = `i=32854`, …). Those identifiers are
allocated in `StandardTypes.csv` but are **not** declared in the
ModelDesign and **not** present in the published NodeSet, because the
standard address space does not instantiate optional children. The
source generator therefore emits no parent-to-instance mapping and no
`MethodIds` constants for them, so
`DiagnosticsNodeManager.ReservedChildIds` supplies the nine method ids
and the two missing `LastChange` ids explicitly, each traceable to its
registry row. The 18 argument-property ids do have generated
`VariableIds` constants and are referenced through those.

I deliberately did **not** "fix" this by declaring the children in
`tools/Opc.Ua.SourceGeneration.Core/Design/StandardTypes.xml`: that file
is a verbatim copy of upstream
`UA-ModelCompiler/Design.v105/StandardTypes.xml` (the only differences
today are upstream being newer), so a local edit is lost on the next
sync and the NodeIds would silently revert to factory-minted ones.
`docs/AliasNames.md` records this.

Worth raising upstream separately: `StandardTypes.csv` allocates
`Aliases_FindAliasVerbose` and siblings while the ModelDesign never
declares those children, so the ModelCompiler cannot emit ids it has
itself reserved. If that is ever reconciled, `ReservedChildIds` becomes
redundant and deletes cleanly.

## Related Issues

- Fixes #4012

## Checklist

- [x] 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.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed. — **not
done: verified on net8.0 only** (Server 4710, InformationModel 1099,
Core 4443, plus the client and features alias suites; AOT build clean).
Needs a run against net framework and net10 before this leaves draft.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.

### Tests

`tests/Opc.Ua.InformationModel.Tests/Aliasname*Tests.cs` mirror the four
CTT conformance units and no longer `Assert.Ignore` where the CTT
reported failures — the alias suite is 37 tests with no skips. New
`AliasnameOptionalMethodsTests` covers the optional methods, their
reserved NodeIds, the anonymous-caller denial, an add/find/delete round
trip and `LastChange` advancing on mutation.

One pre-existing test changed premise:
`EnumerateSubCategoriesAsyncOnLeafReturnsEmptyAsync` asserted that
`TagVariables` has no sub-categories, which this PR deliberately makes
false. It now targets `Topics` (still a leaf) and a new test guards the
nesting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
2026-08-29 18:05:42 +00:00
a568a7e54c Set ContinuationPoint (when browse is finished) to null instead of empty array, align with existing 1.5.xxx behavior (#4057)
This pull request standardizes the handling of the `ContinuationPoint`
property in `BrowseResult` objects, ensuring it is always explicitly set
to `null` (or its equivalent) when no continuation point is present.
This change improves clarity and consistency in both the implementation
and the tests, replacing checks for an "empty" continuation point with
checks for a "null" continuation point.

**Codebase consistency and correctness:**

* All `BrowseResult` objects now explicitly set `ContinuationPoint =
default` when no continuation point is to be returned, ensuring
consistent initialization.
(`src/Opc.Ua.Server/NodeManager/MasterNodeManager.cs`)
[[1]](diffhunk://#diff-851e5925c677925c42bd70bce11ea1a75a5f5cbdb810ac851351385e16f54a71L1900-R1904)
[[2]](diffhunk://#diff-851e5925c677925c42bd70bce11ea1a75a5f5cbdb810ac851351385e16f54a71L2068-R2076)
[[3]](diffhunk://#diff-851e5925c677925c42bd70bce11ea1a75a5f5cbdb810ac851351385e16f54a71L2078-R2090)

**Test updates for new semantics:**

* All test assertions now use `ContinuationPoint.IsNull` instead of
`IsEmpty` to check for the absence of a continuation point, reflecting
the new contract.
(`tests/Opc.Ua.InformationModel.Tests/BrowseContinuationPointTests.cs`,
`tests/Opc.Ua.Server.Tests/NodeManager/MasterNodeManagerDeterministicTests.cs`)
[[1]](diffhunk://#diff-904275d6b4bee35e6884f38e0db5cbc955216eaf2aa7f468ba285133470e1596L121-R122)
[[2]](diffhunk://#diff-904275d6b4bee35e6884f38e0db5cbc955216eaf2aa7f468ba285133470e1596L394-R394)
[[3]](diffhunk://#diff-904275d6b4bee35e6884f38e0db5cbc955216eaf2aa7f468ba285133470e1596L435-R435)
[[4]](diffhunk://#diff-904275d6b4bee35e6884f38e0db5cbc955216eaf2aa7f468ba285133470e1596L634-R634)
[[5]](diffhunk://#diff-bda1da5dc01533ffe61d1c65b6e968b6462e11a63758ac95ded000ffc885345eL420-R420)

* Additional test cases have been added to verify that completed browse
operations and error scenarios always return a null continuation point.
(`tests/Opc.Ua.Server.Tests/NodeManager/MasterNodeManagerDeterministicTests.cs`)
[[1]](diffhunk://#diff-3d9efc81935ec60d7513334833e9eab033925194f5a0d11105668204cc60f54aR203-R230)
[[2]](diffhunk://#diff-3d9efc81935ec60d7513334833e9eab033925194f5a0d11105668204cc60f54aR327)
[[3]](diffhunk://#diff-3d9efc81935ec60d7513334833e9eab033925194f5a0d11105668204cc60f54aR349)#
Description

_Describe the changes here to communicate to the maintainers why they
should accept this pull request. By default - this will become the
Commit message after merging and thus define history._

## Related Issues

_Reference all GitHub issues this PR addresses. If there is no issue
yet, open one and link it here._

_If this is a relatively large or complex change, a design must have
been discussed in the related tracking issue and signed off (which
becomes the Architectural Decision Record (ADR))._

- Fixes #github-issue-number, ...

## Checklist

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

- [x] 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.
- [ ] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] 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: Marc Schier <marcschier@users.noreply.github.com>
Co-authored-by: Marc Schier <marcschier@hotmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-21 20:54:19 +02:00
84fa8e8906 CTT follow-up: monitored items, alarms, codecs, history, and model validation (#4002)
# Description

Follow-up to #3978 based on the latest OPC UA CTT aggregate, matrix,
Historical Access, Attribute, and Node Management runs.

## Aggregate run 16

- Ignore synthetic `BadBoundNotFound` raw-bound markers when feeding
aggregate calculators.
- Add direct and live historian regression coverage.

## Multi-dimensional Variant matrices

- Fix `Variant.Copy()` so rank-2 Variant matrices preserve their payload
and dimensions.
- Enforce valid Variant matrix dimensions consistently across Binary,
JSON, XML stream, and XML parser codecs.
- Encoders return `BadEncodingError`; decoders return `BadDecodingError`
for malformed matrix dimensions.
- Add cross-codec valid/null/empty/malformed tests and a batched
ReferenceServer Read regression.
- Correct the previous CTT issue attribution: the invalid
`Scalar_Static_Arrays2D_Variant` server encoding poisoned the batched
CTT Read.

## Node Management AddNodes

- Return `BadNodeIdRejected` for unsupported requested-NodeId
namespaces.
- Validate hierarchical ReferenceType source/target NodeClass
constraints.
- Document run-18 confirmation that all remaining 15 AddNodes errors are
CTT project/script configuration issues.

## Historical Access and Attribute Services run 18

- Reject whitespace in `NumericRange` syntax with
`BadIndexRangeInvalid`.
- Add HistoryRead tests for operation-level invalid syntax and
per-DataValue `BadIndexRangeNoData`.
- Document CTT defects:
- `012.js` expects `BadIndexRangeNoData` at the operation level instead
of on returned DataValues;
  - `Err-012.js` uses a non-historizing node for an access-denied test;
- generic Attribute array helpers omit NodeId[] and StatusCode[]
conversion paths.

## Base Information model validation run 19

- Run the CTT main session as `sysadmin` over Basic256Sha256
SignAndEncrypt so SecurityAdmin RolePermissions and EncryptionRequired
restrictions are both satisfied without weakening the server model.
- Preserve predefined well-known NodeIds while making generated dynamic
type and optional-child factories allocate compatible per-instance
NodeIds, remap internal references, and update references from the
owning subtree.
- Materialize dynamic RoleType properties through generated helpers and
keep role-child string NodeIds disjoint from numeric RoleManager root
IDs.
- Add net48/net10 regressions for generator output, NodeId
allocation/reference remapping, DI mandatory children, dynamic roles,
and low-privilege versus SecurityAdmin Browse visibility.
- Document CTT defects for permission-unaware mandatory-child
validation, the UA 1.04 reference model used against a UA 1.05 server,
stale ServerDiagnostics cache, and the `ConformanceUnits` scalar/array
mismatch.
## Related Issues

- Follow-up to #3960 and #3978.

## Checklist

- [x] I have signed the CLA and read the CONTRIBUTING document.
- [x] Tests prove the fixes and improve coverage.
- [x] Required CTT documentation is updated.
- [x] Focused builds/tests introduce no warnings.
- [x] Affected tests pass on .NET Framework and .NET 10.
- [ ] CI and CodeQL are green.
- [ ] All PR feedback is addressed.



## Latest CTT full run and A&C run 20

- Fix Monitor Value Change V2 `036.js`: an ambiguous
`DataValue(StatusCode)` call encoded `BadIndexRangeNoData` as a Good
value.
- Prove all 19 configured matrix monitored items notify when the
selected value actually changes; document the independent `042.js`
script defects.
- Rebase dynamic `CertificateExpired` / `TrustListOutOfDate` alarm roots
and descendants, restore standard type declarations and ModellingRules,
and expose the cross-node-manager references.
- Deliver method-triggered events to every authorized Session, fixing
the two-Session Confirm scenario.
- Preserve locale-only `LocalizedText` values consistently across
Binary, JSON, and XML and align Acknowledge/Confirm comment behavior and
tests.
- Document the remaining proven CTT defects for TransactionDiagnostics,
SemanticChange, History `013`, PolicyId scope, A&C, durable
subscriptions, and Subscription Minimum events.

## Base synchronization

Merged `master` through `007cfaf90` (`#4010`, repository layout
consolidation) and retained the matrix regression tests at their new
`tests/` locations.

## Latest validation

- Focused merged-tree tests pass on net10 and net48.
- `Opc.Ua.Server` and `Quickstarts.Servers` Release builds complete with
0 warnings and 0 errors on net10 and net48.
- The existing
`DisableEnableViaTypeAndInstanceMethodNoEventsDuringDisabledAsync`
timing test took its documented inconclusive timeout path after the
layout merge; no test failure was reported.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <romanett98@gmail.com>
2026-07-18 05:01:03 +02:00
Marc Schier 8538f531e7 Update paths for the consolidated repository layout 2026-07-16 06:26:05 +02:00
Marc Schier 7cec2d614d Move repository files to the consolidated layout 2026-07-16 06:25:54 +02:00