fix(types): add tombstone validation and block direct status update (bd-md2, bd-y68)
- Add validation in ValidateWithCustomStatuses() requiring deleted_at for tombstones - Add validation that non-tombstones cannot have deleted_at set - Block direct status update to tombstone in validateStatusWithCustom() - Users must use 'bd delete' instead of 'bd update --status=tombstone' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -112,6 +112,13 @@ func (i *Issue) ValidateWithCustomStatuses(customStatuses []string) error {
|
||||
if i.Status != StatusClosed && i.ClosedAt != nil {
|
||||
return fmt.Errorf("non-closed issues cannot have closed_at timestamp")
|
||||
}
|
||||
// Enforce tombstone invariants (bd-md2): deleted_at must be set for tombstones, and only for tombstones
|
||||
if i.Status == StatusTombstone && i.DeletedAt == nil {
|
||||
return fmt.Errorf("tombstone issues must have deleted_at timestamp")
|
||||
}
|
||||
if i.Status != StatusTombstone && i.DeletedAt != nil {
|
||||
return fmt.Errorf("non-tombstone issues cannot have deleted_at timestamp")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user