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
This commit is contained in:
Miguel Palhas
2026-08-24 22:03:56 +01:00
parent 766d256970
commit cfebfd441b
@@ -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);