fix(daemon): address review findings

Idle paused loop no longer spins, local snapshots continue during network
backoff, debounce has a maximum wait, sync accepts non-canonical paths, removed
repos are dropped, socket dir mode is enforced. adopt_if_identical now skips
worktrees with staged changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Sonnet 5.5 committed 2026-11-16 13:05:38 +01:00
1 parent 3f5ef28503
commit 0e77dd26d9
6 files changed
+182 -18

No files matched your search

+37
View File
@@ -131,3 +131,40 @@ fn unreachable_remote_is_reported_but_local_snapshot_still_taken() {
assert!(!r.worktrees[0].errors.is_empty(), "push failure surfaced");
assert_eq!(r.worktrees[0].state, State::Dirty);
}
#[test]
fn staged_changes_block_adoption_so_the_index_is_never_reset() {
let base = tmpdir("staged");
let remote = base.join("r.git");
Git::new(&base)
.run(&[
"init",
"-q",
"--bare",
"-b",
"main",
remote.to_str().unwrap(),
])
.unwrap();
let seed = init(&base.join("seed"));
seed.run(&["remote", "add", "origin", remote.to_str().unwrap()])
.unwrap();
commit(&seed, "a.txt", "1\n");
seed.run(&["push", "-q", "-u", "origin", "main"]).unwrap();
let (ga, da) = clone(&base, &remote, "A");
let (_gb, db) = clone(&base, &remote, "B");
fs::write(da.join("a.txt"), "1\nwork\n").unwrap();
sync_repo(&da, &opts("A", "t1")).unwrap();
sync_repo(&db, &opts("B", "t2")).unwrap();
// B stages an intermediate version, then its worktree matches what A will commit.
let gb = Git::new(&db);
fs::write(db.join("a.txt"), "1\nstaged\n").unwrap();
gb.run(&["add", "a.txt"]).unwrap();
fs::write(db.join("a.txt"), "1\nwork\n").unwrap();
ga.run(&["add", "-A"]).unwrap();
ga.run(&["commit", "-qm", "work"]).unwrap();
ga.run(&["push", "-q"]).unwrap();
let r = sync_repo(&db, &opts("B", "t3")).unwrap();
assert_eq!(r.worktrees[0].state, State::BehindDirty);
assert_eq!(gb.run(&["show", ":a.txt"]).unwrap(), "1\nstaged");
}