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 starts-with-ends-with-operators flag (#91199)

Phil Haack7a752f6dabdb
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index a387ba98adc9..2c02e97a8364 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -2553,13 +2553,13 @@ snapshots:
filters-propertyfilters--with-no-close-button--light:
hash: v1.k794b7964.eba5ff94aa0a84f3d5b321cc72098928dbb717f5df0d25c09e49833af1d37b13.uwTMich99_PKan4bAEVqG5MuX0M5pkpxAOoWsjfwtNM
filters-propertyfilters-operatorvalueselect--operator-value-menu-open--dark:
- hash: v1.k794b7964.cfb355e2c40234208226b49f44bd27c31d7d00209f77d4e0725ad6a473459700.MTNjF9ThMDTVSynL8se2INaGpq_jQ3JUdGIbsthi4jw
+ hash: v1.k794b7964.352cfe99917d54e620155b2fbad7a34925e6f87394f59bdc3bb52a7a4306f8fa.PHzbW8Wv9V2tEC_dut7e56k5trwtzp4ScpxegDx148A
filters-propertyfilters-operatorvalueselect--operator-value-menu-open--light:
- hash: v1.k794b7964.fe8c7024aecdaf758ec480edd46db8a4ed50e3aa499f7aff5eb5688b1ed04420.SoCoD-JIXfi-TJXJSH3_1EJYdEKcm-4-ABHq6KAgoh0
+ hash: v1.k794b7964.7847e8f61591729f30efc7fa0b50f3cbee1d235af826f4687852efc5136e4d8e.noppZlwvhJvqmX9xlnwGHwm0sKBsT79C9ZsVcDDy2IQ
filters-propertyfilters-operatorvalueselect--operator-value-menu-with-allowlist--dark:
- hash: v1.k794b7964.56c4f47d9a1e90077041f9fd67a8bceb74fab4c1288c092bff96abfbb788e198.nAE4ldspTxLaklBddJriykiSBJskttlFws3yG_cMgZo
+ hash: v1.k794b7964.2dd05cbc0bf895740c37317b583a2b9d1fdcb32d51aae2c3a00ebd61f5be8c9f.OV9m0YvoE5vrwn1jxJcIlIHJelGb7AUOhQ-KRu7oO_w
filters-propertyfilters-operatorvalueselect--operator-value-menu-with-allowlist--light:
- hash: v1.k794b7964.66f736bd2d49969cf229fbfee755e985cd4fb0f437688be865c8b9bad45cb040.wQo1GVHp6MU-N12E6WbVFHu2rxuJBgJ9ig1r2nuxW7I
+ hash: v1.k794b7964.6cacf1314dfd940014b41e443da63bb4db90ddb6d55bc2a97179fdb99ff00635.ka_l_xUfEpuW-4kh6uqh7yAoQjbttygSJNQG3kI0PRs
filters-propertyfilters-operatorvalueselect--operator-value-with-boolean-property--dark:
hash: v1.k794b7964.f177d54e80c8da329e88c4f19f1e766dc8683cd54eb64e6fe01a265365d04e49.NU4Y2LcdutmlPuffo1zk4NzvllMrtmXdHXAbmCITqWI
filters-propertyfilters-operatorvalueselect--operator-value-with-boolean-property--light:
diff --git a/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.test.tsx b/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.test.tsx
deleted file mode 100644
index 781a98d24237..000000000000
--- a/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.test.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import '@testing-library/jest-dom'
-
-import { cleanup, render, screen } from '@testing-library/react'
-import { Provider } from 'kea'
-
-import { FEATURE_FLAGS } from 'lib/constants'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-
-import { useMocks } from '~/mocks/jest'
-import { initKeaTests } from '~/test/init'
-import { PropertyDefinition, PropertyFilterType, PropertyOperator, PropertyType } from '~/types'
-
-import { OperatorValueSelect } from './OperatorValueSelect'
-
-jest.mock('@posthog/lemon-ui', () => ({
- ...jest.requireActual('@posthog/lemon-ui'),
- // Render a native select so operator options are directly assertable without popover mechanics
- LemonSelect: ({ onChange, options, value }: any): JSX.Element => {
- const flatOptions = options.flatMap((option: any) => ('options' in option ? option.options : option))
- return (
- <select
- data-attr="operator-select"
- value={value === undefined ? '' : String(value)}
- onChange={(event) => {
- const selectedOption = flatOptions.find(
- (option: any) => String(option.value) === event.target.value
- )
- onChange?.(selectedOption?.value)
- }}
- >
- {flatOptions.map((option: any) => (
- <option key={String(option.value)} value={String(option.value)}>
- {String(option.value)}
- </option>
- ))}
- </select>
- )
- },
-}))
-
-const STARTS_ENDS_WITH_VALUES = ['starts_with', 'not_starts_with', 'ends_with', 'not_ends_with']
-
-const emailPropertyDefinition = {
- id: '1',
- name: 'email',
- property_type: PropertyType.String,
-} as PropertyDefinition
-
-describe('OperatorValueSelect', () => {
- let unmountFeatureFlagLogic: (() => void) | null = null
-
- beforeEach(() => {
- initKeaTests()
- useMocks({
- get: {
- '/api/person/values': [],
- '/api/event/values': [],
- },
- })
- unmountFeatureFlagLogic = featureFlagLogic.mount()
- })
-
- afterEach(() => {
- featureFlagLogic.actions.setFeatureFlags([], {})
- unmountFeatureFlagLogic?.()
- unmountFeatureFlagLogic = null
- cleanup()
- })
-
- function setStartsEndsWithFlag(enabled: boolean): void {
- featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.STARTS_WITH_ENDS_WITH_OPERATORS], {
- [FEATURE_FLAGS.STARTS_WITH_ENDS_WITH_OPERATORS]: enabled,
- })
- }
-
- function renderSelect(operator?: PropertyOperator): void {
- render(
- <Provider>
- <OperatorValueSelect
- type={PropertyFilterType.Person}
- propertyKey="email"
- operator={operator}
- value={null}
- editable
- onChange={jest.fn()}
- propertyDefinitions={[emailPropertyDefinition]}
- />
- </Provider>
- )
- }
-
- function renderedOperatorValues(): string[] {
- const select = screen.getByTestId('operator-select')
- return Array.from(select.querySelectorAll('option')).map((option) => option.value)
- }
-
- it('hides the starts_with/ends_with operator family when the flag is off', () => {
- setStartsEndsWithFlag(false)
- renderSelect()
- const values = renderedOperatorValues()
- for (const operatorValue of STARTS_ENDS_WITH_VALUES) {
- expect(values).not.toContain(operatorValue)
- }
- expect(values).toContain('icontains')
- })
-
- it('keeps a saved starts_with operator selectable when the flag is off, without resetting it', () => {
- setStartsEndsWithFlag(false)
- renderSelect(PropertyOperator.StartsWith)
- const values = renderedOperatorValues()
- expect(values).toContain('starts_with')
- expect(values).not.toContain('ends_with')
- expect(screen.getByTestId('operator-select')).toHaveValue('starts_with')
- })
-
- it('offers the full starts_with/ends_with operator family when the flag is on', () => {
- setStartsEndsWithFlag(true)
- renderSelect()
- const values = renderedOperatorValues()
- for (const operatorValue of STARTS_ENDS_WITH_VALUES) {
- expect(values).toContain(operatorValue)
- }
- })
-})
diff --git a/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.tsx b/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.tsx
index ff4c7d936901..65cc65ddb05d 100644
--- a/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.tsx
+++ b/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.tsx
@@ -1,4 +1,3 @@
-import { useValues } from 'kea'
import { RE2JS } from 're2js'
import { useEffect, useState } from 'react'
@@ -6,11 +5,9 @@ import { LemonBanner, LemonDropdownProps, LemonSelect, LemonSelectProps, LemonSe
import { allOperatorsToHumanName } from 'lib/components/DefinitionPopover/utils'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
-import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { LemonInputSelect } from 'lib/lemon-ui/LemonInputSelect/LemonInputSelect'
import { Link } from 'lib/lemon-ui/Link'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { isMobile } from 'lib/utils/dom'
import {
allOperatorsMapping,
@@ -230,9 +227,6 @@ export function OperatorValueSelect({
const [currentOperator, setCurrentOperator] = useState(startingOperator)
- const { featureFlags } = useValues(featureFlagLogic)
- const startsEndsWithEnabled = !!featureFlags[FEATURE_FLAGS.STARTS_WITH_ENDS_WITH_OPERATORS]
-
const [operators, setOperators] = useState([] as Array<PropertyOperator>)
useEffect(() => {
let propertyType = propertyDefinition?.property_type
@@ -268,15 +262,6 @@ export function OperatorValueSelect({
(op) => !operatorAllowlist || operatorAllowlist.includes(op)
)
- // Hidden until SDK local evaluation supports these operators; existing filters using them still
- // render and evaluate, they just can't be newly selected without the flag. Keep the
- // currently-selected operator in the list even when hidden, so an existing filter doesn't get
- // silently reset to Exact and lose its operator on the next edit. Deliberately compares the
- // saved `operator` prop, not `currentOperator` state: the prop is what protects a saved filter.
- if (!startsEndsWithEnabled) {
- operators = operators.filter((op) => !STARTS_ENDS_WITH_OPERATORS.includes(op) || op === operator)
- }
-
// Restrict message log property to only allow string-search operators
if (propertyKey === 'message' && type === PropertyFilterType.Log) {
operators = operators.filter((op) =>
@@ -355,7 +340,7 @@ export function OperatorValueSelect({
}
setCurrentOperator(defaultProperty)
}
- }, [propertyDefinition, propertyKey, operator, operatorAllowlist, type, startsEndsWithEnabled]) // oxlint-disable-line react-hooks/exhaustive-deps
+ }, [propertyDefinition, propertyKey, operator, operatorAllowlist, type]) // oxlint-disable-line react-hooks/exhaustive-deps
const validationError = currentOperator && value ? getValidationError(currentOperator, value, propertyKey) : null
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 7e74ea497108..526f8232f82e 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -242,7 +242,6 @@ export const FEATURE_FLAGS = {
SLACK_APP_ASSISTANT: 'slack-app-assistant', // owner: @VojtechBartos #team-platform-features
SLACK_APP_OAUTH: 'slack-app-oauth', // owner: @VojtechBartos #team-platform-features
SLOPE_GRAPH_INSIGHT: 'slope-graph-insight', // owner: @pauldambra #team-product-analytics
- STARTS_WITH_ENDS_WITH_OPERATORS: 'starts-with-ends-with-operators', // owner: @haacked #team-feature-flags, gates the starts_with/ends_with property filter operators in the UI until SDK local evaluation supports them, see `OperatorValueSelect.tsx`
STARTUP_PROGRAM_INTENT: 'startup-program-intent', // owner: @pawel-cebula #team-billing
SURVEYS_ACTIONS: 'surveys-actions', // owner: #team-surveys
SURVEYS_ADAPTIVE_LIMITS: 'surveys-adaptive-limits', // owner: #team-surveys