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(flags): remove legacy auto-rollback backend (#71381)

Phil Haack5d1c1a9b8fa8
diff --git a/ee/api/sentry_stats.py b/ee/api/sentry_stats.py
deleted file mode 100644
index 36a9c0d95800..000000000000
--- a/ee/api/sentry_stats.py
+++ /dev/null
@@ -1,113 +0,0 @@
-from datetime import UTC, datetime, timedelta
-from typing import Any, Optional, Union
-
-from django.http import HttpRequest, JsonResponse
-
-import requests
-from rest_framework.decorators import api_view
-from rest_framework.exceptions import ValidationError
-
-from posthog.models.instance_setting import get_instance_settings
-
-
-def get_sentry_stats(start_time: str, end_time: str) -> tuple[dict, int]:
- sentry_config: dict[str, str] = get_instance_settings(["SENTRY_AUTH_TOKEN", "SENTRY_ORGANIZATION"])
-
- org_slug = sentry_config.get("SENTRY_ORGANIZATION")
- token = sentry_config.get("SENTRY_AUTH_TOKEN")
-
- if not org_slug or not token:
- raise ValidationError("Sentry integration not configured")
-
- url = f"https://sentry.io/api/0/organizations/{org_slug}/issues/"
- headers = {"Authorization": f"Bearer {token}"}
-
- params = {"start": start_time, "end": end_time, "sort": "freq", "utc": "true"}
-
- response = requests.get(url=url, headers=headers, params=params, timeout=10).json()
-
- counts = {}
- total_count = 0
- for item in response:
- counts[item["id"]] = {
- "count": int(item["count"]),
- "id": item["id"],
- "title": item["title"],
- "url": item["permalink"],
- "shortId": item["shortId"],
- }
- total_count += int(item["count"])
-
- return counts, total_count
-
-
-def get_tagged_issues_stats(
- start_time: str, end_time: str, tags: dict[str, str], target_issues: list[str]
-) -> dict[str, Any]:
- sentry_config: dict[str, str] = get_instance_settings(["SENTRY_AUTH_TOKEN", "SENTRY_ORGANIZATION"])
-
- org_slug = sentry_config.get("SENTRY_ORGANIZATION")
- token = sentry_config.get("SENTRY_AUTH_TOKEN")
-
- if not org_slug or not token:
- raise ValidationError("Sentry integration not configured")
-
- url = f"https://sentry.io/api/0/organizations/{org_slug}/issues-stats/"
- headers = {"Authorization": f"Bearer {token}"}
-
- query = "is:unresolved"
- for tag, value in tags.items():
- query += f" {tag}:{value}"
-
- params: dict[str, Union[list, str]] = {
- "start": start_time,
- "end": end_time,
- "sort": "freq",
- "query": query,
- "utc": "true",
- }
-
- pagination_chunk_size = 25
-
- counts = {}
-
- for i in range(0, len(target_issues), pagination_chunk_size):
- groups = target_issues[i : i + pagination_chunk_size]
- params["groups"] = groups
- response = requests.get(url=url, headers=headers, params=params, timeout=10).json()
-
- # TODO: Confirm sentry always sends this information
- for item in response:
- counts[item["id"]] = {"id": item["id"]}
- counts[item["id"]]["filtered_count"] = item["filtered"]["count"]
- counts[item["id"]]["total_count"] = item["count"]
-
- return counts
-
-
-def get_stats_for_timerange(
- base_start_time: str,
- base_end_time: str,
- target_start_time: str,
- target_end_time: str,
- tags: Optional[dict[str, str]] = None,
-) -> tuple[int, int]:
- base_counts, base_total_count = get_sentry_stats(base_start_time, base_end_time)
- target_counts, target_total_count = get_sentry_stats(target_start_time, target_end_time)
-
- return base_total_count, target_total_count
-
-
-@api_view(["GET"])
-def sentry_stats(request: HttpRequest):
- try:
- current_time = datetime.now(UTC)
- target_end_date = current_time.strftime("%Y-%m-%dT%H:%M:%S")
- target_start_date = (current_time - timedelta(days=1)).strftime("%Y-%m-%dT%H:%M:%S")
-
- _, total_count = get_sentry_stats(target_start_date, target_end_date)
-
- except Exception as e:
- return JsonResponse({"error": "Error fetching stats from sentry", "exception": str(e)})
-
- return JsonResponse({"sentry_integration_enabled": True, "total_count": total_count})
diff --git a/ee/tasks/auto_rollback_feature_flag.py b/ee/tasks/auto_rollback_feature_flag.py
deleted file mode 100644
index ee1d0cfed163..000000000000
--- a/ee/tasks/auto_rollback_feature_flag.py
+++ /dev/null
@@ -1,103 +0,0 @@
-from datetime import UTC, datetime, timedelta
-from typing import cast
-from zoneinfo import ZoneInfo
-
-from celery import shared_task
-
-from posthog.schema import TrendsQuery
-
-from posthog.clickhouse.query_tagging import Feature, Product, tags_context
-from posthog.hogql_queries.insights.trends.trends_query_runner import TrendsQueryRunner
-from posthog.hogql_queries.legacy_compatibility.filter_to_query import filter_to_query
-from posthog.hogql_queries.query_runner import ExecutionMode
-from posthog.models.team import Team
-from posthog.scoping_audit import skip_team_scope_audit
-
-from products.feature_flags.backend.models.feature_flag import FeatureFlag
-
-from ee.api.sentry_stats import get_stats_for_timerange
-
-
-def check_flags_to_rollback():
- flags_with_threshold = FeatureFlag.objects.exclude(rollback_conditions__isnull=True).exclude(
- rollback_conditions__exact=[]
- )
-
- for feature_flag in flags_with_threshold:
- check_feature_flag_rollback_conditions(feature_flag_id=feature_flag.pk)
-
-
-@shared_task(ignore_result=True, max_retries=2)
-@skip_team_scope_audit
-def check_feature_flag_rollback_conditions(feature_flag_id: int) -> None:
- flag: FeatureFlag = FeatureFlag.objects.get(pk=feature_flag_id)
-
- with tags_context(
- product=Product.FEATURE_FLAGS,
- feature=Feature.QUERY,
- team_id=flag.team_id,
- name="check_feature_flag_rollback_conditions",
- ):
- if any(check_condition(condition, flag) for condition in flag.rollback_conditions or []):
- flag.performed_rollback = True
- flag.active = False
- flag.save()
-
-
-def calculate_rolling_average(threshold_metric: dict, team: Team, timezone: str) -> float:
- curr = datetime.now(tz=ZoneInfo(timezone))
-
- rolling_average_days = 7
-
- metric = {
- **threshold_metric,
- "date_from": (curr - timedelta(days=rolling_average_days)).strftime("%Y-%m-%d %H:%M:%S.%f"),
- "date_to": curr.strftime("%Y-%m-%d %H:%M:%S.%f"),
- }
- # Stored rollback metrics use the lowercase legacy insight value; filter_to_query keys on the
- # uppercase insight constants (e.g. "TRENDS").
- if isinstance(metric.get("insight"), str):
- metric["insight"] = metric["insight"].upper()
-
- query = filter_to_query(metric)
- response = TrendsQueryRunner(query=cast(TrendsQuery, query), team=team).run(ExecutionMode.CALCULATE_BLOCKING_ALWAYS)
-
- results = getattr(response, "results", None)
- if not results:
- return False
-
- data = results[0]["data"]
-
- return sum(data) / rolling_average_days
-
-
-def check_condition(rollback_condition: dict, feature_flag: FeatureFlag) -> bool:
- if rollback_condition["threshold_type"] == "sentry":
- created_date = feature_flag.created_at
- base_start_date = created_date.strftime("%Y-%m-%dT%H:%M:%S")
- base_end_date = (created_date + timedelta(days=1)).strftime("%Y-%m-%dT%H:%M:%S")
-
- current_time = datetime.now(UTC)
- target_end_date = current_time.strftime("%Y-%m-%dT%H:%M:%S")
- target_start_date = (current_time - timedelta(days=1)).strftime("%Y-%m-%dT%H:%M:%S")
-
- base, target = get_stats_for_timerange(base_start_date, base_end_date, target_start_date, target_end_date)
-
- if rollback_condition["operator"] == "lt":
- return target < float(rollback_condition["threshold"]) * base
- else:
- return target > float(rollback_condition["threshold"]) * base
-
- elif rollback_condition["threshold_type"] == "insight":
- rolling_average = calculate_rolling_average(
- rollback_condition["threshold_metric"],
- feature_flag.team,
- feature_flag.team.timezone,
- )
-
- if rollback_condition["operator"] == "lt":
- return rolling_average < rollback_condition["threshold"]
- else:
- return rolling_average > rollback_condition["threshold"]
-
- return False
diff --git a/ee/tasks/test/test_auto_rollback_feature_flag.py b/ee/tasks/test/test_auto_rollback_feature_flag.py
deleted file mode 100644
index 692f0febc621..000000000000
--- a/ee/tasks/test/test_auto_rollback_feature_flag.py
+++ /dev/null
@@ -1,206 +0,0 @@
-from freezegun import freeze_time
-from posthog.test.base import APIBaseTest, ClickhouseTestMixin, _create_event, flush_persons_and_events
-from unittest.mock import patch
-
-from products.feature_flags.backend.models.feature_flag import FeatureFlag
-
-from ee.tasks.auto_rollback_feature_flag import (
- calculate_rolling_average,
- check_condition,
- check_feature_flag_rollback_conditions,
-)
-
-
-class AutoRollbackTest(ClickhouseTestMixin, APIBaseTest):
- def test_calculate_rolling_average(self):
- threshold_metric = {
- "insight": "trends",
- "events": [{"order": 0, "id": "$pageview"}],
- }
-
- with freeze_time("2021-08-21T20:00:00.000Z"):
- for _ in range(70):
- _create_event(
- event="$pageview",
- distinct_id="1",
- team=self.team,
- timestamp="2021-08-21 05:00:00",
- properties={"prop": 1},
- )
-
- _create_event(
- event="$pageview",
- distinct_id="1",
- team=self.team,
- timestamp="2021-08-22 05:00:00",
- properties={"prop": 1},
- )
- flush_persons_and_events()
- with freeze_time("2021-08-21T21:00:00.000Z"):
- self.assertEqual(
- calculate_rolling_average(
- threshold_metric=threshold_metric,
- team=self.team,
- timezone="UTC",
- ),
- 10, # because we have 70 events in the last 7 days
- )
-
- with freeze_time("2021-08-22T21:00:00.000Z"):
- self.assertEqual(
- calculate_rolling_average(
- threshold_metric=threshold_metric,
- team=self.team,
- timezone="UTC",
- ),
- 20, # because we have 140 events in the last 7 days
- )
-
- def test_check_condition(self):
- rollback_condition = {
- "threshold": 10,
- "threshold_metric": {
- "insight": "trends",
- "events": [{"order": 0, "id": "$pageview"}],
- },
- "operator": "lt",
- "threshold_type": "insight",
- }
-
- flag = FeatureFlag.objects.create(
- team=self.team,
- created_by=self.user,
- key="test-ff",
- rollback_conditions=[rollback_condition],
- )
-
- self.assertEqual(check_condition(rollback_condition, flag), True)
-
- def test_check_condition_valid(self):
- rollback_condition = {
- "threshold": 15,
- "threshold_metric": {
- "insight": "trends",
- "events": [{"order": 0, "id": "$pageview"}],
- },
- "operator": "gt",
- "threshold_type": "insight",
- }
-
- for _ in range(70):
- _create_event(
- event="$pageview",
- distinct_id="1",
- team=self.team,
- timestamp="2021-08-21 00:00:00",
- properties={"prop": 1},
- )
- _create_event(
- event="$pageview",
- distinct_id="1",
- team=self.team,
- timestamp="2021-08-22 00:00:00",
- properties={"prop": 1},
- )
-
- flush_persons_and_events()
-
- with freeze_time("2021-08-21T20:00:00.000Z"):
- flag = FeatureFlag.objects.create(
- team=self.team,
- created_by=self.user,
- key="test-ff",
- rollback_conditions=[rollback_condition],
- )
-
- with freeze_time("2021-08-21T20:00:00.000Z"):
- self.assertEqual(check_condition(rollback_condition, flag), False)
-
- # Go another day with 0 events
- with freeze_time("2021-08-22T20:00:00.000Z"):
- self.assertEqual(check_condition(rollback_condition, flag), True)
-
- def test_feature_flag_rolledback(self):
- rollback_condition = {
- "threshold": 15,
- "threshold_metric": {
- "insight": "trends",
- "events": [{"order": 0, "id": "$pageview"}],
- },
- "operator": "gt",
- "threshold_type": "insight",
- }
-
- for _ in range(70):
- _create_event(
- event="$pageview",
- distinct_id="1",
- team=self.team,
- timestamp="2021-08-21 00:00:00",
- properties={"prop": 1},
- )
- _create_event(
- event="$pageview",
- distinct_id="1",
- team=self.team,
- timestamp="2021-08-22 00:00:00",
- properties={"prop": 1},
- )
-
- flush_persons_and_events()
-
- with freeze_time("2021-08-21T00:00:00.000Z"):
- flag = FeatureFlag.objects.create(
- team=self.team,
- created_by=self.user,
- key="test-ff",
- rollback_conditions=[rollback_condition],
- )
-
- flag = FeatureFlag.objects.get(pk=flag.pk)
- self.assertEqual(flag.performed_rollback, None)
- self.assertEqual(flag.active, True)
-
- with freeze_time("2021-08-23T20:00:00.000Z"):
- check_feature_flag_rollback_conditions(feature_flag_id=flag.pk)
- flag = FeatureFlag.objects.get(pk=flag.pk)
- self.assertEqual(flag.performed_rollback, True)
- self.assertEqual(flag.active, False)
-
- @patch("ee.tasks.auto_rollback_feature_flag.get_stats_for_timerange")
- def test_check_condition_sentry(self, stats_for_timerange):
- rollback_condition = {
- "threshold": 1.25,
- "threshold_metric": {},
- "operator": "gt",
- "threshold_type": "sentry",
- }
-
- with freeze_time("2021-08-21T20:00:00.000Z"):
- flag = FeatureFlag.objects.create(
- team=self.team,
- created_by=self.user,
- key="test-ff",
- rollback_conditions=[rollback_condition],
- )
-
- stats_for_timerange.return_value = (100, 130)
- with freeze_time("2021-08-23T20:00:00.000Z"):
- self.assertEqual(check_condition(rollback_condition, flag), True)
- stats_for_timerange.assert_called_once_with(
- "2021-08-21T20:00:00",
- "2021-08-22T20:00:00",
- "2021-08-22T20:00:00",
- "2021-08-23T20:00:00",
- )
-
- stats_for_timerange.reset_mock()
- stats_for_timerange.return_value = (100, 120)
- with freeze_time("2021-08-25T13:00:00.000Z"):
- self.assertEqual(check_condition(rollback_condition, flag), False)
- stats_for_timerange.assert_called_once_with(
- "2021-08-21T20:00:00",
- "2021-08-22T20:00:00",
- "2021-08-24T13:00:00",
- "2021-08-25T13:00:00",
- )
diff --git a/ee/urls.py b/ee/urls.py
index 1132ffa08dfc..3a059a28f55e 100644
--- a/ee/urls.py
+++ b/ee/urls.py
@@ -23,7 +23,7 @@ from ee.api.vercel import vercel_connect, vercel_sso, vercel_webhooks
from ee.middleware import admin_oauth2_callback
from ee.support_sidebar_max.views import MaxChatViewSet
-from .api import authentication, billing, conversation, core_memory, license, sentry_stats, subscription
+from .api import authentication, billing, conversation, core_memory, license, subscription
from .api.rbac import role
from .api.scim import views as scim_views
@@ -250,7 +250,6 @@ else:
urlpatterns: list[Any] = [
path("api/saml/metadata/", authentication.saml_metadata_view),
- path("api/sentry_stats/", sentry_stats.sentry_stats),
path("max/chat/", csrf_exempt(MaxChatViewSet.as_view({"post": "create"})), name="max_chat"),
re_path(r"^login/vercel/?$", vercel_sso.VercelSSOViewSet.as_view({"get": "sso_redirect"})),
re_path(r"^login/vercel/continue/?$", vercel_sso.VercelSSOViewSet.as_view({"get": "sso_continue"})),
diff --git a/frontend/src/mocks/handlers.ts b/frontend/src/mocks/handlers.ts
index 09bc287009cf..8de4a149dc2f 100644
--- a/frontend/src/mocks/handlers.ts
+++ b/frontend/src/mocks/handlers.ts
@@ -213,11 +213,6 @@ export const defaultMocks: Mocks = {
},
'/_system_status': _systemStatus,
'/api/instance_status': _instanceStatus,
- // TODO: Add a real mock once we know why this endpoint returns an error inside a 200 response
- '/api/sentry_stats/': {
- error: 'Error fetching stats from sentry',
- exception: "[ErrorDetail(string='Sentry integration not configured', code='invalid')]",
- },
// We don't want to show the "new version available" banner in tests
'https://api.github.com/repos/posthog/posthog-js/tags': () => [200, []],
'https://www.gravatar.com/avatar/:gravatar_id': () => [404, ''],
diff --git a/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts b/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts
index 66620db901da..0c27939d2174 100644
--- a/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts
+++ b/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts
@@ -63,8 +63,6 @@ const EDITABLE_INSTANCE_SETTINGS = [
'CLICKHOUSE_KILL_SWITCH_LIGHT_TEAMS',
'CLICKHOUSE_KILL_SWITCH_FULL_TEAMS',
'CLICKHOUSE_HEDGED_APP_QUERIES',
- 'SENTRY_AUTH_TOKEN',
- 'SENTRY_ORGANIZATION',
]
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
diff --git a/posthog/models/resource_transfer/test/__snapshots__/test_visitor_field_snapshots.ambr b/posthog/models/resource_transfer/test/__snapshots__/test_visitor_field_snapshots.ambr
index 40964147722b..c8f0c40fa6b8 100644
--- a/posthog/models/resource_transfer/test/__snapshots__/test_visitor_field_snapshots.ambr
+++ b/posthog/models/resource_transfer/test/__snapshots__/test_visitor_field_snapshots.ambr
@@ -97,8 +97,6 @@
'analytics_dashboards',
'deleted',
'last_called_at',
- 'performed_rollback',
- 'rollback_conditions',
'usage_dashboard',
])
# ---
@@ -844,10 +842,8 @@
'last_modified_by_id',
'objects',
'objects_including_soft_deleted',
- 'performed_rollback',
'product_tours_internal_targeting_flag',
'product_tours_linked_flag',
- 'rollback_conditions',
'rollout_percentage',
'scheduled_changes_dispatcher',
'surveys_internal_response_sampling_flag',
diff --git a/posthog/models/resource_transfer/visitors/feature_flag.py b/posthog/models/resource_transfer/visitors/feature_flag.py
index f31c7f2d529f..cc348a9df7d2 100644
--- a/posthog/models/resource_transfer/visitors/feature_flag.py
+++ b/posthog/models/resource_transfer/visitors/feature_flag.py
@@ -29,8 +29,6 @@ class FeatureFlagVisitor(
"analytics_dashboards",
"last_called_at",
"deleted",
- "rollback_conditions",
- "performed_rollback",
"_evaluation_tag_names",
],
friendly_name="Feature flag",
diff --git a/posthog/tasks/scheduled.py b/posthog/tasks/scheduled.py
index 1153e042d680..1ea4cc6d60ff 100644
--- a/posthog/tasks/scheduled.py
+++ b/posthog/tasks/scheduled.py
@@ -36,7 +36,6 @@ from posthog.tasks.tasks import (
calculate_decide_usage,
capture_task_run_state_metrics,
check_async_migration_health,
- check_flags_to_rollback,
clean_stale_partials,
clear_clickhouse_deleted_person,
clear_expired_sessions,
@@ -648,12 +647,6 @@ def setup_periodic_tasks(sender: Celery, **kwargs: Any) -> None:
name="clickhouse materialize columns",
)
- sender.add_periodic_task(
- crontab(minute="0", hour="*"),
- check_flags_to_rollback.s(),
- name="check feature flags that should be rolled back",
- )
-
sender.add_periodic_task(
crontab(minute="10", hour="*/12"),
find_flags_with_enriched_analytics.s(),
diff --git a/posthog/tasks/tasks.py b/posthog/tasks/tasks.py
index 1811d97f11e8..aae776e94dbf 100644
--- a/posthog/tasks/tasks.py
+++ b/posthog/tasks/tasks.py
@@ -1039,16 +1039,6 @@ def clickhouse_send_license_usage() -> None:
pass
-@shared_task(ignore_result=True, queue=CeleryQueue.FEATURE_FLAGS.value)
-def check_flags_to_rollback() -> None:
- try:
- from ee.tasks.auto_rollback_feature_flag import check_flags_to_rollback
-
- check_flags_to_rollback()
- except ImportError:
- pass
-
-
@shared_task(ignore_result=True, queue=CeleryQueue.LONG_RUNNING.value)
def background_delete_model_task(
model_name: str, team_id: int, batch_size: int = 10000, records_to_delete: int | None = None
diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr
index 65691cc221b2..48ac7dc41f13 100644
--- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr
+++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr
@@ -451,8 +451,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -680,8 +678,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -712,8 +708,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -1190,8 +1184,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -1333,8 +1325,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -1349,212 +1339,6 @@
LIMIT 21
'''
# ---
-# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.45
- '''
- SELECT "posthog_team"."id",
- "posthog_team"."uuid",
- "posthog_team"."organization_id",
- "posthog_team"."parent_team_id",
- "posthog_team"."project_id",
- "posthog_team"."api_token",
- "posthog_team"."app_urls",
- "posthog_team"."name",
- "posthog_team"."slack_incoming_webhook",
- "posthog_team"."created_at",
- "posthog_team"."updated_at",
- "posthog_team"."anonymize_ips",
- "posthog_team"."completed_snippet_onboarding",
- "posthog_team"."has_completed_onboarding_for",
- "posthog_team"."onboarding_tasks",
- "posthog_team"."ingested_event",
- "posthog_team"."ingested_production_event",
- "posthog_team"."ingested_production_event_last_checked_at",
- "posthog_team"."person_processing_opt_out",
- "posthog_team"."secret_api_token",
- "posthog_team"."secret_api_token_backup",
- "posthog_team"."session_recording_opt_in",
- "posthog_team"."session_recording_sample_rate",
- "posthog_team"."session_recording_minimum_duration_milliseconds",
- "posthog_team"."session_recording_linked_flag",
- "posthog_team"."session_recording_network_payload_capture_config",
- "posthog_team"."session_recording_masking_config",
- "posthog_team"."session_recording_url_trigger_config",
- "posthog_team"."session_recording_url_blocklist_config",
- "posthog_team"."session_recording_event_trigger_config",
- "posthog_team"."session_recording_trigger_match_type_config",
- "posthog_team"."session_recording_trigger_groups",
- "posthog_team"."session_replay_config",
- "posthog_team"."session_recording_retention_period",
- "posthog_team"."event_retention_months",
- "posthog_team"."conversations_enabled",
- "posthog_team"."conversations_settings",
- "posthog_team"."proactive_tasks_enabled",
- "posthog_team"."survey_config",
- "posthog_team"."surveys_opt_in",
- "posthog_team"."product_tours_opt_in",
- "posthog_team"."capture_console_log_opt_in",
- "posthog_team"."capture_performance_opt_in",
- "posthog_team"."capture_dead_clicks",
- "posthog_team"."autocapture_opt_out",
- "posthog_team"."autocapture_web_vitals_opt_in",
- "posthog_team"."autocapture_web_vitals_allowed_metrics",
- "posthog_team"."autocapture_exceptions_opt_in",
- "posthog_team"."autocapture_exceptions_errors_to_ignore",
- "posthog_team"."logs_settings",
- "posthog_team"."llm_gateway_enabled_at",
- "posthog_team"."llm_gateway_revoked_at",
- "posthog_team"."llm_gateway_overspend_allowance_usd",
- "posthog_team"."heatmaps_opt_in",
- "posthog_team"."receive_org_level_activity_logs",
- "posthog_team"."web_analytics_pre_aggregated_tables_enabled",
- "posthog_team"."web_analytics_pre_aggregated_tables_version",
- "posthog_team"."flags_persistence_default",
- "posthog_team"."feature_flag_confirmation_enabled",
- "posthog_team"."feature_flag_confirmation_message",
- "posthog_team"."default_evaluation_environments_enabled",
- "posthog_team"."require_evaluation_environment_tags",
- "posthog_team"."default_evaluation_contexts_enabled",
- "posthog_team"."require_evaluation_contexts",
- "posthog_team"."session_recording_version",
- "posthog_team"."signup_token",
- "posthog_team"."is_demo",
- "posthog_team"."access_control",
- "posthog_team"."week_start_day",
- "posthog_team"."inject_web_apps",
- "posthog_team"."test_account_filters",
- "posthog_team"."test_account_filters_default_checked",
- "posthog_team"."path_cleaning_filters",
- "posthog_team"."timezone",
- "posthog_team"."data_attributes",
- "posthog_team"."person_display_name_properties",
- "posthog_team"."live_events_columns",
- "posthog_team"."recording_domains",
- "posthog_team"."human_friendly_comparison_periods",
- "posthog_team"."cookieless_server_hash_mode",
- "posthog_team"."primary_dashboard_id",
- "posthog_team"."default_data_theme",
- "posthog_team"."extra_settings",
- "posthog_team"."modifiers",
- "posthog_team"."correlation_config",
- "posthog_team"."session_recording_retention_period_days",
- "posthog_team"."external_data_workspace_id",
- "posthog_team"."external_data_workspace_last_synced_at",
- "posthog_team"."api_query_rate_limit",
- "posthog_team"."drop_events_older_than",
- "posthog_team"."base_currency",
- "posthog_team"."experiment_recalculation_time",
- "posthog_team"."default_experiment_confidence_level",
- "posthog_team"."default_experiment_stats_method",
- "posthog_team"."business_model"
- FROM "posthog_team"
- WHERE "posthog_team"."id" = 99999
- LIMIT 21
- '''
-# ---
-# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.46
- '''
- SELECT "posthog_scheduledchange"."id",
- "posthog_scheduledchange"."record_id",
- "posthog_scheduledchange"."model_name",
- "posthog_scheduledchange"."payload",
- "posthog_scheduledchange"."scheduled_at",
- "posthog_scheduledchange"."executed_at",
- "posthog_scheduledchange"."failure_reason",
- "posthog_scheduledchange"."failure_count",
- "posthog_scheduledchange"."is_recurring",
- "posthog_scheduledchange"."recurrence_interval",
- "posthog_scheduledchange"."last_executed_at",
- "posthog_scheduledchange"."cron_expression",
- "posthog_scheduledchange"."end_date",
- "posthog_scheduledchange"."timezone",
- "posthog_scheduledchange"."team_id",
- "posthog_scheduledchange"."change_request_id",
- "posthog_scheduledchange"."created_at",
- "posthog_scheduledchange"."created_by_id",
- "posthog_scheduledchange"."updated_at"
- FROM "posthog_scheduledchange"
- WHERE "posthog_scheduledchange"."id" = 99999
- LIMIT 21
- '''
-# ---
-# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.47
- '''
- SELECT "posthog_scheduledchange"."id",
- "posthog_scheduledchange"."record_id",
- "posthog_scheduledchange"."model_name",
- "posthog_scheduledchange"."payload",
- "posthog_scheduledchange"."scheduled_at",
- "posthog_scheduledchange"."executed_at",
- "posthog_scheduledchange"."failure_reason",
- "posthog_scheduledchange"."failure_count",
- "posthog_scheduledchange"."is_recurring",
- "posthog_scheduledchange"."recurrence_interval",
- "posthog_scheduledchange"."last_executed_at",
- "posthog_scheduledchange"."cron_expression",
- "posthog_scheduledchange"."end_date",
- "posthog_scheduledchange"."timezone",
- "posthog_scheduledchange"."team_id",
- "posthog_scheduledchange"."change_request_id",
- "posthog_scheduledchange"."created_at",
- "posthog_scheduledchange"."created_by_id",
- "posthog_scheduledchange"."updated_at"
- FROM "posthog_scheduledchange"
- WHERE "posthog_scheduledchange"."id" = 99999
- LIMIT 21
- '''
-# ---
-# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.48
- '''
- SELECT "posthog_scheduledchange"."id",
- "posthog_scheduledchange"."record_id",
- "posthog_scheduledchange"."model_name",
- "posthog_scheduledchange"."payload",
- "posthog_scheduledchange"."scheduled_at",
- "posthog_scheduledchange"."executed_at",
- "posthog_scheduledchange"."failure_reason",
- "posthog_scheduledchange"."failure_count",
- "posthog_scheduledchange"."is_recurring",
- "posthog_scheduledchange"."recurrence_interval",
- "posthog_scheduledchange"."last_executed_at",
- "posthog_scheduledchange"."cron_expression",
- "posthog_scheduledchange"."end_date",
- "posthog_scheduledchange"."timezone",
- "posthog_scheduledchange"."team_id",
- "posthog_scheduledchange"."change_request_id",
- "posthog_scheduledchange"."created_at",
- "posthog_scheduledchange"."created_by_id",
- "posthog_scheduledchange"."updated_at"
- FROM "posthog_scheduledchange"
- WHERE "posthog_scheduledchange"."id" = 99999
- LIMIT 21
- '''
-# ---
-# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.49
- '''
- SELECT "posthog_scheduledchange"."id",
- "posthog_scheduledchange"."record_id",
- "posthog_scheduledchange"."model_name",
- "posthog_scheduledchange"."payload",
- "posthog_scheduledchange"."scheduled_at",
- "posthog_scheduledchange"."executed_at",
- "posthog_scheduledchange"."failure_reason",
- "posthog_scheduledchange"."failure_count",
- "posthog_scheduledchange"."is_recurring",
- "posthog_scheduledchange"."recurrence_interval",
- "posthog_scheduledchange"."last_executed_at",
- "posthog_scheduledchange"."cron_expression",
- "posthog_scheduledchange"."end_date",
- "posthog_scheduledchange"."timezone",
- "posthog_scheduledchange"."team_id",
- "posthog_scheduledchange"."change_request_id",
- "posthog_scheduledchange"."created_at",
- "posthog_scheduledchange"."created_by_id",
- "posthog_scheduledchange"."updated_at"
- FROM "posthog_scheduledchange"
- WHERE "posthog_scheduledchange"."id" = 99999
- LIMIT 21
- '''
-# ---
# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.5
'''
SELECT "posthog_team"."id",
@@ -1657,37 +1441,6 @@
LIMIT 21
'''
# ---
-# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.50
- '''
- SELECT "posthog_featureflag"."id",
- "posthog_featureflag"."key",
- "posthog_featureflag"."name",
- "posthog_featureflag"."filters",
- "posthog_featureflag"."team_id",
- "posthog_featureflag"."created_by_id",
- "posthog_featureflag"."created_at",
- "posthog_featureflag"."updated_at",
- "posthog_featureflag"."deleted",
- "posthog_featureflag"."active",
- "posthog_featureflag"."archived",
- "posthog_featureflag"."version",
- "posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
- "posthog_featureflag"."ensure_experience_continuity",
- "posthog_featureflag"."usage_dashboard_id",
- "posthog_featureflag"."has_enriched_analytics",
- "posthog_featureflag"."is_remote_configuration",
- "posthog_featureflag"."has_encrypted_payloads",
- "posthog_featureflag"."evaluation_runtime",
- "posthog_featureflag"."bucketing_identifier",
- "posthog_featureflag"."last_called_at"
- FROM "posthog_featureflag"
- WHERE (NOT ("posthog_featureflag"."deleted")
- AND "posthog_featureflag"."key" = 'flag-1')
- LIMIT 21
- '''
-# ---
# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.6
'''
SELECT "posthog_organization"."id",
@@ -1791,8 +1544,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -1823,8 +1574,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
diff --git a/posthog/tasks/test/__snapshots__/test_task_registration.ambr b/posthog/tasks/test/__snapshots__/test_task_registration.ambr
index e11fd18c0aee..10ef84175dad 100644
--- a/posthog/tasks/test/__snapshots__/test_task_registration.ambr
+++ b/posthog/tasks/test/__snapshots__/test_task_registration.ambr
@@ -96,7 +96,6 @@
'posthog.tasks.tasks.calculate_decide_usage',
'posthog.tasks.tasks.capture_task_run_state_metrics',
'posthog.tasks.tasks.check_async_migration_health',
- 'posthog.tasks.tasks.check_flags_to_rollback',
'posthog.tasks.tasks.clean_stale_partials',
'posthog.tasks.tasks.clear_clickhouse_deleted_person',
'posthog.tasks.tasks.clear_expired_sessions',
diff --git a/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr b/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr
index 7b3ba54bc647..3ef79c13e987 100644
--- a/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr
+++ b/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr
@@ -169,8 +169,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -632,8 +630,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -914,8 +910,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -1094,8 +1088,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
diff --git a/products/feature_flags/backend/api/feature_flag.py b/products/feature_flags/backend/api/feature_flag.py
index 2663138f09d1..731ce5b953c9 100644
--- a/products/feature_flags/backend/api/feature_flag.py
+++ b/products/feature_flags/backend/api/feature_flag.py
@@ -953,8 +953,6 @@ class FeatureFlagSerializer(
"experiment_set_metadata",
"surveys",
"features",
- "rollback_conditions",
- "performed_rollback",
"can_edit",
"tags",
"evaluation_contexts",
@@ -2088,10 +2086,6 @@ class FeatureFlagSerializer(
if "get_filters" in validated_data:
validated_data["filters"] = validated_data.pop("get_filters")
- active = validated_data.get("active", None)
- if active:
- validated_data["performed_rollback"] = False
-
def get_status(self, feature_flag: FeatureFlag) -> str:
checker = FeatureFlagStatusChecker(feature_flag=feature_flag)
flag_status, _ = checker.get_status()
@@ -2489,8 +2483,6 @@ class FeatureFlagVersionResponseSerializer(serializers.ModelSerializer):
"active",
"deleted",
"version",
- "rollback_conditions",
- "performed_rollback",
"ensure_experience_continuity",
"has_enriched_analytics",
"is_remote_configuration",
diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
index 930e914c9be3..943e9a719fcc 100644
--- a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
+++ b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr
@@ -795,8 +795,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -1564,8 +1562,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr
index fdeb341fea22..c3a03dde1479 100644
--- a/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr
+++ b/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr
@@ -205,8 +205,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -410,8 +408,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -1605,8 +1601,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -1918,8 +1912,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
@@ -2684,8 +2676,6 @@
"posthog_featureflag"."archived",
"posthog_featureflag"."version",
"posthog_featureflag"."last_modified_by_id",
- "posthog_featureflag"."rollback_conditions",
- "posthog_featureflag"."performed_rollback",
"posthog_featureflag"."ensure_experience_continuity",
"posthog_featureflag"."usage_dashboard_id",
"posthog_featureflag"."has_enriched_analytics",
diff --git a/products/feature_flags/backend/api/test/feature_flag_openapi_test_helpers.py b/products/feature_flags/backend/api/test/feature_flag_openapi_test_helpers.py
index 0c17b3290527..17b8db9c5f60 100644
--- a/products/feature_flags/backend/api/test/feature_flag_openapi_test_helpers.py
+++ b/products/feature_flags/backend/api/test/feature_flag_openapi_test_helpers.py
@@ -20,8 +20,6 @@ FEATURE_FLAG_REQUEST_SCHEMA_EXCLUDED_RUNTIME_FIELDS: frozenset[str] = frozenset(
"has_encrypted_payloads", # server-managed, derived from payload encryption
"has_enriched_analytics", # internal analytics flag, not agent-facing
"last_called_at", # server-managed usage timestamp, not agent-facing
- "performed_rollback", # internal rollback state
- "rollback_conditions", # legacy rollback config, not agent-facing
"version", # server-managed optimistic-concurrency counter
}
)
diff --git a/products/feature_flags/backend/api/test/test_feature_flag.py b/products/feature_flags/backend/api/test/test_feature_flag.py
index 03c67f3dc54b..53ce59d13067 100644
--- a/products/feature_flags/backend/api/test/test_feature_flag.py
+++ b/products/feature_flags/backend/api/test/test_feature_flag.py
@@ -6156,42 +6156,6 @@ class TestFeatureFlag(APIBaseTest, ClickhouseTestMixin):
},
)
- def test_feature_flag_threshold(self):
- feature_flag = self.client.post(
- f"/api/projects/{self.team.id}/feature_flags/",
- data={
- "name": "Beta feature",
- "key": "beta-feature",
- "filters": {
- "aggregation_group_type_index": 0,
- "groups": [{"rollout_percentage": 65}],
- },
- "rollback_conditions": [
- {
- "threshold": 5000,
- "threshold_metric": {
- "insight": "trends",
- "events": [{"order": 0, "id": "$pageview"}],
- "properties": [
- {
- "key": "$geoip_country_name",
- "type": "person",
- "value": ["france"],
- "operator": "exact",
- }
- ],
- },
- "operator": "lt",
- "threshold_type": "insight",
- }
- ],
- "auto-rollback": True,
- },
- format="json",
- ).json()
-
- self.assertEqual(len(feature_flag["rollback_conditions"]), 1)
-
def test_get_flags_dont_return_survey_targeting_flags(self):
FeatureFlag.objects.create(team=self.team, created_by=self.user, key="red_button")
survey = self.client.post(
diff --git a/products/feature_flags/backend/api/test/test_organization_feature_flag.py b/products/feature_flags/backend/api/test/test_organization_feature_flag.py
index 1c29c016075d..cd8ae9184515 100644
--- a/products/feature_flags/backend/api/test/test_organization_feature_flag.py
+++ b/products/feature_flags/backend/api/test/test_organization_feature_flag.py
@@ -487,8 +487,6 @@ class TestOrganizationFeatureFlagCopy(APIBaseTest, QueryMatchingTest):
"experiment_set_metadata": [],
"surveys": [],
"features": [],
- "rollback_conditions": None,
- "performed_rollback": False,
"can_edit": True,
"analytics_dashboards": [],
"has_enriched_analytics": False,
@@ -607,8 +605,6 @@ class TestOrganizationFeatureFlagCopy(APIBaseTest, QueryMatchingTest):
"deleted": False,
"archived": False,
"created_by": ANY,
- "rollback_conditions": None,
- "performed_rollback": False,
"can_edit": True,
"has_enriched_analytics": False,
"tags": [],
@@ -796,8 +792,6 @@ class TestOrganizationFeatureFlagCopy(APIBaseTest, QueryMatchingTest):
"deleted": False,
"archived": False,
"created_by": ANY,
- "rollback_conditions": None,
- "performed_rollback": False,
"can_edit": True,
"has_enriched_analytics": False,
"tags": [],
diff --git a/products/feature_flags/backend/migrations/0010_remove_featureflag_performed_rollback_and_more.py b/products/feature_flags/backend/migrations/0010_remove_featureflag_performed_rollback_and_more.py
new file mode 100644
index 000000000000..a0dfa89eab38
--- /dev/null
+++ b/products/feature_flags/backend/migrations/0010_remove_featureflag_performed_rollback_and_more.py
@@ -0,0 +1,28 @@
+# Generated by Django 5.2.14 on 2026-07-15 18:32
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("feature_flags", "0009_scheduledchange_change_request"),
+ ]
+
+ # State-only removal: the columns stay in Postgres so code from the previous
+ # deploy can still read them during rollout. Drop them with a follow-up
+ # migration after at least one full deploy cycle.
+ operations = [
+ migrations.SeparateDatabaseAndState(
+ state_operations=[
+ migrations.RemoveField(
+ model_name="featureflag",
+ name="performed_rollback",
+ ),
+ migrations.RemoveField(
+ model_name="featureflag",
+ name="rollback_conditions",
+ ),
+ ],
+ database_operations=[],
+ ),
+ ]
diff --git a/products/feature_flags/backend/migrations/max_migration.txt b/products/feature_flags/backend/migrations/max_migration.txt
index 09d212f093b7..b89a9015f206 100644
--- a/products/feature_flags/backend/migrations/max_migration.txt
+++ b/products/feature_flags/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0009_scheduledchange_change_request
+0010_remove_featureflag_performed_rollback_and_more
diff --git a/products/feature_flags/backend/models/feature_flag.py b/products/feature_flags/backend/models/feature_flag.py
index aceed5ae95ad..6d7299e4be26 100644
--- a/products/feature_flags/backend/models/feature_flag.py
+++ b/products/feature_flags/backend/models/feature_flag.py
@@ -178,9 +178,6 @@ class FeatureFlag(FileSystemSyncMixin, ModelActivityMixin, RootTeamMixin, models
db_index=False,
)
- rollback_conditions = models.JSONField(null=True, blank=True)
- performed_rollback = models.BooleanField(null=True, blank=True)
-
ensure_experience_continuity = models.BooleanField(default=False, null=True, blank=True)
usage_dashboard = models.ForeignKey("dashboards.Dashboard", on_delete=models.SET_NULL, null=True, blank=True)
analytics_dashboards: models.ManyToManyField = models.ManyToManyField(
diff --git a/products/feature_flags/backend/test/test_version_history.py b/products/feature_flags/backend/test/test_version_history.py
index f05eeaecbfa7..256fa7cfab70 100644
--- a/products/feature_flags/backend/test/test_version_history.py
+++ b/products/feature_flags/backend/test/test_version_history.py
@@ -175,12 +175,11 @@ class TestReconstructFlagAtVersion(BaseTest):
assert v2["active"] is False
def test_reconstruct_field_set_from_none(self):
- flag = self._create_flag(rollback_conditions=None, version=1)
- rollback = {"threshold": 5}
- self._simulate_update(flag, {"rollback_conditions": (None, rollback)})
+ flag = self._create_flag(ensure_experience_continuity=None, version=1)
+ self._simulate_update(flag, {"ensure_experience_continuity": (None, True)})
result = reconstruct_flag_at_version(flag, target_version=1, team_id=self.team.id)
- assert result["rollback_conditions"] is None
+ assert result["ensure_experience_continuity"] is None
def test_reconstruct_multiple_fields_in_one_update(self):
flag = self._create_flag(name="V1", active=True, version=1)
@@ -269,12 +268,11 @@ class TestReconstructFlagAtVersion(BaseTest):
assert result["filters"] == expected
def test_reconstruct_field_cleared_to_none(self):
- rollback = {"threshold": 5}
- flag = self._create_flag(rollback_conditions=rollback, version=1)
- self._simulate_update(flag, {"rollback_conditions": (rollback, None)})
+ flag = self._create_flag(ensure_experience_continuity=True, version=1)
+ self._simulate_update(flag, {"ensure_experience_continuity": (True, None)})
result = reconstruct_flag_at_version(flag, target_version=1, team_id=self.team.id)
- assert result["rollback_conditions"] == {"threshold": 5}
+ assert result["ensure_experience_continuity"] is True
class TestTimestampBasedReconstruction(TestReconstructFlagAtVersion):
diff --git a/products/feature_flags/frontend/generated/api.schemas.ts b/products/feature_flags/frontend/generated/api.schemas.ts
index 83c17f6b2f01..153c108fb2c9 100644
--- a/products/feature_flags/frontend/generated/api.schemas.ts
+++ b/products/feature_flags/frontend/generated/api.schemas.ts
@@ -493,9 +493,6 @@ export interface FeatureFlagApi {
readonly experiment_set_metadata: readonly FeatureFlagExperimentSetMetadataApi[]
readonly surveys: FeatureFlagApiSurveys
readonly features: FeatureFlagApiFeatures
- rollback_conditions?: unknown
- /** @nullable */
- performed_rollback?: boolean | null
readonly can_edit: boolean
tags?: unknown[]
evaluation_contexts?: unknown[]
@@ -1241,9 +1238,6 @@ export interface FeatureFlagVersionResponseApi {
* @nullable
*/
version?: number | null
- rollback_conditions?: unknown
- /** @nullable */
- performed_rollback?: boolean | null
/** @nullable */
ensure_experience_continuity?: boolean | null
/** @nullable */
diff --git a/products/feature_flags/frontend/generated/api.zod.ts b/products/feature_flags/frontend/generated/api.zod.ts
index eedac331b0e4..14f65d75bdfb 100644
--- a/products/feature_flags/frontend/generated/api.zod.ts
+++ b/products/feature_flags/frontend/generated/api.zod.ts
@@ -533,8 +533,6 @@ export const FeatureFlagsUpdateBody = /* @__PURE__ */ zod
created_at: zod.iso.datetime({ offset: true }).optional(),
version: zod.number().default(featureFlagsUpdateBodyVersionDefault),
ensure_experience_continuity: zod.boolean().nullish(),
- rollback_conditions: zod.unknown().optional(),
- performed_rollback: zod.boolean().nullish(),
tags: zod.array(zod.unknown()).optional(),
evaluation_contexts: zod.array(zod.unknown()).optional(),
analytics_dashboards: zod.array(zod.number()).optional(),
@@ -960,8 +958,6 @@ export const FeatureFlagsCreateStaticCohortForFlagCreateBody = /* @__PURE__ */ z
created_at: zod.iso.datetime({ offset: true }).optional(),
version: zod.number().default(featureFlagsCreateStaticCohortForFlagCreateBodyVersionDefault),
ensure_experience_continuity: zod.boolean().nullish(),
- rollback_conditions: zod.unknown().optional(),
- performed_rollback: zod.boolean().nullish(),
tags: zod.array(zod.unknown()).optional(),
evaluation_contexts: zod.array(zod.unknown()).optional(),
analytics_dashboards: zod.array(zod.number()).optional(),
@@ -1048,8 +1044,6 @@ export const FeatureFlagsDashboardCreateBody = /* @__PURE__ */ zod
created_at: zod.iso.datetime({ offset: true }).optional(),
version: zod.number().default(featureFlagsDashboardCreateBodyVersionDefault),
ensure_experience_continuity: zod.boolean().nullish(),
- rollback_conditions: zod.unknown().optional(),
- performed_rollback: zod.boolean().nullish(),
tags: zod.array(zod.unknown()).optional(),
evaluation_contexts: zod.array(zod.unknown()).optional(),
analytics_dashboards: zod.array(zod.number()).optional(),
@@ -1136,8 +1130,6 @@ export const FeatureFlagsEnrichUsageDashboardCreateBody = /* @__PURE__ */ zod
created_at: zod.iso.datetime({ offset: true }).optional(),
version: zod.number().default(featureFlagsEnrichUsageDashboardCreateBodyVersionDefault),
ensure_experience_continuity: zod.boolean().nullish(),
- rollback_conditions: zod.unknown().optional(),
- performed_rollback: zod.boolean().nullish(),
tags: zod.array(zod.unknown()).optional(),
evaluation_contexts: zod.array(zod.unknown()).optional(),
analytics_dashboards: zod.array(zod.number()).optional(),
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 7b02a29738c8..d43806a36c33 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -27737,9 +27737,6 @@ export namespace Schemas {
readonly experiment_set_metadata: readonly FeatureFlagExperimentSetMetadata[];
readonly surveys: FeatureFlagSurveys;
readonly features: FeatureFlagFeatures;
- rollback_conditions?: unknown;
- /** @nullable */
- performed_rollback?: boolean | null;
readonly can_edit: boolean;
tags?: unknown[];
evaluation_contexts?: unknown[];
@@ -27993,9 +27990,6 @@ export namespace Schemas {
* @nullable
*/
version?: number | null;
- rollback_conditions?: unknown;
- /** @nullable */
- performed_rollback?: boolean | null;
/** @nullable */
ensure_experience_continuity?: boolean | null;
/** @nullable */