Skip to content

Campus Connect: log silent email-trigger no-ops; fix overclaiming notice text (issue #1714 point 4) - #1748

Open
peiraisotta wants to merge 1 commit into
productionfrom
cc-needs-orientation-email-observability
Open

Campus Connect: log silent email-trigger no-ops; fix overclaiming notice text (issue #1714 point 4)#1748
peiraisotta wants to merge 1 commit into
productionfrom
cc-needs-orientation-email-observability

Conversation

@peiraisotta

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1730/#1731. Testing the Needs Orientation transition on a real Campus Connect application showed the private note and admin banner appear, but no organizer email is sent.

Root cause — configuration, not code: WCOR_Mailer::send_triggered_emails() only sends Automated Reminder posts (organizer-reminder CPT) whose wcor_which_trigger meta matches the fired trigger. No reminder post on Central is assigned to wcor_cc_needs_orientation — the trigger key first reached production with #1730's merge, so none can exist yet. The code path itself is verified working: test_cc_needs_orientation_trigger_message_sent passes precisely because the test fixture creates and assigns a reminder post — the step production is missing. The email content must be created in wp-admin (Automated Reminders → new reminder → trigger "Campus Connect application needs orientation"); that's the actual fix and needs no deploy.

This PR fixes the two things that made the gap invisible and misleading:

Changes

wordcamp-organizer-reminders/wcor-mailer.php

send_triggered_emails() was the only silent failure path in the mailer — mail() already logs invalid recipients and wp_mail() failures. Now logs via \WordCamp\Logger\log() when:

  • a trigger fires with no reminder posts assigned to it (the case hit here), and
  • reminders are assigned but every one is skipped or fails (subtype restriction, already-sent dedupe, send failure).

Both events are rare and always worth explaining, so log volume is negligible. No behaviour change when emails send normally.

wcpt/wcpt-wordcamp/wordcamp-admin.php

The admin notice and audit note claimed "the organizer notification email has been triggered" — stated as fact even when no email exists to send, which is exactly what misled testing. Reworded both to claim only what the code guarantees (the trigger fired), following the same merge-resolution precedent applied to the point 5 text (#1731 comment). The notice now also names the Automated Reminders trigger so a wrangler knows where to look when no email arrives.

Not in this PR (one-time admin action, no deploy needed)

Create the Automated Reminder on Central: Automated Reminders → Add New → title = subject, body = email content → "When to send": on a trigger → "Campus Connect application needs orientation" → recipients: "the organizing team" (resolves to the application's E-mail Address/Email Address meta) → restrict event subtype to Campus Connect. Note every WCOR email is already hard-CC'd to support@wordcamp.org by mail(), satisfying that requirement in #1714 automatically.

Test plan

  • php -l clean on both files (verified)
  • Existing test-wcor-mailer.php suite passes unchanged (no behavioural change when reminders are assigned; test_cc_needs_orientation_trigger_message_sent and test_repeatable_trigger_sends_multiple_times cover the send paths)
  • Transition a CC post to Needs Orientation with no reminder assigned → log entry "Trigger fired, but no reminder posts are assigned to it" appears; notice/note no longer claim an email was sent
  • Assign a reminder to the trigger, repeat → email sends, CC'd to support@wordcamp.org, no log entry

See #1714 (point 4).

🤖 Generated with Claude Code

… UI text

When wcpt_cc_needs_orientation fires with no Automated Reminder post
assigned to the wcor_cc_needs_orientation trigger, send_triggered_emails()
loops over zero posts and returns without a trace. Every other failure
mode in the mailer (invalid recipients, wp_mail failure) is already
logged; this was the only silent one, and it cost real debugging time
when the Needs Orientation email did not arrive (issue #1714 point 4).

Log via \WordCamp\Logger\log() when a trigger fires with no assigned
reminders, and when every assigned reminder is skipped or fails. Reword
the admin notice and audit note so they no longer state an email 'has
been triggered' when the code only guarantees the trigger fired.

See #1714.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dd32

dd32 commented Jun 12, 2026

Copy link
Copy Markdown
Member

I'm not fully sure I understand this PR, it seems to be logging stuff, but AFAIK, these logs aren't actually shown or accessed anywhere?

Sign up for free to 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