diff --git a/crates/maestro-daemon/src/gitroot.rs b/crates/maestro-daemon/src/gitroot.rs index f12d9be..e2c8fb4 100644 --- a/crates/maestro-daemon/src/gitroot.rs +++ b/crates/maestro-daemon/src/gitroot.rs @@ -80,24 +80,21 @@ mod tests { } #[test] - fn non_repo_dir_is_none() { - // A temp dir with no `.git` anywhere up the chain. We need a path whose - // *entire* ancestor chain is `.git`-free, but `/tmp` itself may live - // inside a repo (CI containers, sandbox VMs). Work around this by - // creating a tmpfs-like isolated root via an in-memory mount when - // possible, or — more portably — by asserting the result is NOT inside - // the temp dir we control rather than asserting None outright. + fn non_repo_dir_does_not_find_root_inside_fixture() { + // The fixture has no `.git`, so `find_root` must not return a path + // inside it. On hosts where an ancestor of the temp dir *is* a repo + // (e.g. `/tmp` lives inside a checkout), the function legitimately + // returns that ancestor — the test only asserts the fixture itself + // was not mistaken for a repo. let tmp = tempfile::tempdir().unwrap(); let sub = tmp.path().join("plain/dir"); fs::create_dir_all(&sub).unwrap(); - // If an ancestor of /tmp has .git, find_root will return that — but it - // must never return anything at or below our tempdir. - let result = find_root(&sub); - if let Some(ref root) = result { - assert!( + match find_root(&sub) { + None => {} // expected on most hosts + Some(root) => assert!( !root.starts_with(tmp.path()), - "find_root returned {root:?} which is inside our .git-free tempdir", - ); + "found .git inside the fixture at {root:?}, but none was created" + ), } } diff --git a/crates/maestro-daemon/src/session.rs b/crates/maestro-daemon/src/session.rs index b16d935..5c01779 100644 --- a/crates/maestro-daemon/src/session.rs +++ b/crates/maestro-daemon/src/session.rs @@ -805,6 +805,10 @@ impl SessionManager { }); drop(stream); sync_structured_activity(&self.inner, id).await; + #[cfg(feature = "haiku-autoname")] + if let Ok(true) = self.claim_autoname(id).await { + crate::autoname::spawn_naming(self.clone(), id, text); + } return Ok(QueueAcpPrompt::Queued); } Err(message) => { diff --git a/crates/maestro-daemon/tests/local_api.rs b/crates/maestro-daemon/tests/local_api.rs index 9ff7ce6..90a1855 100644 --- a/crates/maestro-daemon/tests/local_api.rs +++ b/crates/maestro-daemon/tests/local_api.rs @@ -1020,12 +1020,15 @@ async fn gitroot_probes_path() { .json() .await .unwrap(); - if let Some(serde_json::Value::String(root)) = resp.get("root") { - let root = std::path::Path::new(root); - assert!( - !root.starts_with(tmp.path()), - "gitroot returned {root:?} inside our .git-free tempdir", - ); + // On hosts where an ancestor of the temp dir is a repo (e.g. `/tmp` + // inside a checkout), the root legitimately points there. The test only + // asserts no root was found *inside* the temp dir. + match resp.get("root").and_then(|v| v.as_str()) { + None => {} + Some(root) => assert!( + !root.starts_with(tmp.path().to_string_lossy().as_ref()), + "found a repo root inside the fixture at {root:?}" + ), } }