fix(resilience): #999 K-8 a wrong-shaped ResilienceConfig falls back to tier defaults instead of throwing out of driver spawn

This commit is contained in:
Joseph Doherty
2026-12-03 10:46:17 -05:00
parent 3795cd5f21
commit be4f4f8f94
4 changed files with 108 additions and 3 deletions
@@ -4594,6 +4594,33 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
StartAcquisitionDemand(ready.DriverInstanceId, desired, ActorRefs.Nobody);
}
/// <summary>
/// #999 / review K-8: the resilience invoker for a spawn, never throwing. A factory throw (a wrong-shaped
/// <c>ResilienceConfig</c> from a restored database, a manual SQL edit or an older build) used to escape
/// <see cref="SpawnChild"/> and the handler hosting every driver on the node — and the same artifact was re-applied
/// afterwards. Like a driver-factory throw it is a CONFIG error: logged at Error, and the driver runs on its tier
/// defaults (no per-instance overrides); only if that throws too does it run with the pass-through invoker.
/// </summary>
private IDriverCapabilityInvoker CreateInvoker(DriverInstanceSpec spec)
{
try { return _invokerFactory.Create(spec.DriverInstanceId, spec.DriverType, spec.ResilienceConfig); }
catch (Exception ex)
{
_log.Error(ex,
"DriverHost {Node}: the ResilienceConfig of {Id} ({Type}) could not be applied — the driver runs on its " +
"tier-default resilience policy until the config is fixed and redeployed",
_localNode, spec.DriverInstanceId, spec.DriverType);
}
try { return _invokerFactory.Create(spec.DriverInstanceId, spec.DriverType, null); }
catch (Exception ex)
{
_log.Error(ex,
"DriverHost {Node}: no resilience invoker could be built for {Id} ({Type}) — its capability calls run " +
"WITHOUT retry/timeout/breaker", _localNode, spec.DriverInstanceId, spec.DriverType);
return NullDriverCapabilityInvoker.Instance;
}
}
private void SpawnChild(DriverInstanceSpec spec, bool deferSubscriptions = false)
{
// An instance id removed by an earlier deployment (StopChild ⇒ Evict, which also holds back late
@@ -4663,7 +4690,7 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
// route through the retry/breaker/telemetry pipeline. The tier defaults are layered
// with the per-instance ResilienceConfig from the artifact; the pass-through factory yields a
// no-op invoker on nodes without the real resilience factory bound.
var invoker = _invokerFactory.Create(spec.DriverInstanceId, spec.DriverType, spec.ResilienceConfig);
var invoker = CreateInvoker(spec);
child = Context.ActorOf(
_dataWriteRuntime is null ? DriverInstanceActor.Props(
driver!,