: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
chore(alerts): remove fully rolled out hogql and funnel insight alert flags (#71594)
Vasco de Krijgerfc26d241a2ce
diff --git a/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx b/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsxindex 723a7d8df8bc..8c25dab049e9 100644--- a/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx+++ b/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx@@ -224,13 +224,9 @@ export function InsightMeta({const showDashboardAlertsMenuItem = isUsedAsDashboardTile && !!dashboardId && !!insight.id && canViewInsightconst canCreateAlertForInsight = areAlertsSupportedForInsight(query, {- hogqlAlertsEnabled: !!featureFlags[FEATURE_FLAGS.HOGQL_INSIGHT_ALERTS],- funnelAlertsEnabled: !!featureFlags[FEATURE_FLAGS.FUNNEL_INSIGHT_ALERTS],metricsAlertsEnabled: !!featureFlags[FEATURE_FLAGS.METRICS],})- const canCreateAnomalyAlertForInsight = areAnomalyAlertsSupportedForInsight(query, {- hogqlAlertsEnabled: !!featureFlags[FEATURE_FLAGS.HOGQL_INSIGHT_ALERTS],- })+ const canCreateAnomalyAlertForInsight = areAnomalyAlertsSupportedForInsight(query)const showDisplayOptionsMenu = isUsedAsDashboardTile && canEditInsight && !!persistDisplayOptions// Hoist the hook out of the More overlay so kea logics it mounts don't do so lazily inside adiff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 8eee88959c37..5297fba68ad0 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -330,10 +330,9 @@ export const FEATURE_FLAGS = {FIELD_NOTES: 'field-notes', // owner: @adamleithFLAG_EVALUATION_TAGS: 'flag-evaluation-tags', // owner: @dmarticus #team-feature-flagsFLAGGED_FEATURE_INDICATOR: 'flagged-feature-indicator', // owner: @benjackwhite- FUNNEL_INSIGHT_ALERTS: 'funnel-insight-alerts', // owner: @vdekrijger, gates alerts on funnel insights (conversion rate)GROUP_PROFILE_EXPERIMENT: 'group-profile-experiment', // owner: @arthurdedeus #team-customer-analyticsHEALTH_ASK_AI: 'health-ask-ai', // owner: @jordanm-posthog #team-web-analytics, gates the "Ask PostHog AI" buttons on the Health overview- HOGQL_INSIGHT_ALERTS: 'hogql-insight-alerts', // owner: @vdekrijger, gates alerts on SQL-backed (HogQL) insights+ HOG_INVOCATION_RESULTS_RUNS_TAB: 'hog-invocation-results-runs-tab', // owner: #team-workflowsHOGQL_WAREHOUSE_ACCESS_CONTROL: 'hogql-warehouse-access-control', // owner: @a-lider #team-platform-features, gates per-object access control for warehouse tables and viewsIDENTITY_MATCHING: 'identity-matching', // owner: @fercgomes #team-growth, gates new identity matching scene on marketing analyticsINBOX_SLACK_NOTIFICATIONS: 'inbox-slack-notifications', // owner: #team-self-driving, gates the Slack notifications config card in the inboxdiff --git a/frontend/src/scenes/insights/InsightModals.tsx b/frontend/src/scenes/insights/InsightModals.tsxindex e987afacbf72..759212cc03af 100644--- a/frontend/src/scenes/insights/InsightModals.tsx+++ b/frontend/src/scenes/insights/InsightModals.tsx@@ -91,14 +91,8 @@ function InsightAlertsModals({ insightLogicProps }: { insightLogicProps: Insightconst { query } = useValues(insightDataLogic(insightProps))const { push } = useActions(router)- const hogqlAlertsEnabled = useFeatureFlag('HOGQL_INSIGHT_ALERTS')- const funnelAlertsEnabled = useFeatureFlag('FUNNEL_INSIGHT_ALERTS')const metricsAlertsEnabled = useFeatureFlag('METRICS')- const canCreateAlertForInsight = areAlertsSupportedForInsight(query, {- hogqlAlertsEnabled,- funnelAlertsEnabled,- metricsAlertsEnabled,- })+ const canCreateAlertForInsight = areAlertsSupportedForInsight(query, { metricsAlertsEnabled })return (<>diff --git a/frontend/src/scenes/insights/InsightPageHeader.tsx b/frontend/src/scenes/insights/InsightPageHeader.tsxindex 5e09e0a1f37a..2117dc30d922 100644--- a/frontend/src/scenes/insights/InsightPageHeader.tsx+++ b/frontend/src/scenes/insights/InsightPageHeader.tsx@@ -81,14 +81,8 @@ export function InsightPageHeader({ insightLogicProps }: { insightLogicProps: Inconst defaultInsightName =typeof lastBreadcrumb?.name === 'string' ? lastBreadcrumb.name : insight.name || insight.derived_name- const hogqlAlertsEnabled = useFeatureFlag('HOGQL_INSIGHT_ALERTS')- const funnelAlertsEnabled = useFeatureFlag('FUNNEL_INSIGHT_ALERTS')const metricsAlertsEnabled = useFeatureFlag('METRICS')- const canCreateAlertForInsight = areAlertsSupportedForInsight(query, {- hogqlAlertsEnabled,- funnelAlertsEnabled,- metricsAlertsEnabled,- })+ const canCreateAlertForInsight = areAlertsSupportedForInsight(query, { metricsAlertsEnabled })const insightDisplayName = insight?.name || insight?.derived_namediff --git a/products/alerts/backend/api/alert.py b/products/alerts/backend/api/alert.pyindex 73b1d28a9a37..ff6dfc13afc6 100644--- a/products/alerts/backend/api/alert.py+++ b/products/alerts/backend/api/alert.py@@ -112,10 +112,6 @@ def _enforce_alert_feature_flags(context: dict[str, Any], insight: Insight) -> Nkind = insight.alertable_query_kindif kind is None:raise ValidationError("Alerts are not supported for this insight.")- if kind == NodeKind.HOG_QL_QUERY and not _insight_alert_flag_enabled(context, "hogql-insight-alerts"):- raise ValidationError("SQL insight alerts are not enabled for your account.")- if kind == NodeKind.FUNNELS_QUERY and not _insight_alert_flag_enabled(context, "funnel-insight-alerts"):- raise ValidationError("Funnel insight alerts are not enabled for your account.")# Gated on the Metrics product flag itself: anyone who can see the product can alert on it.if kind == NodeKind.METRICS_QUERY and not _insight_alert_flag_enabled(context, "metrics"):raise ValidationError("Metrics insight alerts are not enabled for your account.")diff --git a/products/alerts/backend/api/test/test_alert.py b/products/alerts/backend/api/test/test_alert.pyindex 8ec2017520fe..a25cd29be6c4 100644--- a/products/alerts/backend/api/test/test_alert.py+++ b/products/alerts/backend/api/test/test_alert.py@@ -159,7 +159,7 @@ class TestAlert(APIBaseTest, QueryMatchingTest):assert delete.status_code == status.HTTP_404_NOT_FOUND, delete.contentassert [a["id"] for a in listed.json()["results"]] == []- def test_create_alert_on_funnel_insight_is_flag_gated(self) -> None:+ def test_create_alert_on_funnel_insight(self) -> None:funnel_insight = self.client.post(f"/api/projects/{self.team.id}/insights",data={@@ -182,15 +182,7 @@ class TestAlert(APIBaseTest, QueryMatchingTest):"calculation_interval": "daily",}- # Flag off: the insight gate rejects funnel alerts.- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=False):- response = self.client.post(f"/api/projects/{self.team.id}/alerts", creation_request)- assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content- assert "Funnel insight alerts are not enabled" in str(response.content)-- # Flag on: the same request is accepted.- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=True):- response = self.client.post(f"/api/projects/{self.team.id}/alerts", creation_request)+ response = self.client.post(f"/api/projects/{self.team.id}/alerts", creation_request)assert response.status_code == status.HTTP_201_CREATED, response.contentdef test_create_threshold_alert_rejects_empty_bounds(self) -> None:@@ -568,18 +560,17 @@ class TestAlert(APIBaseTest, QueryMatchingTest):}hogql_insight = self.client.post(f"/api/projects/{self.team.id}/insights", data=hogql_insight_data).json()- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=True):- alert = self.client.post(- f"/api/projects/{self.team.id}/alerts",- {- "insight": hogql_insight["id"],- "subscribed_users": [self.user.id],- "condition": {"type": AlertConditionType.ABSOLUTE_VALUE},- "config": {"type": "HogQLAlertConfig", "evaluation": "last_row"},- "threshold": {"configuration": {"type": InsightThresholdType.ABSOLUTE, "bounds": {"upper": 100}}},- "name": "sql alert",- },- ).json()+ alert = self.client.post(+ f"/api/projects/{self.team.id}/alerts",+ {+ "insight": hogql_insight["id"],+ "subscribed_users": [self.user.id],+ "condition": {"type": AlertConditionType.ABSOLUTE_VALUE},+ "config": {"type": "HogQLAlertConfig", "evaluation": "last_row"},+ "threshold": {"configuration": {"type": InsightThresholdType.ABSOLUTE, "bounds": {"upper": 100}}},+ "name": "sql alert",+ },+ ).json()# The insight response must list the alert inline — the UI trusts this list on reload.insight_response = self.client.get(f"/api/projects/{self.team.id}/insights/{hogql_insight['id']}").json()@@ -612,18 +603,17 @@ class TestAlert(APIBaseTest, QueryMatchingTest):}funnel_insight = self.client.post(f"/api/projects/{self.team.id}/insights", data=funnel_insight_data).json()- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=True):- alert = self.client.post(- f"/api/projects/{self.team.id}/alerts",- {- "insight": funnel_insight["id"],- "subscribed_users": [self.user.id],- "condition": {"type": AlertConditionType.ABSOLUTE_VALUE},- "config": {"type": "FunnelsAlertConfig", "metric": "conversion_from_start", "funnel_step": None},- "threshold": {"configuration": {"type": InsightThresholdType.ABSOLUTE, "bounds": {"upper": 50}}},- "name": "funnel alert",- },- ).json()+ alert = self.client.post(+ f"/api/projects/{self.team.id}/alerts",+ {+ "insight": funnel_insight["id"],+ "subscribed_users": [self.user.id],+ "condition": {"type": AlertConditionType.ABSOLUTE_VALUE},+ "config": {"type": "FunnelsAlertConfig", "metric": "conversion_from_start", "funnel_step": None},+ "threshold": {"configuration": {"type": InsightThresholdType.ABSOLUTE, "bounds": {"upper": 50}}},+ "name": "funnel alert",+ },+ ).json()# The insight response must list the alert inline — the UI trusts this list on reload.insight_response = self.client.get(f"/api/projects/{self.team.id}/insights/{funnel_insight['id']}").json()@@ -644,47 +634,6 @@ class TestAlert(APIBaseTest, QueryMatchingTest):response = self.client.get(f"/api/projects/{self.team.id}/alerts/{alert['id']}")assert response.status_code == status.HTTP_404_NOT_FOUND- def _create_hogql_insight(self) -> dict:- return self.client.post(- f"/api/projects/{self.team.id}/insights",- data={- "query": {- "kind": "DataVisualizationNode",- "source": {"kind": "HogQLQuery", "query": "select count() from events"},- }- },- ).json()-- def test_hogql_flag_enforced_on_config_only_patch(self) -> None:- # A config-only PATCH (no `insight`) skips the field-level validate_insight, so the SQL-alert- # flag must be enforced in the object-level validate() — otherwise an existing SQL alert could- # be reconfigured in an account where the flag is no longer enabled.- hogql_insight = self._create_hogql_insight()- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=True):- alert = self.client.post(- f"/api/projects/{self.team.id}/alerts",- {- "insight": hogql_insight["id"],- "subscribed_users": [self.user.id],- "condition": {"type": AlertConditionType.ABSOLUTE_VALUE},- "config": {"type": "HogQLAlertConfig", "evaluation": "last_row"},- "threshold": {"configuration": {"type": InsightThresholdType.ABSOLUTE, "bounds": {"upper": 100}}},- "name": "sql alert",- },- )- assert alert.status_code == status.HTTP_201_CREATED, alert.content- alert_id = alert.json()["id"]-- config_patch = {"config": {"type": "HogQLAlertConfig", "evaluation": "first_row"}}- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=False):- blocked = self.client.patch(f"/api/projects/{self.team.id}/alerts/{alert_id}", config_patch)- assert blocked.status_code == status.HTTP_400_BAD_REQUEST, blocked.content- assert "SQL insight alerts are not enabled" in str(blocked.content)-- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=True):- allowed = self.client.patch(f"/api/projects/{self.team.id}/alerts/{alert_id}", config_patch)- assert allowed.status_code == status.HTTP_200_OK, allowed.content-def test_alert_survives_switch_between_alertable_kinds(self) -> None:# Switching the insight to a different alertable kind (trends -> SQL) leaves the alert's config# mismatched, but the alert is NOT deleted: the check cycle re-validates against the current@@ -706,59 +655,16 @@ class TestAlert(APIBaseTest, QueryMatchingTest):).json()["id"]# Switch the insight from trends to SQL — a different alertable kind.- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=True):- self.client.patch(- f"/api/projects/{self.team.id}/insights/{trends_insight['id']}",- data={- "query": {- "kind": "DataVisualizationNode",- "source": {"kind": "HogQLQuery", "query": "select count() from events"},- }- },- )- assert self.client.get(f"/api/projects/{self.team.id}/alerts/{alert_id}").status_code == status.HTTP_200_OK-- def test_funnel_flag_enforced_on_config_only_patch(self) -> None:- # Object-level enforcement for the funnel flag, mirroring the SQL gate: a config-only PATCH- # (no `insight`) skips the field-level validate_insight, so validate() must re-check the flag.- funnel_insight = self.client.post(- f"/api/projects/{self.team.id}/insights",+ self.client.patch(+ f"/api/projects/{self.team.id}/insights/{trends_insight['id']}",data={"query": {- "kind": "FunnelsQuery",- "series": [- {"kind": "EventsNode", "event": "$pageview"},- {"kind": "EventsNode", "event": "$autocapture"},- ],+ "kind": "DataVisualizationNode",+ "source": {"kind": "HogQLQuery", "query": "select count() from events"},}},- ).json()- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=True):- alert = self.client.post(- f"/api/projects/{self.team.id}/alerts",- {- "insight": funnel_insight["id"],- "subscribed_users": [self.user.id],- "condition": {"type": AlertConditionType.ABSOLUTE_VALUE},- "config": {"type": "FunnelsAlertConfig", "metric": "conversion_from_start", "funnel_step": None},- "threshold": {"configuration": {"type": InsightThresholdType.ABSOLUTE, "bounds": {"upper": 50}}},- "name": "funnel alert",- },- )- assert alert.status_code == status.HTTP_201_CREATED, alert.content- alert_id = alert.json()["id"]-- config_patch = {- "config": {"type": "FunnelsAlertConfig", "metric": "conversion_from_previous", "funnel_step": 1}- }- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=False):- blocked = self.client.patch(f"/api/projects/{self.team.id}/alerts/{alert_id}", config_patch)- assert blocked.status_code == status.HTTP_400_BAD_REQUEST, blocked.content- assert "Funnel insight alerts are not enabled" in str(blocked.content)-- with mock.patch("products.alerts.backend.api.alert.posthoganalytics.feature_enabled", return_value=True):- allowed = self.client.patch(f"/api/projects/{self.team.id}/alerts/{alert_id}", config_patch)- assert allowed.status_code == status.HTTP_200_OK, allowed.content+ )+ assert self.client.get(f"/api/projects/{self.team.id}/alerts/{alert_id}").status_code == status.HTTP_200_OKdef test_alert_is_deleted_on_insight_soft_delete(self) -> None:another_insight = self.client.post(diff --git a/products/alerts/frontend/components/AlertsButton.tsx b/products/alerts/frontend/components/AlertsButton.tsxindex 03a8d053da00..0d1d3b58922b 100644--- a/products/alerts/frontend/components/AlertsButton.tsx+++ b/products/alerts/frontend/components/AlertsButton.tsx@@ -22,21 +22,15 @@ export function AlertsButton({ insight, insightLogicProps, text, ...props }: Aleconst { push } = useActions(router)const logic = insightAlertsLogic({ insightId: insight.id!, insightLogicProps })const { alerts } = useValues(logic)- const hogqlAlertsEnabled = useFeatureFlag('HOGQL_INSIGHT_ALERTS')- const funnelAlertsEnabled = useFeatureFlag('FUNNEL_INSIGHT_ALERTS')const metricsAlertsEnabled = useFeatureFlag('METRICS')- const supported = areAlertsSupportedForInsight(insight.query, {- hogqlAlertsEnabled,- funnelAlertsEnabled,- metricsAlertsEnabled,- })+ const supported = areAlertsSupportedForInsight(insight.query, { metricsAlertsEnabled })// Existing alerts must stay manageable even if the gating flag is later disabled —// they keep evaluating server-side, so the user needs a way in to edit or disable them.const disabledReason =supported || (alerts?.length ?? 0) > 0? undefined- : alertsUnsupportedReason({ hogqlAlertsEnabled, funnelAlertsEnabled, metricsAlertsEnabled }, insight.query)+ : alertsUnsupportedReason({ metricsAlertsEnabled }, insight.query)return (<LemonButtondiff --git a/products/alerts/frontend/logic/insightAlertsLogic.test.ts b/products/alerts/frontend/logic/insightAlertsLogic.test.tsindex 07f0639446e4..f83fa3ab587e 100644--- a/products/alerts/frontend/logic/insightAlertsLogic.test.ts+++ b/products/alerts/frontend/logic/insightAlertsLogic.test.ts@@ -252,8 +252,8 @@ describe('areAlertsSupportedForInsight', () => {expect(areAlertsSupportedForInsight(query)).toBe(true)})- it('returns false for funnel insight viz when the funnel flag is off', () => {- expect(areAlertsSupportedForInsight(FUNNEL_QUERY)).toBe(false)+ it('supports funnel insight viz by default', () => {+ expect(areAlertsSupportedForInsight(FUNNEL_QUERY)).toBe(true)})it('supports bare metrics query nodes only when metricsAlertsEnabled', () => {@@ -261,20 +261,15 @@ describe('areAlertsSupportedForInsight', () => {expect(areAlertsSupportedForInsight(METRICS_QUERY)).toBe(false)})- it('returns true for funnel insight viz when funnelAlertsEnabled', () => {- expect(areAlertsSupportedForInsight(FUNNEL_QUERY, { funnelAlertsEnabled: true })).toBe(true)- })-it('supports steps and trends funnels but not time-to-convert or flow', () => {const withViz = (funnelVizType?: string): Record<string, any> => ({...FUNNEL_QUERY,source: { ...FUNNEL_QUERY.source, funnelsFilter: { funnelVizType } },})- const opts = { funnelAlertsEnabled: true }- expect(areAlertsSupportedForInsight(withViz('steps'), opts)).toBe(true)- expect(areAlertsSupportedForInsight(withViz('trends'), opts)).toBe(true)- expect(areAlertsSupportedForInsight(withViz('time_to_convert'), opts)).toBe(false)- expect(areAlertsSupportedForInsight(withViz('flow'), opts)).toBe(false)+ expect(areAlertsSupportedForInsight(withViz('steps'))).toBe(true)+ expect(areAlertsSupportedForInsight(withViz('trends'))).toBe(true)+ expect(areAlertsSupportedForInsight(withViz('time_to_convert'))).toBe(false)+ expect(areAlertsSupportedForInsight(withViz('flow'))).toBe(false)})it.each<[string, ChartDisplayType | undefined, boolean]>([@@ -296,17 +291,9 @@ describe('areAlertsSupportedForInsight', () => {describe('alertsUnsupportedReason', () => {it.each([- ['only trends (no flags)', {}, ['trends'], ['SQL', 'funnel', 'metrics']],- ['trends + SQL', { hogqlAlertsEnabled: true }, ['trends', 'SQL'], ['funnel', 'metrics']],- ['trends + funnel', { funnelAlertsEnabled: true }, ['trends', 'funnel'], ['SQL', 'metrics']],- ['trends + metrics', { metricsAlertsEnabled: true }, ['trends', 'metrics'], ['SQL', 'funnel']],- [- 'all four',- { hogqlAlertsEnabled: true, funnelAlertsEnabled: true, metricsAlertsEnabled: true },- ['trends', 'SQL', 'funnel', 'metrics'],- [],- ],- ])('lists only enabled types: %s', (_name, options, included, excluded) => {+ ['metrics gated off', {}, ['trends', 'SQL', 'funnel'], ['metrics']],+ ['metrics enabled', { metricsAlertsEnabled: true }, ['trends', 'SQL', 'funnel', 'metrics'], []],+ ])('always lists trends/SQL/funnel and gates only metrics: %s', (_name, options, included, excluded) => {const reason = alertsUnsupportedReason(options)expect(included.every((type) => reason.includes(type))).toBe(true)expect(excluded.every((type) => !reason.includes(type))).toBe(true)@@ -319,14 +306,13 @@ describe('alertsUnsupportedReason', () => {...FUNNEL_QUERY,source: { ...FUNNEL_QUERY.source, funnelsFilter: { funnelVizType } },})- const options = { funnelAlertsEnabled: true }for (const viz of ['time_to_convert', 'flow']) {- const reason = alertsUnsupportedReason(options, funnelWithViz(viz))+ const reason = alertsUnsupportedReason({}, funnelWithViz(viz))expect(reason).toContain('conversion rate')expect(reason).toContain('steps or trends')expect(reason).not.toContain('only available for')}// No query → backward-compatible generic copy.- expect(alertsUnsupportedReason(options)).toContain('only available for')+ expect(alertsUnsupportedReason({})).toContain('only available for')})})diff --git a/products/alerts/frontend/logic/insightAlertsLogic.ts b/products/alerts/frontend/logic/insightAlertsLogic.tsindex 90e0e8590e65..63c8843dcd9f 100644--- a/products/alerts/frontend/logic/insightAlertsLogic.ts+++ b/products/alerts/frontend/logic/insightAlertsLogic.ts@@ -2,8 +2,7 @@ import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path,import { loaders } from 'kea-loaders'import api from 'lib/api'-import { FEATURE_FLAGS, NON_TIME_SERIES_DISPLAY_TYPES } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { NON_TIME_SERIES_DISPLAY_TYPES } from 'lib/constants'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'@@ -18,7 +17,6 @@ import {} from '~/queries/utils'import { FunnelVizType, InsightLogicProps } from '~/types'-import type { FeatureFlagsSet } from '../../../../frontend/src/lib/logic/featureFlagLogic'import type { Node } from '../../../../frontend/src/queries/schema/schema-general'import type { QueryBasedInsightModel } from '../../../../frontend/src/types'import { AlertType, AnomalyPoint, isTrendsAlertConfig } from '../types'@@ -36,8 +34,6 @@ export interface InsightAlertsLogicProps {/** Per-kind feature-flag state threaded from call sites into the alert-support predicates. */export interface AlertSupportFlagOptions {- hogqlAlertsEnabled?: boolean- funnelAlertsEnabled?: booleanmetricsAlertsEnabled?: boolean}@@ -51,7 +47,7 @@ export const areAlertsSupportedForInsight = (if (isInsightVizNode(query) && isTrendsQuery(query.source)) {return true}- if (options.funnelAlertsEnabled && isInsightVizNode(query) && isFunnelsQuery(query.source)) {+ if (isInsightVizNode(query) && isFunnelsQuery(query.source)) {// Steps and trends both alert on a conversion-rate percentage. Time-to-convert (a duration)// and flow (a sankey) have no conversion-rate metric, so they aren't supported.const vizType = query.source.funnelsFilter?.funnelVizType@@ -61,7 +57,7 @@ export const areAlertsSupportedForInsight = (if (options.metricsAlertsEnabled && isMetricsQuery(query)) {return true}- return !!options.hogqlAlertsEnabled && containsHogQLQuery(query)+ return containsHogQLQuery(query)}export const areAnomalyAlertsSupportedForInsight = (@@ -81,14 +77,7 @@ export const areAnomalyAlertsSupportedForInsight = (// List only the insight types this account can actually alert on — naming a flag-gated type the// user doesn't have would disclose an unreleased feature.const alertableInsightTypesLabel = (options: AlertSupportFlagOptions): string =>- [- 'trends',- options.hogqlAlertsEnabled && 'SQL',- options.funnelAlertsEnabled && 'funnel',- options.metricsAlertsEnabled && 'metrics',- ]- .filter(Boolean)- .join(', ')+ ['trends', 'SQL', 'funnel', options.metricsAlertsEnabled && 'metrics'].filter(Boolean).join(', ')export const alertsUnsupportedReason = (options: AlertSupportFlagOptions,@@ -96,7 +85,7 @@ export const alertsUnsupportedReason = (): string => {// A funnel on a viz type without a conversion-rate metric otherwise reads as a contradiction —// "funnel insights are supported" while standing on a blocked funnel. Name the real reason instead.- if (options.funnelAlertsEnabled && query && isInsightVizNode(query) && isFunnelsQuery(query.source)) {+ if (query && isInsightVizNode(query) && isFunnelsQuery(query.source)) {const vizType = query.source.funnelsFilter?.funnelVizTypeif (vizType === FunnelVizType.TimeToConvert || vizType === FunnelVizType.Flow) {return "Alerts track a conversion rate, which time-to-convert and flow funnels don't have. Switch to the steps or trends view to add an alert."@@ -139,7 +128,6 @@ export function alertsToThresholdGoalLines(alerts: AlertType[]): GoalLine[] {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface insightAlertsLogicValues {- featureFlags: FeatureFlagsSet // featureFlagLogicinsight: Partial<QueryBasedInsightModel<Node<Record<string, any>>>> // insightLogicbreakdownFilter: BreakdownFilter | null | undefined // insightVizDataLogicshowAlertThresholdLines: boolean | null | undefined // insightVizDataLogic@@ -235,8 +223,6 @@ export const insightAlertsLogic = kea<insightAlertsLogicType>([['showAlertThresholdLines', 'breakdownFilter'],insightLogic(props.insightLogicProps),['insight'],- featureFlagLogic,- ['featureFlags'],],})),@@ -364,12 +350,7 @@ export const insightAlertsLogic = kea<insightAlertsLogicType>([listeners(({ actions, values }) => ({setQuery: ({ query }) => {- const hogqlAlertsEnabled = !!values.featureFlags[FEATURE_FLAGS.HOGQL_INSIGHT_ALERTS]- const funnelAlertsEnabled = !!values.featureFlags[FEATURE_FLAGS.FUNNEL_INSIGHT_ALERTS]- if (- values.alerts.length === 0 ||- areAlertsSupportedForInsight(query, { hogqlAlertsEnabled, funnelAlertsEnabled })- ) {+ if (values.alerts.length === 0 || areAlertsSupportedForInsight(query)) {actions.setShouldShowAlertDeletionWarning(false)} else {actions.setShouldShowAlertDeletionWarning(true)diff --git a/products/alerts/frontend/views/ManageAlertsModal.tsx b/products/alerts/frontend/views/ManageAlertsModal.tsxindex 11c38d2cb9ad..6d8c09b203cf 100644--- a/products/alerts/frontend/views/ManageAlertsModal.tsx+++ b/products/alerts/frontend/views/ManageAlertsModal.tsx@@ -3,7 +3,6 @@ import { router } from 'kea-router'import { Link } from '@posthog/lemon-ui'-import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { LemonModal } from 'lib/lemon-ui/LemonModal'import { LemonTag } from 'lib/lemon-ui/LemonTag'@@ -107,8 +106,6 @@ export function ManageAlertsModal(props: ManageAlertsModalProps): JSX.Element {const logic = insightAlertsLogic(props)const { alerts, alertsLoading } = useValues(logic)- const hogqlAlertsEnabled = useFeatureFlag('HOGQL_INSIGHT_ALERTS')- const funnelAlertsEnabled = useFeatureFlag('FUNNEL_INSIGHT_ALERTS')const showDeferredListSpinner = props.deferInitialAlertsLoad && props.isOpen && alertsLoadingconst openAlert = (alertId: AlertType['id']): void => {@@ -173,9 +170,7 @@ export function ManageAlertsModal(props: ManageAlertsModalProps): JSX.Element {type="primary"onClick={createAlert}disabledReason={- !props.canCreateAlertForInsight- ? alertsUnsupportedReason({ hogqlAlertsEnabled, funnelAlertsEnabled }, props.insightQuery)- : undefined+ !props.canCreateAlertForInsight ? alertsUnsupportedReason({}, props.insightQuery) : undefined}>New alert