Skip to content

feat: add creator and squad relation queries#3764

Merged
idoshamun merged 2 commits intomainfrom
codex/tag-materialized-views
Mar 31, 2026
Merged

feat: add creator and squad relation queries#3764
idoshamun merged 2 commits intomainfrom
codex/tag-materialized-views

Conversation

@idoshamun
Copy link
Copy Markdown
Member

Summary

  • add creator relation queries for topCreatorsByTag and similarCreators
  • add topMembersBySquad with runtime engagement scoring for non-staff members
  • tighten user_tag_view to public-safe posts and expand user_similarity_view to 10 results
  • keep the materialized-view migration in sync with the new definitions and add integration coverage

Testing

  • pnpm exec eslint src/common/schema/entityRelations.ts src/entity/user/UserTagView.ts src/entity/user/UserSimilarityView.ts src/schema/users.ts src/schema/sources.ts __tests__/sources.ts __tests__/users.ts
  • NODE_ENV=test npx jest __tests__/sources.ts --testEnvironment=node --runInBand --testNamePattern='materialized tag views|topCreatorsByTag|similarCreators|topMembersBySquad|similarSources|sourcesByTag'

Notes

  • local test verification required reapplying TagMaterializedViews1774956867935 because the test DB still had the older user_tag_view definition from the previous branch state
  • the broader repo migration issue on ChannelHighlights1773000000000 is still unrelated and unchanged

@pulumi
Copy link
Copy Markdown

pulumi Bot commented Mar 31, 2026

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

✨ Neo Explanation

This is a standard application version rollout deploying a new build to all production services, along with database and Clickhouse migrations. As part of this release, two tag-related cron jobs (`update-source-tag-view` and `update-tag-recommendations`) are being replaced by a single consolidated `update-tag-materialized-views` cron job.

Root Cause Analysis

A new version of the application has been built and is being deployed across the entire production stack. Every deployment, cron job, and migration job is being updated to roll out the new container image. Additionally, two tag-related cron jobs have been consolidated into a single new one as part of this release.

Dependency Chain

The new application version cascades uniformly across all resources:

  • 7 Deployments (API, background workers, WebSocket, Temporal, private, personalized digest, worker-job) are all rolling out the new container image via a standard Kubernetes rolling update.
  • ~35 CronJobs are updated to reference the new image so future scheduled runs use the new code.
  • 2 CronJobs are being consolidated: update-source-tag-view (ran Sundays at 3:20 AM) and update-tag-recommendations (ran Sundays at 3:05 AM) are both being deleted and replaced by a single new update-tag-materialized-views cron job.
  • Migration Jobs: The previous DB and Clickhouse migration jobs (tied to the old version) are deleted and new ones for the current version are created, which will run the database and Clickhouse schema migrations for this release.

Risk analysis

No stateful resources (databases, storage buckets, persistent volumes) are being replaced or deleted. The migration jobs introduce the only meaningful risk — if a DB or Clickhouse migration fails or contains a breaking schema change, it could impact running services. The deletion of the two tag-related cron jobs and replacement with a single consolidated one means those scheduled tasks will not run under their old definitions going forward; if the new combined job is misconfigured, tag materialized view updates would be missed until the next scheduled run.

Resource Changes

    Name                                                Type                           Operation
~   vpc-native-clean-gifted-plus-cron                   kubernetes:batch/v1:CronJob    update
-   vpc-native-api-clickhouse-migration-73fe5028        kubernetes:batch/v1:Job        delete
+   vpc-native-api-db-migration-e511fb8a                kubernetes:batch/v1:Job        create
~   vpc-native-user-posts-analytics-refresh-cron        kubernetes:batch/v1:CronJob    update
~   vpc-native-deployment                               kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-user-companies-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-worker-job-deployment                    kubernetes:apps/v1:Deployment  update
~   vpc-native-user-profile-analytics-clickhouse-cron   kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-clickhouse-cron           kubernetes:batch/v1:CronJob    update
-   vpc-native-update-tag-recommendations-cron          kubernetes:batch/v1:CronJob    delete
~   vpc-native-clean-channel-highlights-cron            kubernetes:batch/v1:CronJob    update
~   vpc-native-generic-referral-reminder-cron           kubernetes:batch/v1:CronJob    update
~   vpc-native-ws-deployment                            kubernetes:apps/v1:Deployment  update
~   vpc-native-update-current-streak-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-generate-search-invites-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-rotate-weekly-quests-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-update-source-tag-view-cron              kubernetes:batch/v1:CronJob    delete
~   vpc-native-validate-active-users-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-expire-super-agent-trial-cron            kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-expired-better-auth-sessions-cron  kubernetes:batch/v1:CronJob    update
~   vpc-native-sync-subscription-with-cio-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-opportunities-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-stale-user-transactions-cron       kubernetes:batch/v1:CronJob    update
~   vpc-native-temporal-deployment                      kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-images-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-squad-posts-analytics-refresh-cron       kubernetes:batch/v1:CronJob    update
~   vpc-native-calculate-top-readers-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-update-highlighted-views-cron            kubernetes:batch/v1:CronJob    update
~   vpc-native-bg-deployment                            kubernetes:apps/v1:Deployment  update
~   vpc-native-personalized-digest-deployment           kubernetes:apps/v1:Deployment  update
~   vpc-native-update-tags-str-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-personalized-digest-cron                 kubernetes:batch/v1:CronJob    update
-   vpc-native-api-db-migration-73fe5028                kubernetes:batch/v1:Job        delete
~   vpc-native-channel-digests-cron                     kubernetes:batch/v1:CronJob    update
... and 11 other changes

@idoshamun idoshamun changed the title Add creator and squad relation queries feat: add creator and squad relation queries Mar 31, 2026
@idoshamun idoshamun marked this pull request as ready for review March 31, 2026 13:37
@idoshamun idoshamun merged commit 703f575 into main Mar 31, 2026
10 checks passed
@idoshamun idoshamun deleted the codex/tag-materialized-views branch March 31, 2026 13:38
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