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

@@ -376,6 +376,7 @@ func insertIssueTx(ctx context.Context, tx *sql.Tx, issue *types.Issue) error {
func scanIssueTx(ctx context.Context, tx *sql.Tx, id string) (*types.Issue, error) {
var issue types.Issue
var createdAtStr, updatedAtStr sql.NullString // TEXT columns - must parse manually
var closedAt sql.NullTime
var estimatedMinutes sql.NullInt64
var assignee, owner, contentHash sql.NullString
@@ -392,7 +393,7 @@ func scanIssueTx(ctx context.Context, tx *sql.Tx, id string) (*types.Issue, erro
&issue.ID, &contentHash, &issue.Title, &issue.Description, &issue.Design,
&issue.AcceptanceCriteria, &issue.Notes, &issue.Status,
&issue.Priority, &issue.IssueType, &assignee, &estimatedMinutes,
&issue.CreatedAt, &issue.CreatedBy, &owner, &issue.UpdatedAt, &closedAt,
&createdAtStr, &issue.CreatedBy, &owner, &updatedAtStr, &closedAt,
&ephemeral, &pinned, &isTemplate, &crystallizes,
)
@@ -403,6 +404,14 @@ func scanIssueTx(ctx context.Context, tx *sql.Tx, id string) (*types.Issue, erro
return nil, 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
}