973e59de84
VERIFY-THEN-FIX: the plan-authoring discovery is CONFIRMED. No code anywhere in src/ registered IOperationTrackingStore in DI, yet AkkaHostedService and AuditLog SCE both comment that AddSiteRuntime provides it. Every consumer resolved it via GetService (null-tolerant) and silently ran degraded: cached-drain scheduler never armed, PullSiteCalls reconciliation seam never wired, Tracking.Status degraded to audit-only. This is a FUNCTIONAL FIX riding the hygiene plan: AddSiteRuntime now registers the store (site-only), so site-local cached-call tracking runs in its intended mode. OperationTrackingOptions is now bound + eagerly validated in the Host site-options block.
27 lines
1.2 KiB
C#
27 lines
1.2 KiB
C#
using ZB.MOM.WW.Configuration;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Tracking;
|
|
|
|
/// <summary>
|
|
/// Validates <see cref="OperationTrackingOptions"/> at host startup (arch-review
|
|
/// 08 round 2 NF4). <see cref="OperationTrackingStore"/> opens the SQLite
|
|
/// connection string in its constructor, so an empty/blank connection string
|
|
/// must fail the host at boot rather than throw opaquely on first resolve. The
|
|
/// retention window must be positive — a zero would make the host's terminal-row
|
|
/// purge delete every tracking row.
|
|
/// </summary>
|
|
public sealed class OperationTrackingOptionsValidator : OptionsValidatorBase<OperationTrackingOptions>
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Validate(ValidationBuilder builder, OperationTrackingOptions options)
|
|
{
|
|
builder.RequireThat(!string.IsNullOrWhiteSpace(options.ConnectionString),
|
|
$"ScadaBridge:OperationTracking:{nameof(OperationTrackingOptions.ConnectionString)} " +
|
|
"must be a non-empty SQLite connection string.");
|
|
|
|
builder.RequireThat(options.RetentionDays > 0,
|
|
$"ScadaBridge:OperationTracking:{nameof(OperationTrackingOptions.RetentionDays)} " +
|
|
$"({options.RetentionDays}) must be > 0.");
|
|
}
|
|
}
|