Skip to content

feat: gate post creation behind profile completion experiment#3612

Merged
rebelchris merged 4 commits intomainfrom
eng-740-experiment-require-completed-profile-to-create-posts
Feb 20, 2026
Merged

feat: gate post creation behind profile completion experiment#3612
rebelchris merged 4 commits intomainfrom
eng-740-experiment-require-completed-profile-to-create-posts

Conversation

@rebelchris
Copy link
Contributor

Summary

  • extract profile completion calculation into a reusable module
  • gate post creation mutations behind a GrowthBook experiment flag
  • support boolean and numeric threshold flag values for rollout flexibility
  • add coverage for profile gate logic and post-creation mutation behavior

Key Decisions

  • enforce on backend as the source of truth, with frontend as UX-only guidance
  • use read replica for profile completion reads where eventual consistency is acceptable
  • centralize flag evaluation in a single helper to avoid duplication across mutations

Linear issue: https://linear.app/dailydev/issue/ENG-740/experiment-require-completed-profile-to-create-posts

Closes ENG-740


Created by Huginn 🐦‍⬛

@pulumi
Copy link

pulumi bot commented Feb 19, 2026

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

Resource Changes

    Name                                                       Type                           Operation
~   vpc-native-update-source-public-threshold-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-stale-user-transactions-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-bg-deployment                                   kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-gifted-plus-cron                          kubernetes:batch/v1:CronJob    update
~   vpc-native-generic-referral-reminder-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-user-posts-analytics-refresh-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-private-deployment                              kubernetes:apps/v1:Deployment  update
-   vpc-native-api-db-migration-4e739256                       kubernetes:batch/v1:Job        delete
~   vpc-native-user-profile-updated-sync-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-worker-job-deployment                           kubernetes:apps/v1:Deployment  update
~   vpc-native-temporal-deployment                             kubernetes:apps/v1:Deployment  update
~   vpc-native-sync-subscription-with-cio-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-analytics-clickhouse-cron          kubernetes:batch/v1:CronJob    update
-   vpc-native-api-clickhouse-migration-4e739256               kubernetes:batch/v1:Job        delete
~   vpc-native-update-trending-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-squad-posts-analytics-refresh-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-user-companies-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-update-highlighted-views-cron                   kubernetes:batch/v1:CronJob    update
+   vpc-native-api-db-migration-6b207f74                       kubernetes:batch/v1:Job        create
+   vpc-native-api-clickhouse-migration-6b207f74               kubernetes:batch/v1:Job        create
~   vpc-native-update-achievement-rarity-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-update-current-streak-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                               kubernetes:batch/v1:CronJob    update
~   vpc-native-hourly-notification-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-update-views-cron                               kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tags-str-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-validate-active-users-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tag-recommendations-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-deployment                  kubernetes:apps/v1:Deployment  update
~   vpc-native-post-analytics-history-day-clickhouse-cron      kubernetes:batch/v1:CronJob    update
~   vpc-native-generate-search-invites-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-ws-deployment                                   kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-images-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-update-source-tag-view-cron                     kubernetes:batch/v1:CronJob    update
~   vpc-native-check-analytics-report-cron                     kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-users-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-post-analytics-clickhouse-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-expire-super-agent-trial-cron                   kubernetes:batch/v1:CronJob    update
... and 4 other changes

Copy link
Contributor Author

@rebelchris rebelchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude I think we should just make it a number flag only, it will just be off for those not enrolled. It makes things easier. (see how we handle numeric flags though)

@claude
Copy link

claude bot commented Feb 20, 2026

Claude finished @rebelchris's task in 1m 45s —— View job


Simplified to numeric-only flag

  • Gather context
  • Understand current boolean+numeric flag implementation
  • Find how numeric flags are handled elsewhere in the codebase
  • Update implementation to numeric-only
  • Update tests
  • Lint and verify
  • Commit and push

Changes made across 3 files:

src/growthbook.ts — Changed Feature<boolean | number>Feature<number> with default 0:

profileCompletionPostGate: new Feature<number>('profile_completion_post_gate', 0),

src/common/profile/completion.ts — Simplified ensureProfileCompleteIfEnabled — the flag value is now directly the requiredPercentage; 0 (falsy) means off/not enrolled:

const requiredPercentage = gb.getFeatureValue(
  features.profileCompletionPostGate.id,
  features.profileCompletionPostGate.defaultValue ?? 0,
);

if (!requiredPercentage) {
  return;
}

await ensureProfileComplete(con, userId, requiredPercentage);

__tests__/posts.ts — Updated the mock to return 100 (number) instead of true when the gate is enabled.

rebelchris and others added 2 commits February 20, 2026 10:33
Replace the boolean|number flag with a number-only flag where 0 means
off (not enrolled) and any positive value is the required completion
percentage threshold.

Co-authored-by: Chris Bongers <rebelchris@users.noreply.github.com>
@rebelchris rebelchris merged commit 544f656 into main Feb 20, 2026
9 checks passed
@rebelchris rebelchris deleted the eng-740-experiment-require-completed-profile-to-create-posts branch February 20, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant