From c2d4a6d793b3e21b47e063213334d48f824ead2c Mon Sep 17 00:00:00 2001 From: gastown/crew/joe Date: Sun, 25 Jan 2026 11:17:17 -0800 Subject: [PATCH] fix(daemon): refuse startup with Dolt backend for deprecated --start flag The guardDaemonStartForDolt check was only applied to the 'bd daemon start' subcommand, but the deprecated 'bd daemon --start' flag path bypassed it. This adds the same guard check to the deprecated path so both entry points consistently refuse to start the daemon when Dolt backend is configured. The --federation flag still allows Dolt since it enables dolt sql-server mode which supports multi-writer access. Co-Authored-By: Claude Opus 4.5 --- cmd/bd/daemon.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/bd/daemon.go b/cmd/bd/daemon.go index 38228d86..e4a0b55f 100644 --- a/cmd/bd/daemon.go +++ b/cmd/bd/daemon.go @@ -63,6 +63,7 @@ Run 'bd daemon --help' to see all subcommands.`, foreground, _ := cmd.Flags().GetBool("foreground") logLevel, _ := cmd.Flags().GetString("log-level") logJSON, _ := cmd.Flags().GetBool("log-json") + federation, _ := cmd.Flags().GetBool("federation") // If no operation flags provided, show help if !start && !stop && !stopAll && !status && !health && !metrics { @@ -141,6 +142,15 @@ Run 'bd daemon --help' to see all subcommands.`, os.Exit(1) } + // Guard: refuse to start daemon with Dolt backend (unless --federation) + // This matches guardDaemonStartForDolt which guards the 'bd daemon start' subcommand. + if !federation { + if err := guardDaemonStartForDolt(cmd, args); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } + } + // Skip daemon-running check if we're the forked child (BD_DAEMON_FOREGROUND=1) // because the check happens in the parent process before forking if os.Getenv("BD_DAEMON_FOREGROUND") != "1" { @@ -237,7 +247,6 @@ Run 'bd daemon --help' to see all subcommands.`, fmt.Printf("Logging to: %s\n", logFile) } - federation, _ := cmd.Flags().GetBool("federation") federationPort, _ := cmd.Flags().GetInt("federation-port") remotesapiPort, _ := cmd.Flags().GetInt("remotesapi-port") startDaemon(interval, autoCommit, autoPush, autoPull, localMode, foreground, logFile, pidFile, logLevel, logJSON, federation, federationPort, remotesapiPort)