doctor: harden corruption repair and JSONL config

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
Jordan Hubbard
2025-12-26 04:29:29 -04:00
parent b089aaa0d6
commit 1a4f06ef8c
17 changed files with 264 additions and 80 deletions

View File

@@ -353,6 +353,28 @@ func applyFixesInteractive(path string, issues []doctorCheck) {
// applyFixList applies a list of fixes and reports results
func applyFixList(path string, fixes []doctorCheck) {
// Run corruption recovery before any operations that need a healthy SQLite DB.
priority := map[string]int{
"Database Integrity": 0,
}
slices.SortStableFunc(fixes, func(a, b doctorCheck) int {
pa, oka := priority[a.Name]
if !oka {
pa = 1000
}
pb, okb := priority[b.Name]
if !okb {
pb = 1000
}
if pa < pb {
return -1
}
if pa > pb {
return 1
}
return 0
})
fixedCount := 0
errorCount := 0