Fix bd-206: Handle status transitions and closed_at constraint
- Updated manageClosedAt to handle both string and types.Status type assertions - Added equalTime function for comparing timestamps in import change detection - Added tests for open→closed and closed→open transitions - Added comment clarifying closed_at is managed automatically The bug occurred when UpdateIssue received types.Status instead of string, causing manageClosedAt to skip setting closed_at when status changed to closed. Amp-Thread-ID: https://ampcode.com/threads/T-ee774f6d-3b90-4311-976d-60c8dd8fe677 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -181,16 +181,19 @@ func upsertIssues(ctx context.Context, sqliteStore *sqlite.SQLiteStorage, issues
|
||||
updates["acceptance_criteria"] = issue.AcceptanceCriteria
|
||||
updates["notes"] = issue.Notes
|
||||
|
||||
// bd-206: closed_at is managed automatically by UpdateIssue based on status
|
||||
// No need to set it explicitly here
|
||||
|
||||
if issue.Assignee != "" {
|
||||
updates["assignee"] = issue.Assignee
|
||||
updates["assignee"] = issue.Assignee
|
||||
} else {
|
||||
updates["assignee"] = nil
|
||||
updates["assignee"] = nil
|
||||
}
|
||||
|
||||
if issue.ExternalRef != nil && *issue.ExternalRef != "" {
|
||||
updates["external_ref"] = *issue.ExternalRef
|
||||
updates["external_ref"] = *issue.ExternalRef
|
||||
} else {
|
||||
updates["external_ref"] = nil
|
||||
updates["external_ref"] = nil
|
||||
}
|
||||
|
||||
// bd-88: Only update if data actually changed (prevents timestamp churn)
|
||||
|
||||
Reference in New Issue
Block a user