fix(alarms): #937 review r2 — deadline/poison refusals unsent, Call size quota, expired asks skip the engine, mutation-counter revert guard
M1: a scripted method whose request deadline leaves < the dispatch floor, or that follows an unanswered scripted method in the same Call, is refused BadTimeout in its handler (unsent, unapplied); OpcUa:Quotas:MaxNodesPerMethodCall = 1000. M2: ExecuteAlarmCommand carries the asker's deadline; an expired ask skips the engine and is not remembered (the broadcast copy applies). L1: revert guarded by a per-condition mutation counter; raw severity restored. L5 + nits: docs, stale comment. SDK check: no Part 9 handler calls our delegate before its own validation. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+23
@@ -72,6 +72,29 @@ public sealed class ScriptedAlarmCommandVerdictTests : RuntimeActorTestBase
|
||||
(await Ask(host, "alm-1", "AddComment", "second")).Verdict.ShouldBe(AlarmCommandVerdict.Applied);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #937 review r2 M2: an ask still queued past its asker's deadline never touches the engine (no growth of late work
|
||||
/// behind a stalled store) and is NOT remembered — the broadcast copy of the same command still applies here.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task An_expired_ask_skips_the_engine_and_leaves_the_broadcast_copy_to_apply()
|
||||
{
|
||||
var (host, engine, _, mux) = Spawn();
|
||||
host.Tell(new ScriptedAlarmHostActor.ApplyScriptedAlarms([Plan("alm-1")]));
|
||||
mux.ExpectMsg<DependencyMuxActor.RegisterInterest>(Timeout, cancellationToken: Ct);
|
||||
|
||||
var cmd = new AlarmCommand("alm-1", "AddComment", "alice", "late", null, "cmd-late");
|
||||
var expired = await host.Ask<AlarmCommandOutcome>(
|
||||
new ScriptedAlarmHostActor.ExecuteAlarmCommand(cmd, DateTime.UtcNow.AddSeconds(-1)), Timeout, Ct);
|
||||
expired.Verdict.ShouldBe(AlarmCommandVerdict.OutcomeUnknown);
|
||||
engine.GetState("alm-1")!.Comments.ShouldBeEmpty("the expired ask never reached the engine");
|
||||
|
||||
host.Tell(cmd); // the broadcast copy (same CommandId)
|
||||
// Positive control behind it in the mailbox: a fresh ask (in time) applies, so the copy was processed first.
|
||||
(await Ask(host, "alm-1", "AddComment", "after", "cmd-after")).Verdict.ShouldBe(AlarmCommandVerdict.Applied);
|
||||
engine.GetState("alm-1")!.Comments.Select(c => c.Text).ShouldBe(["late", "after"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task An_alarm_this_host_does_not_own_is_answered_not_applied()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user