fix(events): Handle nullable label and milestone in resource events

GitLab returns null for the label/milestone fields on resource_label_events
and resource_milestone_events when the referenced label or milestone has
been deleted. This caused deserialization failures during sync.

- Add migration 012 to recreate both event tables with nullable
  label_name, milestone_title, and milestone_id columns (SQLite
  requires table recreation to alter NOT NULL constraints)
- Change GitLabLabelEvent.label and GitLabMilestoneEvent.milestone
  to Option<> in the Rust types
- Update upsert functions to pass through None values correctly
- Add tests for null label and null milestone deserialization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-02-03 17:36:17 -05:00
parent deafa88af5
commit a92e176bb6
5 changed files with 134 additions and 14 deletions

View File

@@ -230,7 +230,7 @@ pub struct GitLabLabelEvent {
pub created_at: String,
pub resource_type: String,
pub resource_id: i64,
pub label: GitLabLabelRef,
pub label: Option<GitLabLabelRef>,
pub action: String,
}
@@ -242,7 +242,7 @@ pub struct GitLabMilestoneEvent {
pub created_at: String,
pub resource_type: String,
pub resource_id: i64,
pub milestone: GitLabMilestoneRef,
pub milestone: Option<GitLabMilestoneRef>,
pub action: String,
}