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(feature-flags): remove the rolled-out default evaluation environments gate (#107365)

posthog[bot]e283ac813b81
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 689655fe6034..57ca705951ab 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -302,7 +302,6 @@ export const FEATURE_FLAGS = {
DATA_WAREHOUSE_CUSTOM_SOURCE_AI_BUILDER: 'dwh-custom-source-ai-builder', // owner: #team-warehouse-sources
DATA_WAREHOUSE_CUSTOM_SOURCE_OAUTH2: 'dwh-custom-source-oauth2', // owner: #team-warehouse-sources
DATA_WAREHOUSE_SCENE: 'data-warehouse-scene', // owner: #team-data-modeling
- DEFAULT_EVALUATION_ENVIRONMENTS: 'default-evaluation-environments', // owner: @dmarticus #team-feature-flags
DESTINATIONS_INCIDENT_REPLAY: 'destinations-incident-replay', // owner: #team-workflows
DISCUSSIONS_SLACK_SYNC: 'discussions-slack-sync', // owner: #team-platform-features
DROP_PERSON_LIST_ORDER_BY: 'drop-person-list-order-by', // owner: @arthurdedeus #team-customer-analytics
diff --git a/frontend/src/scenes/feature-flags/DefaultEvaluationContexts.tsx b/frontend/src/scenes/feature-flags/DefaultEvaluationContexts.tsx
index 47a746752794..3dd423176ce5 100644
--- a/frontend/src/scenes/feature-flags/DefaultEvaluationContexts.tsx
+++ b/frontend/src/scenes/feature-flags/DefaultEvaluationContexts.tsx
@@ -3,17 +3,15 @@ import { useActions, useValues } from 'kea'
import { IconBolt, IconPlus, IconPlusSmall, IconX } from '@posthog/icons'
import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'
-import { FEATURE_FLAGS, TeamMembershipLevel } from 'lib/constants'
+import { TeamMembershipLevel } from 'lib/constants'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonInput } from 'lib/lemon-ui/LemonInput'
import { LemonSwitch } from 'lib/lemon-ui/LemonSwitch'
import { LemonTag } from 'lib/lemon-ui/LemonTag'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { defaultEvaluationContextsLogic } from './defaultEvaluationContextsLogic'
-export function DefaultEvaluationContexts(): JSX.Element | null {
- const { featureFlags } = useValues(featureFlagLogic)
+export function DefaultEvaluationContexts(): JSX.Element {
const { contexts, isEnabled, canAddMoreContexts, newContextInput, defaultEvaluationContextsLoading, isAdding } =
useValues(defaultEvaluationContextsLogic)
const { addContext, removeContext, toggleEnabled, setNewContextInput, setIsAdding } =
@@ -23,10 +21,6 @@ export function DefaultEvaluationContexts(): JSX.Element | null {
minimumAccessLevel: TeamMembershipLevel.Admin,
})
- if (!featureFlags[FEATURE_FLAGS.DEFAULT_EVALUATION_ENVIRONMENTS]) {
- return null
- }
-
const handleAddContext = (): void => {
const trimmed = newContextInput.trim().toLowerCase()
if (trimmed && !contexts.some((c: { name: string }) => c.name === trimmed)) {
diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
index b216e4e7f348..fa600e24a658 100644
--- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
@@ -30,13 +30,11 @@ import { handleApprovalRequired } from 'lib/approvals/utils'
import { ACTIVITY_SEARCH_PARAM } from 'lib/components/ActivityLog/activityLogLogic'
import { tryShowMCPHint } from 'lib/components/MCPHint/mcpHintLogic'
import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'
-import { FEATURE_FLAGS } from 'lib/constants'
import { describeCron } from 'lib/cron'
import { Dayjs, dayjs } from 'lib/dayjs'
import { scrollToFormError } from 'lib/forms/scrollToFormError'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
-import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
import { deleteWithUndo } from 'lib/utils/deleteWithUndo'
import { stringifyWithBigInts } from 'lib/utils/json'
@@ -102,7 +100,6 @@ import type {
} from 'products/feature_flags/frontend/generated/api.schemas'
import type { CopyFlagsResponseApi } from '../../../../products/feature_flags/frontend/generated/api.schemas'
-import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'
import type { ProductIntentProperties } from '../../lib/utils/product-intents'
import type { Noun } from '../../models/groupsModel'
import type { Node } from '../../queries/schema/schema-general'
@@ -859,7 +856,6 @@ function cleanFilterGroups(groups?: FeatureFlagGroupType[]): FeatureFlagGroupTyp
export interface featureFlagLogicValues {
defaultEvaluationContexts: DefaultEvaluationContextsResponse | null // defaultEvaluationContextsLogic
defaultReleaseConditions: DefaultReleaseConditionsResponse | null // defaultReleaseConditionsLogic
- enabledFeatures: FeatureFlagsSet // enabledFeaturesLogic
aggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel
currentOrganization: OrganizationType | null // organizationLogic
currentOrganizationId: string // organizationLogic
@@ -2167,8 +2163,6 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
['hasAvailableFeature', 'user'],
organizationLogic,
['currentOrganization', 'currentOrganizationId'],
- enabledFeaturesLogic,
- ['featureFlags as enabledFeatures'],
defaultEvaluationContextsLogic,
['defaultEvaluationContexts'],
defaultReleaseConditionsLogic,
@@ -3034,12 +3028,6 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
if (props.id === 'new') {
const flagType = router.values.searchParams.type as FlagType | undefined
- // Only load and apply default evaluation contexts if BOTH conditions are met:
- // 1. The feature flag is enabled globally
- // 2. The team has enabled default evaluation contexts
- const isFeatureEnabled = values.enabledFeatures[FEATURE_FLAGS.DEFAULT_EVALUATION_ENVIRONMENTS]
- const isTeamEnabled = values.currentTeam?.default_evaluation_contexts_enabled
-
let baseFlagConfig: typeof NEW_FLAG = {
...NEW_FLAG,
ensure_experience_continuity: values.currentTeam?.flags_persistence_default ?? false,
@@ -3092,7 +3080,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
}
}
- if (isFeatureEnabled && isTeamEnabled) {
+ if (values.currentTeam?.default_evaluation_contexts_enabled) {
try {
actions.loadDefaultEvaluationContexts()
} catch (error) {
@@ -3108,7 +3096,6 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
}
}
- // If either condition is false, return flag without default tags
return baseFlagConfig
}
diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsx
index 35abcb2d17cd..959e638936ab 100644
--- a/frontend/src/scenes/settings/SettingsMap.tsx
+++ b/frontend/src/scenes/settings/SettingsMap.tsx
@@ -824,7 +824,6 @@ export const SETTINGS_MAP: SettingSection[] = [
description:
'Automatically apply default evaluation context tags to newly created feature flags. Users can still modify them during flag creation.',
docsUrl: 'https://posthog.com/docs/feature-flags/evaluation-contexts',
- flag: 'DEFAULT_EVALUATION_ENVIRONMENTS',
component: <DefaultEvaluationContexts />,
keywords: ['evaluation', 'default', 'context', 'tag'],
},
diff --git a/products/feature_flags/backend/max_tools.py b/products/feature_flags/backend/max_tools.py
index b60f676be127..4b774eeaaa1c 100644
--- a/products/feature_flags/backend/max_tools.py
+++ b/products/feature_flags/backend/max_tools.py
@@ -2,7 +2,6 @@ from textwrap import dedent
from types import SimpleNamespace
from typing import Any
-import posthoganalytics
from pydantic import BaseModel, Field
from rest_framework.exceptions import ValidationError
@@ -355,21 +354,6 @@ class CreateFeatureFlagTool(MaxTool):
if not self._team.default_evaluation_contexts_enabled:
return []
- # Mirror the web UI, which applies defaults only when this gate is also on (featureFlagLogic.ts).
- organization = self._user.organization
- distinct_id = self._user.distinct_id
- if organization is None or distinct_id is None:
- return []
- if not posthoganalytics.feature_enabled(
- "default-evaluation-environments",
- distinct_id,
- groups={"organization": str(organization.id)},
- group_properties={"organization": {"id": str(organization.id)}},
- only_evaluate_locally=False,
- send_feature_flag_events=False,
- ):
- return []
-
return list(
TeamDefaultEvaluationContext.objects.filter(team=self._team)
.select_related("evaluation_context")
diff --git a/products/feature_flags/backend/test/test_max_tools.py b/products/feature_flags/backend/test/test_max_tools.py
index 6dcb204e046b..acb217676298 100644
--- a/products/feature_flags/backend/test/test_max_tools.py
+++ b/products/feature_flags/backend/test/test_max_tools.py
@@ -511,10 +511,7 @@ class TestCreateFeatureFlagTool(APIBaseTest):
await database_sync_to_async(self.team.save)()
await self._create_default_context("production")
- with patch(
- "posthoganalytics.feature_enabled",
- side_effect=_enable_gates("flag-evaluation-tags", "default-evaluation-environments"),
- ):
+ with patch("posthoganalytics.feature_enabled", side_effect=_enable_gates("flag-evaluation-tags")):
tool = self._create_tool()
schema = FeatureFlagCreationSchema(
@@ -562,10 +559,7 @@ class TestCreateFeatureFlagTool(APIBaseTest):
await database_sync_to_async(self.team.save)()
await self._create_default_context("production")
- with patch(
- "posthoganalytics.feature_enabled",
- side_effect=_enable_gates("flag-evaluation-tags", "default-evaluation-environments"),
- ):
+ with patch("posthoganalytics.feature_enabled", side_effect=_enable_gates("flag-evaluation-tags")):
tool = self._create_tool()
schema = FeatureFlagCreationSchema(