Skip to content

fix(achievements): follower_gain progress uses absolute follower count#3995

Merged
idoshamun merged 1 commit into
mainfrom
fix/prophet-follower-gain-progress
Jul 9, 2026
Merged

fix(achievements): follower_gain progress uses absolute follower count#3995
idoshamun merged 1 commit into
mainfrom
fix/prophet-follower-gain-progress

Conversation

@idoshamun

Copy link
Copy Markdown
Member

Problem

User feedback (ENG-1796): the Prophet achievement ("Gain 100 followers") showed 99/100 progress for a user with only 15 followers.

Root cause

follower_gain achievements (Prophet, Shepherd) are evaluated in checkAchievementProgress, but AchievementEventType.FollowerGain was missing from absoluteValueEventTypes. As a result:

  • The CDC handler (onContentPreferenceChange) computes the real followerCount and passes it as currentValue, but the code fell through to the milestone evaluator, which ignores currentValue and just does progress += 1 on every follow event.
  • On unfollow (op === 'd') only Quest progress is decremented — the achievement progress is never brought back down.

So progress increments on every follow and never decrements, drifting far above the real follower count over follow/unfollow churn.

The retroactive backfill handler (handleFollowerGain) already does it correctly — it counts content_preference where status IN ('follow','subscribed') and sets progress to that absolute value. The live path and the backfill disagreed.

Fix

  1. Add AchievementEventType.FollowerGain to absoluteValueEventTypes so progress is set to the true follower count (already computed and passed as currentValue) instead of incremented.
  2. Align the live follower count filter in primary.ts to status IN (follow, subscribed) to match the retroactive handler.

Follow-up (not in this PR)

Re-run the FollowerGain retroactive sync to correct users whose progress already drifted (e.g. the reporter would go from 99 back to 15).

Fixes ENG-1796

The Prophet/Shepherd achievements (follower_gain) were being incremented
by +1 on every follow event and never decremented on unfollow, causing
progress to drift far above a user's real follower count (e.g. 99/100
shown for a user with 15 followers).

- Add AchievementEventType.FollowerGain to absoluteValueEventTypes so
  checkAchievementProgress sets progress to the true follower count
  (already computed and passed as currentValue) instead of incrementing.
- Align the live follower count filter to status IN (follow, subscribed)
  to match the retroactive backfill handler.

Fixes ENG-1796
@pulumi

pulumi Bot commented Jul 9, 2026

Copy link
Copy Markdown

🍹 The Update (preview) for dailydotdev/api/prod (at 9c0c120) was successful.

Resource Changes

    Name                                                       Type                           Operation
~   vpc-native-channel-highlights-cron                         kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-analytics-history-clickhouse-cron  kubernetes:batch/v1:CronJob    update
~   vpc-native-hourly-notification-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-update-trending-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-calculate-top-readers-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-deployment                  kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-old-notifications-cron                    kubernetes:batch/v1:CronJob    update
-   vpc-native-api-clickhouse-migration-46e10cfe               kubernetes:batch/v1:Job        delete
~   vpc-native-update-tags-str-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                               kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-user-companies-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-images-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-private-deployment                              kubernetes:apps/v1:Deployment  update
~   vpc-native-user-profile-analytics-clickhouse-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-users-cron                         kubernetes:batch/v1:CronJob    update
~   vpc-native-rotate-daily-quests-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-bg-deployment                                   kubernetes:apps/v1:Deployment  update
~   vpc-native-sync-subscription-with-cio-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-materialize-yearly-best-post-archives-cron      kubernetes:batch/v1:CronJob    update
-   vpc-native-api-db-migration-46e10cfe                       kubernetes:batch/v1:Job        delete
+   vpc-native-api-db-migration-9c4cf9e0                       kubernetes:batch/v1:Job        create
~   vpc-native-update-achievement-rarity-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-deployment                                      kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-opportunities-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-expire-super-agent-trial-cron                   kubernetes:batch/v1:CronJob    update
~   vpc-native-squad-posts-analytics-refresh-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-clickhouse-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-channel-highlights-cron                   kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-update-current-streak-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-worker-job-deployment                           kubernetes:apps/v1:Deployment  update
~   vpc-native-post-analytics-history-day-clickhouse-cron      kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-achievements-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-gifted-plus-cron                          kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-updated-sync-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-materialize-monthly-best-post-archives-cron     kubernetes:batch/v1:CronJob    update
~   vpc-native-update-source-public-threshold-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-expired-better-auth-sessions-cron         kubernetes:batch/v1:CronJob    update
~   vpc-native-user-posts-analytics-refresh-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-update-views-cron                               kubernetes:batch/v1:CronJob    update
+   vpc-native-api-clickhouse-migration-9c4cf9e0               kubernetes:batch/v1:Job        create
... and 15 other changes

@idoshamun idoshamun merged commit 89670bb into main Jul 9, 2026
8 checks passed
@idoshamun idoshamun deleted the fix/prophet-follower-gain-progress branch July 9, 2026 13:12
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.

1 participant