Severity: Info (DRY / inconsistency — silently breaks if DefaultRecoveryAction is ever changed)
File / line: src/Servy.Core/Mappers/ServiceMapper.cs line 133
Code:
// Validate Enum ranges
RecoveryAction = ConfigParser.ParseEnum(dto.RecoveryAction, RecoveryAction.RestartService),
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// hardcoded literal
What's wrong: This is the only field-default in ServiceMapper.ToDomain that does not route through AppConfig. Every neighboring line uses an AppConfig.Default* constant — e.g. AppConfig.DefaultStartupType, AppConfig.DefaultPriority, AppConfig.DefaultDateRotationType, AppConfig.DefaultEnableRotation, AppConfig.DefaultMaxRestartAttempts — and AppConfig.cs already defines:
public const RecoveryAction DefaultRecoveryAction = RecoveryAction.RestartService; // AppConfig.cs:308
Today the literal happens to equal the constant, so behavior is identical. But if a future maintainer flips the policy default to RecoveryAction.None (or anything else) in AppConfig.DefaultRecoveryAction, this one mapper line will silently keep falling back to RestartService — and the discrepancy will only surface as "newly-imported services from corrupt rows still get RestartService despite the new default."
This is the same class of bug as #845 (DefaultRotationSize is duplicated between AppConfig and Logger (DRY)), just in the mapper.
Suggested fix:
RecoveryAction = ConfigParser.ParseEnum(dto.RecoveryAction, AppConfig.DefaultRecoveryAction),
Same one-line change pattern as the surrounding AppConfig.Default* references.
Severity: Info (DRY / inconsistency — silently breaks if
DefaultRecoveryActionis ever changed)File / line:
src/Servy.Core/Mappers/ServiceMapper.csline 133Code:
What's wrong: This is the only field-default in
ServiceMapper.ToDomainthat does not route throughAppConfig. Every neighboring line uses anAppConfig.Default*constant — e.g.AppConfig.DefaultStartupType,AppConfig.DefaultPriority,AppConfig.DefaultDateRotationType,AppConfig.DefaultEnableRotation,AppConfig.DefaultMaxRestartAttempts— andAppConfig.csalready defines:Today the literal happens to equal the constant, so behavior is identical. But if a future maintainer flips the policy default to
RecoveryAction.None(or anything else) inAppConfig.DefaultRecoveryAction, this one mapper line will silently keep falling back toRestartService— and the discrepancy will only surface as "newly-imported services from corrupt rows still get RestartService despite the new default."This is the same class of bug as #845 (
DefaultRotationSize is duplicated between AppConfig and Logger (DRY)), just in the mapper.Suggested fix:
Same one-line change pattern as the surrounding
AppConfig.Default*references.