feat: enqueue graph join after fan-in
CI / test (push) Successful in 27s
CI / test (pull_request) Successful in 27s

This commit is contained in:
m
2026-08-22 16:06:33 +03:00
parent 785441f2a0
commit c7fc8d6a63
2 changed files with 9 additions and 0 deletions
@@ -106,6 +106,12 @@ func CompleteGraphNode(ctx context.Context, store ports.GraphStore, graphID stri
for _, candidate := range ready {
if graph.Nodes[i].ID == candidate && graph.Nodes[i].State == work.GraphNodeBlocked {
graph.Nodes[i].State = work.GraphNodeReady
if graph.Nodes[i].DispatchID == "" {
return work.WorkGraph{}, ErrGraphDispatchBinding
}
if err := store.EnqueueDispatch(ctx, work.AgentDispatchQueueItem{DispatchID: graph.Nodes[i].DispatchID, State: work.AgentDispatchQueued, AvailableAtUnixMillis: time.Now().UnixMilli(), UpdatedAtUnixMillis: time.Now().UnixMilli()}); err != nil {
return work.WorkGraph{}, err
}
}
}
}
@@ -50,6 +50,9 @@ func TestGraphRuntimeSchedulesFanOutAndCompletesFanIn(t *testing.T) {
if _, err := application.CompleteGraphNode(context.Background(), store, "g", 3, "b", true); err != nil {
t.Fatal(err)
}
if len(store.queued) != 3 || store.queued[2] != "d-join" {
t.Fatalf("fan-in dispatch was not enqueued: %v", store.queued)
}
completed, err := application.CompleteGraphNode(context.Background(), store, "g", 4, "join", true)
if err != nil || completed.State != work.GraphCompleted {
t.Fatalf("completed=%+v err=%v", completed, err)