Port cron-minutely fixes: reactivate tombstoned subs + confirm-email rate limit #29

Merged
matt merged 3 commits from mailship-fc-merge-cron-fixes-df6 into main 2026-09-23 17:56:12 +00:00
Collaborator

Port of the three genuine commits from origin/cron-minutely onto main. Skipped commits are already on main, superseded, or deliberate:

  • 291f92c "Run cron every minute for testing" — testing hack, excluded on purpose.
  • 395b192 "Set trust proxy..." — byte-identical to mains 8235513 (same patch-id).
  • ce59c15 "dedupe and serialize subscription writes" — superseded: main already carries the partial unique-index migration + insert race fallback.
  • 082b442 "Update subscription confirmation email template" + cdabec2 "log errors" — content already on main (branded template, normalized EVENT_VIEWER_URL).

Included:

  1. fd81528 "Re-activate tombstoned subscriptions when email is the same"
  2. 5675ebd "fix reactivating old rows"
  3. 051c1e8 "Rate-limit confirmation emails and restore daily/weekly digest cron" — confirm-email cooldown (10 min) merged with mains schedule-aware upsert: email-change branch resets last_confirm_sent_at, Subscription type gains the field; the cron "restore" part is a no-op against mains schedule-aware getCronExpression.

Verified: tsc --noEmit, eslint src, vitest run (13 files / 57 tests) all pass.

Port of the three genuine commits from origin/cron-minutely onto main. Skipped commits are already on main, superseded, or deliberate: - 291f92c "Run cron every minute for testing" — testing hack, excluded on purpose. - 395b192 "Set trust proxy..." — byte-identical to mains 8235513 (same patch-id). - ce59c15 "dedupe and serialize subscription writes" — superseded: main already carries the partial unique-index migration + insert race fallback. - 082b442 "Update subscription confirmation email template" + cdabec2 "log errors" — content already on main (branded template, normalized EVENT_VIEWER_URL). Included: 1. fd81528 "Re-activate tombstoned subscriptions when email is the same" 2. 5675ebd "fix reactivating old rows" 3. 051c1e8 "Rate-limit confirmation emails and restore daily/weekly digest cron" — confirm-email cooldown (10 min) merged with mains schedule-aware upsert: email-change branch resets last_confirm_sent_at, Subscription type gains the field; the cron "restore" part is a no-op against mains schedule-aware getCronExpression. Verified: tsc --noEmit, eslint src, vitest run (13 files / 57 tests) all pass.
hudson added 3 commits 2026-09-23 16:14:55 +00:00
(cherry picked from commit fd815282c2)
(cherry picked from commit 5675ebdf52)
Rate-limit confirmation emails and restore daily/weekly digest cron
All checks were successful
CI / checks (pull_request) Successful in 41s
34c5e28fd1
- Add last_confirm_sent_at to subscriptions, with a migration for
  existing databases. registerSubscription now sends at most one
  confirmation email per 10 minutes per subscription, so a page-refresh
  or client retry storm can't spam an inbox. The cooldown resets when
  the address changes or a tombstoned row is reactivated (fresh key),
  so genuinely new addresses always get an email immediately.
- Restore getCronExpression to the documented daily (17:00 UTC) and
  weekly (Monday 17:00 UTC) schedules with the 6-field cron syntax the
  cron package expects, fixing the pre-existing reschedule tests that the
  'run every minute' testing hack had broken.
- Add confirm-email-cooldown.test.ts covering first send, refresh storms,
  frequency changes, email changes, reactivation, and the 10-minute constant.

(cherry picked from commit 051c1e88fb)
matt approved these changes 2026-09-23 17:56:08 +00:00
matt merged commit 9ad5c4eef4 into main 2026-09-23 17:56:12 +00:00
matt deleted branch mailship-fc-merge-cron-fixes-df6 2026-09-23 17:56:16 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: matt/mailship#29
No description provided.