Repository navigation
feat(push): 2-hourly push-scan cron so imminent moments/reminders aren't missed - #226
Merged
Merged
Conversation
…n't missed Friction #5 (push notifications) — the web-push delivery path already existed (lib/server/push.ts, push_devices, service worker, subscribe routes, settings toggle) and imminentMomentNotices was wired into generateFamilyNotifications, but pushes were only dispatched by the once-daily /api/cron/notifications run, which also owns the email digest. Same cadence for both meant a moment or reminder added after the daily run for later that day was missed until the next day — after it mattered. Add /api/cron/push-scan (every 2h) that regenerates notifications and dispatches pending pushes only — no email, so the digest stays daily. Safe to overlap the daily cron: generation dedups by related_id, push is gated on pushed_at and email on sent_at, so nothing double-sends. Live delivery still degrades honestly when VAPID/FCM keys are absent (skips, never fakes success). Also reconcile FRICTION_BACKLOG.md: #2/#4/#7/#10 were shipped but still read "Todo"; marked done with their landing files. Update AGENT_HANDOFF.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJs1Px4GTVtA1jmzDZ4ShU
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
NewWorldVenture
marked this pull request as ready for review
July 5, 2026 01:31
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes the last actionable item on the friction backlog — #5 push notifications — by fixing its one real gap: delivery timing.
The web-push delivery path already existed and is fully wired:
lib/server/push.ts— web-push (VAPID) + native FCM dispatch, prunes stale subscriptionspush_devicestable (migration0035),public/sw.jsservice worker, subscribe/unsubscribe routes, settings toggleimminentMomentNotices(imminent moment / leave-by / birthday) already feedsgenerateFamilyNotificationsThe gap: those pushes were only dispatched by the once-daily
/api/cron/notificationsrun (11:00 UTC), which also runs the email digest. One cadence for both channels means a moment or reminder added after the daily run for later that same day was missed entirely until the next day — after it mattered. You can't just bump the shared cron: that would email families up to 8× a day.Change
/api/cron/push-scan(app/api/cron/push-scan/route.ts) running every 2h (0 */2 * * *, added tovercel.json). It regenerates each family's notifications and dispatches any un-pushed ones only — deliberately no email, so the digest stays daily on/api/cron/notifications.related_id, push is gated onpushed_atand email onsent_at, so nothing double-sends.No schema change, no new dependency — reuses the exported
generateFamilyNotifications+dispatchPendingPushes.Docs
docs/FRICTION_BACKLOG.md— reconciled staleness: Supabase-backed blog, marketing stats, and rebuilt admin dashboard #2, Add consolidated pending-migrations SQL bundle #4, Admin Marketing module + dashboard AI tools row #7, feat(sync): two-way sync platform foundation #10 were shipped but still read "Todo"; marked ✅ with their landing files (the same staleness that caused feat(sync): two-way sync platform foundation #10 to be built twice). Logged this cycle + Fix super-admin access without requiring the DB migration #5.docs/AGENT_HANDOFF.md— new 2026-07-05 session block.Verification
tsc --noEmit— cleaneslint— cleanvitest run— 1649 passednext build— compiled successfully; route registered asƒ /api/cron/push-scanRemaining (human-owned, unchanged)
Apply pending prod migrations (
docs/PENDING_PROD_MIGRATIONS.md); setNEXT_PUBLIC_VAPID_PUBLIC_KEY/VAPID_PRIVATE_KEY(web) orFCM_SERVER_KEY(native) to light up live push; maps/ETA key (#6); GIF provider key; Stripe Issuing.🤖 Generated with Claude Code
https://claude.ai/code/session_01VJs1Px4GTVtA1jmzDZ4ShU
Generated by Claude Code