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:
Steve Yegge
2025-12-30 15:54:37 -08:00
parent 48dca4ea33
commit 31ee2a61b5

View File

@@ -241,7 +241,10 @@ func makeKey(issue Issue) IssueKey {
}
// 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
var (
@@ -571,7 +574,7 @@ func mergeIssue(base, left, right Issue) (Issue, string) {
// Merge closed_at - only if status is closed
// 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)
} else {
result.ClosedAt = ""
@@ -622,8 +625,8 @@ func mergeStatus(base, left, right string) string {
// RULE 1: closed always wins over open
// This prevents the insane situation where issues never die
if left == "closed" || right == "closed" {
return "closed"
if left == StatusClosed || right == StatusClosed {
return StatusClosed
}
// Otherwise use standard 3-way merge