fix: tombstone/deletion overhaul for bd-4q8

- IsExpired(): Negative TTL means immediately expired (for --hard mode)
- IsExpired(): ClockSkewGrace only added for TTLs > 1 hour
- bd cleanup --hard: Use negative TTL to prune freshly created tombstones
- bd delete --hard: New flag to immediately prune tombstones from JSONL
- Import: Add early tombstone check before all phases to prevent resurrection

The early tombstone check prevents ghost issues from being created when
tombstones exist in the DB. However, a deeper git merge issue (bd-ncwo)
can still cause resurrection when remote's status:closed wins the merge.

🤖 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-16 22:01:31 -08:00
parent 8d73a86f7a
commit 0ce039429d
5 changed files with 95 additions and 12 deletions

View File

@@ -77,8 +77,9 @@ SEE ALSO:
if olderThanDays > 0 {
customTTL = time.Duration(olderThanDays) * 24 * time.Hour
} else {
// --hard without --older-than: prune ALL tombstones (use 1 second TTL)
customTTL = time.Second
// --hard without --older-than: prune ALL tombstones immediately
// Negative TTL means "immediately expired" (bd-4q8 fix)
customTTL = -1
}
if !jsonOutput && !dryRun {
fmt.Println(color.YellowString("⚠️ HARD DELETE MODE: Bypassing tombstone TTL safety"))
@@ -186,7 +187,8 @@ SEE ALSO:
}
// Use the existing batch deletion logic
deleteBatch(cmd, issueIDs, force, dryRun, cascade, jsonOutput, "cleanup")
// Note: cleanup always creates tombstones first; --hard prunes them after
deleteBatch(cmd, issueIDs, force, dryRun, cascade, jsonOutput, false, "cleanup")
// Also prune expired tombstones (bd-08ea)
// This runs after closed issues are converted to tombstones, cleaning up old ones