feat(persona-quiz): add bragi-backed GraphQL mutations#3874
Conversation
Adds two stateless mutations wrapping the new bragi PersonaQuiz pipelines: - personaQuizNextQuestion proxies bragi.NextPersonaQuizQuestion, fetching NMF candidate_topics from recswipe for steering on each turn. - personaQuizReveal proxies bragi.PersonaQuizReveal, merges with recswipe recommendTags fillers, and filters the result through the canonical Keyword table so unknown slugs can't FK-violate downstream followTags inserts. Mocks added to the bragi client for local + test runs. Tests cover auth, input validation, recswipe steering pass-through, isFinal propagation, recswipe-failure resilience, the Keyword-table canonical filter, and the targetCount cap. Requires a schema-python bump including the new bragi proto definitions before TypeScript types from @dailydotdev/schema resolve. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🍹 The Update (preview) for dailydotdev/api/prod (at bdb6ded) was successful. ✨ Neo ExplanationStandard image rollout deploying the new persona quiz GraphQL mutations (`personaQuizNextQuestion` and `personaQuizReveal`) with paired DB and ClickHouse migration jobs. ✅ Low RiskThis is a routine code deployment rolling out two new GraphQL mutations ( 🔵 Info — The Resource Changes Name Type Operation
~ vpc-native-clean-stale-user-transactions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-updated-sync-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-clickhouse-migration-d562bcb4 kubernetes:batch/v1:Job create
~ vpc-native-expire-super-agent-trial-cron kubernetes:batch/v1:CronJob update
~ vpc-native-materialize-monthly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-digests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-temporal-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-ws-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-generic-referral-reminder-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-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-rotate-daily-quests-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-db-migration-d562bcb4 kubernetes:batch/v1:Job create
~ vpc-native-update-trending-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-source-public-threshold-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-squad-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tags-str-cron kubernetes:batch/v1:CronJob update
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
~ vpc-native-materialize-yearly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-history-day-clickhouse-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-tag-materialized-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-achievement-rarity-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-history-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-opportunities-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-zombie-user-companies-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-db-migration-4f36baef kubernetes:batch/v1:Job delete
- vpc-native-api-clickhouse-migration-4f36baef kubernetes:batch/v1:Job delete
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
... and 11 other changes |
- escape backticks in personaQuizReveal docstring so the GraphQL schema template literal stays well-formed - read recommended_tags from recswipe and map .tag (not recs.tags) - bump @dailydotdev/schema to 0.3.8 for new persona-quiz proto types and Pipelines RPCs - prettier auto-fixes in onboarding tests Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
recommendTagsMock was returning { tags: string[] }; the actual
RecommendTagsResponse is { recommended_tags: { tag, score }[] }.
Match the resolver code so the persona-quiz integration tests
exercise the real mapping path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
personaQuizNextQuestionGraphQL mutation that proxiesbragi.NextPersonaQuizQuestion, pulling NMFcandidate_topicsfrom recswipe as steering signals on each turnpersonaQuizRevealGraphQL mutation that proxiesbragi.PersonaQuizReveal, merges with recswiperecommendTagsfillers, and filters the result through the canonicalKeywordtable so unknown slugs can't FK-violate downstreamfollowTagsinsertsThe canonical-filter step is load-bearing:
ContentPreferenceKeyword.keywordIdis a@ManyToOneFK toKeyword, so a hallucinated tag from bragi would crash theaddFiltersToFeedresolver when the user hits "Looks good" on the quiz reveal screen.This depends on a
schema-python(and@dailydotdev/schema) bump including the newbragi/pipelines.prototypes (NextPersonaQuizQuestionRequest/Response,PersonaQuizRevealRequest/Response, etc.).Test plan
pnpm installresolves cleanly after@dailydotdev/schemabumppnpm lintpassespnpm test __tests__/schema/onboarding.tspasses the 8 new persona-quiz specs (4 forpersonaQuizNextQuestion, 4 forpersonaQuizReveal)BRAGI_ORIGINset, hit the new mutations end-to-end against a bragi instance carrying the matching schema rev — verify the structured question / reveal copy / filtered tag list shape"definitely-not-a-keyword") does NOT appear inpersonaQuizReveal.includeTags🤖 Generated with Claude Code