* fix: prefer bootstrap for missing database recovery Executed-By: beads/crew/emma * fix: align doctor recovery guidance with bootstrap Executed-By: beads/crew/emma * fix: let bootstrap recover missing server databases Executed-By: beads/crew/emma * fix: bootstrap missing server databases safely Executed-By: beads/crew/emma * fix: fail closed on bootstrap server probe errors Executed-By: beads/crew/emma * fix: honor runtime server config in bootstrap Executed-By: beads/crew/emma * docs: soften bootstrap-first recovery wording Executed-By: beads/crew/emma * fix: report resolved bootstrap server port Executed-By: beads/crew/emma * fix: repair test failures from build tag mismatch and mode detection Three issues causing CI failures on macOS and Ubuntu: 1. detectBootstrapAction used isEmbeddedMode() (global state) to choose the database path, but tests set cfg.DoltMode without updating the global serverMode flag. Switch to cfg.GetDoltMode() so the detection logic respects the config object passed by the caller. 2. TestDetectBootstrapAction_NoneWhenDatabaseExists created a "dolt" directory but default (embedded) config looks for "embeddeddolt". Fix the test to create the correct directory. 3. embeddeddolt/slots.go and new_methods_test.go used //go:build embeddeddolt tag while all other files in the package use cgo, causing interface satisfaction failures. Also fix undefined isEmbeddedDolt reference (should be isEmbeddedMode()). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Executed-By: beads/crew/emma --------- Co-authored-by: mayor <thalia.geraghty@fiserv.com> Co-authored-by: beads/crew/emma <steve.yegge@gmail.com>
45 lines
1 KiB
Go
45 lines
1 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
"io"
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestHandleFreshCloneError_UsesBootstrapFirstGuidance(t *testing.T) {
|
|
err := errors.New("post-migration validation failed: required config key missing: issue_prefix")
|
|
|
|
origStderr := os.Stderr
|
|
r, w, pipeErr := os.Pipe()
|
|
if pipeErr != nil {
|
|
t.Fatal(pipeErr)
|
|
}
|
|
os.Stderr = w
|
|
|
|
handled := handleFreshCloneError(err)
|
|
_ = w.Close()
|
|
os.Stderr = origStderr
|
|
|
|
var buf bytes.Buffer
|
|
if _, copyErr := io.Copy(&buf, r); copyErr != nil {
|
|
t.Fatal(copyErr)
|
|
}
|
|
_ = r.Close()
|
|
|
|
if !handled {
|
|
t.Fatal("expected fresh clone error to be handled")
|
|
}
|
|
msg := buf.String()
|
|
if !strings.Contains(msg, "bd bootstrap") {
|
|
t.Fatalf("expected bootstrap guidance, got:\n%s", msg)
|
|
}
|
|
if strings.Contains(msg, "To initialize a new database: bd init") {
|
|
t.Fatalf("did not expect init-first guidance for fresh clone recovery, got:\n%s", msg)
|
|
}
|
|
if !strings.Contains(msg, "brand-new database from scratch") {
|
|
t.Fatalf("expected brand-new project fallback note, got:\n%s", msg)
|
|
}
|
|
}
|