: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(aio): remove the evaluation backfills feature flag from code (#109823)
Bernat Torresc59741125503
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex d526299bcf92..edd01e3c6142 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -368,7 +368,6 @@ export const FEATURE_FLAGS = {LLM_ANALYTICS_CLUSTERING_ADMIN: 'llm-analytics-clustering-admin', // owner: #team-ai-observabilityLLM_ANALYTICS_COMMUNITY_SKILLS: 'llm-analytics-community-skills', // owner: #team-ai-observabilityLLM_ANALYTICS_DATASETS: 'llm-analytics-datasets', // owner: #team-ai-observability #team-posthog-ai- LLM_ANALYTICS_EVAL_BACKFILLS: 'llm-analytics-eval-backfills', // owner: #team-ai-observabilityLLM_ANALYTICS_EVAL_SETTLING_STRATEGY: 'llm-analytics-eval-settling-strategy', // owner: #team-ai-observabilityLLM_ANALYTICS_NUMERIC_EVALS: 'llm-analytics-numeric-evaluations', // owner: #team-ai-observabilityLLM_ANALYTICS_SYSTEM_ONE_EVALUATIONS: 'llm-analytics-system-one-evaluations', // owner: #team-ai-observabilitydiff --git a/products/ai_observability/backend/api/evaluation_backfills.py b/products/ai_observability/backend/api/evaluation_backfills.pyindex 8d13aed9469b..9a62f33ba586 100644--- a/products/ai_observability/backend/api/evaluation_backfills.py+++ b/products/ai_observability/backend/api/evaluation_backfills.py@@ -31,12 +31,7 @@ from posthog.api.shared import UserBasicSerializerfrom posthog.dataclasses import frozenfrom posthog.event_usage import report_user_actionfrom posthog.models.user import User-from posthog.permissions import (- AccessControlPermission,- APIScopePermission,- PostHogFeatureFlagPermission,- TeamMemberAccessPermission,-)+from posthog.permissions import AccessControlPermission, APIScopePermission, TeamMemberAccessPermissionfrom posthog.rate_limit import (AIObservabilityBackfillCreateSustainedThrottle,AIObservabilityBackfillCreateThrottle,@@ -272,8 +267,6 @@ class EvaluationBackfillViewSet():"""Historical runs of one evaluation over a closed time window (nested under an evaluation)."""- # The same flag as the tab, so the API and the surface reach a project together.- posthog_feature_flag = "llm-analytics-eval-backfills"scope_object = "evaluation"scope_object_read_actions = ["list", "retrieve", "estimate"]scope_object_write_actions = WRITE_ACTIONS@@ -288,7 +281,6 @@ class EvaluationBackfillViewSet(APIScopePermission(),EvaluationBackfillAccessControlPermission(),TeamMemberAccessPermission(),- PostHogFeatureFlagPermission(),]def get_throttles(self) -> list[BaseThrottle]:diff --git a/products/ai_observability/backend/api/test/test_evaluation_backfills.py b/products/ai_observability/backend/api/test/test_evaluation_backfills.pyindex 04044d5b3893..90162e7a1218 100644--- a/products/ai_observability/backend/api/test/test_evaluation_backfills.py+++ b/products/ai_observability/backend/api/test/test_evaluation_backfills.py@@ -117,17 +117,9 @@ def _workflow_not_found() -> RPCError:return RPCError("workflow not found", RPCStatusCode.NOT_FOUND, b"")-def _enable_backfills_flag(test: APIBaseTest) -> None:- """Turn the rollout flag on for one test, the way a project that opted in sees the API."""- flag = patch("posthog.permissions.posthog_feature_flag_enabled", return_value=True)- flag.start()- test.addCleanup(flag.stop)--class TestEvaluationBackfillsApi(APIBaseTest):def setUp(self):super().setUp()- _enable_backfills_flag(self)self.evaluation = _evaluation(self.team, [{"id": "c1", "properties": [], "rollout_percentage": 50}])self.url = f"/api/projects/{self.team.id}/evaluations/{self.evaluation.id}/backfills"@@ -649,25 +641,6 @@ class TestEvaluationBackfillsApi(APIBaseTest):[properties] = _captured(capture, "llma evaluation backfill cancelled")assert properties == {**properties, "source": "web", "backfill_id": str(backfill.id), "total_count": 1}- @parameterized.expand(- [- ("list", "get", "/", None),- (- "estimate",- "post",- "/estimate/",- {"window_start": "2024-01-01T00:00:00Z", "window_end": "2024-01-02T00:00:00Z"},- ),- ("create", "post", "/", {"window_start": "2024-01-01T00:00:00Z", "window_end": "2024-01-02T00:00:00Z"}),- ]- )- def test_every_action_is_off_while_the_flag_is_off(self, _case, method, path, payload):- with patch("posthog.permissions.posthog_feature_flag_enabled", return_value=False):- response = getattr(self.client, method)(f"{self.url}{path}", payload, format="json")-- assert response.status_code == status.HTTP_403_FORBIDDEN, response.json()- assert EvaluationBackfill.objects.unscoped().count() == 0-def test_list_breaks_created_at_ties_by_ascending_id(self):ids = sorted(str(self._running_backfill(status=EvaluationBackfillStatus.COMPLETED).id) for _ in range(5))# created_at is auto_now_add, so tying the rows to one timestamp takes an update.@@ -694,7 +667,6 @@ class TestEvaluationBackfillsApi(APIBaseTest):class TestEvaluationBackfillsAccessControl(APIBaseTest):def setUp(self):super().setUp()- _enable_backfills_flag(self)self.organization.available_product_features = [{"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL},{"key": AvailableFeature.ROLE_BASED_ACCESS, "name": AvailableFeature.ROLE_BASED_ACCESS},diff --git a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsxindex deef47c69973..084692302abd 100644--- a/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx+++ b/products/ai_observability/frontend/evaluations/AIObservabilityEvaluation.tsx@@ -107,7 +107,6 @@ export function AIObservabilityEvaluation(): JSX.Element {const { featureFlags } = useValues(featureFlagLogic)const numericEvaluationsEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_NUMERIC_EVALS]const settlingStrategyEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_EVAL_SETTLING_STRATEGY]- const backfillsEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_EVAL_BACKFILLS]const {setEvaluationName,setEvaluationDescription,@@ -502,19 +501,18 @@ export function AIObservabilityEvaluation(): JSX.Element {/>),},- !isNewEvaluation &&- backfillsEnabled && {- key: 'backfills',- label: 'Backfills',- 'data-attr': 'llma-evaluation-backfills-tab',- content: (- <EvaluationBackfillsTab- evaluationId={evaluation.id}- userAccessLevel={evaluation.user_access_level ?? undefined}- onConfigurationClick={() => setActiveTab('configuration')}- />- ),- },+ !isNewEvaluation && {+ key: 'backfills',+ label: 'Backfills',+ 'data-attr': 'llma-evaluation-backfills-tab',+ content: (+ <EvaluationBackfillsTab+ evaluationId={evaluation.id}+ userAccessLevel={evaluation.user_access_level ?? undefined}+ onConfigurationClick={() => setActiveTab('configuration')}+ />+ ),+ },{key: 'configuration',label: 'Configuration',diff --git a/products/ai_observability/frontend/evaluations/llmEvaluationLogic.ts b/products/ai_observability/frontend/evaluations/llmEvaluationLogic.tsindex 8a6cfa26a125..1172c06f0aa3 100644--- a/products/ai_observability/frontend/evaluations/llmEvaluationLogic.ts+++ b/products/ai_observability/frontend/evaluations/llmEvaluationLogic.ts@@ -4,9 +4,7 @@ import { actionToUrl, combineUrl, router, urlToAction } from 'kea-router'import posthog from 'posthog-js'import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'-import { FEATURE_FLAGS } from 'lib/constants'import { lemonToast } from 'lib/lemon-ui/LemonToast'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'@@ -15,7 +13,6 @@ import { DateRange, InsightVizNode, NodeKind } from '~/queries/schema/schema-genimport { MaxContextInput, createMaxContextHelpers } from '~/scenes/max/maxTypes'import { ActivityScope, Breadcrumb, ChartDisplayType, HogQLMathType } from '~/types'-import type { FeatureFlagsSet } from '../../../../frontend/src/lib/logic/featureFlagLogic'import {evaluationsBackfillsRetrieve,evaluationsCreate,@@ -90,10 +87,6 @@ function evaluationDetailTab(value: unknown): string | null {if (typeof value !== 'string' || !EVALUATION_DETAIL_TABS.has(value)) {return null}- // Backfills is flag-gated, so a bookmarked URL for it falls back to the default tab.- if (value === 'backfills' && !featureFlagLogic.values.featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_EVAL_BACKFILLS]) {- return null- }return value}@@ -304,7 +297,6 @@ export interface LLMEvaluationLogicProps {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface llmEvaluationLogicValues {- featureFlags: FeatureFlagsSet // featureFlagLogicactiveProviderKey: LLMProviderKey | null | undefined // llmProviderKeysLogicproviderKeys: LLMProviderKey[] // llmProviderKeysLogicproviderKeysLoading: boolean // llmProviderKeysLogic@@ -609,8 +601,6 @@ export const llmEvaluationLogic = kea<llmEvaluationLogicType>([values: [llmProviderKeysLogic,['providerKeys', 'providerKeysLoading', 'requiresProviderKey', 'activeProviderKey'],- featureFlagLogic,- ['featureFlags'],],actions: [llmProviderKeysLogic, ['loadProviderKeys', 'loadEvaluationConfigSuccess']],})),@@ -1316,7 +1306,7 @@ export const llmEvaluationLogic = kea<llmEvaluationLogicType>([if (isNew) {globalSetupLogic.findMounted()?.actions.markTaskAsCompleted(SetupTaskId.SetUpLlmEvaluation)// Saving navigates away, so the offer to cover past data travels with the user.- if (response?.id && values.featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_EVAL_BACKFILLS]) {+ if (response?.id) {lemonToast.info('This evaluation grades new data from now on.', {button: {label: 'Evaluate past data',