diff --git a/cmd/bd/backup_export.go b/cmd/bd/backup_export.go index 667fb365b..bb2999305 100644 --- a/cmd/bd/backup_export.go +++ b/cmd/bd/backup_export.go @@ -152,7 +152,6 @@ func runBackupExport(ctx context.Context, force bool) (*backupState, error) { // Export issues only — wisps are ephemeral and excluded from backup. // They can be regenerated from the database if needed for disaster recovery. - // (The daemon's JSONL git backup in jsonl_git_backup.go follows the same pattern.) n, err := exportTable(ctx, store, dir, "issues.jsonl", "SELECT * FROM issues ORDER BY id") if err != nil { return nil, fmt.Errorf("backup issues: %w", err) diff --git a/cmd/bd/cli_coverage_show_test.go b/cmd/bd/cli_coverage_show_test.go index 06e17c76b..7cfe396f8 100644 --- a/cmd/bd/cli_coverage_show_test.go +++ b/cmd/bd/cli_coverage_show_test.go @@ -40,17 +40,6 @@ func runBDForCoverage(t *testing.T, dir string, args ...string) (stdout string, os.Stdout = wOut os.Stderr = wErr - // Ensure direct mode. - oldNoDaemon, noDaemonWasSet := os.LookupEnv("BEADS_NO_DAEMON") - os.Setenv("BEADS_NO_DAEMON", "1") - defer func() { - if noDaemonWasSet { - _ = os.Setenv("BEADS_NO_DAEMON", oldNoDaemon) - } else { - os.Unsetenv("BEADS_NO_DAEMON") - } - }() - // Mark tests explicitly. oldTestMode, testModeWasSet := os.LookupEnv("BEADS_TEST_MODE") os.Setenv("BEADS_TEST_MODE", "1") diff --git a/cmd/bd/close.go b/cmd/bd/close.go index 84b9e99cc..9317d374c 100644 --- a/cmd/bd/close.go +++ b/cmd/bd/close.go @@ -85,7 +85,7 @@ create, update, show, or close operation).`, // Resolve partial IDs first, handling cross-rig routing var resolvedIDs []string - var routedArgs []string // IDs that need cross-repo routing (bypass daemon) + var routedArgs []string // IDs that need cross-repo routing // Direct mode - check routing for each ID for _, id := range args { if needsRouting(id) { diff --git a/cmd/bd/create.go b/cmd/bd/create.go index 720f410f3..2df4cfdc7 100644 --- a/cmd/bd/create.go +++ b/cmd/bd/create.go @@ -749,7 +749,7 @@ var createCmd = &cobra.Command{ } // If issue was routed to a different repo, commit pending changes. - // Push is NOT done here — the daemon handles periodic pushes to + // Push is NOT done here — periodic sync handles pushes to // DoltHub remotes. Per-create pushes caused 22GB of git-remote-cache // bloat with dozens of agents creating wisps constantly (hq-glw). if repoPath != "." && targetStore != nil { diff --git a/cmd/bd/dep.go b/cmd/bd/dep.go index f6ba43941..0b6fcd3e3 100644 --- a/cmd/bd/dep.go +++ b/cmd/bd/dep.go @@ -158,7 +158,7 @@ Examples: FatalErrorRespectJSON("%v", err) } - // Check for cycles after adding dependency (both daemon and direct mode) + // Check for cycles after adding dependency warnIfCyclesExist(fromStore) if jsonOutput { diff --git a/cmd/bd/doctor_repair_chaos_test.go b/cmd/bd/doctor_repair_chaos_test.go index ad66cb83a..9d0eb59e8 100644 --- a/cmd/bd/doctor_repair_chaos_test.go +++ b/cmd/bd/doctor_repair_chaos_test.go @@ -9,7 +9,6 @@ import ( "os" "os/exec" "path/filepath" - "strings" "testing" "time" ) @@ -50,15 +49,7 @@ func startDaemonForChaosTest(t *testing.T, bdExe, ws, dbPath string) *exec.Cmd { cmd.Stdout = &stdout cmd.Stderr = &stderr - // Inherit environment, but explicitly ensure daemon mode is allowed. - env := make([]string, 0, len(os.Environ())+1) - for _, e := range os.Environ() { - if strings.HasPrefix(e, "BEADS_NO_DAEMON=") { - continue - } - env = append(env, e) - } - cmd.Env = env + cmd.Env = os.Environ() if err := cmd.Start(); err != nil { t.Fatalf("start daemon: %v", err) @@ -90,7 +81,6 @@ func runBDWithEnv(ctx context.Context, exe, dir, dbPath string, env map[string]s cmd := exec.CommandContext(ctx, exe, fullArgs...) cmd.Dir = dir cmd.Env = append(os.Environ(), - "BEADS_NO_DAEMON=1", "BEADS_DIR="+filepath.Join(dir, ".beads"), ) for k, v := range env { diff --git a/cmd/bd/doctor_repair_test.go b/cmd/bd/doctor_repair_test.go index f77c1e964..de941da0f 100644 --- a/cmd/bd/doctor_repair_test.go +++ b/cmd/bd/doctor_repair_test.go @@ -47,7 +47,6 @@ func runBDSideDB(t *testing.T, exe, dir, dbPath string, args ...string) (string, cmd := exec.Command(exe, fullArgs...) cmd.Dir = dir cmd.Env = append(os.Environ(), - "BEADS_NO_DAEMON=1", "BEADS_DIR="+filepath.Join(dir, ".beads"), ) out, err := cmd.CombinedOutput() diff --git a/cmd/bd/dolt_autocommit_integration_test.go b/cmd/bd/dolt_autocommit_integration_test.go index 687fe4b62..6a5c9e6cb 100644 --- a/cmd/bd/dolt_autocommit_integration_test.go +++ b/cmd/bd/dolt_autocommit_integration_test.go @@ -109,7 +109,6 @@ func TestDoltAutoCommit_On_WritesAdvanceHead(t *testing.T) { env := []string{ "BEADS_TEST_MODE=1", - "BEADS_NO_DAEMON=1", } initOut, initErr := runBDExecAllowErrorWithEnv(t, tmpDir, env, "init", "--backend", "dolt", "--prefix", "test", "--quiet") @@ -171,7 +170,6 @@ func TestDoltAutoCommit_Batch_DefersCommit(t *testing.T) { env := []string{ "BEADS_TEST_MODE=1", - "BEADS_NO_DAEMON=1", } initOut, initErr := runBDExecAllowErrorWithEnv(t, tmpDir, env, "init", "--backend", "dolt", "--prefix", "test", "--quiet") @@ -231,7 +229,6 @@ func TestDoltAutoCommit_Off_DoesNotAdvanceHead(t *testing.T) { env := []string{ "BEADS_TEST_MODE=1", - "BEADS_NO_DAEMON=1", } initOut, initErr := runBDExecAllowErrorWithEnv(t, tmpDir, env, "init", "--backend", "dolt", "--prefix", "test", "--quiet") diff --git a/cmd/bd/dolt_doctor_integration_test.go b/cmd/bd/dolt_doctor_integration_test.go index 1a99d6f1f..89607e687 100644 --- a/cmd/bd/dolt_doctor_integration_test.go +++ b/cmd/bd/dolt_doctor_integration_test.go @@ -8,7 +8,6 @@ import ( "runtime" "strings" "testing" - "time" ) func TestDoltDoctor_NoSQLiteWarningsAfterInitAndCreate(t *testing.T) { @@ -28,12 +27,8 @@ func TestDoltDoctor_NoSQLiteWarningsAfterInitAndCreate(t *testing.T) { _ = runCommandInDir(tmpDir, "git", "config", "user.email", "test@example.com") _ = runCommandInDir(tmpDir, "git", "config", "user.name", "Test User") - socketPath := filepath.Join(tmpDir, ".beads", "bd.sock") env := []string{ "BEADS_TEST_MODE=1", - "BEADS_AUTO_START_DAEMON=true", - "BEADS_NO_DAEMON=0", - "BD_SOCKET=" + socketPath, } // Init dolt backend. @@ -47,16 +42,6 @@ func TestDoltDoctor_NoSQLiteWarningsAfterInitAndCreate(t *testing.T) { t.Fatalf("bd init --backend dolt failed: %v\n%s", initErr, initOut) } - // Ensure daemon cleanup so temp dir removal doesn't flake. - t.Cleanup(func() { - _, _ = runBDExecAllowErrorWithEnv(t, tmpDir, env, "daemon", "stop") - sockPath := filepath.Join(tmpDir, ".beads", "bd.sock") - waitFor(t, 2*time.Second, 50*time.Millisecond, func() bool { - _, err := os.Stat(sockPath) - return os.IsNotExist(err) - }) - }) - // Create one issue so the store is definitely initialized. createOut, createErr := runBDExecAllowErrorWithEnv(t, tmpDir, env, "create", "doctor dolt smoke", "--json") if createErr != nil { diff --git a/cmd/bd/dolt_metadata_e2e_test.go b/cmd/bd/dolt_metadata_e2e_test.go index 1bec68f11..0b2e2eb1b 100644 --- a/cmd/bd/dolt_metadata_e2e_test.go +++ b/cmd/bd/dolt_metadata_e2e_test.go @@ -8,7 +8,6 @@ import ( "runtime" "strings" "testing" - "time" ) // TestE2E_InitDoltMetadataRoundtrip verifies that bd init --backend dolt writes @@ -32,12 +31,8 @@ func TestE2E_InitDoltMetadataRoundtrip(t *testing.T) { _ = runCommandInDir(tmpDir, "git", "config", "user.name", "Test User") _ = runCommandInDir(tmpDir, "git", "config", "remote.origin.url", "https://github.com/test/repo.git") - socketPath := filepath.Join(tmpDir, ".beads", "bd.sock") env := append(os.Environ(), "BEADS_TEST_MODE=1", - "BEADS_AUTO_START_DAEMON=true", - "BEADS_NO_DAEMON=0", - "BD_SOCKET="+socketPath, ) // Init dolt backend @@ -50,16 +45,6 @@ func TestE2E_InitDoltMetadataRoundtrip(t *testing.T) { t.Fatalf("bd init --backend dolt failed: %v\n%s", initErr, initOut) } - // Ensure daemon cleanup - t.Cleanup(func() { - _, _ = runBDExecAllowErrorWithEnv(t, tmpDir, env, "daemon", "stop") - sockPath := filepath.Join(tmpDir, ".beads", "bd.sock") - waitFor(t, 2*time.Second, 50*time.Millisecond, func() bool { - _, err := os.Stat(sockPath) - return os.IsNotExist(err) - }) - }) - // Run doctor and verify no metadata warnings doctorOut, _ := runBDExecAllowErrorWithEnv(t, tmpDir, env, "doctor") @@ -109,12 +94,8 @@ func TestE2E_DoctorFixMetadataRoundtrip(t *testing.T) { _ = runCommandInDir(tmpDir, "git", "config", "user.name", "Test User") _ = runCommandInDir(tmpDir, "git", "config", "remote.origin.url", "https://github.com/test/repo.git") - socketPath := filepath.Join(tmpDir, ".beads", "bd.sock") env := append(os.Environ(), "BEADS_TEST_MODE=1", - "BEADS_AUTO_START_DAEMON=true", - "BEADS_NO_DAEMON=0", - "BD_SOCKET="+socketPath, ) // Init dolt backend (which now writes metadata via Phase 1) @@ -127,16 +108,6 @@ func TestE2E_DoctorFixMetadataRoundtrip(t *testing.T) { t.Fatalf("bd init --backend dolt failed: %v\n%s", initErr, initOut) } - // Ensure daemon cleanup - t.Cleanup(func() { - _, _ = runBDExecAllowErrorWithEnv(t, tmpDir, env, "daemon", "stop") - sockPath := filepath.Join(tmpDir, ".beads", "bd.sock") - waitFor(t, 2*time.Second, 50*time.Millisecond, func() bool { - _, err := os.Stat(sockPath) - return os.IsNotExist(err) - }) - }) - // Delete metadata to simulate a pre-Phase-1 database sqlOut, sqlErr := runBDExecAllowErrorWithEnv(t, tmpDir, env, "sql", "DELETE FROM metadata WHERE key IN ('bd_version', 'repo_id', 'clone_id')") @@ -192,12 +163,8 @@ func TestE2E_MigrateDoltMetadata(t *testing.T) { _ = runCommandInDir(tmpDir, "git", "config", "user.name", "Test User") _ = runCommandInDir(tmpDir, "git", "config", "remote.origin.url", "https://github.com/test/repo.git") - socketPath := filepath.Join(tmpDir, ".beads", "bd.sock") env := append(os.Environ(), "BEADS_TEST_MODE=1", - "BEADS_AUTO_START_DAEMON=true", - "BEADS_NO_DAEMON=0", - "BD_SOCKET="+socketPath, ) // Init dolt backend (writes all metadata via Phase 1) @@ -210,16 +177,6 @@ func TestE2E_MigrateDoltMetadata(t *testing.T) { t.Fatalf("bd init --backend dolt failed: %v\n%s", initErr, initOut) } - // Ensure daemon cleanup - t.Cleanup(func() { - _, _ = runBDExecAllowErrorWithEnv(t, tmpDir, env, "daemon", "stop") - sockPath := filepath.Join(tmpDir, ".beads", "bd.sock") - waitFor(t, 2*time.Second, 50*time.Millisecond, func() bool { - _, err := os.Stat(sockPath) - return os.IsNotExist(err) - }) - }) - // Delete repo_id and clone_id to simulate a pre-Phase-3 database // (bd_version is set by init, but identity fields are missing) sqlOut, sqlErr := runBDExecAllowErrorWithEnv(t, tmpDir, env, "sql", diff --git a/cmd/bd/init_cancel_e2e_test.go b/cmd/bd/init_cancel_e2e_test.go index 8a6a65781..2cd0ba656 100644 --- a/cmd/bd/init_cancel_e2e_test.go +++ b/cmd/bd/init_cancel_e2e_test.go @@ -43,9 +43,8 @@ func TestInitCancel_E2E(t *testing.T) { cmd.Stdin = stdinR cmd.Stdout = stdoutW cmd.Stderr = stdoutW - cmd.Env = append(filteredEnv("BEADS_DB", "BEADS_DIR", "BEADS_NO_DAEMON", "HOME", "XDG_CONFIG_HOME"), + cmd.Env = append(filteredEnv("BEADS_DB", "BEADS_DIR", "HOME", "XDG_CONFIG_HOME"), "BEADS_DB=", - "BEADS_NO_DAEMON=1", "HOME="+tmpDir, "XDG_CONFIG_HOME="+filepath.Join(tmpDir, "xdg-config"), ) diff --git a/cmd/bd/init_test.go b/cmd/bd/init_test.go index bc001c9e7..c6cee75b9 100644 --- a/cmd/bd/init_test.go +++ b/cmd/bd/init_test.go @@ -155,8 +155,6 @@ func TestInitCommand(t *testing.T) { "*.db-journal", "*.db-wal", "*.db-shm", - "daemon.log", - "daemon.pid", "bd.sock", "dolt/", "dolt-access.lock", @@ -1697,7 +1695,7 @@ func TestInitDatabaseFlag(t *testing.T) { // Run init with --database to specify a pre-existing database name cmd := exec.Command(bd, "init", "--database", "myapp_production", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("bd init --database failed: %v\n%s", err, out) @@ -1728,7 +1726,7 @@ func TestInitDatabaseFlag(t *testing.T) { // --database should override prefix for DB name, but prefix still sets issue_prefix cmd := exec.Command(bd, "init", "--database", "shared_db", "--prefix", "team-alpha", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("bd init --database --prefix failed: %v\n%s", err, out) @@ -1774,7 +1772,7 @@ func TestInitDatabaseFlag(t *testing.T) { // Run init with --database cmd := exec.Command(bd, "init", "--database", "test_server_cfg", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("bd init --database failed: %v\n%s", err, out) @@ -1807,7 +1805,7 @@ func TestInitDatabaseFlag(t *testing.T) { // Run init with an invalid database name (contains semicolon = SQL injection) cmd := exec.Command(bd, "init", "--database", "bad;name", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err == nil { t.Fatal("Expected error for invalid database name, but command succeeded") @@ -1831,7 +1829,7 @@ func TestInitDatabaseFlag(t *testing.T) { // Database name with spaces should fail validation cmd := exec.Command(bd, "init", "--database", "my database", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err == nil { t.Fatal("Expected error for database name with spaces, but command succeeded") @@ -1849,7 +1847,7 @@ func TestInitDatabaseFlag(t *testing.T) { // Database name with backtick injection should fail validation cmd := exec.Command(bd, "init", "--database", "db`; DROP DATABASE x; --", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err == nil { t.Fatal("Expected error for database name with backtick injection, but command succeeded") @@ -1870,7 +1868,7 @@ func TestInitBackendFlag(t *testing.T) { cmd := exec.Command(bd, "init", "--backend", "sqlite", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err == nil { t.Fatal("Expected non-zero exit for --backend=sqlite, but command succeeded") @@ -1899,7 +1897,7 @@ func TestInitBackendFlag(t *testing.T) { cmd := exec.Command(bd, "init", "--backend", "postgres", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err == nil { t.Fatal("Expected non-zero exit for --backend=postgres, but command succeeded") @@ -1917,7 +1915,7 @@ func TestInitBackendFlag(t *testing.T) { cmd := exec.Command(bd, "init", "--backend", "dolt", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("bd init --backend=dolt should succeed: %v\n%s", err, out) @@ -1930,7 +1928,7 @@ func TestInitBackendFlag(t *testing.T) { cmd := exec.Command(bd, "init", "--quiet") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("bd init should default to dolt: %v\n%s", err, out) diff --git a/cmd/bd/list.go b/cmd/bd/list.go index e7ee10785..99002f638 100644 --- a/cmd/bd/list.go +++ b/cmd/bd/list.go @@ -21,10 +21,10 @@ import ( "github.com/steveyegge/beads/internal/validation" ) -// storageExecutor handles operations that need to work with both direct store and daemon mode +// storageExecutor handles operations that need a store connection type storageExecutor func(store *dolt.DoltStore) error -// withStorage executes an operation with either the direct store or a read-only store in daemon mode +// withStorage executes an operation with either the direct store or a read-only store func withStorage(ctx context.Context, store *dolt.DoltStore, dbPath string, fn storageExecutor) error { if store != nil { return fn(store) diff --git a/cmd/bd/main_errors.go b/cmd/bd/main_errors.go index 63238754b..1bb3786ad 100644 --- a/cmd/bd/main_errors.go +++ b/cmd/bd/main_errors.go @@ -38,7 +38,7 @@ func handleFreshCloneError(err error) bool { } // isWispOperation returns true if the command operates on ephemeral wisps. -// Wisp operations auto-bypass the daemon because wisps are local-only. +// Wisp operations use direct store access (local-only). // Detects: // - mol wisp subcommands (create, list, gc, or direct proto invocation) // - mol burn (only operates on wisps) diff --git a/cmd/bd/mol_burn.go b/cmd/bd/mol_burn.go index 9de273727..be1c33926 100644 --- a/cmd/bd/mol_burn.go +++ b/cmd/bd/mol_burn.go @@ -58,7 +58,7 @@ func runMolBurn(cmd *cobra.Command, args []string) { ctx := rootCtx - // mol burn requires direct store access (daemon auto-bypassed for wisp ops) + // mol burn requires direct store access if store == nil { FatalErrorWithHint("no database connection", "run 'bd init' or 'bd import' to initialize the database") } diff --git a/cmd/bd/mol_squash.go b/cmd/bd/mol_squash.go index 70da84bd0..20aab48d3 100644 --- a/cmd/bd/mol_squash.go +++ b/cmd/bd/mol_squash.go @@ -65,7 +65,7 @@ func runMolSquash(cmd *cobra.Command, args []string) { ctx := rootCtx - // mol squash requires direct store access (daemon auto-bypassed for wisp ops) + // mol squash requires direct store access if store == nil { FatalErrorWithHint("no database connection", "run 'bd init' or 'bd import' to initialize the database") } diff --git a/cmd/bd/protocol/helpers_test.go b/cmd/bd/protocol/helpers_test.go index f70830c55..027eb4ca2 100644 --- a/cmd/bd/protocol/helpers_test.go +++ b/cmd/bd/protocol/helpers_test.go @@ -186,7 +186,6 @@ func (w *workspace) env() []string { env := []string{ "PATH=" + os.Getenv("PATH"), "HOME=" + w.dir, - "BEADS_NO_DAEMON=1", "GIT_CONFIG_NOSYSTEM=1", "BEADS_TEST_MODE=1", } diff --git a/cmd/bd/reopen_defer_test.go b/cmd/bd/reopen_defer_test.go index 45a5ebb86..a31192c70 100644 --- a/cmd/bd/reopen_defer_test.go +++ b/cmd/bd/reopen_defer_test.go @@ -26,7 +26,7 @@ func TestCLI_ReopenClearsDeferUntil(t *testing.T) { // Defer the issue to far future cmd := exec.Command(testBD, "update", id, "--defer", "+8760h") // 1 year cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() if out, err := cmd.CombinedOutput(); err != nil { t.Fatalf("defer failed: %v\n%s", err, out) } @@ -34,7 +34,7 @@ func TestCLI_ReopenClearsDeferUntil(t *testing.T) { // Close it cmd = exec.Command(testBD, "close", id) cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() if out, err := cmd.CombinedOutput(); err != nil { t.Fatalf("close failed: %v\n%s", err, out) } @@ -42,7 +42,7 @@ func TestCLI_ReopenClearsDeferUntil(t *testing.T) { // Reopen it cmd = exec.Command(testBD, "reopen", id) cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() if out, err := cmd.CombinedOutput(); err != nil { t.Fatalf("reopen failed: %v\n%s", err, out) } @@ -50,7 +50,7 @@ func TestCLI_ReopenClearsDeferUntil(t *testing.T) { // Verify defer_until is cleared cmd = exec.Command(testBD, "show", id, "--json") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("show failed: %v\n%s", err, out) diff --git a/cmd/bd/reparent_test.go b/cmd/bd/reparent_test.go index cfdd2ff36..683d4e7b7 100644 --- a/cmd/bd/reparent_test.go +++ b/cmd/bd/reparent_test.go @@ -62,7 +62,7 @@ func createExecTestIssueWithID(t *testing.T, tmpDir, title, id string) string { t.Helper() cmd := exec.Command(testBD, "create", title, "-p", "1", "--id", id, "--json") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("create with --id %s failed: %v\n%s", id, err, out) @@ -83,7 +83,7 @@ func runBD(t *testing.T, tmpDir string, args ...string) []byte { t.Helper() cmd := exec.Command(testBD, args...) cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { t.Fatalf("bd %s failed: %v\n%s", strings.Join(args, " "), err, out) @@ -96,7 +96,7 @@ func assertParentLists(t *testing.T, tmpDir, parentID, childID string, shouldApp t.Helper() cmd := exec.Command(testBD, "list", "--parent", parentID, "--json") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err != nil { if shouldAppear { diff --git a/cmd/bd/repo.go b/cmd/bd/repo.go index 5fc1bb196..ee1a6aba6 100644 --- a/cmd/bd/repo.go +++ b/cmd/bd/repo.go @@ -312,7 +312,7 @@ Also triggers Dolt push/pull if a remote is configured.`, } } - // Push is handled by daemon periodic task, not per-operation. + // Push is handled by periodic sync, not per-operation. // Manual push available via: bd dolt push if jsonOutput { diff --git a/cmd/bd/routed.go b/cmd/bd/routed.go index e73eb7521..8558eee7e 100644 --- a/cmd/bd/routed.go +++ b/cmd/bd/routed.go @@ -263,7 +263,7 @@ func getRoutedStoreForID(ctx context.Context, id string) (*routing.RoutedStorage } // needsRouting checks if an ID would be routed to a different beads directory. -// This is used to decide whether to bypass the daemon for cross-repo lookups. +// This is used to decide whether to use direct store access for cross-repo lookups. func needsRouting(id string) bool { if dbPath == "" || beadsDirOverride() { return false diff --git a/cmd/bd/test_repo_beads_guard_test.go b/cmd/bd/test_repo_beads_guard_test.go index b4f328624..fdb19e8af 100644 --- a/cmd/bd/test_repo_beads_guard_test.go +++ b/cmd/bd/test_repo_beads_guard_test.go @@ -7,7 +7,6 @@ import ( "path/filepath" "strings" "testing" - "time" "github.com/steveyegge/beads/internal/config" ) @@ -64,19 +63,6 @@ func testMainInner(m *testing.M) int { // which raced under t.Parallel(). _ = os.Setenv("BEADS_TEST_MODE", "1") - // Prevent daemon auto-start and ensure tests don't interact with any running daemon. - // This prevents false positives in the test guard when a background daemon touches - // .beads files (like issues.jsonl via auto-sync) during test execution. - origNoDaemon := os.Getenv("BEADS_NO_DAEMON") - os.Setenv("BEADS_NO_DAEMON", "1") - defer func() { - if origNoDaemon != "" { - os.Setenv("BEADS_NO_DAEMON", origNoDaemon) - } else { - os.Unsetenv("BEADS_NO_DAEMON") - } - }() - // Clear BEADS_DIR to prevent tests from accidentally picking up the project's // .beads directory via git repo detection when there's a redirect file. // Each test that needs a .beads directory should set BEADS_DIR explicitly. @@ -101,13 +87,8 @@ func testMainInner(m *testing.M) int { return m.Run() } - // Stop any running daemon for this repo to prevent false positives in the guard. - // The daemon auto-syncs and touches files like issues.jsonl, which would trigger - // the guard even though tests didn't cause the change. repoRoot := findRepoRootFrom(origWD) - if repoRoot != "" { - stopRepoDaemon(repoRoot) - } else { + if repoRoot == "" { return m.Run() } @@ -127,9 +108,6 @@ func testMainInner(m *testing.M) int { // interactions.jsonl excluded: legitimately created by init during tests "deletions.jsonl", "molecules.jsonl", - "daemon.lock", - "daemon.pid", - "bd.sock", } before := snapshotFiles(repoBeadsDir, watch) @@ -208,34 +186,3 @@ func findRepoRootFrom(wd string) string { } return "" } - -// stopRepoDaemon stops any running daemon for the given repository. -// This prevents false positives in the test guard when a background daemon -// touches .beads files during test execution. Uses exec to avoid import cycles. -func stopRepoDaemon(repoRoot string) { - beadsDir := filepath.Join(repoRoot, ".beads") - socketPath := filepath.Join(beadsDir, "bd.sock") - - // Check if socket exists (quick check before shelling out) - if _, err := os.Stat(socketPath); err != nil { - return // no daemon running - } - - // Shell out to bd daemon stop. We can't call the daemon functions directly - // from TestMain because they have complex dependencies. Using exec is cleaner. - cmd := exec.Command("bd", "daemon", "stop") - cmd.Dir = repoRoot - cmd.Env = append(os.Environ(), "BEADS_DIR="+beadsDir) - - // Best-effort stop - ignore errors (daemon may not be running) - _ = cmd.Run() - - // Wait for daemon socket to disappear (graceful shutdown). - deadline := time.Now().Add(3 * time.Second) - for time.Now().Before(deadline) { - if _, err := os.Stat(socketPath); os.IsNotExist(err) { - return - } - time.Sleep(50 * time.Millisecond) - } -} diff --git a/cmd/bd/update_edge_cases_test.go b/cmd/bd/update_edge_cases_test.go index ea6881d7e..3b5ad0c3c 100644 --- a/cmd/bd/update_edge_cases_test.go +++ b/cmd/bd/update_edge_cases_test.go @@ -233,7 +233,7 @@ func TestCLI_UpdateInvalidPriority(t *testing.T) { t.Run(tc.name, func(t *testing.T) { cmd := exec.Command(testBD, "update", id, "-p", tc.priority) cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err == nil { @@ -332,7 +332,7 @@ func TestCLI_UpdateNegativeEstimate(t *testing.T) { // Try negative estimate cmd := exec.Command(testBD, "update", id, "--estimate", "-5") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err == nil { t.Errorf("Expected error for negative estimate, but command succeeded. Output: %s", out) @@ -426,7 +426,7 @@ func TestCLI_UpdateInvalidDueDate(t *testing.T) { cmd := exec.Command(testBD, "update", id, "--due", "not-a-date") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() out, err := cmd.CombinedOutput() if err == nil { t.Errorf("Expected error for invalid --due, but command succeeded. Output: %s", out) @@ -443,7 +443,7 @@ func initExecTestDB(t *testing.T) string { tmpDir := createTempDirWithCleanup(t) initCmd := exec.Command(testBD, "init", "--prefix", "test", "--quiet") initCmd.Dir = tmpDir - initCmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + initCmd.Env = os.Environ() if out, err := initCmd.CombinedOutput(); err != nil { t.Fatalf("init failed: %v\n%s", err, out) } @@ -455,7 +455,7 @@ func createExecTestIssue(t *testing.T, tmpDir, title string) string { t.Helper() createCmd := exec.Command(testBD, "create", title, "-p", "1", "--json") createCmd.Dir = tmpDir - createCmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + createCmd.Env = os.Environ() out, err := createCmd.CombinedOutput() if err != nil { t.Fatalf("create failed: %v\n%s", err, out) @@ -592,7 +592,7 @@ func TestCLI_UpdateMultipleIssuesExec(t *testing.T) { // Update both at once cmd := exec.Command(testBD, "update", id1, id2, "--status", "in_progress") cmd.Dir = tmpDir - cmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + cmd.Env = os.Environ() if out, err := cmd.CombinedOutput(); err != nil { t.Fatalf("update failed: %v\n%s", err, out) } @@ -601,7 +601,7 @@ func TestCLI_UpdateMultipleIssuesExec(t *testing.T) { for _, id := range []string{id1, id2} { showCmd := exec.Command(testBD, "show", id, "--json") showCmd.Dir = tmpDir - showCmd.Env = append(os.Environ(), "BEADS_NO_DAEMON=1") + showCmd.Env = os.Environ() showOut, err := showCmd.CombinedOutput() if err != nil { t.Fatalf("show %s failed: %v\n%s", id, err, showOut) diff --git a/cmd/bd/wisp.go b/cmd/bd/wisp.go index 90307ab97..0d3bf3cfb 100644 --- a/cmd/bd/wisp.go +++ b/cmd/bd/wisp.go @@ -137,7 +137,7 @@ func runWispCreate(cmd *cobra.Command, args []string) { ctx := rootCtx - // Wisp create requires direct store access (daemon auto-bypassed for wisp ops) + // Wisp create requires direct store access if store == nil { FatalErrorWithHint("no database connection", "check 'bd doctor' and 'bd dolt status' for configuration issues") } @@ -558,7 +558,7 @@ func runWispGC(cmd *cobra.Command, args []string) { } } - // Wisp gc requires direct store access for deletion (daemon auto-bypassed for wisp ops) + // Wisp gc requires direct store access for deletion if store == nil { FatalErrorWithHint("no database connection", "check 'bd doctor' and 'bd dolt status' for configuration issues") } diff --git a/docs/ADVANCED.md b/docs/ADVANCED.md index d6efe2e05..bb41db2b4 100644 --- a/docs/ADVANCED.md +++ b/docs/ADVANCED.md @@ -319,7 +319,7 @@ Understanding the role of each component: ### RPC Layer (Server Mode) - **Multi-writer access** — Connects to a running Dolt server (`bd dolt start`) for concurrent clients - **Used in multi-agent setups** — Gas Town and similar environments where multiple agents write simultaneously -- **Not needed for single-user** — embedded mode handles all local operations without a daemon +- **Not needed for single-user** — embedded mode handles all local operations without a server ### MCP Server (Optional) - **Protocol adapter** — Translates MCP calls to direct CLI invocations diff --git a/docs/DOLT.md b/docs/DOLT.md index ed5761b4b..9d7a9ef65 100644 --- a/docs/DOLT.md +++ b/docs/DOLT.md @@ -8,14 +8,14 @@ Beads uses Dolt as its storage backend. Dolt provides a version-controlled SQL d - **Multi-writer support** — server mode enables concurrent agents - **Built-in history** — every write creates a Dolt commit - **Native branching** — Dolt branches independent of git branches -- **Single-binary option** — embedded mode for solo users (no daemon needed) +- **Single-binary option** — embedded mode for solo users (no server needed) ## Getting Started ### New Project ```bash -# Embedded mode (single writer, no daemon — default for standalone) +# Embedded mode (single writer, no server — default for standalone) bd init # Server mode (multi-writer, e.g. Gas Town) @@ -48,7 +48,7 @@ standalone Beads users. The `bd` binary includes everything; just `bd init` and - Single-writer (one process at a time) - Data lives in `.beads/dolt/` alongside your code - Push to GitHub with `bd dolt push` — code and issues in one repo -- Zero ops: no daemon, no ports, no PID files +- Zero ops: no server, no ports, no PID files ### Server Mode (Multi-Writer / Gas Town) diff --git a/docs/WORKTREES.md b/docs/WORKTREES.md index 4b05c116d..c63b80c3b 100644 --- a/docs/WORKTREES.md +++ b/docs/WORKTREES.md @@ -126,7 +126,7 @@ Main Repository bd automatically detects when you're in a git worktree: **Default behavior (no sync-branch configured):** -- Uses embedded mode for safety (single-writer, no daemon needed) +- Uses embedded mode for safety (single-writer, no server needed) - All commands work correctly without additional setup **With sync-branch configured:** diff --git a/integrations/beads-mcp/tests/test_mcp_server_integration.py b/integrations/beads-mcp/tests/test_mcp_server_integration.py index ae8342e82..fc7466d4f 100644 --- a/integrations/beads-mcp/tests/test_mcp_server_integration.py +++ b/integrations/beads-mcp/tests/test_mcp_server_integration.py @@ -79,9 +79,6 @@ async def mcp_client(bd_executable, temp_db, monkeypatch): # The workspace root is the parent directory workspace_root = os.path.dirname(temp_db) - # Disable daemon mode for tests (prevents daemon accumulation and timeouts) - os.environ["BEADS_NO_DAEMON"] = "1" - # Create test client async with Client(mcp) as client: # Automatically set context for the tests @@ -94,7 +91,6 @@ async def mcp_client(bd_executable, temp_db, monkeypatch): os.environ.pop("BEADS_WORKING_DIR", None) os.environ.pop("BEADS_DB", None) os.environ.pop("BEADS_DIR", None) - os.environ.pop("BEADS_NO_DAEMON", None) @pytest.mark.asyncio @@ -642,7 +638,6 @@ async def test_context_init_action(bd_executable): os.environ.pop("BEADS_WORKING_DIR", None) os.environ.pop("BEADS_DB", None) os.environ.pop("BEADS_DIR", None) - os.environ["BEADS_NO_DAEMON"] = "1" # Create a fresh temp directory without any beads database temp_dir = tempfile.mkdtemp(prefix="beads_init_test_") diff --git a/integrations/beads-mcp/tests/test_worktree_separate_dbs.py b/integrations/beads-mcp/tests/test_worktree_separate_dbs.py index 8533d4be4..e05dcc90c 100644 --- a/integrations/beads-mcp/tests/test_worktree_separate_dbs.py +++ b/integrations/beads-mcp/tests/test_worktree_separate_dbs.py @@ -3,9 +3,8 @@ Tests the recommended workflow: each worktree has its own .beads database, and changes sync via git commits/pulls of the .beads/issues.jsonl file. -NOTE: These tests have known issues with daemon interference and require -the bd daemon to be stopped before running. They may also have flaky behavior -due to path caching issues. See bd-4aao for details. +NOTE: These tests may have flaky behavior due to path caching issues. +See bd-4aao for details. """ import asyncio @@ -75,9 +74,8 @@ async def git_worktree_with_separate_dbs(bd_executable): ) # Initialize beads in main repo BEFORE creating worktree - # Use --no-daemon to avoid interference from running daemon with cached paths init_result = subprocess.run( - ["bd", "--no-daemon", "init", "--prefix", "main"], + ["bd", "init", "--prefix", "main"], cwd=main_repo, capture_output=True, text=True, @@ -107,12 +105,11 @@ async def git_worktree_with_separate_dbs(bd_executable): ) # Re-sync after commit to avoid staleness check issues - subprocess.run(["bd", "--no-daemon", "sync"], cwd=main_repo, capture_output=True) + subprocess.run(["bd", "sync"], cwd=main_repo, capture_output=True) # Initialize beads in worktree (separate database, different prefix) - # Use --no-daemon to avoid interference from running daemon init_result = subprocess.run( - ["bd", "--no-daemon", "init", "--prefix", "feature"], + ["bd", "init", "--prefix", "feature"], cwd=worktree, capture_output=True, text=True, @@ -137,7 +134,7 @@ async def git_worktree_with_separate_dbs(bd_executable): raise subprocess.CalledProcessError(result.returncode, result.args, result.stdout, result.stderr) # Re-sync after commit to avoid staleness check issues - subprocess.run(["bd", "--no-daemon", "sync"], cwd=worktree, capture_output=True) + subprocess.run(["bd", "sync"], cwd=worktree, capture_output=True) yield main_repo, worktree, temp_dir @@ -146,15 +143,15 @@ async def git_worktree_with_separate_dbs(bd_executable): shutil.rmtree(temp_dir, ignore_errors=True) -@pytest.mark.skip(reason="Flaky due to daemon interference - requires daemon to be stopped") +@pytest.mark.skip(reason="Flaky due to path caching issues - see bd-4aao") @pytest.mark.asyncio async def test_separate_databases_are_isolated(git_worktree_with_separate_dbs, bd_executable): """Test that each worktree has its own isolated database.""" main_repo, worktree, temp_dir = git_worktree_with_separate_dbs - # Create issue in main repo (use --no-daemon to avoid daemon interference) + # Create issue in main repo result = subprocess.run( - ["bd", "--no-daemon", "create", "Main repo issue", "-p", "1", "--json"], + ["bd", "create", "Main repo issue", "-p", "1", "--json"], cwd=main_repo, capture_output=True, text=True, @@ -165,7 +162,7 @@ async def test_separate_databases_are_isolated(git_worktree_with_separate_dbs, b # Create issue in worktree result = subprocess.run( - ["bd", "--no-daemon", "create", "Worktree issue", "-p", "1", "--json"], + ["bd", "create", "Worktree issue", "-p", "1", "--json"], cwd=worktree, capture_output=True, text=True, @@ -176,7 +173,7 @@ async def test_separate_databases_are_isolated(git_worktree_with_separate_dbs, b # List issues in main repo result = subprocess.run( - ["bd", "--no-daemon", "list", "--json"], + ["bd", "list", "--json"], cwd=main_repo, capture_output=True, text=True, @@ -187,7 +184,7 @@ async def test_separate_databases_are_isolated(git_worktree_with_separate_dbs, b # List issues in worktree result = subprocess.run( - ["bd", "--no-daemon", "list", "--json"], + ["bd", "list", "--json"], cwd=worktree, capture_output=True, text=True, @@ -204,7 +201,7 @@ async def test_separate_databases_are_isolated(git_worktree_with_separate_dbs, b assert "main-1" not in worktree_ids, "Worktree should NOT see main repo issue (yet)" -@pytest.mark.skip(reason="Flaky due to daemon interference - requires daemon to be stopped") +@pytest.mark.skip(reason="Flaky due to path caching issues - see bd-4aao") @pytest.mark.asyncio async def test_changes_sync_via_git(git_worktree_with_separate_dbs, bd_executable): """Test that changes sync between worktrees via git commits and merges.""" @@ -212,7 +209,7 @@ async def test_changes_sync_via_git(git_worktree_with_separate_dbs, bd_executabl # Create and commit issue in main repo result = subprocess.run( - ["bd", "--no-daemon", "create", "Shared issue", "-p", "1", "--json"], + ["bd", "create", "Shared issue", "-p", "1", "--json"], cwd=main_repo, capture_output=True, text=True, @@ -222,7 +219,7 @@ async def test_changes_sync_via_git(git_worktree_with_separate_dbs, bd_executabl # Export to JSONL (should happen automatically, but force it) subprocess.run( - ["bd", "--no-daemon", "export", "-o", ".beads/issues.jsonl"], + ["bd", "export", "-o", ".beads/issues.jsonl"], cwd=main_repo, check=True, capture_output=True, @@ -251,7 +248,7 @@ async def test_changes_sync_via_git(git_worktree_with_separate_dbs, bd_executabl # Import the changes into worktree database result = subprocess.run( - ["bd", "--no-daemon", "import", "-i", ".beads/issues.jsonl"], + ["bd", "import", "-i", ".beads/issues.jsonl"], cwd=worktree, capture_output=True, text=True, @@ -260,7 +257,7 @@ async def test_changes_sync_via_git(git_worktree_with_separate_dbs, bd_executabl # If import succeeded, verify the issue is now visible if result.returncode == 0: result = subprocess.run( - ["bd", "--no-daemon", "list", "--json"], + ["bd", "list", "--json"], cwd=worktree, capture_output=True, text=True, @@ -274,18 +271,17 @@ async def test_changes_sync_via_git(git_worktree_with_separate_dbs, bd_executabl assert len(worktree_issues) >= 1, "Worktree should have at least one issue after import" -@pytest.mark.skip(reason="Flaky due to daemon interference - requires daemon to be stopped") +@pytest.mark.skip(reason="Flaky due to path caching issues - see bd-4aao") @pytest.mark.asyncio async def test_mcp_works_with_separate_databases(git_worktree_with_separate_dbs, monkeypatch): - """Test that MCP server works independently in each worktree with daemon-less mode.""" + """Test that MCP server works independently in each worktree.""" from beads_mcp import tools from beads_mcp.bd_client import BdCliClient - + main_repo, worktree, temp_dir = git_worktree_with_separate_dbs - - # Configure MCP for daemon-less mode in worktree + + # Configure MCP for worktree tools._connection_pool.clear() - monkeypatch.setenv("BEADS_USE_DAEMON", "0") monkeypatch.setenv("BEADS_WORKING_DIR", str(worktree)) # Reset context @@ -302,7 +298,7 @@ async def test_mcp_works_with_separate_databases(git_worktree_with_separate_dbs, "create", { "title": "MCP issue in worktree", - "description": "Created via MCP in daemon-less mode", + "description": "Created via MCP in worktree", "priority": 1, }, ) @@ -327,15 +323,15 @@ async def test_mcp_works_with_separate_databases(git_worktree_with_separate_dbs, tools._connection_pool.clear() -@pytest.mark.skip(reason="Flaky due to daemon interference - requires daemon to be stopped") +@pytest.mark.skip(reason="Flaky due to path caching issues - see bd-4aao") @pytest.mark.asyncio async def test_worktree_database_discovery(git_worktree_with_separate_dbs, bd_executable): """Test that bd correctly discovers the database in each worktree.""" main_repo, worktree, temp_dir = git_worktree_with_separate_dbs - # Test main repo can find its database (use --no-daemon to avoid daemon interference) + # Test main repo can find its database result = subprocess.run( - ["bd", "--no-daemon", "list", "--json"], + ["bd", "list", "--json"], cwd=main_repo, capture_output=True, text=True, @@ -344,7 +340,7 @@ async def test_worktree_database_discovery(git_worktree_with_separate_dbs, bd_ex # Test worktree can find its database result = subprocess.run( - ["bd", "--no-daemon", "list", "--json"], + ["bd", "list", "--json"], cwd=worktree, capture_output=True, text=True, @@ -355,15 +351,15 @@ async def test_worktree_database_discovery(git_worktree_with_separate_dbs, bd_ex # (The prefix doesn't matter as much as the fact that both can operate) -@pytest.mark.skip(reason="Flaky due to daemon interference - requires daemon to be stopped") +@pytest.mark.skip(reason="Flaky due to path caching issues - see bd-4aao") @pytest.mark.asyncio async def test_jsonl_export_works_in_worktrees(git_worktree_with_separate_dbs, bd_executable): """Test that JSONL export works correctly in worktrees.""" main_repo, worktree, temp_dir = git_worktree_with_separate_dbs - # Create issue in worktree (use --no-daemon to avoid daemon interference) + # Create issue in worktree subprocess.run( - ["bd", "--no-daemon", "create", "Feature issue", "-p", "1"], + ["bd", "create", "Feature issue", "-p", "1"], cwd=worktree, check=True, capture_output=True, @@ -371,7 +367,7 @@ async def test_jsonl_export_works_in_worktrees(git_worktree_with_separate_dbs, b # Export from worktree subprocess.run( - ["bd", "--no-daemon", "export", "-o", ".beads/issues.jsonl"], + ["bd", "export", "-o", ".beads/issues.jsonl"], cwd=worktree, check=True, capture_output=True, @@ -383,33 +379,3 @@ async def test_jsonl_export_works_in_worktrees(git_worktree_with_separate_dbs, b assert len(worktree_jsonl) > 0, "JSONL should not be empty" -@pytest.mark.skip(reason="Flaky due to daemon interference - requires daemon to be stopped") -@pytest.mark.asyncio -async def test_no_daemon_flag_works_in_worktree(git_worktree_with_separate_dbs, bd_executable): - """Test that --no-daemon flag works correctly in worktrees.""" - main_repo, worktree, temp_dir = git_worktree_with_separate_dbs - - # Create issue with --no-daemon flag - result = subprocess.run( - ["bd", "--no-daemon", "create", "No daemon issue", "-p", "1", "--json"], - cwd=worktree, - capture_output=True, - text=True, - ) - - assert result.returncode == 0, f"--no-daemon create should work: {result.stderr}" - issue_data = json.loads(result.stdout) - assert issue_data["id"].startswith("feature-"), "Should use worktree database" - - # List with --no-daemon - result = subprocess.run( - ["bd", "--no-daemon", "list", "--json"], - cwd=worktree, - capture_output=True, - text=True, - ) - - assert result.returncode == 0, f"--no-daemon list should work: {result.stderr}" - issues = json.loads(result.stdout) - assert len(issues) > 0, "Should see created issue" - assert issues[0]["id"].startswith("feature-"), "Should list worktree issues" diff --git a/internal/beads/beads.go b/internal/beads/beads.go index 4fbbd3b6c..bf8dd96e7 100644 --- a/internal/beads/beads.go +++ b/internal/beads/beads.go @@ -311,7 +311,7 @@ func FindDatabasePath() string { // - Any *.db file (excluding backups and vc.db) // - A dolt/ directory (Dolt database) // -// Returns false for directories that only contain daemon registry files. +// Returns false for directories that only contain legacy registry files. // This prevents FindBeadsDir from returning ~/.beads/ which only has registry.json. func hasBeadsProjectFiles(beadsDir string) bool { // Check for project configuration files diff --git a/internal/beads/beads_hash_multiclone_test.go b/internal/beads/beads_hash_multiclone_test.go index 4df14ec6e..14241a56e 100644 --- a/internal/beads/beads_hash_multiclone_test.go +++ b/internal/beads/beads_hash_multiclone_test.go @@ -123,7 +123,7 @@ func TestHashIDs_MultiCloneConverge(t *testing.T) { // Sync all clones once (hash IDs prevent collisions, don't need multiple rounds) for _, clone := range []string{cloneA, cloneB, cloneC} { - runCmdOutputWithEnvAllowError(t, clone, map[string]string{"BEADS_NO_DAEMON": "1"}, true, bdPath, "sync") + runCmdOutputWithEnvAllowError(t, clone, map[string]string{}, true, bdPath, "sync") } // Verify all clones have all 3 issues @@ -174,7 +174,7 @@ func TestHashIDs_IdenticalContentDedup(t *testing.T) { // Sync both clones once (hash IDs handle dedup automatically) for _, clone := range []string{cloneA, cloneB} { - runCmdOutputWithEnvAllowError(t, clone, map[string]string{"BEADS_NO_DAEMON": "1"}, true, bdPath, "sync") + runCmdOutputWithEnvAllowError(t, clone, map[string]string{}, true, bdPath, "sync") } // Verify both clones have exactly 1 issue (deduplication worked) @@ -241,13 +241,12 @@ func setupClone(t *testing.T, tmpDir, remoteDir, name, bdPath string) string { func createIssueInClone(t *testing.T, cloneDir, title string) { t.Helper() - runCmdWithEnv(t, cloneDir, map[string]string{"BEADS_NO_DAEMON": "1"}, getBDCommand(), "create", title, "-t", "task", "-p", "1", "--json") + runCmdWithEnv(t, cloneDir, map[string]string{}, getBDCommand(), "create", title, "-t", "task", "-p", "1", "--json") } func getTitlesFromClone(t *testing.T, cloneDir string) map[string]bool { t.Helper() listJSON := runCmdOutputWithEnv(t, cloneDir, map[string]string{ - "BEADS_NO_DAEMON": "1", "BD_NO_AUTO_IMPORT": "1", }, getBDCommand(), "list", "--json") @@ -301,12 +300,12 @@ func installGitHooks(t *testing.T, repoDir string) { bdCmd := strings.ReplaceAll(getBDCommand(), "\\", "/") preCommit := fmt.Sprintf(`#!/bin/sh -%s --no-daemon export -o .beads/issues.jsonl >/dev/null 2>&1 || true +%s export -o .beads/issues.jsonl >/dev/null 2>&1 || true git add .beads/issues.jsonl >/dev/null 2>&1 || true exit 0 `, bdCmd) postMerge := fmt.Sprintf(`#!/bin/sh -%s --no-daemon import -i .beads/issues.jsonl >/dev/null 2>&1 || true +%s import -i .beads/issues.jsonl >/dev/null 2>&1 || true exit 0 `, bdCmd) os.WriteFile(filepath.Join(hooksDir, "pre-commit"), []byte(preCommit), 0755) diff --git a/internal/beads/context.go b/internal/beads/context.go index d594c1d8b..c2242fa5e 100644 --- a/internal/beads/context.go +++ b/internal/beads/context.go @@ -344,12 +344,12 @@ func isPathInSafeBoundary(path string) bool { // GetRepoContextForWorkspace returns a fresh RepoContext for a specific workspace. // // Unlike GetRepoContext(), this function: -// - Does NOT cache results (daemon handles multiple workspaces) +// - Does NOT cache results (caller may handle multiple workspaces) // - Does NOT respect BEADS_DIR (workspace path is explicit) // - Resolves worktree relationships correctly // -// This is designed for long-running processes like the daemon that need to handle -// multiple workspaces or detect context changes (DMN-001). +// This is designed for processes that need to handle +// multiple workspaces or detect context changes. // // The function temporarily changes to the workspace directory to resolve paths, // then restores the original directory. @@ -380,7 +380,7 @@ func GetRepoContextForWorkspace(workspacePath string) (*RepoContext, error) { // buildRepoContextForWorkspace constructs RepoContext for a specific workspace. // Unlike buildRepoContext(), this ignores BEADS_DIR env var since the workspace -// path is explicitly provided (used by daemon). +// path is explicitly provided. func buildRepoContextForWorkspace(workspacePath string) (*RepoContext, error) { // 1. Determine if we're in a worktree and find the main repo root var repoRoot string diff --git a/internal/config/config.go b/internal/config/config.go index 0f19628d7..6ae8318f4 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -642,7 +642,7 @@ func ResolveExternalProjectPath(projectName string) string { // Resolve relative paths from repo root (parent of .beads/), NOT CWD. // This ensures paths like "../beads" in config resolve correctly - // when running from different directories or in daemon context. + // when running from different directories. if !filepath.IsAbs(path) { // Config is at .beads/config.yaml, so go up twice to get repo root configFile := ConfigFileUsed() diff --git a/internal/config/config_test.go b/internal/config/config_test.go index b1a62327b..591095f03 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -124,7 +124,6 @@ func TestConfigFile(t *testing.T) { // Create a config file configContent := ` json: true -no-daemon: true actor: configuser ` configPath := filepath.Join(tmpDir, "config.yaml") @@ -159,10 +158,6 @@ actor: configuser t.Errorf("GetBool(json) = %v, want true", got) } - if got := GetBool("no-daemon"); got != true { - t.Errorf("GetBool(no-daemon) = %v, want true", got) - } - if got := GetString("actor"); got != "configuser" { t.Errorf("GetString(actor) = %q, want \"configuser\"", got) } @@ -185,7 +180,6 @@ func TestLocalConfigOverride(t *testing.T) { // Create main config file with some settings configContent := ` json: false -no-daemon: false actor: project-user ` configPath := filepath.Join(beadsDir, "config.yaml") @@ -195,7 +189,6 @@ actor: project-user // Create local config file that overrides some settings localConfigContent := ` -no-daemon: true actor: local-user ` localConfigPath := filepath.Join(beadsDir, "config.local.yaml") @@ -212,10 +205,6 @@ actor: local-user } // Test that local config values override project config values - if got := GetBool("no-daemon"); got != true { - t.Errorf("GetBool(no-daemon) = %v, want true (local override)", got) - } - if got := GetString("actor"); got != "local-user" { t.Errorf("GetString(actor) = %q, want \"local-user\" (local override)", got) } diff --git a/internal/configfile/configfile.go b/internal/configfile/configfile.go index e64d226cb..bdc7c4423 100644 --- a/internal/configfile/configfile.go +++ b/internal/configfile/configfile.go @@ -21,7 +21,7 @@ type Config struct { DeletionsRetentionDays int `json:"deletions_retention_days,omitempty"` // 0 means use default (3 days) // Dolt connection mode configuration (bd-dolt.2.2) - // "embedded" (default for standalone) runs Dolt in-process — no daemon needed. + // "embedded" (default for standalone) runs Dolt in-process. // "server" connects to an external dolt sql-server (required for Gas Town / multi-writer). DoltMode string `json:"dolt_mode,omitempty"` // "embedded" (default) or "server" DoltServerHost string `json:"dolt_server_host,omitempty"` // Server host (default: 127.0.0.1) diff --git a/internal/utils/path.go b/internal/utils/path.go index c8c9ecae8..dc51610b9 100644 --- a/internal/utils/path.go +++ b/internal/utils/path.go @@ -144,8 +144,7 @@ func NormalizePathForComparison(path string) string { } // PathsEqual compares two paths for equality, handling case-insensitive -// filesystems and symlinks. This is the preferred way to compare workspace -// paths in the daemon registry and discovery code. +// filesystems and symlinks. func PathsEqual(path1, path2 string) bool { return NormalizePathForComparison(path1) == NormalizePathForComparison(path2) } diff --git a/tests/regression/regression_test.go b/tests/regression/regression_test.go index b9faeeea7..b27da8b96 100644 --- a/tests/regression/regression_test.go +++ b/tests/regression/regression_test.go @@ -271,7 +271,6 @@ func (w *workspace) runEnv() []string { env := []string{ "PATH=" + os.Getenv("PATH"), "HOME=" + w.dir, - "BEADS_NO_DAEMON=1", "BEADS_TEST_MODE=1", "GIT_CONFIG_NOSYSTEM=1", }