Skip to content

Intro quests#3833

Merged
AmarTrebinjac merged 9 commits intomainfrom
intro-quests
Apr 30, 2026
Merged

Intro quests#3833
AmarTrebinjac merged 9 commits intomainfrom
intro-quests

Conversation

@AmarTrebinjac
Copy link
Copy Markdown
Contributor

No description provided.

@pulumi
Copy link
Copy Markdown

pulumi Bot commented Apr 29, 2026

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

✨ Neo Explanation

This is a feature deployment adding an intro quest system with a DB migration to seed quest data; the deployment itself is low risk, but there is a narrow race window at deploy time where new users could permanently miss intro quest assignment if the migration job completes after the first registrations on the new image. ✅ Low Risk (with awareness of the migration ordering dependency).

This PR introduces a new "Intro Quests" system — a set of one-time onboarding quests (install extension, enable notifications, generate brief, complete profile) awarded to new users at registration. The infrastructure changes are a standard code deployment rolling out the new image (fd5b6ca02753f3ee) across all services, plus migration jobs to seed the new quest/rotation/reward rows into the database.

Key behavioral notes for reviewers:

  • The AddIntroQuests migration inserts 4 quests, 4 rotations, and 8 rewards into the quest, quest_rotation, and quest_reward tables. The rotations have periodStart = 2026-03-25, meaning they activate immediately (past date), and periodEnd = 9999-12-31 (effectively permanent). The down migration only deletes from quest — cascade behavior on quest_rotation and quest_reward should be verified to ensure the rollback is clean.

  • assignIntroQuestsToUser is called inline during user sign-up in betterAuth.ts, wrapped in a try/catch so failures are non-fatal. However, if the migration job hasn't completed before new user registrations begin, the function will silently find no active rotations and no quests will be assigned — users registered in that window will permanently miss their intro quests (the assignment is not retried).

  • The extension install detection in boot.ts adds an extra SELECT query (fetching flags) on every boot request to check isFirstEverExtensionBoot. This is a new per-request DB read on a potentially high-frequency endpoint.

🔵 Info — The checkQuestProgress flow in progress.ts now includes QuestType.Intro in its rotation query, but skips auto-creating UserQuest rows for intro type (the continue guard). This is intentional — intro quests are pre-assigned at signup, not created on-demand — but means any user who signed up before this migration runs will never have intro quests, even if they trigger the relevant events.

Resource Changes

    Name                                                       Type                           Operation
~   vpc-native-calculate-top-readers-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-validate-active-users-cron                      kubernetes:batch/v1:CronJob    update
+   vpc-native-api-clickhouse-migration-2753f3ee               kubernetes:batch/v1:Job        create
~   vpc-native-user-profile-analytics-clickhouse-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-temporal-deployment                             kubernetes:apps/v1:Deployment  update
~   vpc-native-update-achievement-rarity-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-stale-user-transactions-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-update-views-cron                               kubernetes:batch/v1:CronJob    update
~   vpc-native-ws-deployment                                   kubernetes:apps/v1:Deployment  update
~   vpc-native-expire-super-agent-trial-cron                   kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-gifted-plus-cron                          kubernetes:batch/v1:CronJob    update
~   vpc-native-rotate-daily-quests-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                               kubernetes:batch/v1:CronJob    update
~   vpc-native-update-trending-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-update-current-streak-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-updated-sync-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-users-cron                         kubernetes:batch/v1:CronJob    update
~   vpc-native-check-analytics-report-cron                     kubernetes:batch/v1:CronJob    update
-   vpc-native-api-db-migration-fd5b6ca0                       kubernetes:batch/v1:Job        delete
~   vpc-native-generic-referral-reminder-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tag-materialized-views-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-channel-digests-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-images-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-expired-better-auth-sessions-cron         kubernetes:batch/v1:CronJob    update
~   vpc-native-hourly-notification-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-channel-highlights-cron                         kubernetes:batch/v1:CronJob    update
~   vpc-native-sync-subscription-with-cio-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-generate-search-invites-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-user-posts-analytics-refresh-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-analytics-history-clickhouse-cron  kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-opportunities-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-worker-job-deployment                           kubernetes:apps/v1:Deployment  update
~   vpc-native-update-highlighted-views-cron                   kubernetes:batch/v1:CronJob    update
~   vpc-native-materialize-yearly-best-post-archives-cron      kubernetes:batch/v1:CronJob    update
~   vpc-native-deployment                                      kubernetes:apps/v1:Deployment  update
-   vpc-native-api-clickhouse-migration-fd5b6ca0               kubernetes:batch/v1:Job        delete
~   vpc-native-update-tags-str-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-private-deployment                              kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-user-companies-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-channel-highlights-cron                   kubernetes:batch/v1:CronJob    update
... and 11 other changes

@AmarTrebinjac
Copy link
Copy Markdown
Contributor Author

@claude what is causing the build issues?

@claude
Copy link
Copy Markdown

claude Bot commented Apr 29, 2026

Claude finished @AmarTrebinjac's task in 15m 21s —— View job


Build Issues Analysis

  • Identify build failures via CI checks
  • Analyze TypeScript compilation and lint
  • Review changed files for potential issues
  • Report findings

The failing checks are:

Check Result
ci/circleci: build-app (TypeScript + lint) ✅ pass
ci/circleci: test ❌ fail
ci/circleci: build-docker ✅ pass
ci/circleci: pulumi-preview ✅ pass

The TypeScript compilation and ESLint are both passing. The failure is isolated to the test suite on CircleCI: view test run.

I cannot access the CircleCI logs directly to see the exact failing test(s), but here are the areas most likely involved based on code review:

Potential Causes

1. New intro quest tests in __tests__/quests.ts

The new describe('intro quests', ...) block adds 11 tests. The tests that use expectSuccessfulBackground(cdcWorker, ...) for CDC-based quest completion (profile complete, UserExperience insert) are the most complex and most likely to surface issues.

2. checkProfileCompletionAchievement now calls checkQuestProgress

src/workers/cdc/primary.ts:260 — this new await runs inside the user table CDC handler. Any existing test that triggers a user table update CDC message will now also run checkQuestProgress(ProfileComplete). If the migration-seeded profile_complete intro rotation is present in the test DB and the user lacks the required UserQuest, this returns early (continue) — but it adds extra DB queries that could surface issues in timing-sensitive tests.

3. requestBriefGeneration now calls checkQuestProgress

src/common/brief.ts:179 — brief generation tests in __tests__/posts.ts will now also trigger the BriefGenerate quest progress check. This is wrapped in try/catch so it won't break the main flow, but an unhandled error inside checkQuestProgress that propagates to the caller would need investigation.

Recommended Next Steps

Check the CircleCI test logs at the link above for the specific test name(s) and error messages. The most likely failures are in __tests__/quests.ts (new intro quest tests) or __tests__/workers/cdc/primary.ts (CDC tests that now also trigger checkQuestProgress via checkProfileCompletionAchievement).
| View failing CircleCI test run

@AmarTrebinjac AmarTrebinjac marked this pull request as ready for review April 30, 2026 08:24
@AmarTrebinjac AmarTrebinjac merged commit 7640c66 into main Apr 30, 2026
11 checks passed
@AmarTrebinjac AmarTrebinjac deleted the intro-quests branch April 30, 2026 08:24
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