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:
Joseph Doherty
2026-11-09 12:37:57 -05:00
parent 5310fd0e26
commit 6d5bb6189f
15 changed files with 484 additions and 155 deletions
@@ -29,6 +29,8 @@ public record RouteToCallRequest(
/// </summary>
/// <param name="ChildExecutionId">Flow Debugger — the routed site run's <c>ExecutionId</c> (design 2026-09-05 §5.4); null from a site that predates the field.</param>
/// <param name="TraceEvents">Flow Debugger — the site's <c>ScriptTrace</c> audit events for a traced run, in emission order (design 2026-09-05 §5.4); null when untraced or from an older site.</param>
/// <param name="Truncated">Flow Debugger (Gitea #54) — the site's inline collector dropped step rows, so <see cref="TraceEvents"/> is short. False when untraced or from an older site.</param>
/// <param name="LogsTruncated">Flow Debugger (Gitea #54) — the site's inline collector dropped log-line rows. False when untraced or from an older site.</param>
public record RouteToCallResponse(
string CorrelationId,
bool Success,
@@ -36,7 +38,9 @@ public record RouteToCallResponse(
string? ErrorMessage,
DateTimeOffset Timestamp,
Guid? ChildExecutionId = null,
IReadOnlyList<AuditEvent>? TraceEvents = null);
IReadOnlyList<AuditEvent>? TraceEvents = null,
bool Truncated = false,
bool LogsTruncated = false);
/// <summary>
/// Request to read attribute(s) from a remote instance.
@@ -4,10 +4,14 @@ namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.ScriptExecution;
/// <param name="ExecutionId">Flow Debugger — the run's own <c>ExecutionId</c> (design 2026-09-05 §5.4). Additive; null from callers that predate the field.</param>
/// <param name="TraceEvents">Flow Debugger — the run's <c>ScriptTrace</c> audit events in emission order when traced (design 2026-09-05 §5.4); null otherwise.</param>
/// <param name="Truncated">Flow Debugger (Gitea #54) — the site's inline trace collector dropped a step row (event cap or byte budget), so <see cref="TraceEvents"/> is short. The audit rows are complete; Replay shows everything. Additive; false when untraced.</param>
/// <param name="LogsTruncated">Flow Debugger (Gitea #54) — the site's collector dropped low-priority log-line rows to keep room for the step rows. Additive; false when untraced.</param>
public record ScriptCallResult(
string CorrelationId,
bool Success,
object? ReturnValue,
string? ErrorMessage,
Guid? ExecutionId = null,
IReadOnlyList<AuditEvent>? TraceEvents = null);
IReadOnlyList<AuditEvent>? TraceEvents = null,
bool Truncated = false,
bool LogsTruncated = false);