Fix #94: Handle NULL assignee in epic status query

- Use sql.NullString to scan nullable assignee column
- Prevents 'converting NULL to string is unsupported' error
- Only set assignee if value is valid (not NULL)
This commit is contained in:
Steve Yegge
2025-10-21 15:01:26 -07:00
parent ec946ee48b
commit acc813e528

View File

@@ -2,6 +2,7 @@ package sqlite
import (
"context"
"database/sql"
"github.com/steveyegge/beads/internal/types"
)
@@ -49,11 +50,12 @@ func (s *SQLiteStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*type
for rows.Next() {
var epic types.Issue
var totalChildren, closedChildren int
var assignee sql.NullString
err := rows.Scan(
&epic.ID, &epic.Title, &epic.Description, &epic.Design,
&epic.AcceptanceCriteria, &epic.Notes, &epic.Status,
&epic.Priority, &epic.IssueType, &epic.Assignee,
&epic.Priority, &epic.IssueType, &assignee,
&epic.EstimatedMinutes, &epic.CreatedAt, &epic.UpdatedAt,
&epic.ClosedAt, &epic.ExternalRef,
&totalChildren, &closedChildren,
@@ -62,6 +64,11 @@ func (s *SQLiteStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*type
return nil, err
}
// Convert sql.NullString to string
if assignee.Valid {
epic.Assignee = assignee.String
}
eligibleForClose := false
if totalChildren > 0 && closedChildren == totalChildren {
eligibleForClose = true