From 780077ccc0054b953fc0438d4d6fd84f7a74b78e Mon Sep 17 00:00:00 2001 From: Savin Angel-Mario Date: Mon, 2 Nov 2026 01:31:59 +0200 Subject: [PATCH] Wait for the pane to settle before the worktree test reads its grid The shell panel eases open over 180 ms of real time, so the pane kept shrinking after the test read its terminal grid. On a fast machine the test saw 39 rows and then 36 and failed with "the skeleton is on another grid". It now waits until the grid holds still for one full open duration before reading it. --- src/app/headless.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/headless.rs b/src/app/headless.rs index 1eaa57b..9a101c6 100644 --- a/src/app/headless.rs +++ b/src/app/headless.rs @@ -1327,6 +1327,16 @@ fn switching_between_worktrees_in_the_workspace() { }); let shell = |ws: &Workspace| ws.shells.get(&id).map(|p| (p.view.entity_id(), p.open, p.height)); let (shell_before, ..) = ws.read_with(&cx, |ws, _| shell(ws)).unwrap(); + // The panels ease open over `Reveal::MS` of real time, so the pane's grid keeps changing for that long; how far + // it has got depends on how fast the machine ran the steps above. The grid read below must be the settled one. + let pane_grid = |cx: &mut TestAppContext| ws.read_with(cx, |ws, app| ws.live_view(&session.id).map(|v| v.read(app).terminal.size())); + let mut last = None; + while last != Some(pane_grid(&mut cx)) { + last = Some(pane_grid(&mut cx)); + std::thread::sleep(Duration::from_millis(crate::panels::widgets::Reveal::MS as u64 + 20)); + cx.update_window(window, |_, window, app| window.draw(app).clear(app)).unwrap(); + cx.run_until_parked(); + } // A bad name keeps the dialog open; a typed one moves the session into the worktree Claude Code will make. step(&mut cx, &|ws, w, cx| ws.act(Act::NewWorktree(repo_dir.clone()), w, cx));