test(commons): FlowGraphBuilder — a RouteCall root (flow debugger direct script call) builds Central → Site
Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
@@ -588,4 +588,34 @@ public class FlowGraphBuilderTests
|
||||
var into = Assert.Single(graph.Edges, e => e.ToEventId == graph.Steps[2].EventId);
|
||||
Assert.Equal(graph.Steps[1].EventId, into.FromEventId);
|
||||
}
|
||||
|
||||
// ---- Script entry point (2026-09-08 plan, Task 6) -----------------------------------------
|
||||
|
||||
[Fact]
|
||||
public void RouteCallRoot_WithoutInboundRow_BuildsCentralToSite_AndNoResponse()
|
||||
{
|
||||
// Flow Debugger script entry (design 2026-09-08 §4): a direct script call's root is an
|
||||
// operator-attributed RouteCall row — there is no InboundRequest and no Response.
|
||||
var root = Guid.NewGuid();
|
||||
var run = Guid.NewGuid();
|
||||
var events = new List<AuditEvent>
|
||||
{
|
||||
ScadaBridgeAuditEventFactory.Create(AuditChannel.ScriptTrace, AuditKind.RouteCall, AuditStatus.Delivered,
|
||||
occurredAtUtc: T0, actor: "ops", target: "M1.Manual", sourceNode: "central-a", executionId: root,
|
||||
sourceSiteId: "site-a", sourceInstanceId: "M1", durationMs: 50, requestSummary: "{\"n\":3}", responseSummary: "42",
|
||||
extra: new ScriptTraceExtra { Source = "flow-debugger", ChildExecutionId = run }.ToJson()),
|
||||
ScadaBridgeAuditEventFactory.Create(AuditChannel.ScriptTrace, AuditKind.ScriptRun, AuditStatus.Delivered,
|
||||
occurredAtUtc: T0.AddMilliseconds(5), actor: "Manual", target: "Manual", sourceNode: "node-a",
|
||||
executionId: run, parentExecutionId: root, sourceSiteId: "site-a", sourceInstanceId: "M1", durationMs: 40,
|
||||
extra: new ScriptTraceExtra { TriggerKind = "call" }.ToJson()),
|
||||
};
|
||||
|
||||
var graph = FlowGraphBuilder.Build(events);
|
||||
|
||||
Assert.Equal([FlowStepKind.RouteCall, FlowStepKind.ScriptRun], graph.Steps.Select(s => s.Kind).ToList());
|
||||
Assert.Equal([FlowLane.Central, FlowLane.Site], graph.Steps.Select(s => s.Lane).ToList());
|
||||
var edge = Assert.Single(graph.Edges);
|
||||
Assert.Equal((graph.Steps[0].EventId, graph.Steps[1].EventId, true), (edge.FromEventId, edge.ToEventId, edge.CrossesBoundary));
|
||||
Assert.DoesNotContain(graph.Steps, s => s.Kind == FlowStepKind.Response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user