fix: persist and retry run alerts and honor notification modes
This commit is contained in:
@@ -121,7 +121,7 @@ func TestRunEventWebSocketPushesTransitions(t *testing.T) {
|
||||
if ack := client.read(); ack.Type != protocol.Subscribe || ack.ID != "sub" {
|
||||
t.Fatalf("subscribe ack = %+v", ack)
|
||||
}
|
||||
client.send(protocol.Message{Type: protocol.RunPipeline, ID: "start", PipelineID: ids[0], Version: 1, RequestKey: "evt-1", Workspace: workspace, Input: map[string]any{"prompt": "test"}})
|
||||
client.send(protocol.Message{Type: protocol.RunPipeline, ID: "start", PipelineID: ids[0], Version: 1, RequestKey: "evt-1", Workspace: workspace, NotifyMode: "off", Input: map[string]any{"prompt": "test"}})
|
||||
|
||||
var runID int64
|
||||
var created, stepStarted, stepFinished, terminal *protocol.RunEventFrame
|
||||
@@ -175,6 +175,11 @@ func TestRunEventWebSocketPushesTransitions(t *testing.T) {
|
||||
if terminal.RunID != runID || terminal.Status != "succeeded" || terminal.Outcome != "success" || terminal.FinishedAt == "" {
|
||||
t.Fatalf("terminal frame = %+v", terminal)
|
||||
}
|
||||
for _, frame := range []*protocol.RunEventFrame{created, stepStarted, stepFinished, terminal} {
|
||||
if frame.NotifyMode != "off" {
|
||||
t.Fatalf("silent mode lost in event: %+v", frame)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestRunEventSubscribeSendsSnapshot proves a client that subscribes to an
|
||||
@@ -188,7 +193,7 @@ func TestRunEventSubscribeSendsSnapshot(t *testing.T) {
|
||||
return stage.Result{Outcome: "success", Output: stage.Values{}}, nil
|
||||
}
|
||||
workspace := eventWorkspace(t)
|
||||
run, err := handler.runner.start(protocol.Message{PipelineID: ids[0], Version: 1, RequestKey: "snap-1", Workspace: workspace, Input: map[string]any{"prompt": "test"}})
|
||||
run, err := handler.runner.start(protocol.Message{PipelineID: ids[0], Version: 1, RequestKey: "snap-1", Workspace: workspace, NotifyMode: "off", Input: map[string]any{"prompt": "test"}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -203,6 +208,9 @@ func TestRunEventSubscribeSendsSnapshot(t *testing.T) {
|
||||
if first.RunEvent.RunID != run.ID || first.RunEvent.Status != "succeeded" || first.RunEvent.CompletedSteps != 1 || first.RunEvent.FinishedAt == "" {
|
||||
t.Fatalf("snapshot frame = %+v", first.RunEvent)
|
||||
}
|
||||
if first.RunEvent.NotifyMode != "off" {
|
||||
t.Fatalf("silent mode lost in snapshot: %+v", first.RunEvent)
|
||||
}
|
||||
// A snapshot for a run the client never saw also carries the identity its row
|
||||
// needs, so a fresh subscribe renders it without a second read.
|
||||
if first.RunEvent.PipelineID != ids[0] || first.RunEvent.Name == "" || first.RunEvent.Version != 1 {
|
||||
|
||||
Reference in New Issue
Block a user