feat(mesh-phase4): retire DB-reachability from ServiceLevel on DB-less nodes

Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW
This commit is contained in:
Joseph Doherty
2026-07-23 11:55:43 -04:00
parent 5c40908a55
commit 9565827275
4 changed files with 223 additions and 11 deletions
@@ -326,10 +326,19 @@ public static class ServiceCollectionExtensions
// (durable AVEVA sink is infra-gated); a deployment binding a real IHistoryWriter overrides.
var historyWriter = resolver.GetService<IHistoryWriter>() ?? NullHistoryWriter.Instance;
var dbHealth = system.ActorOf(
DbHealthProbeActor.Props(dbFactory),
DbHealthProbeActorName);
registry.Register<DbHealthProbeActorKey>(dbHealth);
// Per-cluster mesh Phase 4: a driver-only node has NO ConfigDb (LocalDb is its config
// store), so dbFactory is null and there is nothing to probe. Skip spawning the probe
// entirely — spawning it with a null factory would NRE on the first SELECT 1 — and do not
// register its marker key. OpcUaPublishActor then runs in dbLess mode (DbReachable retired,
// treated constant-true) so a healthy DB-less node still publishes full ServiceLevel.
IActorRef? dbHealth = null;
if (dbFactory is not null)
{
dbHealth = system.ActorOf(
DbHealthProbeActor.Props(dbFactory),
DbHealthProbeActorName);
registry.Register<DbHealthProbeActorKey>(dbHealth);
}
// Dependency mux must be spawned before DriverHostActor so the host can forward
// AttributeValuePublished into it from the very first driver spawn.
@@ -436,7 +445,8 @@ public static class ServiceCollectionExtensions
localNode: roleInfo.LocalNode,
dbFactory: dbFactory,
applier: applier,
dbHealthProbe: dbHealth),
dbHealthProbe: dbHealth,
dbLess: dbFactory is null),
OpcUaPublishActorName);
registry.Register<OpcUaPublishActorKey>(publishActor);
@@ -452,7 +462,14 @@ public static class ServiceCollectionExtensions
// ackRouter: under ClusterClient mode the node comm actor relays ApplyAcks across
// the boundary; under Dps it stays null and the host publishes on the
// deployment-acks topic exactly as before.
DriverHostActor.Props(dbFactory, roleInfo.LocalNode,
// dbFactory! — KNOWN INTERIM. A driver-only node genuinely passes a null factory here
// (ConfigDb is now gated on hasAdmin, and driver-only nodes are forced to FetchAndCache),
// so DriverHostActor's ConfigDb-touching paths — scripted-alarm state persistence
// (EfAlarmConditionStateStore) and UpsertNodeDeploymentState — fault-and-swallow until
// Task 4 makes the factory nullable + guards those sites (and removes this !) and Task 6
// re-homes the alarm store to LocalDb. Inert in practice: no driver-only node is
// configured to boot until the Task 10 rig change.
DriverHostActor.Props(dbFactory!, roleInfo.LocalNode,
ackRouter: useClusterClient ? nodeComm : null,
driverFactory: driverFactory, localRoles: roleInfo.LocalRoles,
dependencyMux: mux,