-
Notifications
You must be signed in to change notification settings - Fork 113
feat(opportunity): auto-upgrade to Super Agent trial on first submission #3474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
idoshamun
wants to merge
5
commits into
main
Choose a base branch
from
eng-226-pricing-auto-plus-plan
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,448
−99
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When an organization submits their first opportunity for review, automatically upgrade them to the Super Agent plan for 30 days as a trial. After 30 days, auto-downgrade to their original plan or Agent plan. Changes: - Add superAgentTrial config to RemoteConfig for GrowthBook control - Add trial fields (trialExpiresAt, trialPlan, isTrialActive) to recruiterSubscriptionFlags schema - Add showSuperAgentTrialUpgrade field to Alerts for frontend notification - Create trial helper functions in src/common/opportunity/trial.ts - Modify updateOpportunityState mutation to activate trial on first IN_REVIEW - Create expireSuperAgentTrial cron job to handle auto-downgrade - Add comprehensive tests for trial logic and cron NOTE: Migrations for showSuperAgentTrialUpgrade column and trial index need to be created and applied separately. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🍹 The Update (preview) for dailydotdev/api/prod (at d47e13a) was successful. Resource Changes Name Type Operation
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-db-migration-b599631c kubernetes:batch/v1:Job delete
~ vpc-native-clean-zombie-images-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-trending-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-db-migration-166ffff3 kubernetes:batch/v1:Job create
~ vpc-native-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-user-profile-updated-sync-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-calculate-top-readers-cron kubernetes:batch/v1:CronJob update
~ vpc-native-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-source-tag-view-cron kubernetes:batch/v1:CronJob update
+ vpc-native-expire-super-agent-trial-cron kubernetes:batch/v1:CronJob create
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-ws-deployment kubernetes:apps/v1:Deployment 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-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tag-recommendations-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tags-str-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-clickhouse-migration-b599631c kubernetes:batch/v1:Job delete
~ vpc-native-post-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-users-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-clickhouse-migration-166ffff3 kubernetes:batch/v1:Job create
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-source-public-threshold-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-user-companies-cron kubernetes:batch/v1:CronJob update
~ vpc-native-validate-active-users-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-generate-search-invites-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-history-day-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-temporal-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-check-analytics-report-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-highlighted-views-cron kubernetes:batch/v1:CronJob update
|
The Alerts entity had a new showSuperAgentTrialUpgrade column but was missing the database migration, causing test failures. - Add migration for alerts.showSuperAgentTrialUpgrade column - Consolidate skipped activateSuperAgentTrial tests into one test - Enable previously skipped tests now that migration exists Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add the new showSuperAgentTrialUpgrade field to: - REST API route query in src/routes/alerts.ts - Test GraphQL query in __tests__/alerts.ts This field was added to the entity and schema but was missing from the queries that return alerts data. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…nizations - Introduce flexible `DataSourceOrManager` type to streamline database interactions. - Remove `isSuperAgentTrialEnabled`, fold checks into `getSuperAgentTrialConfig`. - Simplify `DEFAULT_TRIAL_CONFIG` structure, delegate to remote config. - Improve subscription and trial flag handling with `updateRecruiterSubscriptionFlags`. - Update tests to align with refactor, reducing redundancy and enhancing clarity.
Extract repeated test setup patterns into shared helpers: - Add createMockLogger() for consistent logger mocking - Add defaultSuperAgentTrialConfig constant for trial setup This reduces code duplication across trial-related tests and ensures consistency in test configuration.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements automatic Super Agent trial upgrade for organizations when they submit their first opportunity for review.
superAgentTrialconfigshowSuperAgentTrialUpgradealertKey Changes
src/common/opportunity/trial.ts- Trial activation and helper functionssrc/schema/opportunity.ts- Modified updateOpportunityState for trial logicsrc/cron/expireSuperAgentTrial.ts- Cron job for auto-downgradesrc/entity/Alerts.ts- AddedshowSuperAgentTrialUpgradefieldsrc/entity/Organization.ts- Added trial index decoratorPending
Migrations need to be created manually for:
showSuperAgentTrialUpgradecolumn in alerts tableIDX_organization_trial_expires_atindex on organization tableTest plan
🤖 Generated with Claude Code