From 167ab6788bf3c0c68aac8fbc7eba231d8867df62 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Thu, 20 Nov 2025 22:06:38 -0500 Subject: [PATCH] Fix #328: Remove duplicate computeJSONLHash declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function was declared twice: - Line 80: New version (simpler, no error wrapping) - Line 390: Old version (with error wrapping) This caused compilation failure in CI. Removed the old declaration at line 390. Also fixed integrity_content_test.go to pass context.Context to sqlite.New() as required by the updated API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- cmd/bd/integrity.go | 14 -------------- cmd/bd/integrity_content_test.go | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/cmd/bd/integrity.go b/cmd/bd/integrity.go index 981fd458..b5219974 100644 --- a/cmd/bd/integrity.go +++ b/cmd/bd/integrity.go @@ -385,20 +385,6 @@ func dbNeedsExport(ctx context.Context, store storage.Storage, jsonlPath string) return false, nil } -// computeJSONLHash computes a content hash of the JSONL file. -// Returns the SHA256 hash of the file contents. -func computeJSONLHash(jsonlPath string) (string, error) { - data, err := os.ReadFile(jsonlPath) // #nosec G304 - controlled path from config - if err != nil { - return "", fmt.Errorf("failed to read JSONL: %w", err) - } - - // Use sha256 for consistency with autoimport package - hasher := sha256.New() - hasher.Write(data) - return hex.EncodeToString(hasher.Sum(nil)), nil -} - // computeDBHash computes a content hash of the database by exporting to memory. // This is used to compare DB content with JSONL content without relying on timestamps. func computeDBHash(ctx context.Context, store storage.Storage) (string, error) { diff --git a/cmd/bd/integrity_content_test.go b/cmd/bd/integrity_content_test.go index 4376124d..726e48f2 100644 --- a/cmd/bd/integrity_content_test.go +++ b/cmd/bd/integrity_content_test.go @@ -28,7 +28,7 @@ func TestContentBasedComparison(t *testing.T) { jsonlPath := filepath.Join(beadsDir, "issues.jsonl") // Create and populate database - localStore, err := sqlite.New(dbPath) + localStore, err := sqlite.New(ctx, dbPath) if err != nil { t.Fatalf("Failed to create store: %v", err) } @@ -180,7 +180,7 @@ func TestContentHashComputation(t *testing.T) { jsonlPath := filepath.Join(beadsDir, "issues.jsonl") // Create and populate database - localStore, err := sqlite.New(dbPath) + localStore, err := sqlite.New(ctx, dbPath) if err != nil { t.Fatalf("Failed to create store: %v", err) }