Skip to content

feat: add private endpoint to batch set post briefWorthy flag#3931

Merged
idoshamun merged 1 commit into
mainfrom
eng-1631-brief-worthy-post-flag-private-endpoint
Jun 7, 2026
Merged

feat: add private endpoint to batch set post briefWorthy flag#3931
idoshamun merged 1 commit into
mainfrom
eng-1631-brief-worthy-post-flag-private-endpoint

Conversation

@idoshamun
Copy link
Copy Markdown
Member

What

Adds a private (service-to-service) endpoint POST /p/updatePostsBriefWorthy that batch-sets the briefWorthy flag on posts. It accepts an array of post ids and a boolean value, updates the flag, and bumps metadataChangedAt so the change propagates downstream (CDC).

Key decisions

  • Flag lives in Post.flags JSONB (alongside vordr, promoteToPublic, etc.) rather than a dedicated column — matches the codebase's "flag" pattern and the AGENTS.md "Updating JSONB Flag Fields" guidance (updateFlagsStatement), so no migration is needed.
  • Single atomic SQL update via In(postIds) — duplicate ids are harmless, so no dedup overhead.
  • Validation with a Zod schema (updatePostsBriefWorthySchema) in src/common/schema/posts.ts: non-empty postIds (capped at 500, matching the existing batch convention) and a required boolean briefWorthy.
  • Follows existing private-route conventions: req.service guard returning 404, { error: { name, issues } } on validation failure; returns { updated: <affected count> }.

Tests

Integration tests in __tests__/private.ts cover the auth guard, validation (empty postIds, missing briefWorthy), setting/unsetting the flag with metadataChangedAt bump, and the affected-count for non-existent ids.

Closes ENG-1631


Created by Huginn 🐦‍⬛

Introduce POST /p/updatePostsBriefWorthy that accepts an array of post
ids and a boolean value, sets the briefWorthy flag on the posts and
bumps metadataChangedAt so the change propagates downstream.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pulumi
Copy link
Copy Markdown

pulumi Bot commented Jun 7, 2026

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

✨ Neo Code Review

Standard image rollout deploying a new internal-only API endpoint (`/p/updatePostsBriefWorthy`) that sets a `briefWorthy` flag on posts via a service-authenticated route. ✅ Low Risk

This is a routine application deployment rolling out commit 400bb7d3 (adding the POST /p/updatePostsBriefWorthy endpoint and briefWorthy flag to the PostFlags type). All deployments and cron jobs are simply updated to the new container image. The migration jobs follow the standard pattern: old jobs from the previous commit (97d15d5c) are deleted and new ones are created for the new commit, running both the Postgres TypeORM migration and the Clickhouse migration against the new image.

🔵 Info — The new briefWorthy field is stored in the existing flags JSONB column on Post, so no schema migration adding a new column is expected. Verify the DB migration job contains any necessary migration file if schema changes were made elsewhere, or confirm this is purely a code-level addition to an existing JSONB field.

Resource Changes

    Name                                                       Type                           Operation
~   vpc-native-personalized-digest-deployment                  kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-images-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-clickhouse-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-private-deployment                              kubernetes:apps/v1:Deployment  update
~   vpc-native-generic-referral-reminder-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-check-analytics-report-cron                     kubernetes:batch/v1:CronJob    update
~   vpc-native-squad-posts-analytics-refresh-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-user-posts-analytics-refresh-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-temporal-deployment                             kubernetes:apps/v1:Deployment  update
+   vpc-native-api-db-migration-400bb7d3                       kubernetes:batch/v1:Job        create
~   vpc-native-clean-zombie-users-cron                         kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-expired-better-auth-sessions-cron         kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-channel-highlights-cron                   kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-old-notifications-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-sync-subscription-with-cio-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-update-views-cron                               kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                               kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-opportunities-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-worker-job-deployment                           kubernetes:apps/v1:Deployment  update
~   vpc-native-channel-highlights-cron                         kubernetes:batch/v1:CronJob    update
~   vpc-native-materialize-monthly-best-post-archives-cron     kubernetes:batch/v1:CronJob    update
~   vpc-native-bg-deployment                                   kubernetes:apps/v1:Deployment  update
~   vpc-native-update-tag-materialized-views-cron              kubernetes:batch/v1:CronJob    update
+   vpc-native-api-clickhouse-migration-400bb7d3               kubernetes:batch/v1:Job        create
~   vpc-native-update-source-public-threshold-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-expire-super-agent-trial-cron                   kubernetes:batch/v1:CronJob    update
~   vpc-native-rotate-weekly-quests-cron                       kubernetes:batch/v1:CronJob    update
~   vpc-native-post-lifecycle-state-clickhouse-cron            kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-analytics-clickhouse-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tags-str-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-deployment                                      kubernetes:apps/v1:Deployment  update
~   vpc-native-rotate-daily-quests-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-ws-deployment                                   kubernetes:apps/v1:Deployment  update
-   vpc-native-api-db-migration-97d15d5c                       kubernetes:batch/v1:Job        delete
~   vpc-native-generate-search-invites-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
... and 13 other changes

@idoshamun idoshamun merged commit f54c843 into main Jun 7, 2026
9 checks passed
@idoshamun idoshamun deleted the eng-1631-brief-worthy-post-flag-private-endpoint branch June 7, 2026 17:29
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