Skip to content

V152: deliveries addressability CHECK + friendly incomplete-credentials flash - #649

Merged
ddon merged 1 commit into
BeamLabEU:mainfrom
timujinne:fix/mailer-incomplete-credentials
Jul 19, 2026
Merged

V152: deliveries addressability CHECK + friendly incomplete-credentials flash#649
ddon merged 1 commit into
BeamLabEU:mainfrom
timujinne:fix/mailer-incomplete-credentials

Conversation

@timujinne

Copy link
Copy Markdown
Contributor

Follow-up to the post-merge credential-leak fix (82f2ffc) that closed the [MAJOR] finding from the #647 review — two small pieces from that review round hadn't landed with it:

  1. Deliveries addressability CHECK.phoenix_kit_newsletters_deliveries gains CHECK (user_uuid IS NOT NULL OR recipient_email IS NOT NULL) in V152's broadcast section — with both columns now nullable, a both-NULL row is unaddressable. Idempotently guarded via information_schema.table_constraints (the V125 pattern; Postgres has no ADD CONSTRAINT IF NOT EXISTS), dropped first in down/1. The newsletters Broadcaster already filters such rows before insert_all, so this is a pure DB backstop; V152Test covers both-null rejected / either-side-alone accepted.

  2. Friendly flash for incomplete credentials. The Email Sending test-send handler now renders a specific message for {:error, {:incomplete_credentials, fields}} (field names only) instead of the generic inspect(reason) fallback, plus a LiveView test walking the full chain (validated connection → required field blanked → still connected? → flash names the missing field, and the secret never appears in the rendered HTML).

Databases already stamped '152' need the constraint applied manually (ALTER TABLE ... ADD CONSTRAINT phoenix_kit_newsletters_deliveries_recipient_check CHECK (user_uuid IS NOT NULL OR recipient_email IS NOT NULL)) — same accumulator caveat as documented in the migration's moduledoc.

Verification: V152 fresh-chain + targeted suites (migration, mailer, Email Sending LiveView) — 69 tests, 0 failures; credo --strict clean on touched files.

…s flash
Follow-up to the PR BeamLabEU#647 post-merge credential-leak fix (82f2ffc):
- phoenix_kit_newsletters_deliveries gains CHECK (user_uuid IS NOT NULL
OR recipient_email IS NOT NULL) in V152's broadcast section — a
both-NULL delivery row is unaddressable. Idempotently guarded via
information_schema (same pattern as V125), dropped first in down/1.
The newsletters Broadcaster already filters such rows before
insert_all, so this is a pure DB backstop.
- The Email Sending test-send flash now renders a specific message for
{:error, {:incomplete_credentials, fields}} (field names only) instead
of falling through to the generic inspect(reason).
@ddon
ddon merged commit 90ef74a into BeamLabEU:mainJul 19, 2026
ddon pushed a commit that referenced this pull request Jul 19, 2026
Reviewed alongside PR #648 as part of the same release: no issues
found, both the CHECK constraint and the incomplete-credentials
flash are correctly implemented and tested.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@timujinne
timujinne deleted the fix/mailer-incomplete-credentials branch August 6, 2026 05:55
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@timujinne@ddon