feat: add aiModerated flag to moderateSourcePosts mutation#3777
feat: add aiModerated flag to moderateSourcePosts mutation#3777
Conversation
Add an optional `aiModerated` Boolean parameter to the `moderateSourcePosts`
GraphQL mutation. When set to `true`, the mutation merges
`{ aiModerated: true }` into the JSONB `flags` column of the moderated posts.
This enables traceability for AI-automated moderation decisions vs human ones,
used by the squad-moderation automation agent.
Changes:
- Add `aiModerated` to `SourcePostModerationFlags` type
- Add `aiModerated: Boolean` parameter to GraphQL schema
- Merge flag into JSONB using existing `updateFlagsStatement` utility
|
🍹 The Update (preview) for dailydotdev/api/prod (at 0c1047e) was successful. ✨ Neo ExplanationRoutine application release bumping all workloads from commit `f0e4dd8e` to `8cd23b8f`, with accompanying DB and ClickHouse migration Jobs — ✅ Low Risk, assuming migrations are backward-compatible with the current schema.This is a standard application release rolling out commit The two migration Jobs (PostgreSQL via TypeORM and ClickHouse) follow the expected pattern for this codebase: old Jobs from the previous commit are deleted and new ones are created for the incoming commit. This means database and ClickHouse schema migrations will run as part of this deployment. The new Job specs are not shown in detail, but the pattern matches the deleted Jobs exactly — same runner commands, same secret references, just a new image tag. 🔵 Info — The GCP provider warning about missing ADC credentials is a diagnostic noise issue in the CI runner environment; it does not affect the Kubernetes resources being deployed. Resource Changes Name Type Operation
~ vpc-native-rotate-daily-quests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-expired-better-auth-sessions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-calculate-top-readers-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-clickhouse-migration-f0e4dd8e kubernetes:batch/v1:Job delete
~ vpc-native-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-images-cron kubernetes:batch/v1:CronJob update
~ vpc-native-expire-super-agent-trial-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-history-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-history-day-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-trending-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-user-companies-cron kubernetes:batch/v1:CronJob update
~ vpc-native-squad-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-digests-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-db-migration-f0e4dd8e kubernetes:batch/v1:Job delete
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-highlighted-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-zombie-opportunities-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-clickhouse-migration-8cd23b8f kubernetes:batch/v1:Job create
~ vpc-native-post-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-views-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-api-db-migration-8cd23b8f kubernetes:batch/v1:Job create
~ vpc-native-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-temporal-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-materialize-monthly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-materialize-yearly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-hourly-notification-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-worker-job-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-user-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
~ 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-rotate-weekly-quests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
... and 11 other changes |
Summary
Add an optional
aiModerated: Booleanparameter to themoderateSourcePostsGraphQL mutation. When set totrue, the mutation merges{ "aiModerated": true }into the JSONBflagscolumn of the moderated posts.Motivation
We're running an automated squad moderation agent that approves/rejects pending posts. We need a way to distinguish AI-made decisions from human ones for:
(flags->>'aiModerated')::boolean IS NOT TRUEChanges
src/entity/SourcePostModeration.tsaiModerated: booleantoSourcePostModerationFlagstypesrc/schema/posts.tsaiModerated: Booleanparam to GraphQL schema + resolverHow it works
false— zero impact on existing callersupdateFlagsStatementutility for JSONB merge (same pattern as vordr, promoteToPublic, etc.)Usage
Testing
aiModerated: true, verifyflagscolumn contains{"aiModerated": true}merged with existing flags