Skip to content

Server: push configuration as composed components - #5235

Merged
marcschier merged 4 commits into
masterfrom
romanett/ss5-pushconfig-compose-427b49
Dec 2, 2026
Merged

marcschier merged 4 commits into
masterfrom
romanett/ss5-pushconfig-compose-427b49

Conversation

@romanett

@romanett romanett commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Finishes SS-5 Phase B from the 2026-11-15 server architecture review: push configuration becomes a set of composed components instead of code inside ConfigurationNodeManager.

Based on master; #5230 (shared FileType handle table and composed certificate push) is merged.

The split of ConfigurationNodeManager from DiagnosticsNodeManager is now in its own stacked PR, #5238, on top of this one.

Changes

  • ServerPushConfiguration (internal) owns the push state and implements the explicit IServerPushContext. That state covers certificate groups and stores, transaction coordination, pending regenerated keys and the key generator.
  • Components:
    • ServerCertificatePush (now top-level): certificate methods and slot bookkeeping.
    • PushConfigurationApplyChanges: ApplyChanges, CancelChanges, ResetToServerDefaults and the deferred post-ApplyChanges effects.
    • PushConfigurationTrustMaterial: the §7.10.9 TrustList effects and the trust-material enforcement pump.
    • ManagedApplicationPush: the managed application's effects.
    • KeyCredentialPushBinder.
  • Admin checks touched here go through IServerAuthorizationPolicy.
  • ApplicationConfigurationPushBinding composes only the push engine instead of a whole ConfigurationNodeManager for each managed application.
  • Tests use internal accessors instead of reflecting on private members.

Verification (net10, local)

  • After the rebase onto master: the Server tests filtered to Configuration|TrustList|Push|Certificate|AliasNames|FileType passed (1368), and the GDS tests filtered to Push|TrustList passed (803).
  • Before the rebase:
    • Opc.Ua.Server.Tests, full suite: 12571 passed, 7 skipped, 8 failed. The 8 are the known local symlink-permission tests (FileLinks*, LinkedDirectory*, Recursive*, *RootAncestor*), which need elevated rights on Windows.
    • Opc.Ua.Gds.Tests (Push|TrustList|ProvisionableDeviceResources): 807 passed.
    • The net48 build of Opc.Ua.Server has 0 errors and 0 warnings.

🤖 Generated with Claude Code

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.

🟡 Changes recommended

Critical routing and lookup regressions make core nodes unresolvable, misdirect reference cleanup to diagnostics, and hide existing configuration nodes from server-wide lookups.

2 open issues
What changed in this PR

Completes SS-5 Phase B on top of #5230 by extracting push configuration into composed components and separating configuration from diagnostics node ownership.

Changes:

  • Introduces a shared push engine with certificate, transaction, trust-material, and managed-application components.
  • Separates configuration and diagnostics managers, updating factories, routing, lifecycle integration, and the reference server.
  • Updates tests and documentation for the new ownership boundaries and internal accessors.
File Description
tests/​Opc.Ua.Server.Tests/​NodeManager/​MasterNodeManagerDeterministicTests.cs Expects three distinct system managers.
tests/​Opc.Ua.Server.Tests/​ConfigurationNodeManagerTests.cs Uses extracted certificate validation helpers.
tests/​Opc.Ua.Server.Tests/​ConfigurationNodeManagerPushTests.cs Replaces private reflection with component accessors.
tests/​Opc.Ua.Server.Tests/​Configuration/​PushCertificateRequestRegressionTests.cs Accesses pending keys and coordinator through the engine.
tests/​Opc.Ua.Server.Tests/​Configuration/​ConfigurationNodeManagerTrustListEffectsTests.cs Tests extracted trust-material operations.
tests/​Opc.Ua.Server.Tests/​Configuration/​ConfigurationNodeManagerShutdownTests.cs Uses component accessors for shutdown tests.
tests/​Opc.Ua.Server.Tests/​Configuration/​ConfigurationNodeManagerPushValidationTests.cs Targets extracted certificate validation helpers.
tests/​Opc.Ua.Server.Tests/​Configuration/​CertificateAlarmMonitoringTests.cs Resolves type declarations through diagnostics.
tests/​Opc.Ua.Server.Tests/​AliasNames/​StandardAliasMaterializationOptionsTests.cs Verifies diagnostics-owned alias materialization.
tests/​Opc.Ua.InformationModel.Tests/​AliasnameCategoryTopicsTests.cs Updates the sample-manager name in a comment.
tests/​Opc.Ua.Gds.Tests/​Onboarding/​ProvisionableDeviceResourcesIntegrationTests.cs Expects the diagnostics fallback owner.
src/​Opc.Ua.Server/​Server/​ServerInternalData.cs Initializes configuration through its separate manager.
src/​Opc.Ua.Server/​NodeManager/​MasterNodeManager.cs Adds a separate diagnostics system slot.
src/​Opc.Ua.Server/​NodeManager/​MainNodeManagerFactory.cs Creates configuration and diagnostics separately.
src/​Opc.Ua.Server/​NodeManager/​IMainNodeManagerFactory.cs Adds the diagnostics factory contract.
src/​Opc.Ua.Server/​NodeManager/​AsyncCustomNodeManager.cs Supports foreign declarations and configuration infrastructure.
src/​Opc.Ua.Server/​Diagnostics/​DiagnosticsNodeManager.cs Transfers configuration roots and takes alias materialization.
src/​Opc.Ua.Server/​Configuration/​ServerPushConfiguration.cs Introduces the composed push engine.
src/​Opc.Ua.Server/​Configuration/​ServerCertificatePush.Validation.cs Moves validation into the certificate component.
src/​Opc.Ua.Server/​Configuration/​PushConfigurationTrustMaterial.cs Extracts trust effects and notification handling.
src/​Opc.Ua.Server/​Configuration/​PushConfigurationApplyChanges.cs Extracts transaction completion and deferred effects.
src/​Opc.Ua.Server/​Configuration/​ManagedApplicationPush.cs Extracts managed-application attachments and effects.
src/​Opc.Ua.Server/​Configuration/​KeyCredentialPushBinder.cs Extracts KeyCredential push binding.
src/​Opc.Ua.Server/​Configuration/​IServerPushContext.cs Defines shared push state and services.
src/​Opc.Ua.Server/​Configuration/​ConfigurationNodeManager.PushMethods.cs Removes the superseded binding partial.
src/​Opc.Ua.Server/​Configuration/​ConfigurationNodeManager.NamespaceMetadata.cs Resolves namespace metadata through diagnostics.
src/​Opc.Ua.Server/​Configuration/​ConfigurationNodeManager.cs Hosts configuration subtrees and delegates push operations.
src/​Opc.Ua.Server/​Configuration/​ConfigurationNodeManager.CertificateAlarms.cs Uses engine-owned alarm state.
src/​Opc.Ua.Server/​Configuration/​ApplicationConfigurationPushBinding.cs Composes an engine instead of a configuration manager.
src/​Opc.Ua.Redundancy.Server/​State/​AddressSpaceRegistration.cs Excludes configuration infrastructure from replication.
src/​Opc.Ua.Gds.Server/​Onboarding/​ProvisionableDeviceNodeManagerFactory.Handoff.cs Uses the extracted trust-handoff type.
samples/​Quickstarts.Servers/​ReferenceServer/​ReferenceServerMainNodeManagerFactory.cs Creates separate sample diagnostics and SDK configuration managers.
samples/​Quickstarts.Servers/​ReferenceServer/​ReferenceServerDiagnosticsNodeManager.cs Moves sample customizations onto diagnostics.
samples/​Quickstarts.Servers/​ReferenceServer/​ReferenceServer.cs Initializes aliases through the diagnostics manager.
docs/​NodeManagers.md Documents separate managers and composed push components.
docs/​DependencyInjection.md Updates alias ownership and adds the license header.
docs/​AliasNames.md Updates manager references and adds the license header.

Review effort: Balanced

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.

🟡 Changes recommended

Configuration inherits a factory mode that can cause numeric ID collisions with diagnostics or leave infrastructure nodes without IDs; explicitly selecting String mode is needed.

1 open issue
2 resolved since last review

Review effort: Balanced

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.

🔵 Needs a closer look

The fallback still creates a default diagnostics manager when a custom ConfigurationNodeManager already implements IDiagnosticsNodeManager, bypassing its custom diagnostics implementation.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve diagnostics manager implementations on subclasses

src/​Opc.Ua.Server/​NodeManager/​MasterNodeManager.cs:233

A custom ConfigurationNodeManager subclass can also implement IDiagnosticsNodeManager, in which case returning null from CreateDiagnosticsNodeManager() is documented to retain that combined manager. This condition still creates a default diagnostics manager for that subclass, so the diagnostics slot bypasses its custom implementation. Restrict the fallback to configuration managers that do not already implement IDiagnosticsNodeManager.

1 resolved since last review

Review effort: Balanced

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.

🔵 Needs a closer look

Human assessment is needed to evaluate the caller-managed locking dependencies created by sharing a synchronization root between apply/rotation and trust-material components.

No open issues 🎉

Review effort: Balanced

@romanett
romanett marked this pull request as draft December 2, 2026 05:09
@romanett romanett changed the title Server: push configuration as composed components; split ConfigurationNodeManager from DiagnosticsNodeManager (SS-5) Server: push configuration as composed components; split ConfigurationNodeManager from DiagnosticsNodeManager Dec 2, 2026
@romanett
romanett force-pushed the romanett/ss5-pushconfig-compose-427b49 branch from db34dc0 to 875f891 Compare December 2, 2026 10:12
@romanett romanett changed the title Server: push configuration as composed components; split ConfigurationNodeManager from DiagnosticsNodeManager Server: push configuration as composed components (SS-5 phase B) Dec 2, 2026
@romanett romanett changed the title Server: push configuration as composed components (SS-5 phase B) Server: push configuration as composed components Dec 2, 2026
…-5 phase B)

Push configuration is no longer implemented by ConfigurationNodeManager. A new
internal ServerPushConfiguration engine owns the push state (certificate groups
and stores, coordinator, pending key store, key generator, ApplyChanges lock,
shutdown lifetime) and composes the push components, which reach that state
through the explicit internal IServerPushContext:

- ServerCertificatePush (now top-level; validation helpers moved into it)
- PushConfigurationApplyChanges (ApplyChanges, CancelChanges,
  ResetToServerDefaults, deferred effects, rotation collector)
- PushConfigurationTrustMaterial (7.10.9 TrustList effects, enforcement pump)
- ManagedApplicationPush (managed ApplicationConfiguration attachments)
- KeyCredentialPushBinder (KeyCredentialConfiguration folder binding)

ConfigurationNodeManager still derives from DiagnosticsNodeManager because it
is the server's diagnostics node manager; it now only hosts the nodes and
delegates. The public API and protected virtuals are unchanged.

ApplicationConfigurationPushBinding composes only the push engine instead of a
whole ConfigurationNodeManager per managed application. Without a hosting node
manager, a namespace-less PushPermissionOwner scopes the SecurityAdmin grants.

Tests use internal engine accessors instead of reflecting on CNM fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@romanett
romanett force-pushed the romanett/ss5-pushconfig-compose-427b49 branch from 875f891 to 907baa7 Compare December 2, 2026 13:09
@romanett
romanett changed the base branch from romanett/ss5-filetype-pushconfig-6ee866 to master December 2, 2026 13:09
…ationApplyChanges

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Code coverage

✅ Coverage gate passed.

Check Result Threshold
✅ Project line rate 89.53% (516267/576616 lines) >= 70.00%
✅ Project branch rate 80.18% >= 60.00%
✅ Patch coverage 91.02% (1479/1625 changed lines) >= 75.00% (> 100 changed lines)
ℹ️ Baseline delta (advisory) +15.93 pp 73.60% recorded
Uncovered changed lines
  • src/Opc.Ua.Server/Configuration/PushConfigurationApplyChanges.cs: 227, 269, 424, 642, 713
  • src/Opc.Ua.Server/Configuration/ServerPushConfiguration.cs: 170, 224, 226, 227, 488, 549, 749, 751, 752, 755, 859, 890, 892, 893, 915, 918
  • src/Opc.Ua.Server/Configuration/ManagedApplicationPush.cs: 341, 343, 344, 413
  • src/Opc.Ua.Server/Configuration/ApplicationConfigurationPushBinding.cs: 149, 150, 448, 450, 451
  • src/Opc.Ua.Server/Configuration/PushConfigurationTrustMaterial.cs: 255, 295, 337
  • src/Opc.Ua.Server/Configuration/ConfigurationNodeManager.cs: 537
  • src/Opc.Ua.Gds.Server/Onboarding/ProvisionableDeviceNodeManagerFactory.Handoff.cs: 99
  • src/Opc.Ua.Server/Configuration/ServerCertificatePush.Slots.cs: 104, 105, 106, 107, 108, 109, 110, 112, 114, 115, 119, 121, 122, 257, 258, 297, 299, 300, 301, 441, 443, 444, 445, 446, 496, 498, 499, 500, 501, 567, 629
  • src/Opc.Ua.Server/Configuration/ServerCertificatePush.cs: 165, 194, 195, 196, 230, 231, 232, 245, 246, 247, 282, 284, 286, 287, 288, 289, 297, 299, 300, 303, 306, 307, 311, 312, 315, 316, 319, 323, 325, 326, 327, 328, 336, 339, 417, 420, 421, 422, 423, 424, 425, 465, 466, 467, 655, 657, 658, 670, 671, 752, 753, 763, 764, 765, 766, 844, 845, 846, 847, 848, 849, 951, 953, 954, 1081, 1083, 1085, 1086, 1087, 1089, 1285, 1286, 1287, 1288, 1354, 1355, 1366, 1388, 1398, 1399

Coverage is above the recorded baseline - consider ratcheting coverage-thresholds.json.

Thresholds live in coverage-thresholds.json. Whole report before exclusions: line 89.08%, branch 79.69%.

@romanett
romanett marked this pull request as ready for review December 2, 2026 14:18
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.88982% with 144 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.89%. Comparing base (6410207) to head (ef2acf4).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...Ua.Server/Configuration/ServerPushConfiguration.cs 85.68% 16 Missing and 47 partials ⚠️
...erver/Configuration/ServerCertificatePush.Slots.cs 78.14% 31 Missing and 9 partials ⚠️
....Ua.Server/Configuration/ManagedApplicationPush.cs 85.18% 4 Missing and 8 partials ⚠️
...ver/Configuration/PushConfigurationApplyChanges.cs 87.35% 5 Missing and 6 partials ⚠️
...er/Configuration/PushConfigurationTrustMaterial.cs 77.77% 3 Missing and 7 partials ⚠️
...nfiguration/ApplicationConfigurationPushBinding.cs 83.33% 5 Missing ⚠️
...g/ProvisionableDeviceNodeManagerFactory.Handoff.cs 75.00% 1 Missing ⚠️
...a.Server/Configuration/ConfigurationNodeManager.cs 97.82% 1 Missing ⚠️
...Ua.Server/Configuration/KeyCredentialPushBinder.cs 96.77% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5235      +/-   ##
==========================================
- Coverage   83.91%   83.89%   -0.02%     
==========================================
  Files        3886     3887       +1     
  Lines      576475   576616     +141     
  Branches    99430    99449      +19     
==========================================
+ Hits       483744   483747       +3     
- Misses      60024    60131     +107     
- Partials    32707    32738      +31     
Flag Coverage Δ
actions 83.89% <84.88%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...tion/ConfigurationNodeManager.CertificateAlarms.cs 94.54% <100.00%> (-5.46%) ⬇️
.../Configuration/ServerCertificatePush.Validation.cs 87.59% <ø> (ø)
...c.Ua.Server/Configuration/ServerCertificatePush.cs 83.58% <ø> (+0.06%) ⬆️
...g/ProvisionableDeviceNodeManagerFactory.Handoff.cs 75.70% <75.00%> (ø)
...a.Server/Configuration/ConfigurationNodeManager.cs 91.76% <97.82%> (+3.45%) ⬆️
...Ua.Server/Configuration/KeyCredentialPushBinder.cs 96.77% <96.77%> (ø)
...nfiguration/ApplicationConfigurationPushBinding.cs 82.35% <83.33%> (-0.47%) ⬇️
...er/Configuration/PushConfigurationTrustMaterial.cs 84.86% <77.77%> (ø)
...ver/Configuration/PushConfigurationApplyChanges.cs 88.91% <87.35%> (ø)
....Ua.Server/Configuration/ManagedApplicationPush.cs 85.09% <85.18%> (ø)
... and 2 more

... and 51 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…nd rejection

Adds direct tests for the binder extracted from ConfigurationNodeManager:
null arguments, replacing a passive KeyCredentialConfiguration object with
the typed folder, rejecting a non-object node, and the address-space
fallback when the host does not own the folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@marcschier
marcschier enabled auto-merge (squash) December 2, 2026 15:39
@marcschier marcschier added the ready Ready to merge once CI Passes label Dec 2, 2026
@marcschier
marcschier merged commit 4e8bc8f into master Dec 2, 2026
141 checks passed
marcschier pushed a commit that referenced this pull request Dec 3, 2026
…its delete (#5243)

## Problem


`NodeManagerLifecycleTests.RetiredDrainRestoresNotificationsForLateMonitoredItemAsync`
fails on master (6410207, 2efcebe) every time it runs alone, and it
failed in CI shard `test-linux-net11.0 (12/19)` on #5235.
`DeleteMonitoredItems` for the data item returns
`BadMonitoredItemIdInvalid` instead of Good while a Replace of its
NodeManager commits.

## Root cause

This is a product race, not a stale test expectation. Tracing showed
this order:

1. `Subscription.DeleteMonitoredItemsCoreAsync` removes the item and
unbinds it (`IsRemoved = true`).
2. `NodeManagerServiceDispatcher` groups the item by
`monitoredItem.NodeManager` (the retiring manager), and the owner reads
`ManagerHandle`. Neither read takes a lock.
3. The Replace commit (`MonitoredItemTransition.AdoptAsync` →
`ReleaseSourceAsync`) takes the retiring manager's monitored-item
semaphore first. It releases the source registration and clears the
binding (`NodeManager = null`).
4. The delete then gets the semaphore. `RemoveRegistration` finds no
registration and returns `BadMonitoredItemIdInvalid`.

The handoff itself stays consistent. `AdoptAsync` sees `IsRemoved` and
skips adoption, or releases a replacement registration it already made.
So nothing leaks; only the status code is wrong. Whether the delete or
the release gets the semaphore first depends on timing. That is why the
test fails alone but has passed in some fixture runs and with extra
tracing. It depends on timing, not on test order.

## Fix

`DeleteMonitoredItems` now dispatches to each owner through
`DeleteMonitoredItemsFromOwnerAsync`. After the owner returns, an item
it was offered counts as deleted (Good) when all of these hold:
- the owner left it unprocessed or reported `BadMonitoredItemIdInvalid`,
- the item is removed (`IMonitoredItemGenerationBinding.IsRemoved`),
- its `NodeManager` is no longer that owner (released or adopted during
the delete).

An item that still names its owner but is missing there keeps
`BadMonitoredItemIdInvalid`.

## Tests

- New deterministic `MasterNodeManagerDeterministicTests` cases:
- `DeleteMonitoredItemsAsyncSourceReleasedDuringDeleteReturnsGoodAsync`
(owner processed / unprocessed). Both fail without the fix.
-
`DeleteMonitoredItemsAsyncItemMissingAtUnchangedOwnerReturnsBadMonitoredItemIdInvalidAsync`
(negative case).
- `RetiredDrainRestoresNotificationsForLateMonitoredItemAsync` alone:
3/3 pass (was 3/3 fail).
- Full `NodeManagerLifecycleTests` fixture: 774/774 pass (net10.0).

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

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
marcschier pushed a commit that referenced this pull request Dec 3, 2026
## Summary

`RefreshLockStateAsyncDoesNotBlockOnAsyncNotifications` failed on
`test-linux-net11.0 (3/19)` in #5235 (`Expected True but was False` for
`refreshPending`, LockingServicesExtensionsTests.cs:273). That PR does
not touch Di; the flake is in the test.

The test read `refresh.IsCompleted` only after
`release.TrySetResult(true)`. `release` uses
`RunContinuationsAsynchronously`, so the held notification can finish on
the thread pool before that read, and the "pending while the
notification is held" flag comes out false.

- Sample `IsCompleted` while the notification is still held, before
releasing it.
- Apply the same fix to the sibling
`InitLockAsyncDoesNotBlockOnAsyncNotifications`, which had the same
read-after-release pattern.

Test-only change; no product code touched.

## Testing

- `Opc.Ua.Di.Tests` (net10.0): 612/612 passed.
- The two fixed tests: 20 repeated runs, all passed.

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

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

4 participants