feat(flow-debugger): carry site-side trace truncation on the route reply (ScadaBridge#54)
ScriptCallResult and RouteToCallResponse gain trailing Truncated/LogsTruncated, filled from the site FlowTraceCollector after Complete(); RouteToCallResponseDto fields 8/9 carry them (sitecommand regen). FlowDebugRunner ORs them into FlowDebugRunResult on the script entry, and on the method entry through a new optional truncation sink on RouteHelper.WithTraceSink (carried through every With* clone). Previously a site run whose collector dropped rows came back as a silently short list. Older sites send false. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -161,4 +161,38 @@ public class ScriptRunLauncherTraceTests : TestKit, IDisposable
|
||||
Assert.All(logs, e => Assert.True(rows.ToList().IndexOf(e) < anchorIndex));
|
||||
Assert.Equal(logs.Count, anchorIndex);
|
||||
}
|
||||
|
||||
// ── (d) the reply reports the site collector's truncation (Gitea #54) ────────
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that a traced run whose inline collector dropped log-line rows says so on the
|
||||
/// reply (<c>LogsTruncated</c>), instead of handing the caller a silently short list.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TracedRun_WhoseCollectorDroppedLogRows_ReportsLogsTruncated()
|
||||
{
|
||||
// 600 lines is under the per-run line cap set here (1000) but over the collector's
|
||||
// low-priority event share (DefaultMaxEvents - LowPriorityReserveEvents = 450).
|
||||
var result = RunTraced(
|
||||
"for (var i = 0; i < 600; i++) Log.Info(\"line \" + i); return null;",
|
||||
Options(maxLogLines: 1000));
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.True(result.LogsTruncated);
|
||||
Assert.False(result.Truncated);
|
||||
Assert.True(result.TraceEvents!.Count < 600);
|
||||
// Step rows still fit: the ScriptRun anchor is present.
|
||||
ScriptRunRow(result);
|
||||
}
|
||||
|
||||
/// <summary>Positive control: a small traced run reports neither truncation flag.</summary>
|
||||
[Fact]
|
||||
public void TracedRun_WithinTheCollectorCaps_ReportsNoTruncation()
|
||||
{
|
||||
var result = RunTraced("Log.Info(\"one\"); return null;", Options());
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.False(result.LogsTruncated);
|
||||
Assert.False(result.Truncated);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user