:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(subscriptions): remove hourly frequency option (#59011)
Paul D'Ambraf043be09c838
diff --git a/ee/api/subscription.py b/ee/api/subscription.pyindex ef0de645fac2..fe166555c839 100644--- a/ee/api/subscription.py+++ b/ee/api/subscription.py@@ -26,11 +26,7 @@ from temporalio.exceptions import WorkflowAlreadyStartedErrorfrom posthog.api.forbid_destroy_model import ForbidDestroyModelfrom posthog.api.routing import TeamAndOrgViewSetMixinfrom posthog.api.shared import UserBasicSerializer-from posthog.constants import (- SUBSCRIPTION_AI_SUMMARY_PROMPT_GUIDE_FEATURE_FLAG_KEY,- SUBSCRIPTION_HOURLY_FREQUENCY_FEATURE_FLAG_KEY,- AvailableFeature,-)+from posthog.constants import SUBSCRIPTION_AI_SUMMARY_PROMPT_GUIDE_FEATURE_FLAG_KEY, AvailableFeaturefrom posthog.event_usage import groupsfrom posthog.exceptions import QuotaLimitExceededfrom posthog.exceptions_capture import capture_exception@@ -52,8 +48,6 @@ from ee.tasks.subscriptions.subscription_utils import DEFAULT_MAX_ASSET_COUNTSUMMARY_QUOTA_CACHE_TTL_SECONDS = 60SUMMARY_CAP_HIT_DEDUPE_TTL_SECONDS = 600-HOURLY_CAP_HIT_DEDUPE_TTL_SECONDS = 600-MAX_ACTIVE_HOURLY_SUBSCRIPTIONS_PER_ORG = 5def _summary_quota_cache_key(organization_id) -> str:@@ -64,10 +58,6 @@ def _summary_cap_hit_dedupe_key(organization_id) -> str:return f"subscription:summary_cap_hit:org:{organization_id}"-def _hourly_cap_hit_dedupe_key(organization_id) -> str:- return f"subscription:hourly_cap_hit:org:{organization_id}"--def _count_active_summaries(organization) -> int:"""Count subscriptions with summary_enabled=True (and not soft-deleted) acrossevery team in this organization. Single source of truth for both the cap-check@@ -168,12 +158,7 @@ class SubscriptionSerializer(serializers.ModelSerializer):"target_value": {"help_text": "Recipient(s): comma-separated email addresses for email, Slack channel name/ID for slack, or full URL for webhook."},- "frequency": {- "help_text": (- "How often to deliver: hourly, daily, weekly, monthly, or yearly. "- "Hourly is feature-flagged and limited to one active subscription per organization."- )- },+ "frequency": {"help_text": "How often to deliver: daily, weekly, monthly, or yearly."},"interval": {"help_text": "Interval multiplier (e.g. 2 with weekly frequency means every 2 weeks). Default 1."},@@ -299,17 +284,6 @@ class SubscriptionSerializer(serializers.ModelSerializer):organization = self.context["get_organization"]()self._validate_summary_enabled_org_limit(organization)- # Hourly frequency is feature-flagged and capped at one active- # subscription per organization. Fire whenever the row is *becoming*- # an active hourly subscription (frequency=hourly AND enabled=True AND- # deleted=False) but wasn't before — catches creates, frequency- # changes, re-enables, and undeletes.- if self._is_becoming_active_hourly(attrs):- organization = self.context["get_organization"]()- if not self._hourly_frequency_feature_enabled():- raise exceptions.PermissionDenied("Hourly subscriptions are not enabled for this organization.")- self._validate_hourly_org_limit(organization)-return attrsdef _is_becoming_active_summary(self, attrs: dict) -> bool:@@ -373,76 +347,6 @@ class SubscriptionSerializer(serializers.ModelSerializer):# Telemetry must never poison the validation path.pass- def _is_becoming_active_hourly(self, attrs: dict) -> bool:- pre_frequency = self.instance.frequency if self.instance else None- pre_enabled = self.instance.enabled if self.instance else True- pre_deleted = self.instance.deleted if self.instance else False- post_frequency = attrs.get("frequency", pre_frequency)- post_enabled = attrs.get("enabled", pre_enabled)- post_deleted = attrs.get("deleted", pre_deleted)-- pre_active_hourly = (- pre_frequency == Subscription.SubscriptionFrequency.HOURLY and pre_enabled and not pre_deleted- )- post_active_hourly = (- post_frequency == Subscription.SubscriptionFrequency.HOURLY and post_enabled and not post_deleted- )- return post_active_hourly and not pre_active_hourly-- def _validate_hourly_org_limit(self, organization) -> None:- existing = Subscription.objects.filter(- team__organization_id=organization.id,- frequency=Subscription.SubscriptionFrequency.HOURLY,- enabled=True,- deleted=False,- )- if self.instance is not None:- existing = existing.exclude(pk=self.instance.pk)- active_count = existing.count()- limit = MAX_ACTIVE_HOURLY_SUBSCRIPTIONS_PER_ORG- if active_count >= limit:- self._capture_hourly_cap_hit(organization, active_count, limit)- raise ValidationError(- {- "frequency": [- f"Your organization can have up to {limit} active hourly subscriptions. "- "Disable or delete an existing hourly subscription before adding another."- ]- }- )-- def _capture_hourly_cap_hit(self, organization, active_count: int, limit: int) -> None:- # Rate-limited to one event per org per 10 minutes so a misbehaving- # client retrying in a loop doesn't spam the analytics stream. Within- # that window the user-visible 400 still fires every time.- dedupe_key = _hourly_cap_hit_dedupe_key(organization.id)- if cache.get(dedupe_key):- return- cache.set(dedupe_key, True, HOURLY_CAP_HIT_DEDUPE_TTL_SECONDS)-- request = self.context.get("request")- distinct_id = (- str(request.user.distinct_id)- if request and getattr(request, "user", None) and getattr(request.user, "distinct_id", None)- else f"team_{self.context.get('team_id')}"- )- try:- posthoganalytics.capture(- distinct_id=distinct_id,- event="subscription_hourly_cap_hit",- properties={- "team_id": self.context.get("team_id"),- "organization_id": str(organization.id),- "active_count": active_count,- "limit": limit,- "is_create": self.instance is None,- },- groups={"organization": str(organization.id)},- )- except Exception:- # Telemetry must never poison the validation path.- pass-def _evaluate_feature_flag(self, flag_key: str) -> bool:"""Evaluate a feature flag for the caller's organization.@@ -465,9 +369,6 @@ class SubscriptionSerializer(serializers.ModelSerializer):))- def _hourly_frequency_feature_enabled(self) -> bool:- return self._evaluate_feature_flag(SUBSCRIPTION_HOURLY_FREQUENCY_FEATURE_FLAG_KEY)-def _prompt_guide_feature_enabled(self) -> bool:return self._evaluate_feature_flag(SUBSCRIPTION_AI_SUMMARY_PROMPT_GUIDE_FEATURE_FLAG_KEY)diff --git a/ee/api/test/test_subscription.py b/ee/api/test/test_subscription.pyindex e7d8ab5eb349..e62c27ac2ead 100644--- a/ee/api/test/test_subscription.py+++ b/ee/api/test/test_subscription.py@@ -596,86 +596,6 @@ class TestSubscriptionTemporal(APILicensedTest):assert response.status_code == status.HTTP_403_FORBIDDENassert "AI summary context" in response.json()["detail"]- @parameterized.expand(- [- ("flag_disabled_rejects", False, status.HTTP_403_FORBIDDEN, "Hourly subscriptions"),- ("flag_enabled_allows", True, status.HTTP_201_CREATED, "hourly"),- ]- )- def test_hourly_subscription_create_respects_feature_flag(- self,- _case_name: str,- flag_value: bool,- expected_status: int,- expected_fragment: str,- ):- with patch("ee.api.subscription.posthoganalytics.feature_enabled", return_value=flag_value):- response = self._create_subscription(frequency="hourly")-- assert response.status_code == expected_status, response.content- if expected_status == status.HTTP_201_CREATED:- assert response.json()["frequency"] == expected_fragment- else:- assert expected_fragment in response.json()["detail"]-- @parameterized.expand(- [- ("create_below_cap", 4, status.HTTP_201_CREATED),- ("create_at_cap", 5, status.HTTP_400_BAD_REQUEST),- ("create_over_cap_grandfathered", 7, status.HTTP_400_BAD_REQUEST),- ]- )- def test_hourly_subscription_create_respects_org_cap(- self,- _name: str,- existing_active: int,- expected_status: int,- ):- self._seed_active_hourly_subscriptions(existing_active)-- with patch("ee.api.subscription.posthoganalytics.feature_enabled", return_value=True):- response = self._create_subscription(frequency="hourly", title="new hourly")-- assert response.status_code == expected_status, response.content- if expected_status == status.HTTP_400_BAD_REQUEST:- assert "up to 5 active hourly subscriptions" in str(response.json())-- def test_can_replace_hourly_subscription_after_disable(self):- seeded = self._seed_active_hourly_subscriptions(5)-- with patch("ee.api.subscription.posthoganalytics.feature_enabled", return_value=True):- # Disable one of the seeded hourly subscriptions — it should free up an org slot.- patch_response = self.client.patch(- f"/api/projects/{self.team.id}/subscriptions/{seeded[0].id}",- {"enabled": False},- )- assert patch_response.status_code == status.HTTP_200_OK-- response = self._create_subscription(frequency="hourly", title="replacement hourly")-- assert response.status_code == status.HTTP_201_CREATED-- def test_hourly_cap_hit_emits_telemetry(self):- cache.clear()- self._seed_active_hourly_subscriptions(5)-- with (- patch("ee.api.subscription.posthoganalytics.feature_enabled", return_value=True),- patch("ee.api.subscription.posthoganalytics.capture") as mock_capture,- ):- response = self._create_subscription(frequency="hourly", title="cap-buster hourly")- assert response.status_code == status.HTTP_400_BAD_REQUEST-- cap_hit_calls = [- c for c in mock_capture.call_args_list if c.kwargs.get("event") == "subscription_hourly_cap_hit"- ]- assert len(cap_hit_calls) == 1- props = cap_hit_calls[0].kwargs["properties"]- assert props["organization_id"] == str(self.organization.id)- assert props["is_create"] is True- assert props["active_count"] == 5- assert props["limit"] == 5-def _seed_active_summary_subscriptions(self, count: int) -> list[Subscription]:# Build raw rows so we can place an org over its tier cap to exercise# grandfathering paths without going through the enforced API.@@ -695,24 +615,6 @@ class TestSubscriptionTemporal(APILicensedTest):for i in range(count)]- def _seed_active_hourly_subscriptions(self, count: int) -> list[Subscription]:- # Build raw rows so we can place an org at or above the hourly cap- # without going through the enforced API.- return [- Subscription.objects.create(- team=self.team,- insight=self.insight,- target_type="email",- target_value=f"existing-hourly-{i}@posthog.com",- frequency="hourly",- interval=1,- start_date=datetime(2022, 1, 1, tzinfo=UTC),- title=f"existing hourly {i}",- created_by=self.user,- )- for i in range(count)- ]-@parameterized.expand([("create_under_limit", 5, 4, status.HTTP_201_CREATED),diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.tsindex a985c254de09..4d909de744d7 100644--- a/frontend/src/generated/core/api.schemas.ts+++ b/frontend/src/generated/core/api.schemas.ts@@ -2546,8 +2546,7 @@ export const TargetTypeEnumApi = {} as const/**- * * `hourly` - Hourly- * `daily` - Daily+ * * `daily` - Daily* `weekly` - Weekly* `monthly` - Monthly* `yearly` - Yearly@@ -2556,7 +2555,6 @@ export type SubscriptionFrequencyEnumApi =(typeof SubscriptionFrequencyEnumApi)[keyof typeof SubscriptionFrequencyEnumApi]export const SubscriptionFrequencyEnumApi = {- Hourly: 'hourly',Daily: 'daily',Weekly: 'weekly',Monthly: 'monthly',@@ -2614,9 +2612,8 @@ export interface SubscriptionApi {target_type: TargetTypeEnumApi/** Recipient(s): comma-separated email addresses for email, Slack channel name/ID for slack, or full URL for webhook. */target_value: string- /** How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.+ /** How often to deliver: daily, weekly, monthly, or yearly.- * `hourly` - Hourly* `daily` - Daily* `weekly` - Weekly* `monthly` - Monthly@@ -2745,9 +2742,8 @@ export interface PatchedSubscriptionApi {target_type?: TargetTypeEnumApi/** Recipient(s): comma-separated email addresses for email, Slack channel name/ID for slack, or full URL for webhook. */target_value?: string- /** How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.+ /** How often to deliver: daily, weekly, monthly, or yearly.- * `hourly` - Hourly* `daily` - Daily* `weekly` - Weekly* `monthly` - Monthlydiff --git a/frontend/src/generated/core/api.zod.ts b/frontend/src/generated/core/api.zod.tsindex 8db91bfad87a..9bfb847109ba 100644--- a/frontend/src/generated/core/api.zod.ts+++ b/frontend/src/generated/core/api.zod.ts@@ -2594,12 +2594,10 @@ export const SubscriptionsCreateBody = /* @__PURE__ */ zod'Recipient(s): comma-separated email addresses for email, Slack channel name\/ID for slack, or full URL for webhook.'),frequency: zod- .enum(['hourly', 'daily', 'weekly', 'monthly', 'yearly'])+ .enum(['daily', 'weekly', 'monthly', 'yearly'])+ .describe('\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly').describe(- '\* `hourly` - Hourly\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'- )- .describe(- 'How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.\n\n\* `hourly` - Hourly\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'+ 'How often to deliver: daily, weekly, monthly, or yearly.\n\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'),interval: zod.number()@@ -2702,12 +2700,10 @@ export const SubscriptionsUpdateBody = /* @__PURE__ */ zod'Recipient(s): comma-separated email addresses for email, Slack channel name\/ID for slack, or full URL for webhook.'),frequency: zod- .enum(['hourly', 'daily', 'weekly', 'monthly', 'yearly'])- .describe(- '\* `hourly` - Hourly\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'- )+ .enum(['daily', 'weekly', 'monthly', 'yearly'])+ .describe('\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly').describe(- 'How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.\n\n\* `hourly` - Hourly\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'+ 'How often to deliver: daily, weekly, monthly, or yearly.\n\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'),interval: zod.number()@@ -2812,13 +2808,11 @@ export const SubscriptionsPartialUpdateBody = /* @__PURE__ */ zod'Recipient(s): comma-separated email addresses for email, Slack channel name\/ID for slack, or full URL for webhook.'),frequency: zod- .enum(['hourly', 'daily', 'weekly', 'monthly', 'yearly'])- .describe(- '\* `hourly` - Hourly\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'- )+ .enum(['daily', 'weekly', 'monthly', 'yearly'])+ .describe('\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly').optional().describe(- 'How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.\n\n\* `hourly` - Hourly\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'+ 'How often to deliver: daily, weekly, monthly, or yearly.\n\n\* `daily` - Daily\n\* `weekly` - Weekly\n\* `monthly` - Monthly\n\* `yearly` - Yearly'),interval: zod.number()diff --git a/frontend/src/lib/components/Subscriptions/subscriptionLogic.ts b/frontend/src/lib/components/Subscriptions/subscriptionLogic.tsindex 729ee5e781bd..cfadb8acf6e1 100644--- a/frontend/src/lib/components/Subscriptions/subscriptionLogic.ts+++ b/frontend/src/lib/components/Subscriptions/subscriptionLogic.ts@@ -192,7 +192,7 @@ export const subscriptionLogic = kea<subscriptionLogicType>([setSubscriptionValue: ({ name, value }) => {const key = Array.isArray(name) ? name[0] : nameif (key === 'frequency') {- if (value === 'daily' || value === 'hourly') {+ if (value === 'daily') {actions.setSubscriptionValues({bysetpos: null,byweekday: null,diff --git a/frontend/src/lib/components/Subscriptions/utils.tsx b/frontend/src/lib/components/Subscriptions/utils.tsxindex 50c847af854e..efa22ce64bc4 100644--- a/frontend/src/lib/components/Subscriptions/utils.tsx+++ b/frontend/src/lib/components/Subscriptions/utils.tsx@@ -43,11 +43,8 @@ export const targetTypeOptions: LemonSelectOptions<'email' | 'slack'> = [export const intervalOptions: LemonSelectOptions<number> = range(1, 13).map((x) => ({ value: x, label: x.toString() }))-export type FrequencyOptionValue = 'hourly' | 'daily' | 'weekly' | 'monthly'+export type FrequencyOptionValue = 'daily' | 'weekly' | 'monthly'-// Typed as the concrete `LemonSelectOption[]` (not the `LemonSelectOptions` union of-// `Section[] | Option[]`) so callers can `[...hourly, ...daily-monthly]` without-// the union widening to `(Section | Option)[]` and losing assignability.export const frequencyOptionsSingular: LemonSelectOption<FrequencyOptionValue>[] = [{ value: 'daily', label: 'day' },{ value: 'weekly', label: 'week' },@@ -59,13 +56,6 @@ export const frequencyOptionsPlural: LemonSelectOption<FrequencyOptionValue>[] ={ value: 'monthly', label: 'months' },]-export const hourlyFrequencyOptionSingular: LemonSelectOption<FrequencyOptionValue>[] = [- { value: 'hourly', label: 'hour' },-]-export const hourlyFrequencyOptionPlural: LemonSelectOption<FrequencyOptionValue>[] = [- { value: 'hourly', label: 'hours' },-]-export const weekdayOptions: LemonSelectOptionLeaf<'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday'>[] = [@@ -108,7 +98,6 @@ const RRULE_WEEKDAY_MAP: Record<string, (typeof RRule)['MO']> = {}const RRULE_FREQ_MAP: Record<string, number> = {- hourly: RRule.HOURLY,daily: RRule.DAILY,weekly: RRule.WEEKLY,monthly: RRule.MONTHLY,diff --git a/frontend/src/lib/components/Subscriptions/views/EditSubscription.tsx b/frontend/src/lib/components/Subscriptions/views/EditSubscription.tsxindex fe3f8ed33daf..a042a4518ba0 100644--- a/frontend/src/lib/components/Subscriptions/views/EditSubscription.tsx+++ b/frontend/src/lib/components/Subscriptions/views/EditSubscription.tsx@@ -11,7 +11,6 @@ import { UserActivityIndicator } from 'lib/components/UserActivityIndicator/Userimport { usersLemonSelectOptions } from 'lib/components/UserSelectItem'import { FEATURE_FLAGS } from 'lib/constants'import { dayjs } from 'lib/dayjs'-import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { integrationsLogic } from 'lib/integrations/integrationsLogic'import { SlackChannelPicker, SlackNotConfiguredBanner } from 'lib/integrations/SlackIntegrationHelpers'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'@@ -38,8 +37,6 @@ import {frequencyOptionsPlural,frequencyOptionsSingular,getNextDeliveryDate,- hourlyFrequencyOptionPlural,- hourlyFrequencyOptionSingular,intervalOptions,monthlyWeekdayOptions,targetTypeOptions,@@ -84,17 +81,10 @@ export function EditSubscription({const { deleteSubscription } = useActions(subscriptionslogic)const { slackIntegrations, integrations } = useValues(integrationsLogic)const { dataProcessingAccepted } = useValues(maxGlobalLogic)- const hourlySubscriptionsEnabled = useFeatureFlag('SUBSCRIPTION_HOURLY_FREQUENCY')const emailDisabled = !preflight?.email_service_available- // Show the hourly option whenever the feature flag is on for this user/org, OR- // when the subscription being edited is already hourly (so the user can read /- // modify a value that was created when the flag was on).- const showHourlyOption = hourlySubscriptionsEnabled || subscription?.frequency === 'hourly'- const frequencyOptions = subscription?.interval === 1 ? frequencyOptionsSingular : frequencyOptionsPlural- const hourlyOption = subscription?.interval === 1 ? hourlyFrequencyOptionSingular : hourlyFrequencyOptionPlural- const availableFrequencyOptions = showHourlyOption ? [...hourlyOption, ...frequencyOptions] : frequencyOptions+ const availableFrequencyOptions = subscription?.interval === 1 ? frequencyOptionsSingular : frequencyOptionsPlural// For new subscriptions, show InsightSelector immediately (useEffect will auto-select)// For editing, wait until subscription data has loaded from API (target_type exists)@@ -422,7 +412,7 @@ export function EditSubscription({</LemonField></>)}- <span>{subscription.frequency === 'hourly' ? 'starting at' : 'by'}</span>+ <span>by</span><LemonField name="start_date">{({ value, onChange }) => (<LemonSelectdiff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 563a2733c07c..1be126c5d2a9 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -469,7 +469,6 @@ export const FEATURE_FLAGS = {SQL_EDITOR_VIM_MODE: 'sql-editor-vim-mode', // owner: @arthurdedeusSSE_DASHBOARDS: 'sse-dashboards', // owner: @aspicer #team-analytics-platformSUBSCRIPTION_AI_SUMMARY_PROMPT_GUIDE: 'subscription-ai-summary-prompt-guide', // owner: #team-analytics-platform, gates the per-subscription prompt guide textarea- SUBSCRIPTION_HOURLY_FREQUENCY: 'subscription-hourly-frequency', // owner: #team-analytics-platform, gates hourly subscription frequency (up to 5 active hourly subscriptions per org)SURVEY_HEADLINE_SUMMARY: 'survey-headline-summary', // owner: @adboio #team-surveysSURVEYS_ERROR_TRACKING_CROSS_SELL: 'surveys-in-error-tracking', // owner: @adboio #team-surveysSURVEYS_FORM_BUILDER: 'surveys-form-builder', // owner: @adboio #team-surveysdiff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 56de225ac43a..2c40401eeddd 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -5052,7 +5052,7 @@ export interface SubscriptionType {integration_id?: number | nulltarget_type: stringtarget_value: string- frequency: 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly'+ frequency: 'daily' | 'weekly' | 'monthly' | 'yearly'interval: numberbyweekday: WeekdayType[] | nullbysetpos: number | nulldiff --git a/posthog/constants.py b/posthog/constants.pyindex 8caf90ffe1e9..2c9f2f381616 100644--- a/posthog/constants.py+++ b/posthog/constants.py@@ -315,7 +315,6 @@ PRODUCT_TOUR_TARGETING_FLAG_PREFIX = "product-tour-targeting-"# Server-side evaluation via posthoganalytics; keep in sync with frontend FEATURE_FLAGS.HACKATHONS_SUBSCRIPTIONS_FEATURE_FLAG_KEY = "hackathons_subscriptions"SUBSCRIPTION_AI_SUMMARY_PROMPT_GUIDE_FEATURE_FLAG_KEY = "subscription-ai-summary-prompt-guide"-SUBSCRIPTION_HOURLY_FREQUENCY_FEATURE_FLAG_KEY = "subscription-hourly-frequency"EXPERIMENTS_SYNC_QUERIES_FEATURE_FLAG_KEY = "experiments-sync-queries"GENERATED_DASHBOARD_PREFIX = "Generated Dashboard"diff --git a/posthog/migrations/1161_remove_subscription_hourly_frequency.py b/posthog/migrations/1161_remove_subscription_hourly_frequency.pynew file mode 100644index 000000000000..4e8f79a3b9c2--- /dev/null+++ b/posthog/migrations/1161_remove_subscription_hourly_frequency.py@@ -0,0 +1,23 @@+from django.db import migrations+++def soft_delete_hourly_subscriptions(apps, schema_editor):+ Subscription = apps.get_model("posthog", "Subscription")+ Subscription.objects.filter(frequency="hourly").update(+ deleted=True,+ enabled=False,+ next_delivery_date=None,+ frequency="daily",+ )+++class Migration(migrations.Migration):+ dependencies = [("posthog", "1160_materializedcolumnslot_run_id_concurrent_idx")]++ operations = [+ migrations.RunPython(+ soft_delete_hourly_subscriptions,+ reverse_code=migrations.RunPython.noop,+ elidable=True,+ ),+ ]diff --git a/posthog/migrations/1162_drop_hourly_from_subscription_frequency_choices.py b/posthog/migrations/1162_drop_hourly_from_subscription_frequency_choices.pynew file mode 100644index 000000000000..f5a79b4dd315--- /dev/null+++ b/posthog/migrations/1162_drop_hourly_from_subscription_frequency_choices.py@@ -0,0 +1,21 @@+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [("posthog", "1161_remove_subscription_hourly_frequency")]++ operations = [+ migrations.AlterField(+ model_name="subscription",+ name="frequency",+ field=models.CharField(+ choices=[+ ("daily", "Daily"),+ ("weekly", "Weekly"),+ ("monthly", "Monthly"),+ ("yearly", "Yearly"),+ ],+ max_length=10,+ ),+ ),+ ]diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txtindex c49c2a02c024..e7107eb61b34 100644--- a/posthog/migrations/max_migration.txt+++ b/posthog/migrations/max_migration.txt@@ -1 +1 @@-1160_materializedcolumnslot_run_id_concurrent_idx+1162_drop_hourly_from_subscription_frequency_choicesdiff --git a/posthog/models/subscription.py b/posthog/models/subscription.pyindex 70cbb6e138da..e744f24ad20c 100644--- a/posthog/models/subscription.py+++ b/posthog/models/subscription.py@@ -8,7 +8,7 @@ from django.db.models.signals import post_savefrom django.dispatch import receiverfrom django.utils import timezone-from dateutil.rrule import DAILY, FR, HOURLY, MO, MONTHLY, SA, SU, TH, TU, WE, WEEKLY, YEARLY, rrule+from dateutil.rrule import DAILY, FR, MO, MONTHLY, SA, SU, TH, TU, WE, WEEKLY, YEARLY, rrulefrom posthog.exceptions_capture import capture_exceptionfrom posthog.jwt import PosthogJwtAudience, decode_jwt, encode_jwt@@ -51,7 +51,6 @@ class Subscription(models.Model):WEBHOOK = "webhook"class SubscriptionFrequency(models.TextChoices):- HOURLY = "hourly"DAILY = "daily"WEEKLY = "weekly"MONTHLY = "monthly"@@ -69,7 +68,6 @@ class Subscription(models.Model):RRULE_FIELDS = {"frequency", "count", "interval", "start_date", "until_date", "bysetpos", "byweekday"}_FREQ_MAP: dict[str, int] = {- SubscriptionFrequency.HOURLY: HOURLY,SubscriptionFrequency.DAILY: DAILY,SubscriptionFrequency.WEEKLY: WEEKLY,SubscriptionFrequency.MONTHLY: MONTHLY,@@ -227,7 +225,6 @@ class Subscription(models.Model):def summary(self):try:human_frequency = {- "hourly": "hour","daily": "day","weekly": "week","monthly": "month",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 45dd70d8afa2..006e6729bd10 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -23649,8 +23649,7 @@ export namespace Schemas {} as const;/**- * * `hourly` - Hourly- * `daily` - Daily+ * * `daily` - Daily* `weekly` - Weekly* `monthly` - Monthly* `yearly` - Yearly@@ -23659,7 +23658,6 @@ export namespace Schemas {export const SubscriptionFrequencyEnum = {- Hourly: 'hourly',Daily: 'daily',Weekly: 'weekly',Monthly: 'monthly',@@ -23717,9 +23715,8 @@ export namespace Schemas {target_type: TargetTypeEnum;/** Recipient(s): comma-separated email addresses for email, Slack channel name/ID for slack, or full URL for webhook. */target_value: string;- /** How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.+ /** How often to deliver: daily, weekly, monthly, or yearly.- * `hourly` - Hourly* `daily` - Daily* `weekly` - Weekly* `monthly` - Monthly@@ -29365,9 +29362,8 @@ export namespace Schemas {target_type?: TargetTypeEnum;/** Recipient(s): comma-separated email addresses for email, Slack channel name/ID for slack, or full URL for webhook. */target_value?: string;- /** How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.+ /** How often to deliver: daily, weekly, monthly, or yearly.- * `hourly` - Hourly* `daily` - Daily* `weekly` - Weekly* `monthly` - Monthlydiff --git a/services/mcp/src/generated/core/api.ts b/services/mcp/src/generated/core/api.tsindex 1cee0985fca3..35fc8f329375 100644--- a/services/mcp/src/generated/core/api.ts+++ b/services/mcp/src/generated/core/api.ts@@ -344,12 +344,10 @@ export const SubscriptionsCreateBody = /* @__PURE__ */ zod'Recipient(s): comma-separated email addresses for email, Slack channel name/ID for slack, or full URL for webhook.'),frequency: zod- .enum(['hourly', 'daily', 'weekly', 'monthly', 'yearly'])+ .enum(['daily', 'weekly', 'monthly', 'yearly'])+ .describe('* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly').describe(- '* `hourly` - Hourly\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly'- )- .describe(- 'How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.\n\n* `hourly` - Hourly\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly'+ 'How often to deliver: daily, weekly, monthly, or yearly.\n\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly'),interval: zod.number()@@ -472,13 +470,11 @@ export const SubscriptionsPartialUpdateBody = /* @__PURE__ */ zod'Recipient(s): comma-separated email addresses for email, Slack channel name/ID for slack, or full URL for webhook.'),frequency: zod- .enum(['hourly', 'daily', 'weekly', 'monthly', 'yearly'])- .describe(- '* `hourly` - Hourly\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly'- )+ .enum(['daily', 'weekly', 'monthly', 'yearly'])+ .describe('* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly').optional().describe(- 'How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.\n\n* `hourly` - Hourly\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly'+ 'How often to deliver: daily, weekly, monthly, or yearly.\n\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly'),interval: zod.number()diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/subscriptions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/subscriptions-create.jsonindex 8adcda26e8d6..f20d97e171df 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/subscriptions-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/subscriptions-create.json@@ -71,8 +71,8 @@"type": "boolean"},"frequency": {- "description": "How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.\n\n* `hourly` - Hourly\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly",- "enum": ["hourly", "daily", "weekly", "monthly", "yearly"],+ "description": "How often to deliver: daily, weekly, monthly, or yearly.\n\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly",+ "enum": ["daily", "weekly", "monthly", "yearly"],"type": "string"},"insight": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/subscriptions-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/subscriptions-partial-update.jsonindex 30f90b021bb9..333edf1f7dab 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/subscriptions-partial-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/subscriptions-partial-update.json@@ -70,8 +70,8 @@"type": "boolean"},"frequency": {- "description": "How often to deliver: hourly, daily, weekly, monthly, or yearly. Hourly is feature-flagged and limited to one active subscription per organization.\n\n* `hourly` - Hourly\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly",- "enum": ["hourly", "daily", "weekly", "monthly", "yearly"],+ "description": "How often to deliver: daily, weekly, monthly, or yearly.\n\n* `daily` - Daily\n* `weekly` - Weekly\n* `monthly` - Monthly\n* `yearly` - Yearly",+ "enum": ["daily", "weekly", "monthly", "yearly"],"type": "string"},"id": {