Skip to content

fix: use UTC_TIMESTAMP() for defer_until comparisons#2819

Merged
maphew merged 1 commit intosteveyegge:mainfrom
toumorokoshi:yft/fix-utc
Mar 26, 2026
Merged

fix: use UTC_TIMESTAMP() for defer_until comparisons#2819
maphew merged 1 commit intosteveyegge:mainfrom
toumorokoshi:yft/fix-utc

Conversation

@toumorokoshi
Copy link
Copy Markdown
Contributor

Go stores defer_until as UTC via time.Time, but Dolt's NOW() returns the server's local time. On non-UTC machines (e.g., PDT = UTC-7), the comparison 'defer_until <= NOW()' produces wrong results — a past-deferred issue may not appear in bd ready because NOW() returns a local time hours behind the UTC-stored defer_until.

Fix: Replace NOW() with UTC_TIMESTAMP() in all 4 defer_until SQL comparisons (queries.go lines 169/1005, schema.go ready_issues view). Bump schema version to 8 so the view gets recreated.

Adds two unit tests:

  • TestGetReadyWork_PastDeferredIssueIsReady
  • TestGetReadyWork_FutureDeferredIssueExcluded

Go stores defer_until as UTC via time.Time, but Dolt's NOW() returns
the server's local time. On non-UTC machines (e.g., PDT = UTC-7),
the comparison 'defer_until <= NOW()' produces wrong results — a
past-deferred issue may not appear in bd ready because NOW() returns
a local time hours behind the UTC-stored defer_until.

Fix: Replace NOW() with UTC_TIMESTAMP() in all 4 defer_until SQL
comparisons (queries.go lines 169/1005, schema.go ready_issues view).
Bump schema version to 8 so the view gets recreated.

Adds two unit tests:
- TestGetReadyWork_PastDeferredIssueIsReady
- TestGetReadyWork_FutureDeferredIssueExcluded
@maphew maphew merged commit ec2ac43 into steveyegge:main Mar 26, 2026
@maphew
Copy link
Copy Markdown
Collaborator

maphew commented Mar 26, 2026

Thanks @toumorokoshi this UTC timestamp fix is a real correctness bug that affects anyone not on UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants