feat(flow-debugger): FlowStep carries the audit CorrelationId; CLI table adds a correlation column

Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
Joseph Doherty
2026-09-06 10:58:50 -04:00
parent 4769e192e3
commit 7e3e809a70
7 changed files with 35 additions and 4 deletions
@@ -18,7 +18,7 @@ namespace ZB.MOM.WW.ScadaBridge.CLI.Commands;
/// to the generic renderer unprojected, the object takes the Property/Value branch and the
/// whole event array lands in one cell as raw JSON. This projects the events through the same
/// <see cref="FlowGraphBuilder"/> the Flow Debugger page uses and prints one row per STEP —
/// <c>occurred | kind | lane | target | durationMs | status | lifecycle | error</c> — in the
/// <c>occurred | kind | lane | target | durationMs | status | lifecycle | correlation | error</c> — in the
/// order the page draws them, so a terminal user can read the swimlane top-to-bottom. An
/// outbound operation's rows (a cached call's Submit → Forwarded → Attempted → Resolve, a
/// notification's Send → Deliver) fold into ONE row whose <c>lifecycle</c> column counts them
@@ -146,6 +146,7 @@ internal static class FlowDebugTableProjection
["durationMs"] = step.DurationMs,
["status"] = status,
["lifecycle"] = lifecycle is { Count: > 0 } ? $"{lifecycle.Count} {(lifecycle.Count == 1 ? "row" : "rows")}" : null,
["correlation"] = step.CorrelationId?.ToString("D"),
["error"] = step.ErrorMessage,
});
}
+1 -1
View File
@@ -2289,7 +2289,7 @@ Trace steps are ordinary audit rows: a run leaves them in the central `AuditLog`
chain after the fact.
Table output prints one row per step in chronological order —
`occurred | kind | lane | target | durationMs | status | lifecycle | error` — the same
`occurred | kind | lane | target | durationMs | status | lifecycle | correlation | error` — the same
projection the Flow Debugger page draws (`FlowGraphBuilder`): an outbound `ExternalSystem.*`,
`Database.*` or `Notify` call is ONE row on the `External` lane (kinds `ApiCall` / `DbCall` /
`Notify`), and a cached call's or notification's later rows (Forwarded → Attempted → Delivered /
@@ -81,6 +81,11 @@ public sealed record FlowLifecycleRow(
/// (<see cref="Lifecycle"/>; outbound-calls plan 2026-09-06 D3). Never serialized to the wire;
/// the wire carries the audit events themselves (design §5.4).
/// </summary>
/// <remarks>
/// <c>CorrelationId</c> is the audit row's own: the <c>TrackedOperationId</c> of a cached call or the
/// <c>NotificationId</c> of a notification — the key the Site Calls / Notification report pages accept as
/// <c>?correlationId=</c> (follow-ups plan 2026-09-06 D1/D2). Null for sync one-shots and trace rows.
/// </remarks>
public sealed record FlowStep(
Guid EventId,
Guid? ExecutionId,
@@ -100,4 +105,5 @@ public sealed record FlowStep(
string? Instance,
string? Target,
ScriptTraceExtra? Extra,
IReadOnlyList<FlowLifecycleRow>? Lifecycle = null);
IReadOnlyList<FlowLifecycleRow>? Lifecycle = null,
Guid? CorrelationId = null);
@@ -42,7 +42,8 @@ public static class FlowStepProjector
Node: evt.SourceNode ?? extra?.Node,
Instance: d.SourceInstanceId,
Target: evt.Target,
Extra: extra);
Extra: extra,
CorrelationId: evt.CorrelationId);
}
/// <summary>Projects one outbound audit row onto its lifecycle entry (<see cref="FlowStep.Lifecycle"/>).</summary>