From 85ddca5e7b6fa64d6f9e4cefad81aaed28958130 Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Fri, 4 Sep 2026 09:43:54 +0100 Subject: [PATCH] fix(maestro): assert on the git shim log, not a wall-clock budget a_session_without_a_worktree_costs_no_probe waited up to 5s for the watcher pass to run, using that wait's timeout panic as an implicit proxy for "no probe happened". Under a loaded full-workspace run the watcher task can be scheduled well past 5s, so the test flaked. Poll the shim log directly for A's probe instead of a derived snapshot state, and use the wait only as a 30s hang guard. The actual property - B was never probed - is asserted unconditionally on the log content, independent of timing. Fixes #173. --- crates/maestro-daemon/tests/blocked_work_cost.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/maestro-daemon/tests/blocked_work_cost.rs b/crates/maestro-daemon/tests/blocked_work_cost.rs index a04a923..81f19b2 100644 --- a/crates/maestro-daemon/tests/blocked_work_cost.rs +++ b/crates/maestro-daemon/tests/blocked_work_cost.rs @@ -14,7 +14,7 @@ use std::process::Command; use std::time::Duration; use common::{init_bare_repo, init_repo, push_all_to_origin, wait_for_async, DaemonFixture}; -use maestro_protocol::{CreateSessionRequest, InTheWay, WorktreeSpec}; +use maestro_protocol::{CreateSessionRequest, WorktreeSpec}; use tempfile::TempDir; fn request(cwd: &std::path::Path, repo: &std::path::Path, branch: &str) -> CreateSessionRequest { @@ -91,13 +91,12 @@ async fn a_session_without_a_worktree_costs_no_probe() { Duration::from_millis(100), ); - // The pass demonstrably runs and probed A's tree... - wait_for_async(Duration::from_secs(5), || async { - fx.manager - .snapshot() - .await - .iter() - .any(|s| s.worktree.is_some() && s.blocked_work == Some(InTheWay::default())) + // 30s is a hang guard only, not the property under test — that's the + // timing-free `contains` check below. + wait_for_async(Duration::from_secs(30), || async { + std::fs::read_to_string(&log_path) + .map(|calls| calls.contains(repo_a.path().to_str().unwrap())) + .unwrap_or(false) }) .await;