fix(dolt): parse timestamps from TEXT columns instead of direct time.Time scan

The Dolt storage was scanning created_at and updated_at directly into
time.Time fields, but SQLite stores these as TEXT strings. The Go SQLite
driver cannot automatically convert TEXT to time.Time.

Added parseTimeString() helper and fixed all scan functions:
- issues.go: scanIssue()
- dependencies.go: scanIssueRow()
- history.go: GetIssueHistory(), GetIssueAsOf()
- transaction.go: scanIssueTx()

Fixes bd-4dqmy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/lydia
2026-01-21 20:48:34 -08:00
committed by Steve Yegge
parent b63e7b8cf0
commit 2cc96197c0
5 changed files with 88 additions and 5 deletions

View File

@@ -74,6 +74,7 @@ func (s *DoltStore) GetIssueHistory(ctx context.Context, issueID string) ([]*Iss
for rows.Next() {
var h IssueHistory
var issue types.Issue
var createdAtStr, updatedAtStr sql.NullString // TEXT columns - must parse manually
var closedAt sql.NullTime
var assignee, owner, createdBy, closeReason, molType sql.NullString
var estimatedMinutes sql.NullInt64
@@ -82,13 +83,21 @@ func (s *DoltStore) GetIssueHistory(ctx context.Context, issueID string) ([]*Iss
if err := rows.Scan(
&issue.ID, &issue.Title, &issue.Description, &issue.Design, &issue.AcceptanceCriteria, &issue.Notes,
&issue.Status, &issue.Priority, &issue.IssueType, &assignee, &owner, &createdBy,
&estimatedMinutes, &issue.CreatedAt, &issue.UpdatedAt, &closedAt, &closeReason,
&estimatedMinutes, &createdAtStr, &updatedAtStr, &closedAt, &closeReason,
&pinned, &molType,
&h.CommitHash, &h.Committer, &h.CommitDate,
); err != nil {
return nil, fmt.Errorf("failed to scan history: %w", err)
}
// Parse timestamp strings (TEXT columns require manual parsing)
if createdAtStr.Valid {
issue.CreatedAt = parseTimeString(createdAtStr.String)
}
if updatedAtStr.Valid {
issue.UpdatedAt = parseTimeString(updatedAtStr.String)
}
if closedAt.Valid {
issue.ClosedAt = &closedAt.Time
}
@@ -130,6 +139,7 @@ func (s *DoltStore) GetIssueAsOf(ctx context.Context, issueID string, ref string
}
var issue types.Issue
var createdAtStr, updatedAtStr sql.NullString // TEXT columns - must parse manually
var closedAt sql.NullTime
var assignee, owner, contentHash sql.NullString
var estimatedMinutes sql.NullInt64
@@ -144,7 +154,7 @@ func (s *DoltStore) GetIssueAsOf(ctx context.Context, issueID string, ref string
err := s.db.QueryRowContext(ctx, query, issueID).Scan(
&issue.ID, &contentHash, &issue.Title, &issue.Description, &issue.Status, &issue.Priority, &issue.IssueType, &assignee, &estimatedMinutes,
&issue.CreatedAt, &issue.CreatedBy, &owner, &issue.UpdatedAt, &closedAt,
&createdAtStr, &issue.CreatedBy, &owner, &updatedAtStr, &closedAt,
)
if err == sql.ErrNoRows {
@@ -154,6 +164,14 @@ func (s *DoltStore) GetIssueAsOf(ctx context.Context, issueID string, ref string
return nil, fmt.Errorf("failed to get issue as of %s: %w", ref, err)
}
// Parse timestamp strings (TEXT columns require manual parsing)
if createdAtStr.Valid {
issue.CreatedAt = parseTimeString(createdAtStr.String)
}
if updatedAtStr.Valid {
issue.UpdatedAt = parseTimeString(updatedAtStr.String)
}
if contentHash.Valid {
issue.ContentHash = contentHash.String
}