fix(alarms): #937 review r1 — revert a refused scripted method, broadcast to the peer only after the local verdict, settle a batch per request, in-flight cap
1. A post-dispatch refusal now puts the node back to its captured pre-call state with one corrective event (skipped when the node changed since) — the SDK had already applied and reported the change. Blank scripted AddComment is refused in the handler before the SDK runs. 2. ScriptedAlarmCommandDispatch: ask the local engine first, broadcast to the peer only on Applied/OutcomeUnknown — a refusal now reached no engine anywhere. 3. ApplyAsync no longer checks 'loaded' before _evalGate: a command racing the first load queues behind it; never loaded => refusal (nothing applied). 4. One Call's requests are settled sequentially (no request runs against a node state the engine refused); <= 64 asks in flight node-wide, else BadTooManyOperations before anything applies; per-request bound starts at send. Measured 300 acks through one host + LocalDb: 59 ms sequential, max 24 ms/ask with 64 outstanding. 5. Mixed-batch wire test (scripted refused + native + imported + scripted applied + core-manager method): per-item status in order, one scripted ask at a time. L6: readiness from the engine's HasCompleteGeneration on a load fault. L7: the verdict slot is closed when its SDK call returns (timer-captured AsyncLocal can no longer park an ask). L10: remote budget never stretched. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -436,9 +436,10 @@ public sealed class ScriptedAlarmHostActor : ReceiveActor
|
||||
|
||||
private void OnLoadFailed(Status.Failure msg)
|
||||
{
|
||||
// #937: loads serialize on the engine's gate, so completions arrive in start order — this is the latest
|
||||
// completed load, and the engine now holds no complete generation (it rejects every operator command).
|
||||
_readiness?.SetLoadOutcome(loaded: false);
|
||||
// #937: loads serialize on the engine's gate, so completions arrive in start order — this is the latest completed
|
||||
// load. Publish what the ENGINE says rather than infer it from the fault (review r1 L6): a load can fault after it
|
||||
// completed its generation (e.g. subscribing), and then the engine still accepts commands.
|
||||
_readiness?.SetLoadOutcome(loaded: _engine.HasCompleteGeneration);
|
||||
_log.Warning(msg.Cause, "ScriptedAlarmHost: engine LoadAsync failed — alarms not (re)loaded; operator commands are refused until the next successful deploy");
|
||||
}
|
||||
|
||||
@@ -830,6 +831,9 @@ public sealed class ScriptedAlarmHostActor : ReceiveActor
|
||||
replyTo.Tell(outcome);
|
||||
}
|
||||
|
||||
private const string NotYetLoadedRefusal =
|
||||
"This server's scripted-alarm engine has not completed loading its configuration yet; the command was not applied.";
|
||||
|
||||
private const string NotLoadedRefusal =
|
||||
"The alarm is not loaded by this server's scripted-alarm engine; the command was not applied.";
|
||||
|
||||
@@ -924,7 +928,9 @@ public sealed class ScriptedAlarmHostActor : ReceiveActor
|
||||
// redundant peer's copy) has only this Warning. The next successful deploy re-asserts the node from the store.
|
||||
_log.Warning("ScriptedAlarmHost: {Op} for alarm {AlarmId} NOT applied — {Reason}",
|
||||
cmd.Operation, cmd.AlarmId, ex.Message);
|
||||
return Refused(ScriptedAlarmCommandReadinessView.LoadFailedRefusal);
|
||||
// Before the first load completes there is no failure to name (the readiness view is clear then).
|
||||
return Refused(_readiness?.Refusal() ?? (_loadedGeneration == 0 && _readiness is not null ? NotYetLoadedRefusal
|
||||
: ScriptedAlarmCommandReadinessView.LoadFailedRefusal));
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user