ironflow-engine 2.41.3

Workflow orchestration engine for ironflow with FSM-based run lifecycle
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
//! Integration tests for SLA timers and escalation on approval gates.
//!
//! Every test drives a real [`Engine`] over a real [`InMemoryStore`] with a real
//! [`WorkflowHandler`]: the gate is opened by executing a workflow, the deadline
//! is backdated through the public `update_step` API, and
//! [`ApprovalEscalator::tick`] is called the way the API server's loop calls it.

use std::net::SocketAddr;
use std::sync::{Arc, Mutex};
use std::time::Duration;

use axum::extract::State;
use axum::routing::post;
use axum::{Json, Router};
use chrono::{TimeDelta, Utc};
use serde_json::{Value, json};
use tokio::net::TcpListener;
use tokio::time::timeout;
use uuid::Uuid;

use ironflow_core::provider::AgentProvider;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use ironflow_core::providers::record_replay::RecordReplayProvider;
use ironflow_engine::config::{
    ApprovalConfig, Assignee, EscalationPolicy, NotificationTarget, ShellConfig,
};
use ironflow_engine::context::WorkflowContext;
use ironflow_engine::engine::{Engine, ExecutionMode};
use ironflow_engine::escalation::{
    APPROVAL_TIMEOUT_ERROR, ApprovalEscalator, EscalationAction, SYSTEM_TIMEOUT_ACTOR,
};
use ironflow_engine::handler::{HandlerFuture, WorkflowHandler};
use ironflow_engine::notify::{AuditLogSubscriber, Event};
use ironflow_store::audit_log_store::AuditLogStore;
use ironflow_store::entities::{AuditLogFilter, EventKind};
use ironflow_store::memory::InMemoryStore;
use ironflow_store::models::{RunStatus, Step, StepKind, StepStatus, StepUpdate, TriggerKind};
use ironflow_store::store::{RunStore, Store};

/// Test timeout for bodies that touch sockets or spawn processes.
const TEST_TIMEOUT: Duration = Duration::from_secs(10);

/// Workflow name registered by [`GatedDeploy`].
const WORKFLOW: &str = "gated-deploy";

/// A deploy pipeline gated on an approval, parameterised by its gate config.
struct GatedDeploy {
    config: ApprovalConfig,
}

impl WorkflowHandler for GatedDeploy {
    fn name(&self) -> &str {
        WORKFLOW
    }

    fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a> {
        Box::pin(async move {
            ctx.shell("build", ShellConfig::new("echo build")).await?;
            ctx.approval("prod-gate", self.config.clone()).await?;
            ctx.shell("deploy", ShellConfig::new("echo deploy")).await?;
            Ok(())
        })
    }
}

fn provider() -> Arc<dyn AgentProvider> {
    Arc::new(RecordReplayProvider::replay(
        ClaudeCodeProvider::new(),
        "/tmp/ironflow-fixtures",
    ))
}

fn engine_with(store: Arc<InMemoryStore>, config: ApprovalConfig) -> Engine {
    let store: Arc<dyn Store> = store;
    let mut engine = Engine::new(store, provider());
    engine
        .register(GatedDeploy { config })
        .expect("register handler");
    engine
}

/// Run the gated workflow until it suspends on the approval gate.
async fn suspended_run(engine: &Engine) -> Uuid {
    let result = engine
        .run_handler(WORKFLOW, TriggerKind::Api, json!({}))
        .await
        .expect("handler suspends on the gate");

    assert_eq!(result.run.status.state, RunStatus::AwaitingApproval);
    result.run.id
}

/// The approval step of a run.
async fn gate_step(store: &Arc<InMemoryStore>, run_id: Uuid) -> Step {
    store
        .list_steps(run_id)
        .await
        .expect("list steps")
        .into_iter()
        .find(|s| s.kind == StepKind::Approval)
        .expect("the run has an approval step")
}

/// Push the gate's deadline into the past so the next tick claims it.
async fn expire_gate(store: &Arc<InMemoryStore>, run_id: Uuid) -> Uuid {
    let step = gate_step(store, run_id).await;
    assert!(
        step.approval_deadline_at.is_some(),
        "the gate must carry a deadline before it can expire"
    );

    store
        .update_step(
            step.id,
            StepUpdate {
                approval_deadline_at: Some(Utc::now() - TimeDelta::seconds(1)),
                ..StepUpdate::default()
            },
        )
        .await
        .expect("backdate the deadline");

    step.id
}

/// Names of the steps recorded for a run.
async fn step_names(store: &Arc<InMemoryStore>, run_id: Uuid) -> Vec<String> {
    store
        .list_steps(run_id)
        .await
        .expect("list steps")
        .into_iter()
        .map(|s| s.name)
        .collect()
}

#[tokio::test]
async fn approval_timeout_auto_approve_completes_step_and_resumes_run() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(1)
            .on_timeout(EscalationPolicy::AutoApprove);
        let engine = Arc::new(engine_with(store.clone(), config));

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        let records = ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        assert_eq!(records.len(), 1);
        assert_eq!(records[0].action, EscalationAction::Approved);
        assert_eq!(records[0].step_id, step_id);
        assert!(
            records[0].reason.contains("1s"),
            "got {}",
            records[0].reason
        );

        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.status.state, StepStatus::Completed);
        assert_eq!(
            gate.output.as_ref().unwrap()["approved_by"],
            json!(SYSTEM_TIMEOUT_ACTOR)
        );
        assert!(gate.approval_deadline_at.is_none());

        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::Completed);
        assert!(
            step_names(&store, run_id)
                .await
                .contains(&"deploy".to_string())
        );
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_auto_approve_in_workers_mode_requeues_run() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(1)
            .on_timeout(EscalationPolicy::AutoApprove);
        let engine = Arc::new(
            engine_with(store.clone(), config).with_execution_mode(ExecutionMode::Workers),
        );

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        let records = ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        assert_eq!(records.len(), 1);
        assert_eq!(records[0].action, EscalationAction::Approved);
        assert_eq!(records[0].step_id, step_id);

        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.status.state, StepStatus::Completed);

        // Requeued for a worker: nothing resumed the run in this process.
        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::Pending);
        assert!(
            !step_names(&store, run_id)
                .await
                .contains(&"deploy".to_string())
        );
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_auto_reject_fails_step_and_run() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(1)
            .on_timeout(EscalationPolicy::AutoReject);
        let engine = Arc::new(engine_with(store.clone(), config));

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        let records = ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        assert_eq!(records.len(), 1);
        assert_eq!(records[0].action, EscalationAction::Rejected);

        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.status.state, StepStatus::Failed);
        assert_eq!(gate.error.as_deref(), Some(APPROVAL_TIMEOUT_ERROR));
        assert!(gate.approval_deadline_at.is_none());

        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::Failed);
        assert_eq!(run.error.as_deref(), Some(APPROVAL_TIMEOUT_ERROR));
        assert!(
            !step_names(&store, run_id)
                .await
                .contains(&"deploy".to_string())
        );
    })
    .await
    .expect("test timed out");
}

/// Bodies received by the recording webhook server.
type Received = Arc<Mutex<Vec<Value>>>;

async fn record(State(received): State<Received>, Json(body): Json<Value>) -> &'static str {
    received.lock().expect("recorder lock").push(body);
    "ok"
}

/// Spin a real HTTP server that records every posted JSON body.
async fn recording_server() -> (SocketAddr, Received) {
    let received: Received = Arc::new(Mutex::new(Vec::new()));
    let app = Router::new()
        .route("/hook", post(record))
        .with_state(received.clone());

    let listener = TcpListener::bind("127.0.0.1:0").await.expect("bind");
    let addr = listener.local_addr().expect("local addr");
    tokio::spawn(async move {
        axum::serve(listener, app).await.expect("serve");
    });

    (addr, received)
}

#[tokio::test]
async fn approval_timeout_notify_posts_to_webhook_and_resets_timer() {
    timeout(TEST_TIMEOUT, async {
        let (addr, received) = recording_server().await;
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(600)
            .on_timeout(EscalationPolicy::Notify(vec![
                NotificationTarget::Webhook {
                    url: format!("http://{addr}/hook"),
                },
            ]));
        let engine = Arc::new(engine_with(store.clone(), config));

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        let records = ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        assert_eq!(records.len(), 1);
        assert_eq!(records[0].action, EscalationAction::Notified(1));

        let bodies = received.lock().expect("recorder lock").clone();
        assert_eq!(bodies.len(), 1, "expected exactly one webhook delivery");
        assert_eq!(bodies[0]["step_name"], json!("prod-gate"));
        assert_eq!(bodies[0]["policy"], json!("notify"));
        assert!(
            bodies[0]["reason"]
                .as_str()
                .expect("reason is a string")
                .contains("600s"),
            "got {}",
            bodies[0]["reason"]
        );

        // The gate stays open and the timer is back in the future.
        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::AwaitingApproval);

        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.status.state, StepStatus::AwaitingApproval);
        assert!(gate.approval_deadline_at.expect("timer rearmed") > Utc::now());
        // A bare Notify repeats: the stage does not advance.
        assert_eq!(gate.approval_stage, 0);
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_escalate_reassigns_and_resets_timer() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(600)
            .assigned_to(Assignee::group("release-managers"))
            .on_timeout(EscalationPolicy::Escalate(Assignee::group("sre-oncall")));
        let engine = Arc::new(engine_with(store.clone(), config));

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        let records = ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        assert_eq!(records.len(), 1);
        assert_eq!(
            records[0].action,
            EscalationAction::Reassigned(Assignee::group("sre-oncall"))
        );

        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::AwaitingApproval);

        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.status.state, StepStatus::AwaitingApproval);
        assert_eq!(gate.approval_assignee, Some(Assignee::group("sre-oncall")));
        assert!(gate.approval_deadline_at.expect("timer rearmed") > Utc::now());
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_chain_runs_policies_in_order() {
    timeout(TEST_TIMEOUT, async {
        let (addr, received) = recording_server().await;
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(600)
            .on_timeout(EscalationPolicy::Chain(vec![
                EscalationPolicy::Notify(vec![NotificationTarget::Webhook {
                    url: format!("http://{addr}/hook"),
                }]),
                EscalationPolicy::AutoReject,
            ]));
        let engine = Arc::new(engine_with(store.clone(), config));
        let escalator = ApprovalEscalator::new(engine.clone());

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        // First expiry: notify and advance to the next link.
        let first = escalator.tick().await.expect("first tick");
        assert_eq!(first[0].action, EscalationAction::Notified(1));
        assert_eq!(first[0].stage, 0);

        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.approval_stage, 1);
        assert_eq!(gate.status.state, StepStatus::AwaitingApproval);
        assert_eq!(received.lock().expect("recorder lock").len(), 1);

        // Second expiry: the chain's terminal link rejects.
        expire_gate(&store, run_id).await;
        let second = escalator.tick().await.expect("second tick");
        assert_eq!(second[0].action, EscalationAction::Rejected);
        assert_eq!(second[0].stage, 1);

        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::Failed);
        assert_eq!(run.error.as_deref(), Some(APPROVAL_TIMEOUT_ERROR));
        // No extra notification for the terminal link.
        assert_eq!(received.lock().expect("recorder lock").len(), 1);
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_chain_exhausted_leaves_the_gate_open() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(600)
            .on_timeout(EscalationPolicy::Chain(vec![EscalationPolicy::Escalate(
                Assignee::group("sre-oncall"),
            )]));
        let engine = Arc::new(engine_with(store.clone(), config));
        let escalator = ApprovalEscalator::new(engine.clone());

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        escalator.tick().await.expect("first tick");
        expire_gate(&store, run_id).await;
        let second = escalator.tick().await.expect("second tick");

        assert_eq!(second[0].action, EscalationAction::Exhausted);

        // The gate is still open, with no timer left, and never auto-rejected.
        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::AwaitingApproval);
        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.status.state, StepStatus::AwaitingApproval);
        assert!(gate.approval_deadline_at.is_none());
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_without_deadline_never_fires() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let engine = Arc::new(engine_with(store.clone(), ApprovalConfig::new("Deploy?")));

        let run_id = suspended_run(&engine).await;
        let gate = gate_step(&store, run_id).await;
        assert!(gate.approval_deadline_at.is_none());

        let records = ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        assert!(records.is_empty());
        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::AwaitingApproval);
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_ignores_a_gate_approved_in_the_meantime() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(600)
            .on_timeout(EscalationPolicy::AutoReject);
        let engine = Arc::new(engine_with(store.clone(), config));

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        // A human approves between the deadline passing and the tick.
        store
            .update_run_status(run_id, RunStatus::Running)
            .await
            .expect("approve");

        let records = ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        assert_eq!(records.len(), 1);
        assert_eq!(records[0].action, EscalationAction::Stale);

        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::Running);
        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.status.state, StepStatus::AwaitingApproval);
        assert!(gate.error.is_none());
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_survives_a_restart() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(600)
            .on_timeout(EscalationPolicy::AutoReject);

        let run_id = {
            let engine = Arc::new(engine_with(store.clone(), config.clone()));
            let run_id = suspended_run(&engine).await;
            expire_gate(&store, run_id).await;
            run_id
            // The engine (and its escalator) go away here.
        };

        // A brand-new process over the same store still fires the timer.
        let engine = Arc::new(engine_with(store.clone(), config));
        let records = ApprovalEscalator::new(engine).tick().await.expect("tick");

        assert_eq!(records.len(), 1);
        assert_eq!(records[0].action, EscalationAction::Rejected);

        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::Failed);
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_legacy_timeout_seconds_auto_rejects() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?").with_timeout_seconds(3600);
        let engine = Arc::new(engine_with(store.clone(), config));

        let run_id = suspended_run(&engine).await;
        let step_id = expire_gate(&store, run_id).await;

        let records = ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        assert_eq!(records[0].action, EscalationAction::Rejected);
        assert!(
            records[0].reason.contains("3600s"),
            "got {}",
            records[0].reason
        );

        let gate = store.get_step(step_id).await.unwrap().unwrap();
        assert_eq!(gate.status.state, StepStatus::Failed);
        let run = store.get_run(run_id).await.unwrap().unwrap();
        assert_eq!(run.status.state, RunStatus::Failed);
    })
    .await
    .expect("test timed out");
}

#[tokio::test]
async fn approval_timeout_writes_an_audit_entry_with_the_reason() {
    timeout(TEST_TIMEOUT, async {
        let store = Arc::new(InMemoryStore::new());
        let config = ApprovalConfig::new("Deploy?")
            .with_deadline_secs(900)
            .on_timeout(EscalationPolicy::AutoReject);

        let store_dyn: Arc<dyn Store> = store.clone();
        let mut engine = Engine::new(store_dyn, provider());
        engine
            .register(GatedDeploy { config })
            .expect("register handler");
        engine.subscribe(AuditLogSubscriber::new(store.clone()), Event::ALL);
        let engine = Arc::new(engine);

        let run_id = suspended_run(&engine).await;
        expire_gate(&store, run_id).await;

        ApprovalEscalator::new(engine.clone())
            .tick()
            .await
            .expect("tick");

        // Subscribers run in spawned tasks; give them a turn to persist.
        tokio::task::yield_now().await;
        tokio::time::sleep(Duration::from_millis(50)).await;

        let page = store
            .list_audit_logs(
                AuditLogFilter {
                    event_type: Some(EventKind::ApprovalEscalated),
                    run_id: Some(run_id),
                    from: None,
                    to: None,
                },
                1,
                50,
            )
            .await
            .expect("list audit logs");

        assert_eq!(page.items.len(), 1, "expected one escalation audit entry");
        let entry = &page.items[0];
        assert_eq!(entry.event_type, EventKind::ApprovalEscalated);
        assert_eq!(entry.run_id, Some(run_id));
        assert!(entry.step_id.is_some());
        assert_eq!(entry.payload["action"], json!("rejected"));
        assert_eq!(entry.payload["policy"], json!("auto_reject"));
        assert!(
            entry.payload["reason"]
                .as_str()
                .expect("reason is a string")
                .contains("900s"),
            "got {}",
            entry.payload["reason"]
        );
    })
    .await
    .expect("test timed out");
}