From b4a6ee4f5f236083a9fda6f2689f39b15b89f2f8 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Thu, 18 Dec 2025 00:41:49 -0800 Subject: [PATCH] fix: Include tombstones in DB count for stale check (bd-53c) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The countDBIssuesFast() fallback path used SearchIssues without IncludeTombstones, returning only live issues (161). Meanwhile countIssuesInJSONL counts all lines including tombstones (221). This mismatch caused false "stale DB detected" warnings on every sync, even when DB and JSONL were in sync. Fix: Set IncludeTombstones: true in the fallback SearchIssues call. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- cmd/bd/integrity.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/bd/integrity.go b/cmd/bd/integrity.go index 159b574a..bb33dc6c 100644 --- a/cmd/bd/integrity.go +++ b/cmd/bd/integrity.go @@ -367,7 +367,8 @@ func countDBIssuesFast(ctx context.Context, store storage.Storage) (int, error) } // Fallback: load all issues and count them (slow but always works) - issues, err := store.SearchIssues(ctx, "", types.IssueFilter{}) + // Include tombstones to match JSONL count which includes tombstones + issues, err := store.SearchIssues(ctx, "", types.IssueFilter{IncludeTombstones: true}) if err != nil { return 0, fmt.Errorf("failed to count database issues: %w", err) }