fix(storage): normalize timestamps to UTC to prevent validation failures (#1123)

All time.Now() calls in the dolt storage layer now use time.Now().UTC()
to ensure consistent timezone handling. Previously, timestamps could be
stored with mixed timezone formats (UTC 'Z' vs local '+01:00'), causing
bv validation to fail when updated_at appeared earlier than created_at
in absolute time.

Files modified:
- transaction.go: CreateIssue, UpdateIssue, CloseIssue
- issues.go: CreateIssue, CreateIssues, UpdateIssue, CloseIssue, markDirty, manageClosedAt
- rename.go: UpdateIssueID (2 locations)
- events.go: AddIssueComment (2 locations)
- dirty.go: SetExportHash
- queries.go: Overdue filter, GetStaleIssues

Fixes: bd-84gw9

Co-authored-by: LoomDeBWiles <loomenwiles@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
LoomDeBWiles
2026-01-15 22:22:50 -05:00
committed by GitHub
parent 490e9f695f
commit c40affd601
6 changed files with 16 additions and 16 deletions

View File

@@ -43,7 +43,7 @@ func (s *DoltStore) RunInTransaction(ctx context.Context, fn func(tx storage.Tra
// CreateIssue creates an issue within the transaction
func (t *doltTransaction) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error {
now := time.Now()
now := time.Now().UTC()
if issue.CreatedAt.IsZero() {
issue.CreatedAt = now
}
@@ -122,7 +122,7 @@ func (t *doltTransaction) SearchIssues(ctx context.Context, query string, filter
// UpdateIssue updates an issue within the transaction
func (t *doltTransaction) UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error {
setClauses := []string{"updated_at = ?"}
args := []interface{}{time.Now()}
args := []interface{}{time.Now().UTC()}
for key, value := range updates {
if !isAllowedUpdateField(key) {
@@ -145,7 +145,7 @@ func (t *doltTransaction) UpdateIssue(ctx context.Context, id string, updates ma
// CloseIssue closes an issue within the transaction
func (t *doltTransaction) CloseIssue(ctx context.Context, id string, reason string, actor string, session string) error {
now := time.Now()
now := time.Now().UTC()
_, err := t.tx.ExecContext(ctx, `
UPDATE issues SET status = ?, closed_at = ?, updated_at = ?, close_reason = ?, closed_by_session = ?
WHERE id = ?