From 08f5bbc0451a63b3d555544eb17557de7c09a931 Mon Sep 17 00:00:00 2001 From: naps62-yolo Date: Wed, 27 May 2026 07:38:07 +0000 Subject: [PATCH] test(maestro): fix borrow-after-partial-move in recover regression test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Capture sidecar_dir/fifo_dir/tmux/worktree_root before `drop(fx.manager)` so the post-drop builder calls don't need to reborrow the partially-moved fixture. Pure compile fix — same scenario as before. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../maestro-daemon/tests/session_manager.rs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/crates/maestro-daemon/tests/session_manager.rs b/crates/maestro-daemon/tests/session_manager.rs index c73c5cc..28f827b 100644 --- a/crates/maestro-daemon/tests/session_manager.rs +++ b/crates/maestro-daemon/tests/session_manager.rs @@ -130,19 +130,28 @@ async fn recover_re_pipes_pane_so_output_reaches_subscribers() { .await .expect("create"); - // Drop the original manager. The previous daemon's `pipe-pane` is still - // running against tmux, pointing at a FIFO no one reads now. + // Capture paths + tmux handle before dropping the original manager — + // `drop(fx.manager)` partially moves `fx` so we can't call its helpers + // afterwards. + let sidecar_dir = fx.sidecar_dir(); + let fifo_dir = fx.fifo_dir(); + let tmux = fx.tmux.tmux.clone(); + let worktree_root = fx.worktree_root.path().to_path_buf(); + + // Drop the original manager. Its PtyBridge closes the FIFO's only + // reader, so tmux's `cat >> fifo` writer hits SIGPIPE and exits — but + // tmux's pipe-pane bookkeeping still thinks the pane is piped. That's + // exactly the stale state recover() has to overwrite. drop(fx.manager); - let sidecar = maestro_daemon::sidecar::SidecarStore::new(fx.sidecar_dir()); - let worktree_mgr = - maestro_daemon::worktree::WorktreeManager::new(fx.worktree_root.path().to_path_buf()); + let sidecar = maestro_daemon::sidecar::SidecarStore::new(sidecar_dir); + let worktree_mgr = maestro_daemon::worktree::WorktreeManager::new(worktree_root); let revived = maestro_daemon::SessionManager::new( "laptop".to_string(), - fx.tmux.tmux.clone(), + tmux, sidecar, worktree_mgr, - fx.fifo_dir(), + fifo_dir, ); assert_eq!(revived.recover().await.expect("recover"), 1);