Repository navigation
Phase 2b+2c: announcement queue and delivery events - #1916
Merged
neuromechanist merged 15 commits intoOct 24, 2026
Merged
neuromechanist merged 15 commits into
neuromechanist merged 15 commits into
Conversation
Migration 0100 adds status and outcome counters to broadcast_emails. sendBroadcast enqueues one message per allowed recipient when the Cloudflare provider and EMAIL_OUTBOX are both present. Tested with real D1 and a recording Queue binding.
queue() dispatches broadcast messages to handleOutboxBatch, which sends through sendEmail and records each outcome on the audit row. Rate limits retry after 300s; unknown outcomes are never retried. Exports CLOUDFLARE_LIMIT_CODES.
GET /admin/notify/:id reports a queued announcement's counts; nemar admin notify prints the queued result and gains --status. POST answers 502 when enqueueing fails.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1916Version: 🤖 Updated on each push. |
Add broadcast_outcomes keyed by recipient hash; counters move only when the outcome insert took. A partial enqueue records unqueued outcomes and answers 200 with the counts.
max_retries 10 with growing limit delay, give up and record a failure on the final attempt, defer the rest of a batch after a limit refusal, skip already-recorded recipients. Names the queues in wrangler and tags the unrecognised-message log.
…' into feature/issue-1895-phase2b-outbox
Adds the new CLI API export to the per-module pin and the post-split list. Tested: api export surface, notify CLI and route inventory tests.
The outbox retry check now reads only the outbox consumers, and the 0098 schema check lists 0101's table and indexes as a later migration's. Tested: events, outbox, 0098 migration and provider suites.
A failed D1 write now retries after a growing delay instead of at once; the ADR states the outbox retry bound, the de-duplication, and that every other event type is dropped. Tested: events and outbox suites, ADR index, typecheck.
neuromechanist
merged commit Oct 24, 2026
6ba0f00
into
feature/issue-1893-epic-email-cf
14 checks passed
This was referenced Oct 24, 2026
Merged
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two parts of Phase 2 in one PR to save a CI cycle.
2b, announcements on a Queue. When the Cloudflare email provider is active and
EMAIL_OUTBOXis bound,nemar admin notifyrecords the broadcast asqueuedand enqueues one message per allowed, de-duplicated recipient onnemar-email-outbox(-devon staging). The same Worker consumes it and sends throughsendEmail, so the dev fence and[DEV]wrap still apply.status,queued_count,delivered_count,unknown_countonbroadcast_emails, andbroadcast_outcomes(one row per broadcast and recipient hash) so a redelivered message is never re-sent or double-counted.queue_enqueue_failed, the broadcast id and counts.GET /admin/notify/:idandnemar admin notify --status <id>.2c, delivery events. Cloudflare publishes
message.bouncedandmessage.complainedfor each sending domain tonemar-email-events(-dev); the Worker stores them inemail_delivery_events(migration 0101,INSERT OR IGNOREon the event id, no subject, SMTP response clamped) and prunes rows after 180 days. ADR 0110 and the epic notes are amended for the fallback set, the queue and the events.Operator steps already done: all queues and dead-letter queues exist; subscriptions for
test.nemar.organdnemar.orgare created.Part of #1895, epic #1893.
Test plan
bun run typecheck,bun run lint, ADR index test--userannouncement arrives and reachesdone; a bounce lands in dev D1🤖 Generated with Claude Code