Skip to content

fix: normalise sqlite timestamps to UTC in timeToString (RUK-139) - #23

Merged
ruko1202 merged 1 commit into
mainfrom
feature/ruk-139
May 25, 2026
Merged

fix: normalise sqlite timestamps to UTC in timeToString (RUK-139)#23
ruko1202 merged 1 commit into
mainfrom
feature/ruk-139

Conversation

@ruko1202

Copy link
Copy Markdown
Owner

SQLite stores timestamps as RFC3339 text and compares them
lexicographically. A row written in a non-UTC zone
("2026-05-25T16:00:00+03:00") compares wrong against a UTC row
("2026-05-25T13:00:00Z") even though both moments are identical —
'Z' > '+' in ASCII, so the offset row sorts before the UTC row of
the same instant. Healer/cleaner WHERE clauses then either miss
stuck tasks or pick them up at the wrong moment.

Force UTC at the write boundary (timeToString) and the order is
stable for every row this package writes. All storage WHERE clauses
already go through timeToString for their comparison values, so the
fix is one .UTC() call.

Acceptance for RUK-139 was originally "store INTEGER unix-ms". We
do NOT do that here: SQLite is positioned as dev/test only in the
README, the timestamp column rewrite would be a breaking schema
change + jet regen + bind rewrite (~50 lines + new go.mod tooling),
and the UTC normalisation closes the practical risk surface (all
goque-side writes are now consistent; only external writers
hand-inserting non-UTC rows are still at risk and that's out of
scope for a goque-managed table).

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

SQLite stores timestamps as RFC3339 text and compares them
lexicographically. A row written in a non-UTC zone
("2026-05-25T16:00:00+03:00") compares wrong against a UTC row
("2026-05-25T13:00:00Z") even though both moments are identical —
'Z' > '+' in ASCII, so the offset row sorts before the UTC row of
the same instant. Healer/cleaner WHERE clauses then either miss
stuck tasks or pick them up at the wrong moment.

Force UTC at the write boundary (timeToString) and the order is
stable for every row this package writes. All storage WHERE clauses
already go through timeToString for their comparison values, so the
fix is one .UTC() call.

Acceptance for RUK-139 was originally "store INTEGER unix-ms". We
do NOT do that here: SQLite is positioned as dev/test only in the
README, the timestamp column rewrite would be a breaking schema
change + jet regen + bind rewrite (~50 lines + new go.mod tooling),
and the UTC normalisation closes the practical risk surface (all
goque-side writes are now consistent; only external writers
hand-inserting non-UTC rows are still at risk and that's out of
scope for a goque-managed table).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ruko1202
ruko1202 merged commit caed9c7 into main May 25, 2026
4 checks passed
@ruko1202
ruko1202 deleted the feature/ruk-139 branch May 25, 2026 13:06
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.

1 participant