Skip to content

Spam-check archived events and custom email templates - #1463

Open
daveearley wants to merge 1 commit into
developfrom
fix/archived-and-template-spam-checks
Open

daveearley wants to merge 1 commit into
developfrom
fix/archived-and-template-spam-checks

Conversation

@daveearley

Copy link
Copy Markdown
Contributor

What this changes

Archived events are spam-checked like live ones. Before this, only live events were checked. An event could go from draft straight to archived and send attendee and order emails with full content without ever being checked. Archived events are now checked:

  • when an event enters the archived status
  • when its content changes
  • when its organizer changes (organizer edits now also re-check that organizer's archived events)
  • by events:recheck-spam

A flagged archived event is demoted to pending review, just as a live one is.

Approve restores the original status. The check now records the status the event was demoted from, in a new nullable event_spam_checks.previous_event_status column. Approving the event restores that status, so an approved archived event goes back to archived instead of being published.

Custom email templates are checked. Every active event-level and organizer-level template goes into the checked content in two forms:

  • its Liquid source
  • the same template rendered with sample data

Only the source is part of the content hash, because the sample data includes a random order number. Creating, updating or deleting a template queues a re-check of the events it applies to.

The pending-review notice goes to the account email. It used to go to the organizer email, which is unverified free text.

Things to know

  • Includes a migration: one nullable column on event_spam_checks.
  • More Haiku calls than before:
    • Organizer edits and organizer-level template changes now also re-check that organizer's archived events.
    • Events with templates send longer prompts (capped at 6,000 characters of source and 3,000 rendered per template field).
  • While an event's first check is running (a few seconds after it becomes live or archived), its emails still go out with full content. That window is unchanged and accepted.

Testing

  • Unit and Feature suites pass; pint clean.
  • New tests cover:
    • archived-event dispatch and demotion
    • the restore-on-approve flow
    • template content collection and rendering
    • the prompt budget with templates
    • template create/update/delete re-checks
  • Verified on the dev stack with the real Anthropic key:
    • A scam event moved from draft to archived was flagged (0.99) and demoted within about 4 seconds, and later attendee emails were the generic notice.
    • A phishing order or ticket template was flagged (0.95), including scam text placed in a Liquid string literal.
    • An organizer-level phishing template got that organizer's live and archived events flagged.
    • Legitimate events, archived or with ordinary templates, came back clean, and buyers received the full ticket and order emails.

Archived events were never spam-checked: an event could go from draft
straight to archived and send buyer emails with full content. Archived
events are now checked like live ones, when they enter the status and
when their content changes, and are demoted to pending review if flagged.
Approving a flagged event restores the status it was demoted from
(new event_spam_checks.previous_event_status column).

Custom event and organizer email templates are now part of the checked
content, as their Liquid source plus a render with sample data, and
creating, updating or deleting a template triggers a re-check.

The pending-review notice now goes to the account email instead of the
unverified organizer email.
@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E smoke tests: Everything passed.

Mode Result ✅ Passed ❌ Failed ⚠️ Flaky ⏭️ Skipped ⏱️ Duration
Self-hosted ✅ Passed 112 0 0 0 3m 37s

Open the run

This branch has not been deployed

No deployments
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