: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(groups): remove unused groups/property_definitions endpoint (#66476)
Andy Zhaofebe634017e1
diff --git a/ee/clickhouse/views/groups.py b/ee/clickhouse/views/groups.pyindex c308bc760105..63a5c594234d 100644--- a/ee/clickhouse/views/groups.py+++ b/ee/clickhouse/views/groups.py@@ -1,6 +1,5 @@import json as _jsonimport base64-from collections import defaultdictfrom typing import Any, Literal, Optional, cast, overloadfrom urllib.parse import urlencode@@ -804,26 +803,6 @@ class GroupsViewSet(TeamAndOrgViewSetMixin, mixins.ListModelMixin, mixins.Createresults = RelatedActorsQuery(self.team, group_type_index, actor_id).run()return response.Response(results)- @action(methods=["GET"], detail=False, required_scopes=["group:read"])- def property_definitions(self, request: request.Request, **kw):- tag_queries(product=ProductKey.GROUP_ANALYTICS, feature=Feature.QUERY)- query = parse_select(- """- SELECT index, tupleElement(keysAndValues, 1) AS key, count(*) AS count- FROM groups- ARRAY JOIN JSONExtractKeysAndValuesRaw(properties) AS keysAndValues- GROUP BY index, key- ORDER BY index ASC, count DESC, key ASC- """- )- rows = execute_hogql_query(query, team=self.team).results-- group_type_index_to_properties = defaultdict(list)- for group_type_index, key, count in rows:- group_type_index_to_properties[str(group_type_index)].append({"name": key, "count": count})-- return response.Response(group_type_index_to_properties)-@action(methods=["GET"], detail=False, required_scopes=["group:read"])def property_values(self, request: request.Request, **kw):with (diff --git a/ee/clickhouse/views/test/test_clickhouse_groups.py b/ee/clickhouse/views/test/test_clickhouse_groups.pyindex 56504c2c713e..e5e3083903b1 100644--- a/ee/clickhouse/views/test/test_clickhouse_groups.py+++ b/ee/clickhouse/views/test/test_clickhouse_groups.py@@ -1146,41 +1146,6 @@ class GroupsViewSetTestCase(ClickhouseTestMixin, APIBaseTest):response = self.client.get(f"/api/projects/{self.team.id}/groups/related?group_type_index=0")self.assertEqual(response.status_code, 400)- def test_property_definitions(self):- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key="org:5",- properties={"industry": "finance", "name": "Mr. Krabs"},- )- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key="org:6",- properties={"industry": "technology"},- )- create_group(- team_id=self.team.pk,- group_type_index=1,- group_key="company:1",- properties={"name": "Plankton"},- )- create_group(- team_id=self.team.pk,- group_type_index=1,- group_key="company:2",- properties={},- )-- response_data = self.client.get(f"/api/projects/{self.team.id}/groups/property_definitions").json()- self.assertEqual(- response_data,- {- "0": [{"name": "industry", "count": 2}, {"name": "name", "count": 1}],- "1": [{"name": "name", "count": 1}],- },- )-def test_property_values(self):create_group(team_id=self.team.pk,diff --git a/frontend/src/models/groupPropertiesModel.ts b/frontend/src/models/groupPropertiesModel.tsdeleted file mode 100644index f3e7a63ddf88..000000000000--- a/frontend/src/models/groupPropertiesModel.ts+++ /dev/null@@ -1,46 +0,0 @@-import { connect, events, kea, path, selectors } from 'kea'-import { loaders } from 'kea-loaders'--import api from 'lib/api'-import { groupsAccessLogic } from 'lib/introductions/groupsAccessLogic'-import { projectLogic } from 'scenes/projectLogic'--import { GroupTypeProperties, PersonProperty } from '~/types'--import type { groupPropertiesModelType } from './groupPropertiesModelType'--export const groupPropertiesModel = kea<groupPropertiesModelType>([- path(['models', 'groupPropertiesModel']),- connect(() => ({- values: [projectLogic, ['currentProjectId'], groupsAccessLogic, ['groupsEnabled']],- })),- loaders(({ values }) => ({- allGroupProperties: [- {} as GroupTypeProperties,- {- loadAllGroupProperties: async () => {- if (values.groupsEnabled) {- return await api.get(`api/projects/${values.currentProjectId}/groups/property_definitions`)- }- return {}- },- },- ],- })),- selectors({- groupProperties: [- (s) => [s.allGroupProperties],- (groupProperties: GroupTypeProperties) =>- (groupTypeIndex: number): Array<PersonProperty> =>- groupProperties[groupTypeIndex] || [],- ],- groupProperties_0: [(s) => [s.allGroupProperties], (groupProperties) => groupProperties['0']],- groupProperties_1: [(s) => [s.allGroupProperties], (groupProperties) => groupProperties['1']],- groupProperties_2: [(s) => [s.allGroupProperties], (groupProperties) => groupProperties['2']],- groupProperties_3: [(s) => [s.allGroupProperties], (groupProperties) => groupProperties['3']],- groupProperties_4: [(s) => [s.allGroupProperties], (groupProperties) => groupProperties['4']],- }),- events(({ actions }) => ({- afterMount: actions.loadAllGroupProperties,- })),-])diff --git a/frontend/src/scenes/funnels/funnelPropertyCorrelationLogic.test.ts b/frontend/src/scenes/funnels/funnelPropertyCorrelationLogic.test.tsindex 2b0e6a31666e..720ee4ee87e3 100644--- a/frontend/src/scenes/funnels/funnelPropertyCorrelationLogic.test.ts+++ b/frontend/src/scenes/funnels/funnelPropertyCorrelationLogic.test.ts@@ -39,13 +39,6 @@ describe('funnelPropertyCorrelationLogic', () => {{ name: 'another property', count: 10 },{ name: 'third property', count: 5 },],- '/api/projects/:team/groups/property_definitions': {- '0': [- { name: 'industry', count: 2 },- { name: 'name', count: 1 },- ],- '1': [{ name: 'name', count: 1 }],- },},patch: {'/api/environments/:id': async ({ request }) => {diff --git a/posthog/settings/web.py b/posthog/settings/web.pyindex 7512cd020430..a7e7c6cf101b 100644--- a/posthog/settings/web.py+++ b/posthog/settings/web.py@@ -704,7 +704,6 @@ GZIP_RESPONSE_ALLOW_LIST = get_list("^/?api/(environments|projects)/\\d+/uploaded_media/?$","^/uploaded_media/.*$","^/api/element/stats/?$",- "^/api/(environments|projects)/\\d+/groups/property_definitions/?$","^/api/(environments|projects)/\\d+/cohorts/?$","^/api/(environments|projects)/\\d+/persons/?$","^/api/organizations/@current/plugins/?$",diff --git a/products/groups/frontend/generated/api.ts b/products/groups/frontend/generated/api.tsindex d1c434aeea83..5d21b88ab873 100644--- a/products/groups/frontend/generated/api.ts+++ b/products/groups/frontend/generated/api.ts@@ -171,17 +171,6 @@ export const groupsFindRetrieve = async (})}-export const getGroupsPropertyDefinitionsRetrieveUrl = (projectId: string) => {- return `/api/projects/${projectId}/groups/property_definitions/`-}--export const groupsPropertyDefinitionsRetrieve = async (projectId: string, options?: RequestInit): Promise<void> => {- return apiMutator<void>(getGroupsPropertyDefinitionsRetrieveUrl(projectId), {- ...options,- method: 'GET',- })-}-export const getGroupsPropertyValuesRetrieveUrl = (projectId: string) => {return `/api/projects/${projectId}/groups/property_values/`}