feat(highlights): add channelDigests query#3932
Conversation
Add a top-level read-only `channelDigests` query that returns all enabled channel digests, resolved through GraphORM on the read replica and ordered by channel then key. Introduce a dedicated `ChannelDigest` GraphQL type exposing key, channel, frequency, enabled and the resolved source, with a matching GraphORM mapping reusing the existing source custom relation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address self-review: extract the shared `source` customRelation into a `channelDigestSourceField` constant reused by both the ChannelDigest and ChannelDigestConfiguration GraphORM mappings instead of duplicating it. Merge the overlapping channelDigests ordering and disabled-exclusion tests into a single scenario. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🍹 The Update (preview) for dailydotdev/api/prod (at 858b298) was successful. ✨ Neo Code ReviewRoutine deployment of a new GraphQL query (`channelDigestConfigurations`) with a full image rollout and standard migration job rotation. ✅ Low Risk — confirm the underlying `ChannelDigest` table/entity is already present or a migration is included.This is a routine application deployment rolling out commit All deployment and cron job updates are purely image tag bumps to the new commit SHA. The migration jobs (both DB and Clickhouse) are replaced by new ones named with the new commit hash — this is the standard pattern for one-shot migration Jobs in this stack. 🔵 Info — The new Resource Changes Name Type Operation
+ vpc-native-api-clickhouse-migration-feae556d kubernetes:batch/v1:Job create
~ vpc-native-update-tag-materialized-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-highlighted-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-expire-super-agent-trial-cron kubernetes:batch/v1:CronJob update
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-user-companies-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-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-digests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generic-referral-reminder-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tags-str-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-worker-job-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-stale-user-transactions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
~ vpc-native-rotate-daily-quests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment 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-rotate-weekly-quests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-validate-active-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-history-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-views-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-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-calculate-top-readers-cron kubernetes:batch/v1:CronJob update
~ vpc-native-temporal-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-trending-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-clickhouse-migration-8c1734aa kubernetes:batch/v1:Job delete
~ vpc-native-clean-zombie-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-check-analytics-report-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generate-search-invites-cron kubernetes:batch/v1:CronJob update
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
... and 13 other changes |
| source: channelDigestSourceField, | ||
| }, | ||
| }, | ||
| ChannelDigest: { |
There was a problem hiding this comment.
Why do we need both ChannelDigestConfiguration and ChannelDigest? Seems like duplicates. We can just reuse the existing one
…nnelDigest Address review: ChannelDigestConfiguration and ChannelDigest were two GraphQL types both mapped from the ChannelDigest entity with an identical source relation. Drop ChannelDigestConfiguration, reuse the entity-aligned ChannelDigest type for the nested channelConfigurations.digest field, and inline the now single-use source relation. Document the one-type-per-entity guidance in AGENTS.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Good catch — they were indeed duplicates, both mapped |
Per review direction: leave existing types and names untouched. Revert the introduced ChannelDigest type/mapping and instead expose the new top-level query as channelDigestConfigurations returning the existing ChannelDigestConfiguration type, ordered by channel then key and filtered to enabled digests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Update: rather than renaming the existing type, kept |
What
Adds a top-level read-only
channelDigestsGraphQL query that returns all enabled channel digests, resolved through GraphORM on the read replica and ordered bychannel ASC, key ASC.Changes
src/schema/highlights.ts— NewChannelDigestGraphQL type (key,channel,frequency,enabled, resolvedsource) and thechannelDigests: [ChannelDigest!]!query. Resolver mirrors the existingchannelConfigurationsstyle and filters toenabled = trueat the DB level.src/graphorm/index.ts— Added aChannelDigestGraphORM mapping. Extracted the sharedsourcecustom relation into achannelDigestSourceFieldconstant reused by bothChannelDigestand the existingChannelDigestConfigurationmappings to avoid duplication.__tests__/highlights.ts— Integration tests covering ordering across channels, resolvedsource, disabled-digest exclusion, and the empty-result case.Key decisions
ChannelDigesttype rather than reusingChannelDigestConfiguration(which lackschannel/keyand is shaped as a nested config sub-object).minHighlightScore,sentimentGroupIds,includeSentiment,targetAudience); these can be added later without a breaking change.channelConfigurations(no@auth). AnincludeDisabledarg can be added later if a client needs it.Closes ENG-1633
Created by Huginn 🐦⬛