From 3784e1533baaa5b97f7475c8849fdaf243bada23 Mon Sep 17 00:00:00 2001 From: Dasemu Date: Mon, 16 Nov 2026 18:13:22 +0100 Subject: [PATCH] docs: describe runtime rediscovery in the daemon Co-Authored-By: Claude Sonnet 5.5 --- docs/phase2.md | 4 ++-- docs/phase6.md | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/phase2.md b/docs/phase2.md index aaa58b0..5b3932d 100644 --- a/docs/phase2.md +++ b/docs/phase2.md @@ -59,7 +59,7 @@ socket is refused; a stale socket file left by a crash is replaced. JSON lines in `/activity.jsonl` (rotated at 5 MiB to `.jsonl.1`), the last 500 events in memory, and live via `subscribe`. Kinds: `start`, `stop`, `snapshot`, `fast_forward`, `applied`, -`declined`, `snapshots_withheld`, `snapshots_enabled`, `snapshots_purged`, `state` (worktree state changed), `materialized`, `archived`, `error`, `watch_error`, +`declined`, `snapshots_withheld`, `snapshots_enabled`, `snapshots_purged`, `state` (worktree state changed), `materialized`, `archived`, `repo_added`, `repo_removed`, `error`, `watch_error`, `pause`, `resume`. ## CLI @@ -99,6 +99,6 @@ discard the staged version). - Peer-credential check on the socket: access control is the 0700 directory only. - GUI/tray (Phase 3), providers and wizards (Phase 4). - Remote-change notifications (webhooks); only polling at `fetch_interval_s`. -- Config reload: restart the daemon after editing `config.toml`. +- Config reload: restart the daemon after editing `config.toml`. (Repos added, migrated or removed under the configured groups are picked up at runtime; see `docs/phase6.md`.) - Watching skips no heavy ignored directories (`node_modules`, `target`) at watch time; add them to `sync.ignore_extra` to avoid triggering passes, and raise the inotify limit if needed. diff --git a/docs/phase6.md b/docs/phase6.md index 5f5a3e6..c01ef27 100644 --- a/docs/phase6.md +++ b/docs/phase6.md @@ -74,6 +74,28 @@ groups, repos directly under the root. Ignored plain clones inside a configured "not migrated (run grove add)" by `grove daemon status` and `grove doctor`. Discovery reads one directory per configured group, so it stays cheap. +### Rediscovery at runtime + +Discovery is not startup-only. The daemon watches (non-recursively) the root, each configured group +directory and every child directory that is not managed yet; managed repos keep their recursive +watch. A child directory created, deleted or renamed, or `.bare` / `.git` appearing or disappearing +inside one (`grove add` migrating a clone, `grove import` cloning into `//.bare`, +a clone moved to the trash) triggers a debounced (500 ms) rediscovery and diff: + +- New bare-layout repos are managed at once: watches set up, a pass scheduled, activity event + `repo_added`. +- Repos that are gone (or no longer bare layout) are dropped with their watches and state, one + `repo_removed` event, no error; their files are never touched. A repo whose directory vanishes + while a pass runs is dropped the same way. +- The "not migrated" list is refreshed. + +As a safety net every full pass (every `fetch_interval_s`) re-runs discovery too, so missed +inotify events delay detection by at most that interval. `grove daemon status` reflects the new set +right after rediscovery, also while paused (discovery runs while paused, syncing does not). + +Config reload is still out of scope: restart the daemon after editing `config.toml` (new or removed +groups are only picked up then). + **Breaking change:** group names must now be plain directory names (non-empty, no `/`, no leading `.`); a config with other names no longer loads.