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
@@ -229,11 +229,13 @@ public class FlowDebugCommandsTests
Assert.Equal("External", rows[3].GetProperty("lane").GetString());
Assert.Equal("RigDb", rows[3].GetProperty("target").GetString());
Assert.Equal("3 rows", rows[3].GetProperty("lifecycle").GetString());
Assert.Equal(corr.ToString("D"), rows[3].GetProperty("correlation").GetString());
Assert.Equal("Delivered", rows[3].GetProperty("status").GetString());
Assert.Equal(50, rows[3].GetProperty("durationMs").GetInt32());
Assert.Equal("09:00:00.070", rows[3].GetProperty("occurred").GetString());
Assert.Equal("DelmiaSim01.OutboundDemo", rows[1].GetProperty("target").GetString());
Assert.Equal(JsonValueKind.Null, rows[1].GetProperty("lifecycle").ValueKind);
Assert.Equal(JsonValueKind.Null, rows[1].GetProperty("correlation").ValueKind);
}
}
@@ -232,6 +232,7 @@ public class FlowGraphBuilderTests
Assert.Equal(T0.AddMilliseconds(35), api.OccurredAtUtc.UtcDateTime);
Assert.Equal(4, api.Lifecycle!.Count);
Assert.Equal(new[] { "CachedSubmit", "ApiCallCached", "ApiCallCached", "CachedResolve" }, api.Lifecycle.Select(r => r.Kind));
Assert.Equal(corr, api.CorrelationId);
Assert.Equal("503", api.Lifecycle[2].ErrorMessage);
Assert.Equal(FlowStepOutcome.Ok, api.Outcome);
Assert.Equal(4100, api.DurationMs);
@@ -1,3 +1,4 @@
using ZB.MOM.WW.Audit;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Audit;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Debugging;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
@@ -161,4 +162,23 @@ public class FlowStepProjectorTests
occurredAtUtc: T0.UtcDateTime, target: "MesDb", extra: extra);
Assert.Equal(expected, FlowStepProjector.Project(evt).Subtitle);
}
[Fact]
public void Project_CarriesTheAuditRowsCorrelationId()
{
var corr = Guid.NewGuid();
var evt = ScadaBridgeAuditEventFactory.Create(AuditChannel.ApiOutbound, AuditKind.CachedSubmit, AuditStatus.Submitted,
occurredAtUtc: T0.UtcDateTime, target: "Delmia.Ack", executionId: Guid.NewGuid(), correlationId: corr, sourceSiteId: "site-a");
Assert.Equal(corr, FlowStepProjector.Project(evt).CorrelationId);
}
[Fact]
public void Project_NullCorrelation_LeavesCorrelationIdNull()
{
var evt = ScadaBridgeAuditEventFactory.Create(AuditChannel.ApiOutbound, AuditKind.ApiCall, AuditStatus.Delivered,
occurredAtUtc: T0.UtcDateTime, target: "Delmia.Ack", executionId: Guid.NewGuid(), sourceSiteId: "site-a");
Assert.Null(FlowStepProjector.Project(evt).CorrelationId);
}
}