Use types.Status constants in merge package for type safety
Added StatusClosed constant derived from types.StatusClosed alongside the existing StatusTombstone constant. Replaced hardcoded "closed" strings with the constant for compile-time type checking consistency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -241,7 +241,10 @@ func makeKey(issue Issue) IssueKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use constants from types package to avoid duplication
|
// Use constants from types package to avoid duplication
|
||||||
const StatusTombstone = string(types.StatusTombstone)
|
const (
|
||||||
|
StatusTombstone = string(types.StatusTombstone)
|
||||||
|
StatusClosed = string(types.StatusClosed)
|
||||||
|
)
|
||||||
|
|
||||||
// Alias TTL constants from types package for local use
|
// Alias TTL constants from types package for local use
|
||||||
var (
|
var (
|
||||||
@@ -571,7 +574,7 @@ func mergeIssue(base, left, right Issue) (Issue, string) {
|
|||||||
|
|
||||||
// Merge closed_at - only if status is closed
|
// Merge closed_at - only if status is closed
|
||||||
// This prevents invalid state (status=open with closed_at set)
|
// This prevents invalid state (status=open with closed_at set)
|
||||||
if result.Status == "closed" {
|
if result.Status == StatusClosed {
|
||||||
result.ClosedAt = maxTime(left.ClosedAt, right.ClosedAt)
|
result.ClosedAt = maxTime(left.ClosedAt, right.ClosedAt)
|
||||||
} else {
|
} else {
|
||||||
result.ClosedAt = ""
|
result.ClosedAt = ""
|
||||||
@@ -622,8 +625,8 @@ func mergeStatus(base, left, right string) string {
|
|||||||
|
|
||||||
// RULE 1: closed always wins over open
|
// RULE 1: closed always wins over open
|
||||||
// This prevents the insane situation where issues never die
|
// This prevents the insane situation where issues never die
|
||||||
if left == "closed" || right == "closed" {
|
if left == StatusClosed || right == StatusClosed {
|
||||||
return "closed"
|
return StatusClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise use standard 3-way merge
|
// Otherwise use standard 3-way merge
|
||||||
|
|||||||
Reference in New Issue
Block a user