fix(runtime): review findings — recursion-safe run cap, atomic detach counter, summary edge cases, per-row event-log fallback

This commit is contained in:
Joseph Doherty
2026-08-14 23:42:29 -04:00
parent b1de9dfdd4
commit 950c54c5fc
10 changed files with 626 additions and 42 deletions
@@ -1,3 +1,4 @@
using System.Diagnostics;
using Akka.Actor;
using Akka.Event;
using Akka.TestKit;
@@ -253,13 +254,21 @@ public class ScriptRunLauncherParityTests : TestKit, IDisposable
perScriptTimeoutSeconds: perScriptSeconds);
var caller = CreateTestProbe();
var started = Stopwatch.StartNew();
actor.Tell(new ScriptCallRequest("Runner", null, 0, "corr-timeout"), caller.Ref);
// If the effective timeout were the 300 s global (case 1) or ignored (cases 2/3) this
// would not answer inside the window.
// All three cases must resolve to the SAME effective 1 s deadline. "Answered inside
// 15 s" alone would not discriminate — a 15 s window is satisfied by anything from a
// 1 s cancel to a 14 s one — so the run must be shown to have been cancelled AT that
// deadline: the reported timeout value is 1 s, and the wall clock agrees.
var result = caller.ExpectMsg<ScriptCallResult>(TimeSpan.FromSeconds(15));
started.Stop();
Assert.False(result.Success);
Assert.Contains("timed out", result.ErrorMessage);
Assert.Contains("timed out after 1s", result.ErrorMessage);
// The body loops until cancelled, so it cannot answer before its deadline; and a
// deadline resolved to either global (300 s / 30 s) could not answer this soon.
Assert.InRange(started.Elapsed, TimeSpan.FromMilliseconds(800), TimeSpan.FromSeconds(8));
AwaitAssert(
() => Assert.Contains(siteLog.OfType("script"),