From f9bbe8e8e01080b4e3ec4aa19d137e4e506ced52 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sat, 27 Dec 2025 20:20:06 -0800 Subject: [PATCH] fix(doctor): follow redirect when checking database (bd-tvus) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cmd/bd/doctor/database.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/bd/doctor/database.go b/cmd/bd/doctor/database.go index 5280b7d8..6ffca129 100644 --- a/cmd/bd/doctor/database.go +++ b/cmd/bd/doctor/database.go @@ -26,7 +26,8 @@ type localConfig struct { // CheckDatabaseVersion checks the database version and migration status 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 var dbPath string @@ -135,7 +136,8 @@ func CheckDatabaseVersion(path string, cliVersion string) DoctorCheck { // CheckSchemaCompatibility checks if all required tables and columns are present 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 var dbPath string @@ -224,7 +226,8 @@ func CheckSchemaCompatibility(path string) DoctorCheck { // CheckDatabaseIntegrity runs SQLite's PRAGMA integrity_check (bd-2au) 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) var dbPath string @@ -348,7 +351,8 @@ func CheckDatabaseIntegrity(path string) DoctorCheck { // CheckDatabaseJSONLSync checks if database and JSONL are in sync 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). 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 // closed issue history. We only provide guidance, never action. 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 var dbPath string