| 429 | |
| 430 | #[tokio::test] |
| 431 | async fn phases_get_monotonic_indices() { |
| 432 | let wf = Workflow::builder(Arc::new(EchoExecutor::new())).build(); |
| 433 | let mut rx = wf.subscribe(); |
| 434 | wf.phase("one", vec![spec("a", "explore", "p")]).await; |
| 435 | wf.phase("two", vec![spec("b", "explore", "p")]).await; |
| 436 | |
| 437 | let indices: Vec<usize> = { |
| 438 | let mut seen = Vec::new(); |
| 439 | while let Ok(ev) = rx.try_recv() { |
| 440 | if let WorkflowEvent::PhaseStart { index, .. } = ev { |
| 441 | seen.push(index); |
| 442 | } |
| 443 | } |
| 444 | seen |
| 445 | }; |
| 446 | assert_eq!(indices, vec![0, 1], "phase indices increment per call"); |
| 447 | } |
| 448 | |
| 449 | #[tokio::test] |
| 450 | async fn phase_with_store_resumes_from_checkpoint() { |