From cfebfd441b19bc1ce7e75e69a8d03e92cc28d20e Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Mon, 24 Aug 2026 22:03:56 +0100 Subject: [PATCH] fix(maestro): wait for retained-store write in natural-exit test Dead status can be observed before the settle step's store write lands, so the test's store read raced the write under parallel load. Wait for the store to have the entry before asserting on it, same as the settle-state wait a few lines below. Fixes #111 --- crates/maestro-daemon/tests/session_manager.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/maestro-daemon/tests/session_manager.rs b/crates/maestro-daemon/tests/session_manager.rs index c90d9cc..e0ec6cf 100644 --- a/crates/maestro-daemon/tests/session_manager.rs +++ b/crates/maestro-daemon/tests/session_manager.rs @@ -769,6 +769,14 @@ async fn natural_exit_of_a_guarded_worktree_retains_it_in_the_store() { "a dirty worktree must be retained on natural exit" ); // ...in the store, under the exit reason. + // (`Dead` is observable a moment before the settle step's store write lands.) + wait_for_async(Duration::from_secs(3), || async { + fx.retained_store() + .load_all() + .map(|all| all.len() == 1) + .unwrap_or(false) + }) + .await; let all = fx.retained_store().load_all().expect("load_all"); assert_eq!(all.len(), 1); assert_eq!(all[0].path, wt_path);