notify package and durable outbox worker (Feature 19) #161

2 Commits
Author SHA1 Message Date
dev_agentandClaude Opus 5.5 101498185e Fail overdue notifications before sending them (N-01)
CI / ci (push) Successful in 6m18s
CI / ci (pull_request) Successful in 6m4s
The worker checked the 24-hour give-up deadline only after Send failed, so
an overdue row whose delivery succeeded was marked sent and a stale
notification reached the household. Check the deadline before Send: a row
claimed 24 hours or more after its creation is marked failed, with the
reason and any previous error in last_error, and the sender is never
called. A delivery failing before the deadline still retries with the same
backoff.

Tests cover a succeeding and a failing sender at exactly 24 hours and
after, a row just under the deadline still being sent, and the retry run
now ending with a failure at the deadline instead of a 30th attempt.

Task: addeb256-a4d4-4acf-8acd-6b6778d967ee

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:27:44 -04:00
dev_agentandClaude Opus 5.5 615969cff2 Add notify package and durable notification outbox worker (Feature 19)
CI / ci (push) Successful in 5m54s
CI / ci (pull_request) Successful in 5m30s
Emit(ctx, Event) is the single decision point for who is told what: it
reads the event type's notification_prefs row and stores one pending
notification_outbox row per enabled channel, keyed by (event_key, channel)
with ON CONFLICT DO NOTHING, so a duplicate key never adds or resets a row.

The worker, started and stopped by cmd/server with the job runner, leases
due rows with a conditional update, delivers them through the Sender
registered for their channel, and marks them sent, or retries with a
backoff of 1 minute doubling to 1 hour until 24 hours after creation,
then marks them failed with last_error. A channel with no registered
sender fails its rows with an explicit error.

Maestro task addeb256-a4d4-4acf-8acd-6b6778d967ee.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:23:39 -04:00