fix(doctor): follow redirect when checking database (bd-tvus)
The bug was that doctor's database checks used the local .beads/beads.db file directly, while import followed the redirect to the actual database. This caused confusing output showing 0 issues when the actual database had hundreds. Fixed by using resolveBeadsDir() in all database checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,8 @@ type localConfig struct {
|
|||||||
|
|
||||||
// CheckDatabaseVersion checks the database version and migration status
|
// CheckDatabaseVersion checks the database version and migration status
|
||||||
func CheckDatabaseVersion(path string, cliVersion string) DoctorCheck {
|
func CheckDatabaseVersion(path string, cliVersion string) DoctorCheck {
|
||||||
beadsDir := filepath.Join(path, ".beads")
|
// Follow redirect to resolve actual beads directory (bd-tvus fix)
|
||||||
|
beadsDir := resolveBeadsDir(filepath.Join(path, ".beads"))
|
||||||
|
|
||||||
// Check metadata.json first for custom database name
|
// Check metadata.json first for custom database name
|
||||||
var dbPath string
|
var dbPath string
|
||||||
@@ -135,7 +136,8 @@ func CheckDatabaseVersion(path string, cliVersion string) DoctorCheck {
|
|||||||
|
|
||||||
// CheckSchemaCompatibility checks if all required tables and columns are present
|
// CheckSchemaCompatibility checks if all required tables and columns are present
|
||||||
func CheckSchemaCompatibility(path string) DoctorCheck {
|
func CheckSchemaCompatibility(path string) DoctorCheck {
|
||||||
beadsDir := filepath.Join(path, ".beads")
|
// Follow redirect to resolve actual beads directory (bd-tvus fix)
|
||||||
|
beadsDir := resolveBeadsDir(filepath.Join(path, ".beads"))
|
||||||
|
|
||||||
// Check metadata.json first for custom database name
|
// Check metadata.json first for custom database name
|
||||||
var dbPath string
|
var dbPath string
|
||||||
@@ -224,7 +226,8 @@ func CheckSchemaCompatibility(path string) DoctorCheck {
|
|||||||
|
|
||||||
// CheckDatabaseIntegrity runs SQLite's PRAGMA integrity_check (bd-2au)
|
// CheckDatabaseIntegrity runs SQLite's PRAGMA integrity_check (bd-2au)
|
||||||
func CheckDatabaseIntegrity(path string) DoctorCheck {
|
func CheckDatabaseIntegrity(path string) DoctorCheck {
|
||||||
beadsDir := filepath.Join(path, ".beads")
|
// Follow redirect to resolve actual beads directory (bd-tvus fix)
|
||||||
|
beadsDir := resolveBeadsDir(filepath.Join(path, ".beads"))
|
||||||
|
|
||||||
// Get database path (same logic as CheckSchemaCompatibility)
|
// Get database path (same logic as CheckSchemaCompatibility)
|
||||||
var dbPath string
|
var dbPath string
|
||||||
@@ -348,7 +351,8 @@ func CheckDatabaseIntegrity(path string) DoctorCheck {
|
|||||||
|
|
||||||
// CheckDatabaseJSONLSync checks if database and JSONL are in sync
|
// CheckDatabaseJSONLSync checks if database and JSONL are in sync
|
||||||
func CheckDatabaseJSONLSync(path string) DoctorCheck {
|
func CheckDatabaseJSONLSync(path string) DoctorCheck {
|
||||||
beadsDir := filepath.Join(path, ".beads")
|
// Follow redirect to resolve actual beads directory (bd-tvus fix)
|
||||||
|
beadsDir := resolveBeadsDir(filepath.Join(path, ".beads"))
|
||||||
|
|
||||||
// Resolve database path (respects metadata.json override).
|
// Resolve database path (respects metadata.json override).
|
||||||
dbPath := filepath.Join(beadsDir, beads.CanonicalDatabaseName)
|
dbPath := filepath.Join(beadsDir, beads.CanonicalDatabaseName)
|
||||||
@@ -702,7 +706,8 @@ func isNoDbModeConfigured(beadsDir string) bool {
|
|||||||
// irreversible. The user must make an explicit decision to delete their
|
// irreversible. The user must make an explicit decision to delete their
|
||||||
// closed issue history. We only provide guidance, never action.
|
// closed issue history. We only provide guidance, never action.
|
||||||
func CheckDatabaseSize(path string) DoctorCheck {
|
func CheckDatabaseSize(path string) DoctorCheck {
|
||||||
beadsDir := filepath.Join(path, ".beads")
|
// Follow redirect to resolve actual beads directory (bd-tvus fix)
|
||||||
|
beadsDir := resolveBeadsDir(filepath.Join(path, ".beads"))
|
||||||
|
|
||||||
// Get database path
|
// Get database path
|
||||||
var dbPath string
|
var dbPath string
|
||||||
|
|||||||
Reference in New Issue
Block a user