feat(cleanup): protect pinned issues from cleanup/compact (bd-b2k)

Add Pinned field to Issue struct and database schema to protect
issues from accidental deletion via cleanup or compaction.

Changes:
- Add Pinned bool field to types.Issue
- Create migration 023_pinned_column.go for database schema
- Filter out pinned issues in cleanup command before deletion
- Add pinned check to GetTier1Candidates and GetTier2Candidates
- Add pinned check to CheckEligibility for compaction
- Update all SQL queries and scan functions to include pinned field

🤖 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-19 00:42:35 -08:00
parent 9dc34da64a
commit f032eccbad
13 changed files with 152 additions and 35 deletions

View File

@@ -159,7 +159,7 @@ func (s *SQLiteStorage) GetIssuesByLabel(ctx context.Context, label string) ([]*
i.status, i.priority, i.issue_type, i.assignee, i.estimated_minutes,
i.created_at, i.updated_at, i.closed_at, i.external_ref, i.source_repo, i.close_reason,
i.deleted_at, i.deleted_by, i.delete_reason, i.original_type,
i.sender, i.ephemeral
i.sender, i.ephemeral, i.pinned
FROM issues i
JOIN labels l ON i.id = l.issue_id
WHERE l.label = ?