fix: Include tombstones in DB count for stale check (bd-53c)

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 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-18 00:41:49 -08:00
parent 6394033f72
commit b4a6ee4f5f

View File

@@ -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)
}