feat(notifications): time-based notification jobs#882
Merged
Conversation
…-streak, remix-contest) Adds the three timer-driven notification creators the legacy Python discovery-provider beat produced, as scheduled parity jobs in the core-indexer: - EngagementNotificationsJob: promotes 7-day-cooldown challenges to claimable_reward once their cooldown elapses (complements the handle_on_user_challenge trigger, which only handles cooldown_days=0 and reward_in_cooldown). - ListenStreakReminderJob: reminds users 42-43h after last listen. - RemixContestNotificationsJob: fan/artist contest ended + ending-soon. Each is a set-based INSERT...SELECT...ON CONFLICT DO NOTHING keyed on uq_notification (group_id, specifier) for idempotency, and is wired into startParityJobs. Mirrors the corresponding apps/ Python tasks. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…FK flake database.Seed processes non-entity tables in randomized map order, so a single combined fixture could insert user_challenges before its FK parent challenges, causing a flaky 23503 in CI. Split into two Seed calls to force the ordering. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Adds the three timer-driven notification creators the legacy Python discovery-provider celery beat produced, as scheduled parity jobs in the
core-indexer. This closes the remaining functional gap between the vendored Go ETL indexer and the Python indexer for notifications: event-driven notifications are already handled by DB triggers (#851/#870), and these cover the ones that fire on elapsed time rather than an indexed entity.claimable_reward): promotes 7-day-cooldown challenges toclaimable_rewardonce their cooldown elapses and they're still undisbursed. Complements thehandle_on_user_challengetrigger, which only emits an immediateclaimable_rewardforcooldown_days = 0andreward_in_cooldownforcooldown_days > 0. Hence thecooldown_days = 7filter, matching Python's hardcoded check. Scheduled every 10m.listen_streak_reminder): reminds users in the 42-43h window after their last listen (6h of slack before the 48h streak breaks). Tight 1-2m window underenv=stagefor end-to-end testing, matching Python. Scheduled every 10s.fan/artistremix_contestended/ending_soonnotifications, with the same audience rules (remixers, host followers, parent-track favoriters, event subscribers; host excluded from fan types). Scheduled every 30s.Each job is a set-based
INSERT ... SELECT ... ON CONFLICT (group_id, specifier) DO NOTHINGfor idempotency viauq_notification, and is wired intostartParityJobs. Mirrors the correspondingapps/Python tasks.Test plan
go test ./jobs/...— new tests cover the engagement full pipeline + exclusions (cooldown/disbursement/not-elapsed/incomplete), listen-streak window boundaries + idempotency, and remix-contest ended/ending-soon audiences with host exclusion.handle_on_user_challengeandhandle_eventtriggers that also fire on seed (verified no overlap with the asserted notification types).go vet ./jobs/... ./indexer/...clean; fulljobspackage passes.🤖 Generated with Claude Code