Skip to content

: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.

chore(broadcasts): remove two fully rolled out feature flags (#127264)

Daniel Marchuk90cb12847f85
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index b1be175645ea..3f380133f204 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -271,7 +271,6 @@ export const FEATURE_FLAGS = {
BILLING_ALERTS: 'billing-alerts', // owner: #team-billing, gates the Billing > Alerts tab
BILLING_REAL_TIME_USAGE: 'billing-real-time-usage', // owner: #team-billing, gates the Real-time usage scene
BROADCASTS_AI_FIRST_NEW: 'broadcasts-ai-first-new', // owner: @dmarchuk #team-workflows
- BROADCASTS_PUSH_CHANNEL: 'broadcasts-push-channel', // owner: @dmarchuk #team-workflows, push as a broadcast channel
CANVAS_COMMENTS: 'posthog-desktop-canvas-comments', // owner: @k11kirky, shows canvas comments and selection comments on web canvases, shared with PostHog Desktop
CDP_DWH_TABLE_SOURCE: 'cdp-dwh-table-source', // owner: #team-workflows-cdp
CDP_DWH_VIEW_SOURCE: 'cdp-dwh-view-source', // owner: #team-workflows-cdp
@@ -618,7 +617,6 @@ export const FEATURE_FLAGS = {
WORKFLOW_CLASSIFY_ACTION: 'workflow-classify-action', // owner: #team-workflows
WORKFLOW_OPT_OUT_OF_MESSAGES_ACTION: 'workflow-opt-out-of-messages-action', // owner: #team-workflows
WORKFLOWS_AI_FIRST_NEW: 'workflows-ai-first-new', // owner: @mayteio #team-workflows
- WORKFLOWS_BROADCAST_AUDIENCE_SUGGESTIONS: 'workflows-broadcast-audience-suggestions', // owner: @dmarchuk #team-workflows, AI audience ideas on the Broadcasts tab
WORKFLOWS_COHORT_CONDITIONS: 'workflows-cohort-conditions', // owner: @meikelmosby #team-workflows
WORKFLOWS_CUSTOMERIO_IMPORT: 'workflows-customerio-import', // owner: @dmarchuk #team-workflows, import Customer.io automations as draft workflows
WORKFLOWS_DESTINATION_SUGGESTION: 'workflows-destination-suggestion', // owner: #team-workflows, offers workflows instead of a new email tool destination
diff --git a/products/workflows/backend/facade/audience_suggestions.py b/products/workflows/backend/facade/audience_suggestions.py
index 37089f18beb7..faed73d3796f 100644
--- a/products/workflows/backend/facade/audience_suggestions.py
+++ b/products/workflows/backend/facade/audience_suggestions.py
@@ -5,21 +5,17 @@ from posthog.models import Team, User
from products.workflows.backend.facade.contracts import AudienceSuggestionsResult
from products.workflows.backend.services.audience_suggestions import service
from products.workflows.backend.services.audience_suggestions.service import (
- FEATURE_FLAG_KEY,
can_read_email,
get_audience_suggestion,
get_audience_suggestions,
- is_enabled,
needs_new_generation,
)
from products.workflows.backend.tasks.audience_suggestions import generate_audience_suggestions
__all__ = [
- "FEATURE_FLAG_KEY",
"can_read_email",
"get_audience_suggestion",
"get_audience_suggestions",
- "is_enabled",
"needs_new_generation",
"start_audience_suggestions",
]
diff --git a/products/workflows/backend/presentation/views/broadcast_audience_suggestions.py b/products/workflows/backend/presentation/views/broadcast_audience_suggestions.py
index aaaaefc1026b..cb3fca1c3cea 100644
--- a/products/workflows/backend/presentation/views/broadcast_audience_suggestions.py
+++ b/products/workflows/backend/presentation/views/broadcast_audience_suggestions.py
@@ -16,7 +16,6 @@ from posthog.rate_limit import AIBurstRateThrottle, AISustainedRateThrottle
from products.workflows.backend.facade.audience_suggestions import (
can_read_email,
get_audience_suggestions,
- is_enabled,
needs_new_generation,
start_audience_suggestions,
)
@@ -97,7 +96,7 @@ class BroadcastAudienceSuggestionsViewSet(TeamAndOrgViewSetMixin, viewsets.ViewS
)
@action(detail=False, methods=["get"])
def current(self, request: Request, **kwargs: Any) -> Response:
- self._user_with_feature(request)
+ self._user_with_email_access(request)
return Response(AudienceSuggestionsResponseSerializer(get_audience_suggestions(team=self.team)).data)
@extend_schema(
@@ -107,15 +106,15 @@ class BroadcastAudienceSuggestionsViewSet(TeamAndOrgViewSetMixin, viewsets.ViewS
)
@action(detail=False, methods=["post"])
def generate(self, request: Request, **kwargs: Any) -> Response:
- user = self._user_with_feature(request)
+ user = self._user_with_email_access(request)
payload = DataSuggestionGenerateRequestSerializer(data=request.data)
payload.is_valid(raise_exception=True)
result = start_audience_suggestions(team=self.team, user=user, refresh=payload.validated_data["refresh"])
return Response(AudienceSuggestionsResponseSerializer(result).data)
- def _user_with_feature(self, request: Request) -> User:
+ def _user_with_email_access(self, request: Request) -> User:
user = request.user
- if not isinstance(user, User) or not is_enabled(user, str(self.organization.id)):
+ if not isinstance(user, User):
raise PermissionDenied("This feature is not available.")
# The cards are shared by the whole project and count people by email, so they stay hidden from anyone
# whose access hides email addresses.
diff --git a/products/workflows/backend/services/audience_suggestions/service.py b/products/workflows/backend/services/audience_suggestions/service.py
index ccc5487f0288..6f2e9e75e792 100644
--- a/products/workflows/backend/services/audience_suggestions/service.py
+++ b/products/workflows/backend/services/audience_suggestions/service.py
@@ -8,7 +8,6 @@ from typing import Any
from django.core.cache import cache
import structlog
-import posthoganalytics
from posthog.cloud_utils import is_cloud
from posthog.errors import CH_TRANSIENT_ERRORS, InternalCHQueryError
@@ -41,8 +40,6 @@ from ee.hogai.utils.feature_flags import is_privacy_mode_enabled
logger = structlog.get_logger(__name__)
-# pinned: feature flag key - the frontend gates the same surface on it
-FEATURE_FLAG_KEY = "workflows-broadcast-audience-suggestions"
CACHE_TTL_SECONDS = 24 * 60 * 60
FAILURE_CACHE_TTL_SECONDS = 5 * 60
_GENERATION_LOCK_SECONDS = 15 * 60
@@ -60,18 +57,6 @@ _GENERATING = AudienceSuggestionsResult(status="generating", suggestions=())
_UNAVAILABLE = AudienceSuggestionsResult(status="unavailable", suggestions=())
-def is_enabled(user: User, organization_id: str) -> bool:
- return bool(
- user.distinct_id
- and posthoganalytics.feature_enabled(
- FEATURE_FLAG_KEY,
- user.distinct_id,
- groups={"organization": organization_id},
- group_properties={"organization": {"id": organization_id}},
- )
- )
-
-
def can_read_email(user: User, team_id: int) -> bool:
"""The cards count people by their email address, so only someone who can read it may see them."""
restrictions = get_restricted_properties_with_group_type_index_for_team(user=user, team_id=team_id)
diff --git a/products/workflows/backend/tests/api/test_broadcast_audience_suggestions.py b/products/workflows/backend/tests/api/test_broadcast_audience_suggestions.py
index 1dc3ce29fcd9..91b03fe77622 100644
--- a/products/workflows/backend/tests/api/test_broadcast_audience_suggestions.py
+++ b/products/workflows/backend/tests/api/test_broadcast_audience_suggestions.py
@@ -21,7 +21,6 @@ from products.workflows.backend.services.audience_suggestions.planner import Aud
from products.workflows.backend.services.audience_suggestions.service import _cache_key
SERVICE = "products.workflows.backend.services.audience_suggestions.service"
-FLAG = f"{SERVICE}.posthoganalytics.feature_enabled"
def _idea(
@@ -47,8 +46,6 @@ class TestBroadcastAudienceSuggestions(ClickhouseTestMixin, APIBaseTest):
def setUp(self) -> None:
super().setUp()
cache.delete(_cache_key(self.team.id))
- self.flag = patch(FLAG, return_value=True).start()
- # FLAG patches the shared feature_enabled, which the privacy mode check reads too.
patch(f"{SERVICE}.is_privacy_mode_enabled", return_value=False).start()
self.addCleanup(patch.stopall)
self.organization.is_ai_data_processing_approved = True
@@ -197,23 +194,20 @@ class TestBroadcastAudienceSuggestions(ClickhouseTestMixin, APIBaseTest):
@parameterized.expand(
[
- ("ai_not_approved", False, True, False, 200, "ai_not_approved"),
- ("flag_off", True, False, False, 403, None),
- ("email_hidden_from_the_user", True, True, True, 403, None),
+ ("ai_not_approved", False, False, 200, "ai_not_approved"),
+ ("email_hidden_from_the_user", True, True, 403, None),
]
)
@patch(f"{SERVICE}.suggest_audiences")
- def test_runs_nothing_without_consent_or_flag(
+ def test_runs_nothing_without_consent_or_email_access(
self,
_name: str,
approved: bool,
- flag_on: bool,
email_restricted: bool,
status_code: int,
status: str | None,
suggest: MagicMock,
) -> None:
- self.flag.return_value = flag_on
self.organization.is_ai_data_processing_approved = approved
if email_restricted:
self.organization.available_product_features = [
diff --git a/products/workflows/frontend/Broadcasts/BroadcastsScene.tsx b/products/workflows/frontend/Broadcasts/BroadcastsScene.tsx
index b25c45aa9b4d..8a89fdae9c3c 100644
--- a/products/workflows/frontend/Broadcasts/BroadcastsScene.tsx
+++ b/products/workflows/frontend/Broadcasts/BroadcastsScene.tsx
@@ -41,7 +41,6 @@ export function BroadcastsScene(): JSX.Element {
const { location } = useValues(router)
const { startNewBroadcast } = useActions(newBroadcastAgentLogic)
// The tab routes are literal paths, so the tab is the last path segment rather than a route param.
- const showAudienceSuggestions = useFeatureFlag('WORKFLOWS_BROADCAST_AUDIENCE_SUGGESTIONS')
const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
const lastSegment = location.pathname.split('/').pop() as MessagingNavTabKey | 'calendar'
const currentTab: MessagingNavTabKey | 'broadcasts' | 'calendar' =
@@ -58,7 +57,7 @@ export function BroadcastsScene(): JSX.Element {
content: (
<>
<BroadcastsFeaturePreview />
- {showAudienceSuggestions && <BroadcastAudienceSuggestions />}
+ <BroadcastAudienceSuggestions />
<BroadcastsTable />
</>
),
diff --git a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.test.ts b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.test.ts
index 9e31861866b9..715c699bdea4 100644
--- a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.test.ts
+++ b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.test.ts
@@ -744,9 +744,10 @@ describe('broadcastWizardLogic', () => {
useMocks({
post: {
'/api/projects/:team_id/hog_flows/user_blast_radius/': async ({ request }) => {
- // The recipient email check posts here too, with an extra condition.
- const { filters } = (await request.json()) as { filters: { properties: unknown[] } }
- if (filters.properties.length > 1) {
+ // The recipient email check and the channel reach counts post here too. Only the
+ // audience size asks for the email dedupe, so only it reads the next state.
+ const { sends_email } = (await request.json()) as { sends_email?: boolean }
+ if (!sends_email) {
return [200, { affected: 0, total: 0 }]
}
const state = states[Math.min(calls++, states.length - 1)]
diff --git a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts
index 7e58fb792e5b..89aa4169f19e 100644
--- a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts
+++ b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.ts
@@ -5,10 +5,8 @@ import posthog from 'posthog-js'
import { LemonDialog, lemonToast } from '@posthog/lemon-ui'
-import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
-import { type FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { humanFriendlyDuration } from 'lib/utils/durations'
import { humanFriendlyNumber } from 'lib/utils/numbers'
import { objectsEqual } from 'lib/utils/objects'
@@ -379,7 +377,6 @@ export interface BroadcastWizardLogicProps {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface broadcastWizardLogicValues {
- featureFlags: FeatureFlagsSet // featureFlagLogic
integrations: IntegrationType[] | null // integrationsLogic
integrationsLoading: boolean // integrationsLogic
currentProjectId: number | null // projectLogic
@@ -881,8 +878,6 @@ export const broadcastWizardLogic = kea<broadcastWizardLogicType>([
['currentTeam'],
integrationsLogic,
['integrations', 'integrationsLoading'],
- featureFlagLogic,
- ['featureFlags'],
],
actions: [resourceEditedLogic, ['resourceEdited']],
})),
@@ -986,11 +981,7 @@ export const broadcastWizardLogic = kea<broadcastWizardLogicType>([
loadChannelReach: async (_, breakpoint) => {
await breakpoint(500)
// Never for an unfiltered audience, where both counts would scan every person in the project.
- if (
- !values.currentProjectId ||
- !values.featureFlags[FEATURE_FLAGS.BROADCASTS_PUSH_CHANNEL] ||
- values.audienceProperties.length === 0
- ) {
+ if (!values.currentProjectId || values.audienceProperties.length === 0) {
return null
}
const projectId = String(values.currentProjectId)
diff --git a/products/workflows/frontend/Broadcasts/steps/BroadcastChannelSwitch.tsx b/products/workflows/frontend/Broadcasts/steps/BroadcastChannelSwitch.tsx
index cab11ae9fe45..b8fa2ff19db9 100644
--- a/products/workflows/frontend/Broadcasts/steps/BroadcastChannelSwitch.tsx
+++ b/products/workflows/frontend/Broadcasts/steps/BroadcastChannelSwitch.tsx
@@ -3,19 +3,13 @@ import { useActions, useValues } from 'kea'
import { IconBell, IconLetter } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
-import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
-
import { broadcastWizardLogic } from '../broadcastWizardLogic'
/** A late change of channel on the Content step. The channel is picked first, on the Recipients step. */
-export function BroadcastChannelSwitch(): JSX.Element | null {
- const pushChannelEnabled = useFeatureFlag('BROADCASTS_PUSH_CHANNEL')
+export function BroadcastChannelSwitch(): JSX.Element {
const { channel, pushUnavailableReason } = useValues(broadcastWizardLogic)
const { requestChannel } = useActions(broadcastWizardLogic)
- if (!pushChannelEnabled) {
- return null
- }
const next = channel === 'push' ? 'email' : 'push'
return (
<LemonButton
diff --git a/products/workflows/frontend/Broadcasts/steps/BroadcastRecipientsStep.tsx b/products/workflows/frontend/Broadcasts/steps/BroadcastRecipientsStep.tsx
index 2389d0feeba6..2ad581b9ba98 100644
--- a/products/workflows/frontend/Broadcasts/steps/BroadcastRecipientsStep.tsx
+++ b/products/workflows/frontend/Broadcasts/steps/BroadcastRecipientsStep.tsx
@@ -164,7 +164,6 @@ function AudienceListModal({ isOpen, onClose }: { isOpen: boolean; onClose: () =
export function BroadcastRecipientsStep(): JSX.Element {
const cohortConditionsEnabled = useFeatureFlag('WORKFLOWS_COHORT_CONDITIONS')
- const pushChannelEnabled = useFeatureFlag('BROADCASTS_PUSH_CHANNEL')
const { audienceProperties, linkAudienceRejected, blastRadius, channel } = useValues(broadcastWizardLogic)
// A realtime cohort has to be the audience's only condition.
const realtimeCohortAlone = !!blastRadius?.realtime_cohort || !!blastRadius?.realtime_cohort_with_other_conditions
@@ -175,7 +174,7 @@ export function BroadcastRecipientsStep(): JSX.Element {
return (
<div className="flex flex-col gap-2 @container">
- {pushChannelEnabled ? <BroadcastChannelPicker /> : null}
+ <BroadcastChannelPicker />
<div>
<h2 className="m-0 text-xl font-semibold">
Who should receive this {channel === 'push' ? 'notification' : 'email'}?