chore(config): retire ReplicationEnabled, make legacy db paths migration-only
LocalDb Phase 2 deleted the bespoke replicators, so three config keys changed meaning or died outright: - ScadaBridge:StoreAndForward:ReplicationEnabled is fully dead. Deleted the property, its 10 config entries, and the 5 test references. - SqliteDbPath / SiteDbPath are now migration-only: they name the legacy files SiteLocalDbLegacyMigrator drains at boot, not live databases. Both mandatory rules are relaxed accordingly (StartupValidator's Site-only Require, and the S&F validator's non-empty rule) — an absent value now means "nothing to migrate", so an already-migrated node can drop the key. DatabaseOptions- Validator still rejects a present-but-blank value. - SiteRuntime:ConfigFetchRetryCount's only reader was SiteReplicationActor. Deleted with its validator rule. The two path keys stay present in every config, now with a comment explaining why: removing them would strand un-migrated data on a node that has not yet started once. Both relaxations are pinned by the inverse of the test they replace (Site_MissingSiteDbPath_IsAccepted..., EmptySqliteDbPath_IsAccepted...), each verified to fail with the old rule restored. Note: deploy/wonder-app-vd03/appsettings.Site.json is under a gitignored deploy/ tree, so its edit is local-only and must be repeated on the box. Claude-Session: https://claude.ai/code/session_01BL2Vu1ESDQ9SCN4gVKkdts
This commit is contained in:
@@ -232,15 +232,22 @@ public class StartupValidatorTests
|
||||
Assert.Null(ex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The inverse of the rule this replaces. SiteDbPath was mandatory for Site
|
||||
/// nodes until LocalDb Phase 2 moved the site tables into the consolidated
|
||||
/// LocalDb database; it now names only the legacy file the boot-time migrator
|
||||
/// drains, so its absence means "nothing to migrate". Requiring it would make
|
||||
/// every already-migrated node carry a dead key forever.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Site_MissingSiteDbPath_FailsValidation()
|
||||
public void Site_MissingSiteDbPath_IsAccepted_BecauseThePathIsMigrationOnly()
|
||||
{
|
||||
var values = ValidSiteConfig();
|
||||
values.Remove("ScadaBridge:Database:SiteDbPath");
|
||||
var config = BuildConfig(values);
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => StartupValidator.Validate(config));
|
||||
Assert.Contains("SiteDbPath required for Site nodes", ex.Message);
|
||||
var ex = Record.Exception(() => StartupValidator.Validate(config));
|
||||
Assert.Null(ex);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -29,7 +29,6 @@ public class ParkedMessageHandlerActorTests : TestKit, IAsyncLifetime, IDisposab
|
||||
DefaultRetryInterval = TimeSpan.Zero,
|
||||
DefaultMaxRetries = 1,
|
||||
RetryTimerInterval = TimeSpan.FromMinutes(10),
|
||||
ReplicationEnabled = false,
|
||||
};
|
||||
|
||||
_service = new StoreAndForwardService(
|
||||
|
||||
@@ -34,7 +34,6 @@ public class ParkedOperationRelayTests : TestKit, IAsyncLifetime, IDisposable
|
||||
DefaultRetryInterval = TimeSpan.Zero,
|
||||
DefaultMaxRetries = 1,
|
||||
RetryTimerInterval = TimeSpan.FromMinutes(10),
|
||||
ReplicationEnabled = false,
|
||||
};
|
||||
|
||||
_service = new StoreAndForwardService(
|
||||
|
||||
@@ -11,7 +11,6 @@ public class StoreAndForwardOptionsTests
|
||||
var options = new StoreAndForwardOptions();
|
||||
|
||||
Assert.Equal("./data/store-and-forward.db", options.SqliteDbPath);
|
||||
Assert.True(options.ReplicationEnabled);
|
||||
Assert.Equal(TimeSpan.FromSeconds(30), options.DefaultRetryInterval);
|
||||
Assert.Equal(50, options.DefaultMaxRetries);
|
||||
Assert.Equal(TimeSpan.FromSeconds(10), options.RetryTimerInterval);
|
||||
@@ -23,14 +22,12 @@ public class StoreAndForwardOptionsTests
|
||||
var options = new StoreAndForwardOptions
|
||||
{
|
||||
SqliteDbPath = "/custom/path.db",
|
||||
ReplicationEnabled = false,
|
||||
DefaultRetryInterval = TimeSpan.FromMinutes(5),
|
||||
DefaultMaxRetries = 100,
|
||||
RetryTimerInterval = TimeSpan.FromSeconds(30)
|
||||
};
|
||||
|
||||
Assert.Equal("/custom/path.db", options.SqliteDbPath);
|
||||
Assert.False(options.ReplicationEnabled);
|
||||
Assert.Equal(TimeSpan.FromMinutes(5), options.DefaultRetryInterval);
|
||||
Assert.Equal(100, options.DefaultMaxRetries);
|
||||
}
|
||||
|
||||
+10
-3
@@ -39,13 +39,20 @@ public class StoreAndForwardOptionsValidatorTests
|
||||
Assert.Contains("RetryTimerInterval", result.FailureMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The inverse of the rule this replaces. Before LocalDb Phase 2 an empty
|
||||
/// SqliteDbPath was rejected, because it was the live buffer file and an empty
|
||||
/// value failed opaquely at first enqueue. The buffer now lives in the
|
||||
/// consolidated LocalDb database, so the key is only the legacy migration
|
||||
/// source and an empty value legitimately means "nothing to migrate" — a node
|
||||
/// that has already migrated must be able to drop it.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EmptySqliteDbPath_IsRejected()
|
||||
public void EmptySqliteDbPath_IsAccepted_BecauseThePathIsMigrationOnly()
|
||||
{
|
||||
var result = Validate(new StoreAndForwardOptions { SqliteDbPath = "" });
|
||||
|
||||
Assert.True(result.Failed);
|
||||
Assert.Contains("SqliteDbPath", result.FailureMessage);
|
||||
Assert.False(result.Failed);
|
||||
}
|
||||
|
||||
// ── R2 T9: sweep-tuning eager validation (N4) ──
|
||||
|
||||
Reference in New Issue
Block a user