fix(doctor): include tombstones in getCurrentJSONLIDs to prevent corruption (#552)

The previous bd-in7q fix had backwards logic - by EXCLUDING tombstones
from currentIDs, they appeared missing when compared to historicalIDs,
causing HydrateDeletionsManifest to erroneously add them to deletions.jsonl.

This corruption manifested when:
1. Issues were migrated to tombstones via migrate-tombstones
2. Doctor hydration ran (directly or via sync)
3. Tombstones were seen as deleted and re-added to deletions.jsonl
4. Next import skipped thousands of issues with in deletions manifest

Fix: Include ALL issues (including tombstones) in currentIDs. Tombstones
represent migrated deletions that ARE accounted for - they should not
trigger new deletion records.

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-14 17:33:07 -08:00
parent e5f185875e
commit 1e20d702f2
2 changed files with 28 additions and 17 deletions
+6 -3
View File
@@ -126,9 +126,12 @@ func getCurrentJSONLIDs(jsonlPath string) (map[string]bool, error) {
if err := json.Unmarshal(line, &issue); err != nil {
continue
}
// Skip tombstones - they represent migrated deletions and shouldn't
// be re-added to the deletions manifest (bd-in7q fix)
if issue.ID != "" && issue.Status != "tombstone" {
// Include ALL issues including tombstones (bd-552 fix)
// Tombstones represent migrated deletions that ARE accounted for.
// By including them in currentIDs, they won't appear "missing" when
// compared to historicalIDs, preventing erroneous re-addition to
// deletions.jsonl. The previous bd-in7q fix had backwards logic.
if issue.ID != "" {
ids[issue.ID] = true
}
}