From 153f724e95a6dae897e9ea5cc9d4ffb96f0d7dd0 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 23 Nov 2025 23:01:55 -0800 Subject: [PATCH] Fix Windows CI test failures Two Windows-specific test failures: 1. TestNewSQLiteStorage - File locking on temp cleanup - Windows couldn't delete temp database file because connection was still open - Added defer store.Close() to properly cleanup the database connection - Without this, Windows file locking prevents TempDir cleanup 2. TestFindAllDatabases - Unexpected nil slice return - FindAllDatabases could return nil instead of empty slice when os.Getwd() fails - Changed from var databases to explicit empty slice initialization - Ensures function always returns non-nil slice, matching test expectations Both issues are more pronounced on Windows due to stricter file locking and different filesystem behavior. Co-Authored-By: Claude --- beads_test.go | 1 + internal/beads/beads.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/beads_test.go b/beads_test.go index 54b9bd0d..5bae9828 100644 --- a/beads_test.go +++ b/beads_test.go @@ -18,6 +18,7 @@ func TestNewSQLiteStorage(t *testing.T) { if err != nil { t.Fatalf("NewSQLiteStorage failed: %v", err) } + defer store.Close() if store == nil { t.Error("expected non-nil storage") diff --git a/internal/beads/beads.go b/internal/beads/beads.go index 5c6e555c..a5dd52e5 100644 --- a/internal/beads/beads.go +++ b/internal/beads/beads.go @@ -345,7 +345,7 @@ func findDatabaseInTree() string { // Returns a slice of DatabaseInfo for each database found, starting from the // closest to CWD (most relevant) to the furthest (least relevant). func FindAllDatabases() []DatabaseInfo { - var databases []DatabaseInfo + databases := []DatabaseInfo{} // Initialize to empty slice, never return nil seen := make(map[string]bool) // Track canonical paths to avoid duplicates dir, err := os.Getwd()