Render unknown for a zero CreatedAt in Slack/Mattermost messages (closes #298) #300

Merged
clawbot merged 1 commits from issue-298-zero-timestamp-fallback into next 2026-08-24 17:52:26 +02:00
Collaborator

Fixes #298.

FormatSlackMessage (internal/delivery/target_slack.go) rendered the
Timestamp line unconditionally. When a delivery falls back to a
reaped event row (hydrateEvent leaves CreatedAt as the zero value
deliberately, per #257),
the message carried *Timestamp:* \0001-01-01T00:00:00Z`` --
indistinguishable from the regression #257 was filed against.

Chose to render *Timestamp:* \unknown`whenCreatedAt.IsZero(), rather than omitting the line, so the message shape stays predictable. A non-zero CreatedAt` still renders as RFC3339, unchanged.

Same code path serves Mattermost; target_log.go doesn't render
CreatedAt so it isn't affected.

Added TestFormatSlackMessageZeroTimestamp in
internal/delivery/event_timestamp_test.go, asserting the zero-time
case contains no 0001-01-01 and renders unknown, and that a
non-zero CreatedAt still renders as RFC3339.

make check green, including a fresh (uncached) golangci-lint run
against the pinned image.

Fixes https://git.eeqj.de/sneak/webhooker/issues/298. `FormatSlackMessage` (`internal/delivery/target_slack.go`) rendered the Timestamp line unconditionally. When a delivery falls back to a reaped event row (`hydrateEvent` leaves `CreatedAt` as the zero value deliberately, per https://git.eeqj.de/sneak/webhooker/issues/257), the message carried `*Timestamp:* \`0001-01-01T00:00:00Z\`` -- indistinguishable from the regression #257 was filed against. Chose to render `*Timestamp:* \`unknown\`` when `CreatedAt.IsZero()`, rather than omitting the line, so the message shape stays predictable. A non-zero `CreatedAt` still renders as RFC3339, unchanged. Same code path serves Mattermost; `target_log.go` doesn't render `CreatedAt` so it isn't affected. Added `TestFormatSlackMessageZeroTimestamp` in `internal/delivery/event_timestamp_test.go`, asserting the zero-time case contains no `0001-01-01` and renders `unknown`, and that a non-zero `CreatedAt` still renders as RFC3339. `make check` green, including a fresh (uncached) `golangci-lint` run against the pinned image.
clawbot added the needs-review label 2026-08-24 17:47:15 +02:00
clawbot added 1 commit 2026-08-24 17:47:16 +02:00
Render unknown for a zero CreatedAt in Slack/Mattermost messages (closes #298)
All checks were successful
check / check (push) Successful in 3m9s
d5bebb8408
FormatSlackMessage rendered the Timestamp line unconditionally, so a
reaped-row fallback delivery carried "0001-01-01T00:00:00Z" -- the
exact string #257 was filed
against, indistinguishable from that regression. When
event.CreatedAt.IsZero(), render "unknown" instead; a real CreatedAt
still renders as RFC3339.
clawbot reviewed 2026-08-24 17:51:36 +02:00
clawbot left a comment
Author
Collaborator

Review: PASS. Zero-CreatedAt renders *Timestamp:* \unknown`with no0001-01-01anywhere in output; non-zero path unchanged (RFC3339/UTC). Mutation test: reverted theIsZero()guard intarget_slack.goTestFormatSlackMessageZeroTimestampfailed exactly as expected (both assertions), confirming the test is load-bearing; source restored after.make checkgreen on the PR head, including a fresh (non-cached)golangci-lint run, 0 issues. CI (check / check) green on d5bebb840. Merges cleanly against next(==main). Commit title ends (closes #298), no Claude/Anthropic references or attribution trailers anywhere. Scope check for other targets (per issue DoD item 3) confirmed: target_log.goandtarget_http.go/target_database.godon't renderevent.CreatedAt; only target_slack.go` did, and it's fixed.

Review: PASS. Zero-`CreatedAt` renders `*Timestamp:* \`unknown\`` with no `0001-01-01` anywhere in output; non-zero path unchanged (RFC3339/UTC). Mutation test: reverted the `IsZero()` guard in `target_slack.go` — `TestFormatSlackMessageZeroTimestamp` failed exactly as expected (both assertions), confirming the test is load-bearing; source restored after. `make check` green on the PR head, including a fresh (non-cached) `golangci-lint` run, 0 issues. CI (`check / check`) green on `d5bebb840`. Merges cleanly against `next` (== `main`). Commit title ends ` (closes #298)`, no Claude/Anthropic references or attribution trailers anywhere. Scope check for other targets (per issue DoD item 3) confirmed: `target_log.go` and `target_http.go`/`target_database.go` don't render `event.CreatedAt`; only `target_slack.go` did, and it's fixed.
clawbot reviewed 2026-08-24 17:51:46 +02:00
clawbot left a comment
Author
Collaborator

Review: PASS. Zero-CreatedAt renders *Timestamp:* \unknown`with no0001-01-01anywhere in output; non-zero path unchanged (RFC3339/UTC). Mutation test: reverted theIsZero()guard intarget_slack.goTestFormatSlackMessageZeroTimestampfailed exactly as expected (both assertions), confirming the test is load-bearing; source restored after.make checkgreen on the PR head, including a fresh (non-cached)golangci-lint run, 0 issues. CI (check / check) green on d5bebb840. Merges cleanly against next(==main). Commit title ends (closes #298), no Claude/Anthropic references or attribution trailers anywhere. Scope check for other targets (per issue DoD item 3) confirmed: target_log.goandtarget_http.go/target_database.godon't renderevent.CreatedAt; only target_slack.go` did, and it's fixed.

Review: PASS. Zero-`CreatedAt` renders `*Timestamp:* \`unknown\`` with no `0001-01-01` anywhere in output; non-zero path unchanged (RFC3339/UTC). Mutation test: reverted the `IsZero()` guard in `target_slack.go` — `TestFormatSlackMessageZeroTimestamp` failed exactly as expected (both assertions), confirming the test is load-bearing; source restored after. `make check` green on the PR head, including a fresh (non-cached) `golangci-lint` run, 0 issues. CI (`check / check`) green on `d5bebb840`. Merges cleanly against `next` (== `main`). Commit title ends ` (closes #298)`, no Claude/Anthropic references or attribution trailers anywhere. Scope check for other targets (per issue DoD item 3) confirmed: `target_log.go` and `target_http.go`/`target_database.go` don't render `event.CreatedAt`; only `target_slack.go` did, and it's fixed.
clawbot merged commit b0a011f6b4 into next 2026-08-24 17:52:26 +02:00
clawbot deleted branch issue-298-zero-timestamp-fallback 2026-08-24 17:52:26 +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#300