Skip to content

Migrations: Add auto upgrade coordination for load-balanced setups - #22815

Merged
nikolajlauridsen merged 9 commits into
v17/devfrom
v17/feature/auto-migration-coordination-for-load-balanced-setups
May 18, 2026
Merged

Migrations: Add auto upgrade coordination for load-balanced setups#22815
nikolajlauridsen merged 9 commits into
v17/devfrom
v17/feature/auto-migration-coordination-for-load-balanced-setups

Update src/Umbraco.Infrastructure/Install/MigrationCoordinator.cs

cce0e2a
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Code Health Review (v17/dev) failed May 13, 2026 in 54s

CodeScene PR Check

Quality Gate Failed

Gates Failed
Enforce advisory code health rules (4 files with Large Method, Complex Method, Constructor Over-Injection, Code Duplication)

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Reason for failure
Enforce advisory code health rules Violations Code Health Impact
MigrationCoordinator.cs 2 advisory rules 9.39 Suppress
MigrationCoordinatorTests.cs 1 advisory rule 9.39 Suppress
UnattendedUpgradeBackgroundService.cs 1 advisory rule 9.54 → 9.24 Suppress
UmbracoBuilder.CoreServices.cs 1 advisory rule 8.74 → 8.73 Suppress

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Details

🚩 Declining Code Health (highest to lowest):

  • Large Method UmbracoBuilder.CoreServices.cs: AddCoreInitialServices
  • Code Duplication MigrationCoordinatorTests.cs
  • Complex Method MigrationCoordinator.cs: TryBecomeLeaderAsync
  • Constructor Over-Injection MigrationCoordinator.cs: MigrationCoordinator
  • Constructor Over-Injection UnattendedUpgradeBackgroundService.cs: UnattendedUpgradeBackgroundService

Annotations

Check warning on line 97 in src/Umbraco.Infrastructure/DependencyInjection/UmbracoBuilder.CoreServices.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v17/dev)

❌ Getting worse: Large Method

AddCoreInitialServices increases from 126 to 127 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.

Check warning on line 92 in src/Umbraco.Infrastructure/Install/MigrationCoordinator.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v17/dev)

❌ New issue: Complex Method

TryBecomeLeaderAsync has a cyclomatic complexity of 9, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 40 in src/Umbraco.Infrastructure/Install/MigrationCoordinator.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v17/dev)

❌ New issue: Constructor Over-Injection

MigrationCoordinator has 6 arguments, max arguments = 5. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.

Check warning on line 51 in src/Umbraco.Infrastructure/Install/UnattendedUpgradeBackgroundService.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v17/dev)

❌ New issue: Constructor Over-Injection

UnattendedUpgradeBackgroundService has 6 arguments, max arguments = 5. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.

Check warning on line 55 in tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Install/MigrationCoordinatorTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v17/dev)

❌ New issue: Code Duplication

The module contains 5 functions with similar structure: TryBecomeLeaderAsync_WhenClaimBelongsToSameMachine_ReclaimsAndReturnsTrue,TryBecomeLeaderAsync_WhenClaimIsStale_ClaimsLeadershipAndReturnsTrue,TryBecomeLeaderAsync_WhenClaimKeyIsEmpty_ClaimsLeadershipAndReturnsTrue,TryBecomeLeaderAsync_WhenOtherMachineHoldsClaim_PollsUntilBootFailedAndReturnsFalse and 1 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.