refactor(inbound-api): use the shared ZB.MOM.WW.Health IActiveNodeGate (ScadaBridge#80)

The InboundAPI carried its own IActiveNodeGate (implemented by Host/Health/ActiveNodeGate)
whose rule already matched the shared Health 0.3.0 AkkaActiveNodeGate — both route to
ClusterActiveNode (oldest Up member). The private interface and implementation are deleted;
InboundAPI references ZB.MOM.WW.Health (0.3.0, already pinned) and InboundApiEndpointFilter,
AuditWriteMiddleware, InboundMethodWarmupService and FlowDebugRunner consume
ZB.MOM.WW.Health.IActiveNodeGate. The Central branch of Program.cs registers
AkkaActiveNodeGate (unscoped, like the active-node health check).

Warm-up behaviour is kept: the shared gate answers false while no ActorSystem resolves, while
this member is not Up, and on any cluster-init fault. It resolves the ActorSystem through the
existing DI singleton bridge (GetOrCreateActorSystem), the same path the health probes use.

Tests: CompositionRoot asserts the shared gate type (fails with the registration removed);
the evaluator wiring test now drives AkkaActiveNodeGate; new warm-up test (no ActorSystem ->
not active). Nothing was missing from the Health 0.3.0 package.

(ScadaBridge#80)

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 13:39:54 -05:00
parent 1ee2e171cf
commit 23c35df234
18 changed files with 52 additions and 91 deletions
@@ -332,7 +332,7 @@ public class CentralCompositionRootTests : IDisposable
/// <summary>
/// Regression test: the Central composition root MUST register a
/// concrete <see cref="IActiveNodeGate"/> implementation. Without it,
/// concrete <see cref="ZB.MOM.WW.Health.IActiveNodeGate"/> implementation. Without it,
/// <see cref="InboundApiEndpointFilter"/> falls through to "allow" and a
/// standby central node continues to serve the inbound API, racing the
/// active node and executing scripts against stale singleton state. The
@@ -344,12 +344,17 @@ public class CentralCompositionRootTests : IDisposable
/// indistinguishable from "missing" at runtime, which is the failure mode
/// the finding describes.
/// </summary>
/// <remarks>
/// Gitea #80: the gate is the shared <see cref="ZB.MOM.WW.Health.IActiveNodeGate"/> backed by
/// <see cref="ZB.MOM.WW.Health.Akka.AkkaActiveNodeGate"/> — the same ClusterActiveNode rule as
/// the /health/active probe — not a ScadaBridge-private seam.
/// </remarks>
[Fact]
public void Central_IActiveNodeGate_IsRegisteredAsActiveNodeGate()
{
var gate = _factory.Services.GetService<IActiveNodeGate>();
var gate = _factory.Services.GetService<ZB.MOM.WW.Health.IActiveNodeGate>();
Assert.NotNull(gate);
Assert.IsType<ActiveNodeGate>(gate);
Assert.IsType<ZB.MOM.WW.Health.Akka.AkkaActiveNodeGate>(gate);
}
// --- ScadaBridge#22 regression ---