Store delivery and archive times without the monotonic clock reading #533

Merged
clawbot merged 1 commits from issue-529-timestamps-without-monotonic-reading into next 2026-10-15 11:15:36 +02:00
Collaborator

closes #529

finished_at (written by writeDeliveryStatus), archived_at (written by the archive writer) and the updated_at stamp that takeForRedispatch writes all came from a bare time.Now(). The SQLite driver stores a time as the text of time.Time.String(), and for a time read from time.Now() that text ends in the monotonic clock reading ( m=+365.03). All three now come from GORM's own clock, NowFunc() on the handle they are written through. That is the clock that stamps created_at (GORM's default, time.Now().Local()), so all of them are now stored in the same form.

Tests: the existing test for each of the three writes now reads the column back as text and requires the layout of time.Time.String() with nothing after it. The two tests on deliveries check created_at the same way, so the test also catches it if the form created_at is stored in changes.

The download is unchanged: it reads archived_at as a time and writes it in UTC as RFC 3339.

Package: all changes are in internal/delivery, which writes these rows.

  • Scope: the issue does not name the updated_at stamp in takeForRedispatch. It was the only other bare time.Now() the delivery package writes to the database, and the plan comment says to fix any such write the same way.
  • Not changed: the cutoff times passed as query parameters (pending sweep, archive prune, retention) still carry the reading. They are only compared against stored values, never stored.

Model: opus-5-5

closes https://git.eeqj.de/sneak/webhooker/issues/529 `finished_at` (written by `writeDeliveryStatus`), `archived_at` (written by the archive writer) and the `updated_at` stamp that `takeForRedispatch` writes all came from a bare `time.Now()`. The SQLite driver stores a time as the text of `time.Time.String()`, and for a time read from `time.Now()` that text ends in the monotonic clock reading (` m=+365.03`). All three now come from GORM's own clock, `NowFunc()` on the handle they are written through. That is the clock that stamps `created_at` (GORM's default, `time.Now().Local()`), so all of them are now stored in the same form. Tests: the existing test for each of the three writes now reads the column back as text and requires the layout of `time.Time.String()` with nothing after it. The two tests on `deliveries` check `created_at` the same way, so the test also catches it if the form `created_at` is stored in changes. The download is unchanged: it reads `archived_at` as a time and writes it in UTC as RFC 3339. Package: all changes are in `internal/delivery`, which writes these rows. - Scope: the issue does not name the `updated_at` stamp in `takeForRedispatch`. It was the only other bare `time.Now()` the delivery package writes to the database, and the plan comment says to fix any such write the same way. - Not changed: the cutoff times passed as query parameters (pending sweep, archive prune, retention) still carry the reading. They are only compared against stored values, never stored. Model: opus-5-5
clawbot added the needs-review label 2026-10-15 10:28:07 +02:00
clawbot self-assigned this 2026-10-15 10:28:07 +02:00
clawbot added 1 commit 2026-10-15 10:28:07 +02:00
finished_at, archived_at and the updated_at stamp a re-dispatch
writes came from a bare time.Now(). The SQLite driver stores a time
as time.Time.String(), which appends the monotonic clock reading
(" m=+…") to a time read from time.Now(). All three now come from
GORM's own clock, NowFunc(), which stamps created_at, so they are
stored in the same form. The tests for each write read the stored
text back.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot removed the needs-review label 2026-10-15 11:05:08 +02:00
clawbot merged commit f14fe02011 into next 2026-10-15 11:15:36 +02:00
clawbot deleted branch issue-529-timestamps-without-monotonic-reading 2026-10-15 11:15:37 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#533