fix: resolve daily personalise state via snotra user API#3993
Merged
Conversation
FeedDailyConfigGenerator was wired with the snotra memory API client, whose origin does not serve /api/v1/user/profile and returns 404 on every call. The personalise state therefore always resolved to undefined, the generator always fell back to daily_v1, and cold-start users (no sauron embeddings) got an empty daily feed while daily_cs_v1 was never selected. Use a client pointed at SNOTRA_USER_API_ORIGIN, matching what the personalized digest flow already does for the same endpoint.
|
🍹 The Update (preview) for dailydotdev/api/prod (at de0620e) was successful. Resource Changes Name Type Operation
~ vpc-native-clean-expired-better-auth-sessions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-updated-sync-cron kubernetes:batch/v1:CronJob 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-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generate-search-invites-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-highlighted-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
~ vpc-native-subscription-anniversary-achievements-cron kubernetes:batch/v1:CronJob update
~ vpc-native-rotate-daily-quests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tags-str-cron kubernetes:batch/v1:CronJob update
~ vpc-native-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generic-referral-reminder-cron kubernetes:batch/v1:CronJob update
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-digests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-history-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-expire-super-agent-trial-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-images-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-calculate-top-readers-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-db-migration-804f9d7d kubernetes:batch/v1:Job create
~ vpc-native-user-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-clickhouse-migration-aafdbcd5 kubernetes:batch/v1:Job delete
~ vpc-native-update-achievement-rarity-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tag-materialized-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-clickhouse-migration-804f9d7d kubernetes:batch/v1:Job create
~ vpc-native-clean-old-notifications-cron kubernetes:batch/v1:CronJob update
~ vpc-native-squad-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-stale-user-transactions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-validate-active-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-check-analytics-report-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-views-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-db-migration-aafdbcd5 kubernetes:batch/v1:Job delete
~ vpc-native-post-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-materialize-monthly-best-post-archives-cron kubernetes:batch/v1:CronJob update
... and 15 other changes |
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.
Problem
FeedDailyConfigGeneratorresolves the user's personalise state to pick betweendaily_v1(personalised) anddaily_cs_v1(cold start). It was constructed with the sharedsnotraClient, which points atSNOTRA_ORIGIN(the snotra memory API). That origin serves/api/v1/memstore/shortprofilebut not/api/v1/user/profile, so everygetUserProfilecall fails with a 404.Because
resolvePersonaliseStateswallows the error and returnsundefined, the generator always falls back to the personalised config:daily_cs_v1is never selected in production (zero requests infss_eventsover the last 20 days).daily_v1— observed via thefailed to resolve snotra personalise state for daily feederror logged on every dailyHeadlines request, and a chunk of daily-posts responses returning 0 posts for recently onboarded users.Fix
Add
snotraUserApiClientpointing atSNOTRA_USER_API_ORIGIN(the same origin the personalized digest flow already uses forgetUserProfile) and wire it intodailyFeedConfigGenerator. ExistingsnotraClientconsumers (getProfile/ memstore endpoints) are untouched.Verified
daily_cs_v1itself returns posts when exercised directly against the feed service with production-shaped payloads, so fixing state resolution is enough to restore the cold-start path.Tests
Updated the
getUserProfilespies in__tests__/feeds.tsto target the new client.