Skip to content

Commit 5c078a0

Browse files
committed
/cmd/bd/{doctor,init}.go: skip initDiagnostics with embedded dolt
1 parent 22c9d56 commit 5c078a0

2 files changed

Lines changed: 33 additions & 39 deletions

File tree

cmd/bd/doctor.go

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -861,13 +861,11 @@ func runInitDiagnostics(path string) doctorResult {
861861
result.OverallOK = false
862862
}
863863

864-
// Check 3: Schema compatibility (server-mode only; embedded validates during initSchema)
865-
if !isEmbeddedDolt {
866-
schemaCheck := convertWithCategory(doctor.CheckSchemaCompatibility(path), doctor.CategoryCore)
867-
result.Checks = append(result.Checks, schemaCheck)
868-
if schemaCheck.Status == statusError {
869-
result.OverallOK = false
870-
}
864+
// Check 3: Schema compatibility
865+
schemaCheck := convertWithCategory(doctor.CheckSchemaCompatibility(path), doctor.CategoryCore)
866+
result.Checks = append(result.Checks, schemaCheck)
867+
if schemaCheck.Status == statusError {
868+
result.OverallOK = false
871869
}
872870

873871
// Check 4: Permissions
@@ -877,22 +875,18 @@ func runInitDiagnostics(path string) doctorResult {
877875
result.OverallOK = false
878876
}
879877

880-
// Checks 5-6: Dolt server connection and schema (server-mode only;
881-
// embedded mode has no sql-server to connect to).
882-
if !isEmbeddedDolt {
883-
// Check 5: Dolt connection — validates init actually created a working DB
884-
doltConnCheck := convertDoctorCheck(doctor.CheckDoltConnection(path))
885-
result.Checks = append(result.Checks, doltConnCheck)
886-
if doltConnCheck.Status == statusError {
887-
result.OverallOK = false
888-
}
878+
// Check 5: Dolt connection — validates init actually created a working DB
879+
doltConnCheck := convertDoctorCheck(doctor.CheckDoltConnection(path))
880+
result.Checks = append(result.Checks, doltConnCheck)
881+
if doltConnCheck.Status == statusError {
882+
result.OverallOK = false
883+
}
889884

890-
// Check 6: Dolt schema — validates tables were created
891-
doltSchemaCheck := convertDoctorCheck(doctor.CheckDoltSchema(path))
892-
result.Checks = append(result.Checks, doltSchemaCheck)
893-
if doltSchemaCheck.Status == statusError {
894-
result.OverallOK = false
895-
}
885+
// Check 6: Dolt schema — validates tables were created
886+
doltSchemaCheck := convertDoctorCheck(doctor.CheckDoltSchema(path))
887+
result.Checks = append(result.Checks, doltSchemaCheck)
888+
if doltSchemaCheck.Status == statusError {
889+
result.OverallOK = false
896890
}
897891

898892
return result

cmd/bd/init.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -900,27 +900,27 @@ environment variable.`,
900900
}
901901

902902
// Run limited diagnostics to verify init succeeded.
903-
// Uses runInitDiagnostics (not runDiagnostics) to only check things
904-
// that should be true immediately after init — skips git-dependent,
905-
// federation, and other post-setup checks that aren't applicable yet.
906-
doctorResult := runInitDiagnostics(cwd)
907-
// Check if there are any warnings or errors (not just critical failures)
908-
hasIssues := false
909-
for _, check := range doctorResult.Checks {
910-
if check.Status != statusOK {
911-
hasIssues = true
912-
break
913-
}
914-
}
915-
if hasIssues {
916-
fmt.Printf("%s Setup incomplete. Some issues were detected:\n", ui.RenderWarn("⚠"))
917-
// Show just the warnings/errors, not all checks
903+
// Skipped in embedded mode: diagnostics use dolt.NewFromConfigWithOptions
904+
// which auto-starts a dolt sql-server. Embedded init already validates
905+
// the database via initSchema.
906+
if !isEmbeddedDolt {
907+
doctorResult := runInitDiagnostics(cwd)
908+
hasIssues := false
918909
for _, check := range doctorResult.Checks {
919910
if check.Status != statusOK {
920-
fmt.Printf(" • %s: %s\n", check.Name, check.Message)
911+
hasIssues = true
912+
break
913+
}
914+
}
915+
if hasIssues {
916+
fmt.Printf("%s Setup incomplete. Some issues were detected:\n", ui.RenderWarn("⚠"))
917+
for _, check := range doctorResult.Checks {
918+
if check.Status != statusOK {
919+
fmt.Printf(" • %s: %s\n", check.Name, check.Message)
920+
}
921921
}
922+
fmt.Printf("\nRun %s to see details and fix these issues.\n\n", ui.RenderAccent("bd doctor --fix"))
922923
}
923-
fmt.Printf("\nRun %s to see details and fix these issues.\n\n", ui.RenderAccent("bd doctor --fix"))
924924
}
925925
},
926926
}

0 commit comments

Comments
 (0)