feat(notifications): SMTP delivery policy settable via management/CLI/UI (#149)

SmtpConfiguration.MaxRetries/RetryDelay (and ConnectionTimeoutSeconds/
MaxConcurrentConnections) drive the outbox Email policy but had no write
path, so every row sat at 0/0 and was clamped with a Warning; DEV vd03 had
to be fixed by direct SQL.

- Update/CreateSmtpConfigCommand: four trailing additive nullable fields
  (null = preserve on update / entity default on create; 0 = fallback).
- ManagementActor: preserve-if-null, negatives refused.
- CLI notification smtp create|update: --max-retries, --retry-delay-seconds,
  --connection-timeout-seconds, --max-concurrent-connections (>= 0).
- Central UI /notifications/smtp: fields on the form + read-only panel;
  new rows pre-fill 10 retries / 60 s.
- README + Component-NotificationService; tests for apply/preserve/reject.
This commit is contained in:
Joseph Doherty
2026-11-25 10:54:20 -05:00
parent a87c05754a
commit a4523e090e
9 changed files with 268 additions and 21 deletions
@@ -2753,6 +2753,17 @@ public class ManagementActor : ReceiveActor
// Preserve-if-null for the transport too: an omitted value keeps the stored
// one (null on every pre-EWS row, which means SMTP).
if (cmd.Transport is not null) config.Transport = cmd.Transport;
// Delivery policy (#149): preserve-if-null, 0 = the outbox/options fallback.
// Negative values are refused here rather than silently clamped downstream.
if (cmd.ConnectionTimeoutSeconds is { } timeout) config.ConnectionTimeoutSeconds = RequireNonNegative(timeout, "ConnectionTimeoutSeconds");
if (cmd.MaxConcurrentConnections is { } concurrency) config.MaxConcurrentConnections = RequireNonNegative(concurrency, "MaxConcurrentConnections");
if (cmd.MaxRetries is { } retries) config.MaxRetries = RequireNonNegative(retries, "MaxRetries");
if (cmd.RetryDelay is { } retryDelay)
{
if (retryDelay < TimeSpan.Zero)
throw new ManagementCommandException("RetryDelay must not be negative.");
config.RetryDelay = retryDelay;
}
ValidateSmtpConfigTransportShape(config);
if (cmd is CreateSmtpConfigCommand) await repo.AddSmtpConfigurationAsync(config);
else await repo.UpdateSmtpConfigurationAsync(config);
@@ -2765,6 +2776,9 @@ public class ManagementActor : ReceiveActor
return publicShape;
}
private static int RequireNonNegative(int value, string field) =>
value >= 0 ? value : throw new ManagementCommandException($"{field} must not be negative.");
/// <summary>
/// Write-path gate for the email transport: validates the EFFECTIVE
/// post-assignment state of an SmtpConfiguration so an operator cannot persist a