Repository navigation
Record why an email send was rejected or failed - #132
Conversation
Adds email_send_log.reason so the rejected path (59% of logged sends) can be grouped by cause. Written by api logEmailAttempt as a short code then detail, e.g. "recipient_not_allowed: a@example.com". Refs recoupable/app#1949 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Updates to Preview Branch (codex/email-send-reason) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="supabase/migrations/20261106120000_email_send_log_reason.sql">
<violation number="1" location="supabase/migrations/20261106120000_email_send_log_reason.sql:10">
P3: `reason` combines the cause code and the per-send detail (such as a recipient address) in one free-text value. A plain `GROUP BY reason` will split rejections by recipient, not by cause. Consider separate `reason_code` and `reason_detail` columns, or document the `split_part(reason, ': ', 1)` grouping for analysts. The column is not yet populated, so changing it now is cheap.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| -- followed by detail, e.g. `recipient_not_allowed: a@example.com`, so the | ||
| -- rejection rate can be grouped by cause. Null for successful sends. | ||
|
|
||
| ALTER TABLE public.email_send_log ADD COLUMN IF NOT EXISTS reason TEXT; |
There was a problem hiding this comment.
P3: reason combines the cause code and the per-send detail (such as a recipient address) in one free-text value. A plain GROUP BY reason will split rejections by recipient, not by cause. Consider separate reason_code and reason_detail columns, or document the split_part(reason, ': ', 1) grouping for analysts. The column is not yet populated, so changing it now is cheap.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At supabase/migrations/20261106120000_email_send_log_reason.sql, line 10:
<comment>`reason` combines the cause code and the per-send detail (such as a recipient address) in one free-text value. A plain `GROUP BY reason` will split rejections by recipient, not by cause. Consider separate `reason_code` and `reason_detail` columns, or document the `split_part(reason, ': ', 1)` grouping for analysts. The column is not yet populated, so changing it now is cheap.</comment>
<file context>
@@ -0,0 +1,10 @@
+-- followed by detail, e.g. `recipient_not_allowed: a@example.com`, so the
+-- rejection rate can be grouped by cause. Null for successful sends.
+
+ALTER TABLE public.email_send_log ADD COLUMN IF NOT EXISTS reason TEXT;
</file context>
Records the merged monthly-onboarding and missed-report work: recoupable/database#132, recoupable/api#1235 and #1236, and recoupable/app#2392, #2393 and #2394, plus whatever else landed on those mains since the last recorded commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Adds a nullable
reasoncolumn toemail_send_log, so a rejected or failedPOST /api/emailsattempt records why.Why
Most logged sends (59% in the August investigation on recoupable/app#1949) were
rejected, and the log could not say why: the rejected path stored only the raw body, and the earliererrorcolumn was dropped in20260630211500because nothing filled it. The companion api PR writesreasonas a short code then detail (recipient_not_allowed: …,invalid_body: html: …,no_account_email,auth_failed: 401,resend_error: …), so the rejection rate can be grouped by cause.Notes
🤖 Generated with Claude Code
Summary by cubic
Adds a nullable
reasoncolumn toemail_send_logso rejected or failedPOST /api/emailsattempts can record why.rejectedwith nothing to say why; the earliererrorcolumn was dropped because nothing filled it.reasonas a short code followed by detail, e.g.recipient_not_allowed: …, so rejection rate can be grouped by cause.Written for commit 675e45a. Summary will update on new commits.