refactor(localdb): one replication predicate shared by table registration and the alarm drain gate (#603)

The drain gate counted SyncListenPort; a port with no ApiKey shares nothing (fail-closed
passive endpoint), and an ApiKey-only passive node shares its queue but was never gated.

Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
Joseph Doherty
2026-10-08 06:56:00 -04:00
parent 1b37b2f2b0
commit 4f6231fa40
6 changed files with 94 additions and 18 deletions
@@ -170,12 +170,9 @@ public static class LocalDbSetup
/// <returns><c>true</c> when this node is configured to replicate.</returns>
public static bool ReplicationIsConfigured(IConfiguration configuration)
{
ArgumentNullException.ThrowIfNull(configuration);
var section = configuration.GetSection(LocalDbRegistration.ReplicationSectionPath);
return !string.IsNullOrWhiteSpace(section["PeerAddress"])
|| !string.IsNullOrWhiteSpace(section["ApiKey"]);
// Shared with the alarm-historian drain gate (#603): one predicate, so the nodes that capture
// changes and the nodes that stand down for a peer can never disagree.
return Runtime.LocalDbReplicationPolicy.IsConfigured(configuration);
}
/// <summary>Opts every replicated table into change capture, baselining what is already there.</summary>