From e94ea4614792c99af93dcb94baf1b69e154b05fe Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Mon, 7 Sep 2026 22:19:11 +0800 Subject: [PATCH] test(scm): hold the graph idle test's daemon end open MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `&mut { _pane }` moved the pane's daemon-side handle into a temporary and dropped it at the end of the statement, closing the link a line after the `Cwd` was written into it. On Unix that is harmless: a closed `socketpair` half still hands the peer everything already queued. This module now runs on Windows, where the link is a loopback `TcpStream` and the pane has by then written its own `Resize` back — closing a socket with unread data on it is an abortive close, so the `Cwd` can be discarded with the connection. The test would not fail; `settle_graph` would spend its 30s deadline and return early, and the assertions would be skipped. Hold the handle for the life of the test, the way `file_tree`, `panel` and `detail` already hold theirs. --- src/ui/scm/graph.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ui/scm/graph.rs b/src/ui/scm/graph.rs index 99cdcb32..c0e4ea87 100644 --- a/src/ui/scm/graph.rs +++ b/src/ui/scm/graph.rs @@ -2286,9 +2286,16 @@ mod render_idle_gpui_tests { )); } - let (app, mut vcx, _pane) = test_window::harness_with_pane(cx); + // The daemon end is held for the life of the test, the way every other + // panel harness holds it. `&mut { _pane }` dropped it on the spot: on + // Unix a closed `socketpair` half still delivers the `Cwd` written a + // moment earlier, but on Windows the link is a loopback `TcpStream`, + // and closing one with the pane's own `Resize` sitting unread on it is + // an abortive close — the `Cwd` goes with the connection, and the test + // spends its 30s deadline waiting for a cwd that was thrown away. + let (app, mut vcx, mut pane) = test_window::harness_with_pane(cx); crate::daemon::protocol::DaemonMsg::Cwd(root.clone()) - .encode(&mut { _pane }) + .encode(&mut pane) .expect("the pane's socket takes the cwd"); app.update_in(&mut vcx, |app, _, cx| { app.right_panel_visible = true;