From 0846ff68cb199f6b6bf1a544f3832f6f005f9712 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Fri, 22 Nov 2024 13:26:38 -0800 Subject: [PATCH 01/80] feat(flags): Set up initial UI-reorganization for feature management --- .../navigation-3000/navigationLogic.tsx | 28 +++++--- frontend/src/lib/constants.tsx | 1 + frontend/src/scenes/appScenes.ts | 1 + .../feature-flags/FeatureManagement.tsx | 35 ++++++++++ .../feature-flags/FeatureManagementScenes.tsx | 63 +++++++++++++++++ .../feature-flags/featureManagementLogic.ts | 67 +++++++++++++++++++ frontend/src/scenes/sceneTypes.ts | 1 + frontend/src/scenes/scenes.ts | 6 ++ frontend/src/scenes/urls.ts | 3 + 9 files changed, 197 insertions(+), 8 deletions(-) create mode 100644 frontend/src/scenes/feature-flags/FeatureManagement.tsx create mode 100644 frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx create mode 100644 frontend/src/scenes/feature-flags/featureManagementLogic.ts diff --git a/frontend/src/layout/navigation-3000/navigationLogic.tsx b/frontend/src/layout/navigation-3000/navigationLogic.tsx index 4a81a00349ca9..d8d38ebf288df 100644 --- a/frontend/src/layout/navigation-3000/navigationLogic.tsx +++ b/frontend/src/layout/navigation-3000/navigationLogic.tsx @@ -475,13 +475,24 @@ export const navigation3000Logic = kea([ tag: 'alpha' as const, } : null, - { - identifier: Scene.FeatureFlags, - label: 'Feature flags', - icon: , - logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, - to: isUsingSidebar ? undefined : urls.featureFlags(), - }, + featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] + ? null + : { + identifier: Scene.FeatureFlags, + label: 'Feature flags', + icon: , + logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, + to: isUsingSidebar ? undefined : urls.featureFlags(), + }, + featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] + ? { + identifier: Scene.FeatureManagement, + label: 'Feature management', + icon: , + logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, + to: isUsingSidebar ? undefined : urls.featureManagement('features'), + } + : null, { identifier: Scene.Experiments, label: 'Experiments', @@ -495,7 +506,8 @@ export const navigation3000Logic = kea([ icon: , to: urls.surveys(), }, - featureFlags[FEATURE_FLAGS.PRODUCT_INTRO_PAGES] !== 'test' || hasOnboardedFeatureFlags + (featureFlags[FEATURE_FLAGS.PRODUCT_INTRO_PAGES] !== 'test' || hasOnboardedFeatureFlags) && + !featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] ? { identifier: Scene.EarlyAccessFeatures, label: 'Early access features', diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx index d9d84f586c12e..6ec5e23da0ee8 100644 --- a/frontend/src/lib/constants.tsx +++ b/frontend/src/lib/constants.tsx @@ -231,6 +231,7 @@ export const FEATURE_FLAGS = { CUSTOM_CHANNEL_TYPE_RULES: 'custom-channel-type-rules', // owner: @robbie-c #team-web-analytics SELF_SERVE_CREDIT_OVERRIDE: 'self-serve-credit-override', // owner: @zach EXPERIMENTS_MIGRATION_DISABLE_UI: 'experiments-migration-disable-ui', // owner: @jurajmajerik #team-experiments + FEATURE_MANAGEMENT_UI: 'feature-management-ui', // owner: @haven #team-feature-flags } as const export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS] diff --git a/frontend/src/scenes/appScenes.ts b/frontend/src/scenes/appScenes.ts index 4a8e63759e124..f8dcf5535fef6 100644 --- a/frontend/src/scenes/appScenes.ts +++ b/frontend/src/scenes/appScenes.ts @@ -30,6 +30,7 @@ export const appScenes: Record any> = { [Scene.Experiments]: () => import('./experiments/Experiments'), [Scene.Experiment]: () => import('./experiments/Experiment'), [Scene.FeatureFlags]: () => import('./feature-flags/FeatureFlags'), + [Scene.FeatureManagement]: () => import('./feature-flags/FeatureManagement'), [Scene.FeatureFlag]: () => import('./feature-flags/FeatureFlag'), [Scene.EarlyAccessFeatures]: () => import('./early-access-features/EarlyAccessFeatures'), [Scene.EarlyAccessFeature]: () => import('./early-access-features/EarlyAccessFeature'), diff --git a/frontend/src/scenes/feature-flags/FeatureManagement.tsx b/frontend/src/scenes/feature-flags/FeatureManagement.tsx new file mode 100644 index 0000000000000..422100c803a89 --- /dev/null +++ b/frontend/src/scenes/feature-flags/FeatureManagement.tsx @@ -0,0 +1,35 @@ +import { useActions, useValues } from 'kea' +import { LemonButton } from 'lib/lemon-ui/LemonButton' +import { SceneExport } from 'scenes/sceneTypes' + +import { featureManagementLogic } from './featureManagementLogic' + +export const scene: SceneExport = { + component: FeatureManagement, + logic: featureManagementLogic, +} + +export function FeatureManagement(): JSX.Element { + const { activeScene, scenes } = useValues(featureManagementLogic) + const { setActiveScene } = useActions(featureManagementLogic) + + return ( +
+
    + {scenes.map((scene) => ( +
  • + setActiveScene(scene)} + size="small" + fullWidth + active={activeScene.id === scene.id} + > + {scene.title} + +
  • + ))} +
+
{activeScene.component}
+
+ ) +} diff --git a/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx b/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx new file mode 100644 index 0000000000000..a805725385dc6 --- /dev/null +++ b/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx @@ -0,0 +1,63 @@ +import { Spinner } from '@posthog/lemon-ui' +import { lazy, Suspense } from 'react' + +const EarlyAccessFeatures = lazy(() => + import('scenes/early-access-features/EarlyAccessFeatures').then((module) => ({ + default: module.EarlyAccessFeatures, + })) +) +const Experiments = lazy(() => + import('scenes/experiments/Experiments').then((module) => ({ default: module.Experiments })) +) +const FeatureFlags = lazy(() => import('./FeatureFlags').then((module) => ({ default: module.FeatureFlags }))) + +export const FEATURE_MANAGEMENT_SCENE_IDS = ['features', 'flags', 'experiments'] as const +export type FeatureManagementSceneId = (typeof FEATURE_MANAGEMENT_SCENE_IDS)[number] + +export type FeatureManagementScene = { + id: FeatureManagementSceneId + title: string + component: JSX.Element +} + +const LoadingSpinner = (): JSX.Element => ( +
+ +
+) + +export const FEATURE_MANAGEMENT_SCENES: FeatureManagementScene[] = [ + { + id: 'features', + title: 'Features', + component: ( + }> + + + ), + }, + { + id: 'flags', + title: 'Flags', + component: ( + }> + + + ), + }, + { + id: 'experiments', + title: 'Experiments', + component: ( + }> + + + ), + }, +] + +export const FEATURE_MANAGEMENT_SCENES_MAP: Record = + FEATURE_MANAGEMENT_SCENES.reduce( + (acc, scene) => ({ ...acc, [scene.id]: scene }), + {} as Record + ) diff --git a/frontend/src/scenes/feature-flags/featureManagementLogic.ts b/frontend/src/scenes/feature-flags/featureManagementLogic.ts new file mode 100644 index 0000000000000..3a18b8a3c0adf --- /dev/null +++ b/frontend/src/scenes/feature-flags/featureManagementLogic.ts @@ -0,0 +1,67 @@ +import { actions, kea, path, props, reducers, selectors } from 'kea' +import { actionToUrl, router, urlToAction } from 'kea-router' +import { Scene } from 'scenes/sceneTypes' +import { urls } from 'scenes/urls' + +import { Breadcrumb } from '~/types' + +import type { featureManagementLogicType } from './featureManagementLogicType' +import { + FEATURE_MANAGEMENT_SCENE_IDS, + FEATURE_MANAGEMENT_SCENES, + FEATURE_MANAGEMENT_SCENES_MAP, + FeatureManagementScene, + FeatureManagementSceneId, +} from './FeatureManagementScenes' + +export const featureManagementLogic = kea([ + props({}), + path(['scenes', 'feature-management', 'featureManagementLogic']), + actions({ + setActiveScene: (activeScene: FeatureManagementScene) => ({ activeScene }), + }), + reducers({ + activeScene: [ + FEATURE_MANAGEMENT_SCENES[0], + { + setActiveScene: (_, { activeScene }) => activeScene, + }, + ], + }), + selectors({ + scenes: [() => [], () => FEATURE_MANAGEMENT_SCENES], + breadcrumbs: [ + (s) => [s.activeScene, s.scenes], + (activeScene, scenes): Breadcrumb[] => [ + { + key: Scene.FeatureManagement, + name: 'Feature management', + path: urls.featureManagement('features'), + }, + { + key: [Scene.FeatureManagement, activeScene.id], + name: scenes.find((scene) => scene.id === activeScene.id)?.title, + }, + ], + ], + }), + actionToUrl({ + setActiveScene: ({ activeScene }) => { + return urls.featureManagement(activeScene.id) + }, + }), + urlToAction(({ actions, values }) => ({ + '/feature-management': () => { + router.actions.push('/feature-management/features') + }, + '/feature-management/:sceneId': ({ sceneId }) => { + if (sceneId && values.activeScene.id !== sceneId) { + if (sceneId in FEATURE_MANAGEMENT_SCENE_IDS) { + actions.setActiveScene(FEATURE_MANAGEMENT_SCENES_MAP[sceneId as FeatureManagementSceneId]) + } else { + actions.setActiveScene(FEATURE_MANAGEMENT_SCENES_MAP['features']) + } + } + }, + })), +]) diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.ts index 2c0d227e5ba88..0b6512291276b 100644 --- a/frontend/src/scenes/sceneTypes.ts +++ b/frontend/src/scenes/sceneTypes.ts @@ -35,6 +35,7 @@ export enum Scene { Action = 'Action', Experiments = 'Experiments', Experiment = 'Experiment', + FeatureManagement = 'FeatureManagement', FeatureFlags = 'FeatureFlags', FeatureFlag = 'FeatureFlag', EarlyAccessFeatures = 'EarlyAccessFeatures', diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.ts index 9f6309458496a..49f7a9b9fa421 100644 --- a/frontend/src/scenes/scenes.ts +++ b/frontend/src/scenes/scenes.ts @@ -206,6 +206,11 @@ export const sceneConfigurations: Record = { activityScope: ActivityScope.FEATURE_FLAG, defaultDocsPath: '/docs/feature-flags/creating-feature-flags', }, + [Scene.FeatureManagement]: { + projectBased: true, + name: 'Feature management', + defaultDocsPath: '/docs/feature-flags', + }, [Scene.Surveys]: { projectBased: true, name: 'Surveys', @@ -561,6 +566,7 @@ export const routes: Record = { [urls.sqlEditor()]: Scene.SQLEditor, [urls.featureFlags()]: Scene.FeatureFlags, [urls.featureFlag(':id')]: Scene.FeatureFlag, + [urls.featureManagement(':sceneId')]: Scene.FeatureManagement, [urls.annotations()]: Scene.DataManagement, [urls.annotation(':id')]: Scene.DataManagement, [urls.projectHomepage()]: Scene.ProjectHomepage, diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.ts index ccd4b7a482ff8..2b69232d646b5 100644 --- a/frontend/src/scenes/urls.ts +++ b/frontend/src/scenes/urls.ts @@ -20,6 +20,7 @@ import { SDKKey, } from '~/types' +import { FeatureManagementSceneId } from './feature-flags/FeatureManagementScenes' import { OnboardingStepKey } from './onboarding/onboardingLogic' import { SettingId, SettingLevelId, SettingSectionId } from './settings/types' import { SurveysTabs } from './surveys/surveysLogic' @@ -159,6 +160,8 @@ export const urls = { experiments: (): string => '/experiments', featureFlags: (tab?: string): string => `/feature_flags${tab ? `?tab=${tab}` : ''}`, featureFlag: (id: string | number): string => `/feature_flags/${id}`, + featureManagement: (scene: FeatureManagementSceneId | ':sceneId' = 'features'): string => + `/feature-management/${scene}`, earlyAccessFeatures: (): string => '/early_access_features', /** @param id A UUID or 'new'. ':id' for routing. */ earlyAccessFeature: (id: string): string => `/early_access_features/${id}`, From b34565208b8a86ca625e2cb213724257ef13bebf Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Fri, 22 Nov 2024 13:27:24 -0800 Subject: [PATCH 02/80] tweak --- frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx b/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx index a805725385dc6..12f2334615d67 100644 --- a/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx +++ b/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx @@ -1,4 +1,4 @@ -import { Spinner } from '@posthog/lemon-ui' +import { Spinner } from 'lib/lemon-ui/Spinner' import { lazy, Suspense } from 'react' const EarlyAccessFeatures = lazy(() => From 0e42571eafeba897eccd55127a2533355c9995b4 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Fri, 22 Nov 2024 16:04:14 -0800 Subject: [PATCH 03/80] properly handle New Feature / New Flag -> Cancel navigation --- .../src/scenes/early-access-features/EarlyAccessFeature.tsx | 5 +++++ frontend/src/scenes/feature-flags/FeatureFlag.tsx | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx b/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx index fffe0a16abfdc..ae701d9ac3a7d 100644 --- a/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx +++ b/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx @@ -62,6 +62,7 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element { const isNewEarlyAccessFeature = id === 'new' || id === undefined const showLinkedHogFunctions = useFeatureFlag('HOG_FUNCTIONS_LINKED') + const isFeatureManagementUiEnabled = useFeatureFlag('FEATURE_MANAGEMENT_UI') if (earlyAccessFeatureMissing) { return @@ -107,6 +108,10 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element { editFeature(false) loadEarlyAccessFeature() } else { + if (isFeatureManagementUiEnabled) { + router.actions.replace(urls.featureManagement('features')) + return + } router.actions.push(urls.earlyAccessFeatures()) } }} diff --git a/frontend/src/scenes/feature-flags/FeatureFlag.tsx b/frontend/src/scenes/feature-flags/FeatureFlag.tsx index c2b534403c5b2..55b1323f7d306 100644 --- a/frontend/src/scenes/feature-flags/FeatureFlag.tsx +++ b/frontend/src/scenes/feature-flags/FeatureFlag.tsx @@ -261,7 +261,11 @@ export function FeatureFlag({ id }: { id?: string } = {}): JSX.Element { editFeatureFlag(false) loadFeatureFlag() } else { - router.actions.push(urls.featureFlags()) + if (featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI]) { + router.actions.replace(urls.featureManagement('flags')) + return + } + router.actions.replace(urls.featureFlags()) } }} > From 32a11e2d6bd0e5cb15385c57486c603684304168 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Fri, 22 Nov 2024 16:19:13 -0800 Subject: [PATCH 04/80] handle breadcrumbs properly based on ff --- .../earlyAccessFeatureLogic.ts | 31 ++++++++++++++----- .../scenes/experiments/experimentLogic.tsx | 20 +++++++----- .../scenes/feature-flags/featureFlagLogic.ts | 21 ++++++++----- 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/frontend/src/scenes/early-access-features/earlyAccessFeatureLogic.ts b/frontend/src/scenes/early-access-features/earlyAccessFeatureLogic.ts index 3604d86bcb4f9..bf78c5aec5afc 100644 --- a/frontend/src/scenes/early-access-features/earlyAccessFeatureLogic.ts +++ b/frontend/src/scenes/early-access-features/earlyAccessFeatureLogic.ts @@ -4,6 +4,8 @@ import { forms } from 'kea-forms' import { loaders } from 'kea-loaders' import { router, urlToAction } from 'kea-router' import api from 'lib/api' +import { FEATURE_FLAGS } from 'lib/constants' +import { featureFlagLogic } from 'lib/logic/featureFlagLogic' import { Scene } from 'scenes/sceneTypes' import { teamLogic } from 'scenes/teamLogic' import { urls } from 'scenes/urls' @@ -37,7 +39,14 @@ export const earlyAccessFeatureLogic = kea([ props({} as EarlyAccessFeatureLogicProps), key(({ id }) => id), connect(() => ({ - values: [teamLogic, ['currentTeamId'], earlyAccessFeaturesLogic, ['earlyAccessFeatures']], + values: [ + teamLogic, + ['currentTeamId'], + earlyAccessFeaturesLogic, + ['earlyAccessFeatures'], + featureFlagLogic, + ['featureFlags'], + ], actions: [earlyAccessFeaturesLogic, ['loadEarlyAccessFeatures', 'loadEarlyAccessFeaturesSuccess']], })), actions({ @@ -121,13 +130,19 @@ export const earlyAccessFeatureLogic = kea([ selectors({ mode: [(_, p) => [p.id], (id): 'view' | 'edit' => (id === 'new' ? 'edit' : 'view')], breadcrumbs: [ - (s) => [s.earlyAccessFeature], - (earlyAccessFeature: EarlyAccessFeatureType): Breadcrumb[] => [ - { - key: Scene.EarlyAccessFeatures, - name: 'Early Access Management', - path: urls.earlyAccessFeatures(), - }, + (s) => [s.earlyAccessFeature, s.featureFlags], + (earlyAccessFeature: EarlyAccessFeatureType, featureFlags): Breadcrumb[] => [ + featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] + ? { + key: Scene.FeatureManagement, + name: 'Feature management', + path: urls.featureManagement('features'), + } + : { + key: Scene.EarlyAccessFeatures, + name: 'Early Access Management', + path: urls.earlyAccessFeatures(), + }, { key: [Scene.EarlyAccessFeature, earlyAccessFeature.id || 'new'], name: earlyAccessFeature.name, diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx index 230c97ec654f0..9d59639701690 100644 --- a/frontend/src/scenes/experiments/experimentLogic.tsx +++ b/frontend/src/scenes/experiments/experimentLogic.tsx @@ -1006,13 +1006,19 @@ export const experimentLogic = kea([ }, ], breadcrumbs: [ - (s) => [s.experiment, s.experimentId], - (experiment, experimentId): Breadcrumb[] => [ - { - key: Scene.Experiments, - name: 'Experiments', - path: urls.experiments(), - }, + (s) => [s.experiment, s.experimentId, s.featureFlags], + (experiment, experimentId, featureFlags): Breadcrumb[] => [ + featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] + ? { + key: Scene.FeatureManagement, + name: 'Feature management', + path: urls.featureManagement('experiments'), + } + : { + key: Scene.Experiments, + name: 'Experiments', + path: urls.experiments(), + }, { key: [Scene.Experiment, experimentId], name: experiment?.name || '', diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts index 875b6f56cf81a..c420f26f525e8 100644 --- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts +++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts @@ -3,6 +3,7 @@ import { DeepPartialMap, forms, ValidationErrorType } from 'kea-forms' import { loaders } from 'kea-loaders' import { router, urlToAction } from 'kea-router' import api, { PaginatedResponse } from 'lib/api' +import { FEATURE_FLAGS } from 'lib/constants' import { dayjs } from 'lib/dayjs' import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast' import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic' @@ -942,13 +943,19 @@ export const featureFlagLogic = kea([ }, ], breadcrumbs: [ - (s) => [s.featureFlag], - (featureFlag): Breadcrumb[] => [ - { - key: Scene.FeatureFlags, - name: 'Feature Flags', - path: urls.featureFlags(), - }, + (s) => [s.featureFlag, s.enabledFeatures], + (featureFlag, enabledFeatures): Breadcrumb[] => [ + enabledFeatures[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] + ? { + key: Scene.FeatureManagement, + name: 'Feature management', + path: urls.featureManagement('flags'), + } + : { + key: Scene.FeatureFlags, + name: 'Feature Flags', + path: urls.featureFlags(), + }, { key: [Scene.FeatureFlag, featureFlag.id || 'unknown'], name: featureFlag.key || 'Unnamed' }, ], ], From b2c36b853951b48debfe82bb36fbc082dca099e7 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 25 Nov 2024 17:04:09 -0800 Subject: [PATCH 05/80] cleanup --- .../EarlyAccessFeature.tsx | 5 --- .../earlyAccessFeatureLogic.ts | 31 ++++--------- .../scenes/experiments/experimentLogic.tsx | 20 +++------ .../src/scenes/feature-flags/FeatureFlag.tsx | 44 ++++++++----------- .../scenes/feature-flags/featureFlagLogic.ts | 21 +++------ 5 files changed, 41 insertions(+), 80 deletions(-) diff --git a/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx b/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx index ae701d9ac3a7d..fffe0a16abfdc 100644 --- a/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx +++ b/frontend/src/scenes/early-access-features/EarlyAccessFeature.tsx @@ -62,7 +62,6 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element { const isNewEarlyAccessFeature = id === 'new' || id === undefined const showLinkedHogFunctions = useFeatureFlag('HOG_FUNCTIONS_LINKED') - const isFeatureManagementUiEnabled = useFeatureFlag('FEATURE_MANAGEMENT_UI') if (earlyAccessFeatureMissing) { return @@ -108,10 +107,6 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element { editFeature(false) loadEarlyAccessFeature() } else { - if (isFeatureManagementUiEnabled) { - router.actions.replace(urls.featureManagement('features')) - return - } router.actions.push(urls.earlyAccessFeatures()) } }} diff --git a/frontend/src/scenes/early-access-features/earlyAccessFeatureLogic.ts b/frontend/src/scenes/early-access-features/earlyAccessFeatureLogic.ts index bf78c5aec5afc..3604d86bcb4f9 100644 --- a/frontend/src/scenes/early-access-features/earlyAccessFeatureLogic.ts +++ b/frontend/src/scenes/early-access-features/earlyAccessFeatureLogic.ts @@ -4,8 +4,6 @@ import { forms } from 'kea-forms' import { loaders } from 'kea-loaders' import { router, urlToAction } from 'kea-router' import api from 'lib/api' -import { FEATURE_FLAGS } from 'lib/constants' -import { featureFlagLogic } from 'lib/logic/featureFlagLogic' import { Scene } from 'scenes/sceneTypes' import { teamLogic } from 'scenes/teamLogic' import { urls } from 'scenes/urls' @@ -39,14 +37,7 @@ export const earlyAccessFeatureLogic = kea([ props({} as EarlyAccessFeatureLogicProps), key(({ id }) => id), connect(() => ({ - values: [ - teamLogic, - ['currentTeamId'], - earlyAccessFeaturesLogic, - ['earlyAccessFeatures'], - featureFlagLogic, - ['featureFlags'], - ], + values: [teamLogic, ['currentTeamId'], earlyAccessFeaturesLogic, ['earlyAccessFeatures']], actions: [earlyAccessFeaturesLogic, ['loadEarlyAccessFeatures', 'loadEarlyAccessFeaturesSuccess']], })), actions({ @@ -130,19 +121,13 @@ export const earlyAccessFeatureLogic = kea([ selectors({ mode: [(_, p) => [p.id], (id): 'view' | 'edit' => (id === 'new' ? 'edit' : 'view')], breadcrumbs: [ - (s) => [s.earlyAccessFeature, s.featureFlags], - (earlyAccessFeature: EarlyAccessFeatureType, featureFlags): Breadcrumb[] => [ - featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] - ? { - key: Scene.FeatureManagement, - name: 'Feature management', - path: urls.featureManagement('features'), - } - : { - key: Scene.EarlyAccessFeatures, - name: 'Early Access Management', - path: urls.earlyAccessFeatures(), - }, + (s) => [s.earlyAccessFeature], + (earlyAccessFeature: EarlyAccessFeatureType): Breadcrumb[] => [ + { + key: Scene.EarlyAccessFeatures, + name: 'Early Access Management', + path: urls.earlyAccessFeatures(), + }, { key: [Scene.EarlyAccessFeature, earlyAccessFeature.id || 'new'], name: earlyAccessFeature.name, diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx index 9d59639701690..230c97ec654f0 100644 --- a/frontend/src/scenes/experiments/experimentLogic.tsx +++ b/frontend/src/scenes/experiments/experimentLogic.tsx @@ -1006,19 +1006,13 @@ export const experimentLogic = kea([ }, ], breadcrumbs: [ - (s) => [s.experiment, s.experimentId, s.featureFlags], - (experiment, experimentId, featureFlags): Breadcrumb[] => [ - featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] - ? { - key: Scene.FeatureManagement, - name: 'Feature management', - path: urls.featureManagement('experiments'), - } - : { - key: Scene.Experiments, - name: 'Experiments', - path: urls.experiments(), - }, + (s) => [s.experiment, s.experimentId], + (experiment, experimentId): Breadcrumb[] => [ + { + key: Scene.Experiments, + name: 'Experiments', + path: urls.experiments(), + }, { key: [Scene.Experiment, experimentId], name: experiment?.name || '', diff --git a/frontend/src/scenes/feature-flags/FeatureFlag.tsx b/frontend/src/scenes/feature-flags/FeatureFlag.tsx index 5c55ff9d0fbf8..c2b534403c5b2 100644 --- a/frontend/src/scenes/feature-flags/FeatureFlag.tsx +++ b/frontend/src/scenes/feature-flags/FeatureFlag.tsx @@ -261,11 +261,7 @@ export function FeatureFlag({ id }: { id?: string } = {}): JSX.Element { editFeatureFlag(false) loadFeatureFlag() } else { - if (featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI]) { - router.actions.replace(urls.featureManagement('flags')) - return - } - router.actions.replace(urls.featureFlags()) + router.actions.push(urls.featureFlags()) } }} > @@ -400,7 +396,7 @@ export function FeatureFlag({ id }: { id?: string } = {}): JSX.Element { - + )} - {id !== 'new' && ( -
-

Recordings

-

Watch recordings of people who have been exposed to the feature flag.

-
- { - reportViewRecordingsClicked() - router.actions.push(urls.replay(ReplayTabs.Home, recordingFilterForFlag)) - }} - icon={} - type="secondary" - size="small" - > - View recordings - -
+
+

Recordings

+

Watch recordings of people who have been exposed to the feature flag.

+
+ { + reportViewRecordingsClicked() + router.actions.push(urls.replay(ReplayTabs.Home, recordingFilterForFlag)) + }} + icon={} + type="secondary" + size="small" + > + View recordings +
- )} +
)} {!readOnly && multivariateEnabled && ( diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts index c420f26f525e8..875b6f56cf81a 100644 --- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts +++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts @@ -3,7 +3,6 @@ import { DeepPartialMap, forms, ValidationErrorType } from 'kea-forms' import { loaders } from 'kea-loaders' import { router, urlToAction } from 'kea-router' import api, { PaginatedResponse } from 'lib/api' -import { FEATURE_FLAGS } from 'lib/constants' import { dayjs } from 'lib/dayjs' import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast' import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic' @@ -943,19 +942,13 @@ export const featureFlagLogic = kea([ }, ], breadcrumbs: [ - (s) => [s.featureFlag, s.enabledFeatures], - (featureFlag, enabledFeatures): Breadcrumb[] => [ - enabledFeatures[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] - ? { - key: Scene.FeatureManagement, - name: 'Feature management', - path: urls.featureManagement('flags'), - } - : { - key: Scene.FeatureFlags, - name: 'Feature Flags', - path: urls.featureFlags(), - }, + (s) => [s.featureFlag], + (featureFlag): Breadcrumb[] => [ + { + key: Scene.FeatureFlags, + name: 'Feature Flags', + path: urls.featureFlags(), + }, { key: [Scene.FeatureFlag, featureFlag.id || 'unknown'], name: featureFlag.key || 'Unnamed' }, ], ], From 745bad18013a048230a68b41766edd03e3adee72 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 25 Nov 2024 17:07:24 -0800 Subject: [PATCH 06/80] tweak --- .../navigation-3000/navigationLogic.tsx | 38 +++++++++---------- frontend/src/scenes/scenes.ts | 2 +- frontend/src/scenes/urls.ts | 3 +- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/frontend/src/layout/navigation-3000/navigationLogic.tsx b/frontend/src/layout/navigation-3000/navigationLogic.tsx index d8d38ebf288df..739c63cd946d0 100644 --- a/frontend/src/layout/navigation-3000/navigationLogic.tsx +++ b/frontend/src/layout/navigation-3000/navigationLogic.tsx @@ -4,6 +4,7 @@ import { IconDashboard, IconDatabase, IconDecisionTree, + IconFeatures, IconGraph, IconHome, IconLive, @@ -384,6 +385,15 @@ export const navigation3000Logic = kea([ }, }, }, + featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] + ? { + identifier: Scene.FeatureManagement, + label: 'Features', + icon: , + logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, + to: isUsingSidebar ? undefined : urls.featureManagement('features'), + } + : null, { identifier: Scene.Notebooks, label: 'Notebooks', @@ -475,24 +485,13 @@ export const navigation3000Logic = kea([ tag: 'alpha' as const, } : null, - featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] - ? null - : { - identifier: Scene.FeatureFlags, - label: 'Feature flags', - icon: , - logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, - to: isUsingSidebar ? undefined : urls.featureFlags(), - }, - featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] - ? { - identifier: Scene.FeatureManagement, - label: 'Feature management', - icon: , - logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, - to: isUsingSidebar ? undefined : urls.featureManagement('features'), - } - : null, + { + identifier: Scene.FeatureFlags, + label: 'Feature flags', + icon: , + logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, + to: isUsingSidebar ? undefined : urls.featureFlags(), + }, { identifier: Scene.Experiments, label: 'Experiments', @@ -506,8 +505,7 @@ export const navigation3000Logic = kea([ icon: , to: urls.surveys(), }, - (featureFlags[FEATURE_FLAGS.PRODUCT_INTRO_PAGES] !== 'test' || hasOnboardedFeatureFlags) && - !featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] + featureFlags[FEATURE_FLAGS.PRODUCT_INTRO_PAGES] !== 'test' || hasOnboardedFeatureFlags ? { identifier: Scene.EarlyAccessFeatures, label: 'Early access features', diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.ts index adf0712f2eed4..752a0903d264b 100644 --- a/frontend/src/scenes/scenes.ts +++ b/frontend/src/scenes/scenes.ts @@ -576,7 +576,7 @@ export const routes: Record = { [urls.sqlEditor()]: Scene.SQLEditor, [urls.featureFlags()]: Scene.FeatureFlags, [urls.featureFlag(':id')]: Scene.FeatureFlag, - [urls.featureManagement(':sceneId')]: Scene.FeatureManagement, + [urls.featureManagement(':id')]: Scene.FeatureManagement, [urls.annotations()]: Scene.DataManagement, [urls.annotation(':id')]: Scene.DataManagement, [urls.projectHomepage()]: Scene.ProjectHomepage, diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.ts index b8e657495ead6..62db2a1f57b46 100644 --- a/frontend/src/scenes/urls.ts +++ b/frontend/src/scenes/urls.ts @@ -160,8 +160,7 @@ export const urls = { experiments: (): string => '/experiments', featureFlags: (tab?: string): string => `/feature_flags${tab ? `?tab=${tab}` : ''}`, featureFlag: (id: string | number): string => `/feature_flags/${id}`, - featureManagement: (scene: FeatureManagementSceneId | ':sceneId' = 'features'): string => - `/feature-management/${scene}`, + featureManagement: (id: ':id' | FeatureManagementSceneId): string => `/features/${id}`, earlyAccessFeatures: (): string => '/early_access_features', /** @param id A UUID or 'new'. ':id' for routing. */ earlyAccessFeature: (id: string): string => `/early_access_features/${id}`, From dbba27ec977ee23a45780343357b93a8c244ba19 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 25 Nov 2024 17:10:51 -0800 Subject: [PATCH 07/80] tweak --- .../src/scenes/feature-flags/FeatureFlag.tsx | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/frontend/src/scenes/feature-flags/FeatureFlag.tsx b/frontend/src/scenes/feature-flags/FeatureFlag.tsx index c2b534403c5b2..f3731b149a1cc 100644 --- a/frontend/src/scenes/feature-flags/FeatureFlag.tsx +++ b/frontend/src/scenes/feature-flags/FeatureFlag.tsx @@ -396,7 +396,7 @@ export function FeatureFlag({ id }: { id?: string } = {}): JSX.Element { - + )} -
-

Recordings

-

Watch recordings of people who have been exposed to the feature flag.

-
- { - reportViewRecordingsClicked() - router.actions.push(urls.replay(ReplayTabs.Home, recordingFilterForFlag)) - }} - icon={} - type="secondary" - size="small" - > - View recordings - + {id !== 'new' && ( +
+

Recordings

+

Watch recordings of people who have been exposed to the feature flag.

+
+ { + reportViewRecordingsClicked() + router.actions.push(urls.replay(ReplayTabs.Home, recordingFilterForFlag)) + }} + icon={} + type="secondary" + size="small" + > + View recordings + +
-
+ )}
)} {!readOnly && multivariateEnabled && ( From 4419ec0a5d6c4b7ab4c87d24395efe9c6aabec0b Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 26 Nov 2024 15:22:11 -0800 Subject: [PATCH 08/80] tweak --- .../feature-flags/FeatureManagementScenes.tsx | 26 ++----------------- .../feature-flags/featureManagementLogic.ts | 4 +-- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx b/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx index 12f2334615d67..de75173d8e1e5 100644 --- a/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx +++ b/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx @@ -6,12 +6,8 @@ const EarlyAccessFeatures = lazy(() => default: module.EarlyAccessFeatures, })) ) -const Experiments = lazy(() => - import('scenes/experiments/Experiments').then((module) => ({ default: module.Experiments })) -) -const FeatureFlags = lazy(() => import('./FeatureFlags').then((module) => ({ default: module.FeatureFlags }))) -export const FEATURE_MANAGEMENT_SCENE_IDS = ['features', 'flags', 'experiments'] as const +export const FEATURE_MANAGEMENT_SCENE_IDS = ['new'] as const export type FeatureManagementSceneId = (typeof FEATURE_MANAGEMENT_SCENE_IDS)[number] export type FeatureManagementScene = { @@ -28,7 +24,7 @@ const LoadingSpinner = (): JSX.Element => ( export const FEATURE_MANAGEMENT_SCENES: FeatureManagementScene[] = [ { - id: 'features', + id: 'new', title: 'Features', component: ( }> @@ -36,24 +32,6 @@ export const FEATURE_MANAGEMENT_SCENES: FeatureManagementScene[] = [ ), }, - { - id: 'flags', - title: 'Flags', - component: ( - }> - - - ), - }, - { - id: 'experiments', - title: 'Experiments', - component: ( - }> - - - ), - }, ] export const FEATURE_MANAGEMENT_SCENES_MAP: Record = diff --git a/frontend/src/scenes/feature-flags/featureManagementLogic.ts b/frontend/src/scenes/feature-flags/featureManagementLogic.ts index 3a18b8a3c0adf..63f1b3a76b647 100644 --- a/frontend/src/scenes/feature-flags/featureManagementLogic.ts +++ b/frontend/src/scenes/feature-flags/featureManagementLogic.ts @@ -35,8 +35,8 @@ export const featureManagementLogic = kea([ (activeScene, scenes): Breadcrumb[] => [ { key: Scene.FeatureManagement, - name: 'Feature management', - path: urls.featureManagement('features'), + name: 'Features', + path: urls.features(), }, { key: [Scene.FeatureManagement, activeScene.id], From e98fc0de754a30634fb873950f9a4e1e1f706734 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 2 Dec 2024 17:18:11 -0800 Subject: [PATCH 09/80] Re-worked with master-detail pattern --- .../navigation-3000/navigationLogic.tsx | 4 +- .../feature-flags/FeatureManagement.tsx | 19 +-- .../feature-flags/FeatureManagementDetail.tsx | 86 +++++++++++ .../feature-flags/FeatureManagementScenes.tsx | 41 ------ .../featureManagementDetailLogic.ts | 13 ++ .../feature-flags/featureManagementLogic.ts | 134 ++++++++++++------ frontend/src/scenes/scenes.ts | 3 +- frontend/src/scenes/urls.ts | 3 +- frontend/src/types.ts | 5 + 9 files changed, 213 insertions(+), 95 deletions(-) create mode 100644 frontend/src/scenes/feature-flags/FeatureManagementDetail.tsx delete mode 100644 frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx create mode 100644 frontend/src/scenes/feature-flags/featureManagementDetailLogic.ts diff --git a/frontend/src/layout/navigation-3000/navigationLogic.tsx b/frontend/src/layout/navigation-3000/navigationLogic.tsx index 739c63cd946d0..c40cfe4750de2 100644 --- a/frontend/src/layout/navigation-3000/navigationLogic.tsx +++ b/frontend/src/layout/navigation-3000/navigationLogic.tsx @@ -391,7 +391,7 @@ export const navigation3000Logic = kea([ label: 'Features', icon: , logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, - to: isUsingSidebar ? undefined : urls.featureManagement('features'), + to: isUsingSidebar ? undefined : urls.featureManagement(), } : null, { @@ -420,7 +420,7 @@ export const navigation3000Logic = kea([ icon: , to: urls.activity(), }, - ] + ].filter(isNotNil) : [ { identifier: Scene.Products, diff --git a/frontend/src/scenes/feature-flags/FeatureManagement.tsx b/frontend/src/scenes/feature-flags/FeatureManagement.tsx index 422100c803a89..188143b6961d6 100644 --- a/frontend/src/scenes/feature-flags/FeatureManagement.tsx +++ b/frontend/src/scenes/feature-flags/FeatureManagement.tsx @@ -2,6 +2,7 @@ import { useActions, useValues } from 'kea' import { LemonButton } from 'lib/lemon-ui/LemonButton' import { SceneExport } from 'scenes/sceneTypes' +import { FeatureManagementDetail } from './FeatureManagementDetail' import { featureManagementLogic } from './featureManagementLogic' export const scene: SceneExport = { @@ -10,26 +11,28 @@ export const scene: SceneExport = { } export function FeatureManagement(): JSX.Element { - const { activeScene, scenes } = useValues(featureManagementLogic) - const { setActiveScene } = useActions(featureManagementLogic) + const { activeFeatureId, features } = useValues(featureManagementLogic) + const { setActiveFeatureId } = useActions(featureManagementLogic) return (
    - {scenes.map((scene) => ( -
  • + {features.results.map((feature) => ( +
  • setActiveScene(scene)} + onClick={() => setActiveFeatureId(feature.id)} size="small" fullWidth - active={activeScene.id === scene.id} + active={activeFeatureId === feature.id} > - {scene.title} + {feature.name}
  • ))}
-
{activeScene.component}
+
+ +
) } diff --git a/frontend/src/scenes/feature-flags/FeatureManagementDetail.tsx b/frontend/src/scenes/feature-flags/FeatureManagementDetail.tsx new file mode 100644 index 0000000000000..73c5776094983 --- /dev/null +++ b/frontend/src/scenes/feature-flags/FeatureManagementDetail.tsx @@ -0,0 +1,86 @@ +import { LemonSkeleton } from '@posthog/lemon-ui' +import { useValues } from 'kea' + +import { featureManagementDetailLogic } from './featureManagementDetailLogic' + +function Metadata(): JSX.Element { + return ( +
+

Metadata

+ + + +
+ ) +} + +function Rollout(): JSX.Element { + return ( +
+

Rollout

+ + + +
+ ) +} + +function Usage(): JSX.Element { + return ( +
+

Usage

+ + + +
+ ) +} + +function Activity(): JSX.Element { + return ( +
+

Activity

+ + + +
+ ) +} + +function History(): JSX.Element { + return ( +
+

History

+ + + +
+ ) +} + +function Permissions(): JSX.Element { + return ( +
+

Permissions

+ + + +
+ ) +} + +export function FeatureManagementDetail(): JSX.Element { + const { activeFeature } = useValues(featureManagementDetailLogic) + + return ( +
+
{activeFeature?.name}
+ + + + + + +
+ ) +} diff --git a/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx b/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx deleted file mode 100644 index de75173d8e1e5..0000000000000 --- a/frontend/src/scenes/feature-flags/FeatureManagementScenes.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { Spinner } from 'lib/lemon-ui/Spinner' -import { lazy, Suspense } from 'react' - -const EarlyAccessFeatures = lazy(() => - import('scenes/early-access-features/EarlyAccessFeatures').then((module) => ({ - default: module.EarlyAccessFeatures, - })) -) - -export const FEATURE_MANAGEMENT_SCENE_IDS = ['new'] as const -export type FeatureManagementSceneId = (typeof FEATURE_MANAGEMENT_SCENE_IDS)[number] - -export type FeatureManagementScene = { - id: FeatureManagementSceneId - title: string - component: JSX.Element -} - -const LoadingSpinner = (): JSX.Element => ( -
- -
-) - -export const FEATURE_MANAGEMENT_SCENES: FeatureManagementScene[] = [ - { - id: 'new', - title: 'Features', - component: ( - }> - - - ), - }, -] - -export const FEATURE_MANAGEMENT_SCENES_MAP: Record = - FEATURE_MANAGEMENT_SCENES.reduce( - (acc, scene) => ({ ...acc, [scene.id]: scene }), - {} as Record - ) diff --git a/frontend/src/scenes/feature-flags/featureManagementDetailLogic.ts b/frontend/src/scenes/feature-flags/featureManagementDetailLogic.ts new file mode 100644 index 0000000000000..7181584929b64 --- /dev/null +++ b/frontend/src/scenes/feature-flags/featureManagementDetailLogic.ts @@ -0,0 +1,13 @@ +import { connect, kea, path, props } from 'kea' +import { teamLogic } from 'scenes/teamLogic' + +import { featureManagementDetailLogicType } from './featureManagementDetailLogicType' +import { featureManagementLogic } from './featureManagementLogic' + +export const featureManagementDetailLogic = kea([ + props({}), + path(['scenes', 'features', 'featureManagementDetailLogic']), + connect({ + values: [teamLogic, ['currentTeamId'], featureManagementLogic, ['activeFeatureId', 'activeFeature']], + }), +]) diff --git a/frontend/src/scenes/feature-flags/featureManagementLogic.ts b/frontend/src/scenes/feature-flags/featureManagementLogic.ts index 63f1b3a76b647..f3a5579a70672 100644 --- a/frontend/src/scenes/feature-flags/featureManagementLogic.ts +++ b/frontend/src/scenes/feature-flags/featureManagementLogic.ts @@ -1,67 +1,119 @@ -import { actions, kea, path, props, reducers, selectors } from 'kea' -import { actionToUrl, router, urlToAction } from 'kea-router' +import { actions, afterMount, connect, kea, listeners, path, props, reducers, selectors } from 'kea' +import { loaders } from 'kea-loaders' +import { actionToUrl, urlToAction } from 'kea-router' import { Scene } from 'scenes/sceneTypes' +import { teamLogic } from 'scenes/teamLogic' import { urls } from 'scenes/urls' -import { Breadcrumb } from '~/types' +import { Breadcrumb, Feature } from '~/types' import type { featureManagementLogicType } from './featureManagementLogicType' -import { - FEATURE_MANAGEMENT_SCENE_IDS, - FEATURE_MANAGEMENT_SCENES, - FEATURE_MANAGEMENT_SCENES_MAP, - FeatureManagementScene, - FeatureManagementSceneId, -} from './FeatureManagementScenes' + +export interface FeatureManagementLogicProps { + id?: Feature['id'] +} +export interface FeaturesResult { + results: Feature[] + count: number + next?: string | null + previous?: string | null +} export const featureManagementLogic = kea([ - props({}), - path(['scenes', 'feature-management', 'featureManagementLogic']), + props({} as FeatureManagementLogicProps), + path(['scenes', 'features', 'featureManagementLogic']), + connect({ + values: [teamLogic, ['currentTeamId']], + }), actions({ - setActiveScene: (activeScene: FeatureManagementScene) => ({ activeScene }), + setActiveFeatureId: (activeFeatureId: Feature['id']) => ({ activeFeatureId }), }), reducers({ - activeScene: [ - FEATURE_MANAGEMENT_SCENES[0], + activeFeatureId: [ + null as Feature['id'] | null, { - setActiveScene: (_, { activeScene }) => activeScene, + setActiveFeatureId: (_, { activeFeatureId }) => activeFeatureId, }, ], }), + loaders(() => ({ + features: [ + { results: [], count: 0, offset: 0 } as FeaturesResult, + { + loadFeatures: async () => { + const mockResponse = { + results: [ + { + id: 1, + name: 'SSO Login', + }, + { + id: 2, + name: 'QR Code Scanner', + }, + { + id: 3, + name: 'AR Experience', + }, + ], + count: 3, + offset: 0, + } + + // const response = await api.get(`api/projects/${values.currentTeamId}/features`) + return mockResponse as FeaturesResult + }, + }, + ], + })), selectors({ - scenes: [() => [], () => FEATURE_MANAGEMENT_SCENES], + activeFeature: [ + (s) => [s.activeFeatureId, s.features], + (activeFeatureId, features) => features.results.find((feature) => feature.id === activeFeatureId) || null, + ], breadcrumbs: [ - (s) => [s.activeScene, s.scenes], - (activeScene, scenes): Breadcrumb[] => [ - { - key: Scene.FeatureManagement, - name: 'Features', - path: urls.features(), - }, - { - key: [Scene.FeatureManagement, activeScene.id], - name: scenes.find((scene) => scene.id === activeScene.id)?.title, - }, - ], + (s) => [s.activeFeatureId, s.activeFeature], + (activeFeatureId, activeFeature): Breadcrumb[] => { + const breadcrumbs: Breadcrumb[] = [ + { + key: Scene.FeatureManagement, + name: 'Features', + path: urls.featureManagement(), + }, + ] + + if (activeFeatureId) { + breadcrumbs.push({ + key: [Scene.FeatureManagement, activeFeatureId], + name: activeFeature?.name ?? 'Feature', + path: urls.featureManagement(String(activeFeatureId)), + }) + } + + return breadcrumbs + }, ], }), + listeners(({ actions, values }) => ({ + loadFeaturesSuccess: ({ features }) => { + if (values.activeFeatureId === null && features.results.length > 0) { + actions.setActiveFeatureId(features.results[0].id) + } + }, + })), actionToUrl({ - setActiveScene: ({ activeScene }) => { - return urls.featureManagement(activeScene.id) + setActiveFeatureId: ({ activeFeatureId }) => { + return urls.featureManagement(activeFeatureId) }, }), urlToAction(({ actions, values }) => ({ - '/feature-management': () => { - router.actions.push('/feature-management/features') - }, - '/feature-management/:sceneId': ({ sceneId }) => { - if (sceneId && values.activeScene.id !== sceneId) { - if (sceneId in FEATURE_MANAGEMENT_SCENE_IDS) { - actions.setActiveScene(FEATURE_MANAGEMENT_SCENES_MAP[sceneId as FeatureManagementSceneId]) - } else { - actions.setActiveScene(FEATURE_MANAGEMENT_SCENES_MAP['features']) - } + '/features/:id': ({ id }) => { + if (id && String(values.activeFeatureId) !== id) { + actions.setActiveFeatureId(Number(id)) } }, })), + afterMount(({ actions }) => { + actions.loadFeatures() + }), ]) diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.ts index 16e0b1e34d821..3f007fdaf0e6b 100644 --- a/frontend/src/scenes/scenes.ts +++ b/frontend/src/scenes/scenes.ts @@ -216,7 +216,7 @@ export const sceneConfigurations: Record = { }, [Scene.FeatureManagement]: { projectBased: true, - name: 'Feature management', + name: 'Features', defaultDocsPath: '/docs/feature-flags', }, [Scene.Surveys]: { @@ -576,6 +576,7 @@ export const routes: Record = { [urls.sqlEditor()]: Scene.SQLEditor, [urls.featureFlags()]: Scene.FeatureFlags, [urls.featureFlag(':id')]: Scene.FeatureFlag, + [urls.featureManagement()]: Scene.FeatureManagement, [urls.featureManagement(':id')]: Scene.FeatureManagement, [urls.annotations()]: Scene.DataManagement, [urls.annotation(':id')]: Scene.DataManagement, diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.ts index 27a33da75a99c..477064de6497e 100644 --- a/frontend/src/scenes/urls.ts +++ b/frontend/src/scenes/urls.ts @@ -20,7 +20,6 @@ import { SDKKey, } from '~/types' -import { FeatureManagementSceneId } from './feature-flags/FeatureManagementScenes' import { OnboardingStepKey } from './onboarding/onboardingLogic' import { SettingId, SettingLevelId, SettingSectionId } from './settings/types' import { SurveysTabs } from './surveys/surveysLogic' @@ -160,7 +159,7 @@ export const urls = { experiments: (): string => '/experiments', featureFlags: (tab?: string): string => `/feature_flags${tab ? `?tab=${tab}` : ''}`, featureFlag: (id: string | number): string => `/feature_flags/${id}`, - featureManagement: (id: ':id' | FeatureManagementSceneId): string => `/features/${id}`, + featureManagement: (id?: string | number): string => `/features${id ? `/${id}` : ''}`, earlyAccessFeatures: (): string => '/early_access_features', /** @param id A UUID or 'new'. ':id' for routing. */ earlyAccessFeature: (id: string): string => `/early_access_features/${id}`, diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 498eb1f1f5a67..78bda64f77172 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -2994,6 +2994,11 @@ export interface CombinedFeatureFlagAndValueType { value: boolean | string } +export interface Feature { + id: number | null + name: string +} + export enum EarlyAccessFeatureStage { Draft = 'draft', Concept = 'concept', From 3d35964e03439934182ba81eb1d8037596633b91 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 2 Dec 2024 17:23:42 -0800 Subject: [PATCH 10/80] tweak --- .../feature-flags/FeatureManagement.tsx | 2 +- .../feature-flags/featureManagementLogic.ts | 26 +++---------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/frontend/src/scenes/feature-flags/FeatureManagement.tsx b/frontend/src/scenes/feature-flags/FeatureManagement.tsx index 188143b6961d6..d2d67c7286886 100644 --- a/frontend/src/scenes/feature-flags/FeatureManagement.tsx +++ b/frontend/src/scenes/feature-flags/FeatureManagement.tsx @@ -25,7 +25,7 @@ export function FeatureManagement(): JSX.Element { fullWidth active={activeFeatureId === feature.id} > - {feature.name} + {feature.name} ))} diff --git a/frontend/src/scenes/feature-flags/featureManagementLogic.ts b/frontend/src/scenes/feature-flags/featureManagementLogic.ts index f3a5579a70672..b6de6f8b79bcf 100644 --- a/frontend/src/scenes/feature-flags/featureManagementLogic.ts +++ b/frontend/src/scenes/feature-flags/featureManagementLogic.ts @@ -1,6 +1,7 @@ import { actions, afterMount, connect, kea, listeners, path, props, reducers, selectors } from 'kea' import { loaders } from 'kea-loaders' import { actionToUrl, urlToAction } from 'kea-router' +import api from 'lib/api' import { Scene } from 'scenes/sceneTypes' import { teamLogic } from 'scenes/teamLogic' import { urls } from 'scenes/urls' @@ -36,32 +37,13 @@ export const featureManagementLogic = kea([ }, ], }), - loaders(() => ({ + loaders(({ values }) => ({ features: [ { results: [], count: 0, offset: 0 } as FeaturesResult, { loadFeatures: async () => { - const mockResponse = { - results: [ - { - id: 1, - name: 'SSO Login', - }, - { - id: 2, - name: 'QR Code Scanner', - }, - { - id: 3, - name: 'AR Experience', - }, - ], - count: 3, - offset: 0, - } - - // const response = await api.get(`api/projects/${values.currentTeamId}/features`) - return mockResponse as FeaturesResult + const response = await api.get(`api/projects/${values.currentTeamId}/features`) + return response.data as FeaturesResult }, }, ], From 0bef6a746793a22b42544eed1398417783f41a6d Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 3 Dec 2024 10:45:56 -0800 Subject: [PATCH 11/80] tweak --- .../src/scenes/feature-flags/featureManagementDetailLogic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/scenes/feature-flags/featureManagementDetailLogic.ts b/frontend/src/scenes/feature-flags/featureManagementDetailLogic.ts index 7181584929b64..7389893c32860 100644 --- a/frontend/src/scenes/feature-flags/featureManagementDetailLogic.ts +++ b/frontend/src/scenes/feature-flags/featureManagementDetailLogic.ts @@ -1,7 +1,7 @@ import { connect, kea, path, props } from 'kea' import { teamLogic } from 'scenes/teamLogic' -import { featureManagementDetailLogicType } from './featureManagementDetailLogicType' +import type { featureManagementDetailLogicType } from './featureManagementDetailLogicType' import { featureManagementLogic } from './featureManagementLogic' export const featureManagementDetailLogic = kea([ From 00a837b19566d8a89572b92b0b503cbfd8e7279e Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 3 Dec 2024 11:09:22 -0800 Subject: [PATCH 12/80] stash --- posthog/migrations/0526_add_features_table.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 posthog/migrations/0526_add_features_table.py diff --git a/posthog/migrations/0526_add_features_table.py b/posthog/migrations/0526_add_features_table.py new file mode 100644 index 0000000000000..0f6e15f468d73 --- /dev/null +++ b/posthog/migrations/0526_add_features_table.py @@ -0,0 +1,22 @@ +# Generated by Django 3.2.18 on 2023-06-22 11:08 + +from django.db import migrations, models +from django.utils import timezone + + +class Migration(migrations.Migration): + dependencies = [ + ("posthog", "0525_hog_function_transpiled"), + ] + + operations = [ + migrations.CreateModel( + name="Feature", + fields=[ + ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(blank=True, max_length=400)), + ("created_at", models.DateTimeField(default=timezone.now)), + ("updated_at", models.DateTimeField(auto_now=True)), + ], + ), + ] From 19719f436662e84efe45e8a8ddcc80eb2dc9fefa Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 3 Dec 2024 13:48:27 -0800 Subject: [PATCH 13/80] stash --- posthog/migrations/0526_add_features_table.py | 18 ++++++++++++++++++ posthog/migrations/max_migration.txt | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/posthog/migrations/0526_add_features_table.py b/posthog/migrations/0526_add_features_table.py index 0f6e15f468d73..a4e58fa08b6f7 100644 --- a/posthog/migrations/0526_add_features_table.py +++ b/posthog/migrations/0526_add_features_table.py @@ -14,9 +14,27 @@ class Migration(migrations.Migration): name="Feature", fields=[ ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.team")), ("name", models.CharField(blank=True, max_length=400)), + ("description", models.TextField(blank=True)), + ("issue_url", models.URLField(blank=True)), ("created_at", models.DateTimeField(default=timezone.now)), ("updated_at", models.DateTimeField(auto_now=True)), ], ), + migrations.AddField( + model_name="featureflag", + name="feature", + field=models.ForeignKey(to="posthog.feature"), + ), + migrations.AddField( + model_name="featureflag", + name="feature", + field=models.ForeignKey(to="posthog.feature"), + ), + migrations.AddField( + model_name="experiment", + name="feature", + field=models.ForeignKey(to="posthog.feature"), + ), ] diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt index 85a418de0b4c1..96f0d7b29f012 100644 --- a/posthog/migrations/max_migration.txt +++ b/posthog/migrations/max_migration.txt @@ -1 +1 @@ -0525_hog_function_transpiled +0526_add_features_table From 9008eb5f014ab3b8366f9a9f414e2edfc4d37d02 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 3 Dec 2024 16:40:33 -0800 Subject: [PATCH 14/80] Initial endpoints, still needs tests and FE integration --- posthog/api/feature.py | 99 +++++++++++++++++++ posthog/migrations/0526_add_features.py | 75 ++++++++++++++ posthog/migrations/0526_add_features_table.py | 40 -------- posthog/migrations/max_migration.txt | 2 +- posthog/models/early_access_feature.py | 1 + posthog/models/experiment.py | 1 + posthog/models/feature.py | 22 +++++ posthog/models/feature_flag/feature_flag.py | 1 + 8 files changed, 200 insertions(+), 41 deletions(-) create mode 100644 posthog/api/feature.py create mode 100644 posthog/migrations/0526_add_features.py delete mode 100644 posthog/migrations/0526_add_features_table.py create mode 100644 posthog/models/feature.py diff --git a/posthog/api/feature.py b/posthog/api/feature.py new file mode 100644 index 0000000000000..99a2cf7d72eca --- /dev/null +++ b/posthog/api/feature.py @@ -0,0 +1,99 @@ +from rest_framework import viewsets, serializers +from rest_framework.response import Response +from rest_framework.decorators import action +from django.shortcuts import get_object_or_404 + +from posthog.models import Feature +from posthog.api.routing import TeamAndOrgViewSetMixin +from posthog.api.forbid_destroy_model import ForbidDestroyModel +from posthog.rbac.access_control_api_mixin import AccessControlViewSetMixin + + +class FeatureSerializer(serializers.ModelSerializer): + class Meta: + model = Feature + fields = [ + "id", + "name", + "description", + "documentation_url", + "issue_url", + "status", + "primary_feature_flag_id", + "created_at", + "updated_at", + "archived", + "deleted", + ] + + def get_primary_feature_flag(self, feature: Feature): + from posthog.api.feature_flag import MinimalFeatureFlagSerializer + + return MinimalFeatureFlagSerializer(feature.primary_feature_flag).data + + def get_early_access_features(self, feature: Feature): + from posthog.api.early_access_feature import MinimalEarlyAccessFeatureSerializer + + return MinimalEarlyAccessFeatureSerializer(feature.earlyaccessfeature_set, many=True).data + + def get_experiments(self, feature: Feature): + from posthog.api.web_experiment import WebExperimentsAPISerializer + + return WebExperimentsAPISerializer(feature.experiment_set, many=True).data + + def get_feature_flags(self, feature: Feature): + from posthog.api.feature_flag import MinimalFeatureFlagSerializer + + return MinimalFeatureFlagSerializer(feature.featureflag_set, many=True).data + + +class FeatureViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDestroyModel, viewsets.ModelViewSet): + """ + Create, read, update and delete Features. + """ + + serializer_class = FeatureSerializer + + @action(detail=True, methods=["get"]) + def primary_feature_flag(self, request, pk=None): + """ + Get primary feature flag associated with a specific feature. + """ + feature = get_object_or_404( + Feature.objects.select_related("primary_feature_flag"), team_id=self.team_id, pk=pk, deleted=False + ) + primary_feature_flag = self.get_serializer().get_primary_feature_flag(feature) + return Response(primary_feature_flag) + + @action(detail=True, methods=["get"]) + def feature_flags(self, request, pk=None): + """ + Get all feature flags associated with a specific feature. + """ + feature = get_object_or_404( + Feature.objects.select_related("featureflag_set"), team_id=self.team_id, pk=pk, deleted=False + ) + flags = self.get_serializer().get_feature_flags(feature) + return Response(flags) + + @action(detail=True, methods=["get"]) + def experiments(self, request, pk=None): + """ + Get experiments associated with a specific feature. + """ + feature = get_object_or_404( + Feature.objects.prefetch_related("experiment_set"), team_id=self.team_id, pk=pk, deleted=False + ) + experiments = self.get_serializer().get_experiments(feature) + return Response(experiments) + + @action(detail=True, methods=["get"]) + def early_access_features(self, request, pk=None): + """ + Get early access features associated with a specific feature. + """ + feature = get_object_or_404( + Feature.objects.prefetch_related("earlyaccessfeature_set"), team_id=self.team_id, pk=pk, deleted=False + ) + early_access_features = self.get_serializer().get_early_access_features(feature) + return Response(early_access_features) diff --git a/posthog/migrations/0526_add_features.py b/posthog/migrations/0526_add_features.py new file mode 100644 index 0000000000000..f9c41406e791f --- /dev/null +++ b/posthog/migrations/0526_add_features.py @@ -0,0 +1,75 @@ +# Generated by Django 3.2.18 on 2023-06-22 11:08 + +from django.db import migrations, models +from django.utils import timezone + + +class Migration(migrations.Migration): + dependencies = [ + ("posthog", "0525_hog_function_transpiled"), + ] + + operations = [ + migrations.CreateModel( + name="Feature", + fields=[ + ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.team")), + ("name", models.CharField(blank=True, max_length=400)), + ("description", models.TextField(blank=True)), + ("documentation_url", models.URLField(blank=True)), + ("issue_url", models.URLField(blank=True)), + ( + "status", + models.CharField( + choices=[ + ("pre_alpha", "Pre-alpha"), + ("alpha", "Alpha"), + ("beta", "Beta"), + ("general_availability", "GA"), + ], + default="pre_alpha", + max_length=32, + ), + ), + ( + "primary_feature_flag", + models.ForeignKey(null=True, on_delete=models.deletion.RESTRICT, to="posthog.featureflag"), + ), + ("created_at", models.DateTimeField(default=timezone.now)), + ("updated_at", models.DateTimeField(auto_now=True)), + ("archived", models.BooleanField(default=False)), + ("deleted", models.BooleanField(default=False)), + ], + ), + migrations.AddField( + model_name="featureflag", + name="feature", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=models.deletion.SET_NULL, + to="posthog.feature", + ), + ), + migrations.AddField( + model_name="experiment", + name="feature", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=models.deletion.SET_NULL, + to="posthog.feature", + ), + ), + migrations.AddField( + model_name="earlyaccessfeature", + name="feature", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=models.deletion.SET_NULL, + to="posthog.feature", + ), + ), + ] diff --git a/posthog/migrations/0526_add_features_table.py b/posthog/migrations/0526_add_features_table.py deleted file mode 100644 index a4e58fa08b6f7..0000000000000 --- a/posthog/migrations/0526_add_features_table.py +++ /dev/null @@ -1,40 +0,0 @@ -# Generated by Django 3.2.18 on 2023-06-22 11:08 - -from django.db import migrations, models -from django.utils import timezone - - -class Migration(migrations.Migration): - dependencies = [ - ("posthog", "0525_hog_function_transpiled"), - ] - - operations = [ - migrations.CreateModel( - name="Feature", - fields=[ - ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.team")), - ("name", models.CharField(blank=True, max_length=400)), - ("description", models.TextField(blank=True)), - ("issue_url", models.URLField(blank=True)), - ("created_at", models.DateTimeField(default=timezone.now)), - ("updated_at", models.DateTimeField(auto_now=True)), - ], - ), - migrations.AddField( - model_name="featureflag", - name="feature", - field=models.ForeignKey(to="posthog.feature"), - ), - migrations.AddField( - model_name="featureflag", - name="feature", - field=models.ForeignKey(to="posthog.feature"), - ), - migrations.AddField( - model_name="experiment", - name="feature", - field=models.ForeignKey(to="posthog.feature"), - ), - ] diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt index 96f0d7b29f012..2deceaf1ae1b9 100644 --- a/posthog/migrations/max_migration.txt +++ b/posthog/migrations/max_migration.txt @@ -1 +1 @@ -0526_add_features_table +0526_add_features diff --git a/posthog/models/early_access_feature.py b/posthog/models/early_access_feature.py index 453e184c7e18b..78128f1978840 100644 --- a/posthog/models/early_access_feature.py +++ b/posthog/models/early_access_feature.py @@ -30,6 +30,7 @@ class Stage(models.TextChoices): stage = models.CharField(max_length=40, choices=Stage.choices) documentation_url = models.URLField(max_length=800, blank=True) created_at = models.DateTimeField(auto_now_add=True) + feature = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) def __str__(self) -> str: return self.name diff --git a/posthog/models/experiment.py b/posthog/models/experiment.py index 87119d292b689..741b5fe7630ea 100644 --- a/posthog/models/experiment.py +++ b/posthog/models/experiment.py @@ -45,6 +45,7 @@ class ExperimentType(models.TextChoices): saved_metrics: models.ManyToManyField = models.ManyToManyField( "ExperimentSavedMetric", blank=True, related_name="experiments", through="ExperimentToSavedMetric" ) + feature = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) def get_feature_flag_key(self): return self.feature_flag.key diff --git a/posthog/models/feature.py b/posthog/models/feature.py new file mode 100644 index 0000000000000..546e21a9e47dd --- /dev/null +++ b/posthog/models/feature.py @@ -0,0 +1,22 @@ +from django.db import models +from django.utils import timezone + + +class Feature(models.Model): + class StatusType(models.TextChoices): + PRE_ALPHA = "pre_alpha", "Pre-alpha" + ALPHA = "alpha", "Alpha" + BETA = "beta", "Beta" + GENERAL_AVAILABILITY = "general_availability", "GA" + + name = models.CharField(max_length=400, blank=True) + team = models.ForeignKey("Team", on_delete=models.CASCADE) + description = models.TextField(blank=True) + documentation_url = models.URLField(blank=True) + issue_url = models.URLField(blank=True) + status = models.CharField(max_length=32, choices=StatusType.choices, default="pre_alpha") + primary_feature_flag = models.ForeignKey("FeatureFlag", on_delete=models.RESTRICT, blank=False) + created_at = models.DateTimeField(default=timezone.now) + updated_at = models.DateTimeField(auto_now=True) + archived = models.BooleanField(default=False) + deleted = models.BooleanField(default=False) diff --git a/posthog/models/feature_flag/feature_flag.py b/posthog/models/feature_flag/feature_flag.py index c21af6a397117..250ff97af3fed 100644 --- a/posthog/models/feature_flag/feature_flag.py +++ b/posthog/models/feature_flag/feature_flag.py @@ -53,6 +53,7 @@ class FeatureFlag(models.Model): ) # whether a feature is sending us rich analytics, like views & interactions. has_enriched_analytics = models.BooleanField(default=False, null=True, blank=True) + feature = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) class Meta: constraints = [models.UniqueConstraint(fields=["team", "key"], name="unique key for team")] From 199b5529a8cda628aa617e4b909a40d019389826 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 3 Dec 2024 18:02:42 -0800 Subject: [PATCH 15/80] Add tests for feature viewset --- posthog/api/__init__.py | 7 ++ posthog/api/early_access_feature.py | 9 +- posthog/api/feature.py | 76 ++++++++------ posthog/api/test/test_feature.py | 151 ++++++++++++++++++++++++++++ posthog/models/__init__.py | 2 + posthog/models/feature.py | 2 +- 6 files changed, 206 insertions(+), 41 deletions(-) create mode 100644 posthog/api/test/test_feature.py diff --git a/posthog/api/__init__.py b/posthog/api/__init__.py index bf1db10b864a5..1bb0f27b4641c 100644 --- a/posthog/api/__init__.py +++ b/posthog/api/__init__.py @@ -31,6 +31,7 @@ error_tracking, event_definition, exports, + feature, feature_flag, hog_function, hog_function_template, @@ -151,6 +152,12 @@ def register_grandfathered_environment_nested_viewset( "project_activity_log", ["project_id"], ) +projects_router.register( + r"features", + feature.FeatureViewSet, + "project_feature_management", + ["project_id"], +) project_feature_flags_router = projects_router.register( r"feature_flags", feature_flag.FeatureFlagViewSet, diff --git a/posthog/api/early_access_feature.py b/posthog/api/early_access_feature.py index 004725393b4db..e64d167bab23d 100644 --- a/posthog/api/early_access_feature.py +++ b/posthog/api/early_access_feature.py @@ -30,14 +30,7 @@ class MinimalEarlyAccessFeatureSerializer(serializers.ModelSerializer): class Meta: model = EarlyAccessFeature - fields = [ - "id", - "name", - "description", - "stage", - "documentationUrl", - "flagKey", - ] + fields = ["id", "name", "description", "stage", "documentationUrl", "flagKey", "feature"] read_only_fields = fields diff --git a/posthog/api/feature.py b/posthog/api/feature.py index 99a2cf7d72eca..8a1fc0cc0cbdc 100644 --- a/posthog/api/feature.py +++ b/posthog/api/feature.py @@ -1,8 +1,7 @@ from rest_framework import viewsets, serializers from rest_framework.response import Response from rest_framework.decorators import action -from django.shortcuts import get_object_or_404 - +from django.db.models import QuerySet from posthog.models import Feature from posthog.api.routing import TeamAndOrgViewSetMixin from posthog.api.forbid_destroy_model import ForbidDestroyModel @@ -26,15 +25,19 @@ class Meta: "deleted", ] + def create(self, validated_data): + validated_data["team_id"] = self.context["team_id"] + return super().create(validated_data) + def get_primary_feature_flag(self, feature: Feature): - from posthog.api.feature_flag import MinimalFeatureFlagSerializer + from posthog.api.feature_flag import FeatureFlagSerializer - return MinimalFeatureFlagSerializer(feature.primary_feature_flag).data + return FeatureFlagSerializer(feature.primary_feature_flag, context=self.context).data def get_early_access_features(self, feature: Feature): - from posthog.api.early_access_feature import MinimalEarlyAccessFeatureSerializer + from posthog.api.early_access_feature import EarlyAccessFeatureSerializer - return MinimalEarlyAccessFeatureSerializer(feature.earlyaccessfeature_set, many=True).data + return EarlyAccessFeatureSerializer(feature.earlyaccessfeature_set, many=True).data def get_experiments(self, feature: Feature): from posthog.api.web_experiment import WebExperimentsAPISerializer @@ -42,58 +45,67 @@ def get_experiments(self, feature: Feature): return WebExperimentsAPISerializer(feature.experiment_set, many=True).data def get_feature_flags(self, feature: Feature): - from posthog.api.feature_flag import MinimalFeatureFlagSerializer + from posthog.api.feature_flag import FeatureFlagSerializer - return MinimalFeatureFlagSerializer(feature.featureflag_set, many=True).data + return FeatureFlagSerializer(feature.featureflag_set, context=self.context, many=True).data class FeatureViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDestroyModel, viewsets.ModelViewSet): - """ - Create, read, update and delete Features. - """ - + scope_object = "feature" + queryset = Feature.objects.all() serializer_class = FeatureSerializer + def safely_get_queryset(self, queryset) -> QuerySet: + # Base queryset with team filtering + queryset = Feature.objects.filter(team_id=self.team_id) + + if self.action == "primary_feature_flag": + queryset = queryset.select_related("primary_feature_flag") + elif self.action == "experiments": + queryset = queryset.prefetch_related("experiment_set") + elif self.action == "early_access_features": + queryset = queryset.prefetch_related("earlyaccessfeature_set") + elif self.action == "feature_flags": + queryset = queryset.prefetch_related("featureflag_set") + + return queryset + @action(detail=True, methods=["get"]) - def primary_feature_flag(self, request, pk=None): + def primary_feature_flag(self, request, pk=None, **kwargs): """ Get primary feature flag associated with a specific feature. """ - feature = get_object_or_404( - Feature.objects.select_related("primary_feature_flag"), team_id=self.team_id, pk=pk, deleted=False - ) - primary_feature_flag = self.get_serializer().get_primary_feature_flag(feature) + feature = self.get_object() + serializer = self.get_serializer(feature) + primary_feature_flag = serializer.get_primary_feature_flag(feature) return Response(primary_feature_flag) @action(detail=True, methods=["get"]) - def feature_flags(self, request, pk=None): + def feature_flags(self, request, pk=None, **kwargs): """ Get all feature flags associated with a specific feature. """ - feature = get_object_or_404( - Feature.objects.select_related("featureflag_set"), team_id=self.team_id, pk=pk, deleted=False - ) - flags = self.get_serializer().get_feature_flags(feature) + feature = self.get_object() + serializer = self.get_serializer(feature) + flags = serializer.get_feature_flags(feature) return Response(flags) @action(detail=True, methods=["get"]) - def experiments(self, request, pk=None): + def experiments(self, request, pk=None, **kwargs): """ Get experiments associated with a specific feature. """ - feature = get_object_or_404( - Feature.objects.prefetch_related("experiment_set"), team_id=self.team_id, pk=pk, deleted=False - ) - experiments = self.get_serializer().get_experiments(feature) + feature = self.get_object() + serializer = self.get_serializer(feature) + experiments = serializer.get_experiments(feature) return Response(experiments) @action(detail=True, methods=["get"]) - def early_access_features(self, request, pk=None): + def early_access_features(self, request, pk=None, **kwargs): """ Get early access features associated with a specific feature. """ - feature = get_object_or_404( - Feature.objects.prefetch_related("earlyaccessfeature_set"), team_id=self.team_id, pk=pk, deleted=False - ) - early_access_features = self.get_serializer().get_early_access_features(feature) + feature = self.get_object() + serializer = self.get_serializer(feature) + early_access_features = serializer.get_early_access_features(feature) return Response(early_access_features) diff --git a/posthog/api/test/test_feature.py b/posthog/api/test/test_feature.py new file mode 100644 index 0000000000000..0839f007074a7 --- /dev/null +++ b/posthog/api/test/test_feature.py @@ -0,0 +1,151 @@ +from rest_framework import status + +from posthog.models import Feature, FeatureFlag, Experiment, EarlyAccessFeature, Team +from posthog.test.base import APIBaseTest + + +class TestFeatureAPI(APIBaseTest): + def setUp(self): + super().setUp() + self.feature = Feature.objects.create( + team=self.team, + name="Test Feature", + description="Test Description", + documentation_url="http://example.com", + issue_url="http://github.com/example", + status="beta", + ) + + def test_list_features(self): + response = self.client.get(f"/api/projects/{self.team.id}/features/") + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.json()["results"]), 1) + self.assertEqual(response.json()["results"][0]["name"], "Test Feature") + + def test_retrieve_feature(self): + response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/") + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(response.json()["name"], "Test Feature") + self.assertEqual(response.json()["description"], "Test Description") + + def test_create_feature(self): + response = self.client.post( + f"/api/projects/{self.team.id}/features/", + { + "name": "New Feature", + "team_id": self.team.id, + "description": "New Description", + "documentation_url": "http://example.com/new", + "issue_url": "http://github.com/example/new", + "status": "alpha", + }, + ) + self.assertEqual(response.status_code, status.HTTP_201_CREATED) + self.assertEqual(response.json()["name"], "New Feature") + self.assertEqual(Feature.objects.count(), 2) + + def test_update_feature(self): + response = self.client.patch( + f"/api/projects/{self.team.id}/features/{self.feature.id}/", + { + "name": "Updated Feature", + "status": "beta", + }, + ) + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(response.json()["name"], "Updated Feature") + self.assertEqual(response.json()["status"], "beta") + + def test_delete_not_allowed(self): + response = self.client.delete(f"/api/projects/{self.team.id}/features/{self.feature.id}/") + self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) + + def test_get_primary_feature_flag(self): + flag = FeatureFlag.objects.create( + team=self.team, + name="Test Flag", + key="test-flag", + feature=self.feature, + ) + self.feature.primary_feature_flag = flag + self.feature.save() + + response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/primary_feature_flag/") + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(response.json()["key"], "test-flag") + + def test_get_experiments(self): + Experiment.objects.create( + team=self.team, + name="Test Experiment", + feature_flag=FeatureFlag.objects.create( + team=self.team, + name="Test Flag", + key="test-flag", + ), + feature=self.feature, + description="Test Description", + ) + + response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/experiments/") + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.json()), 1) + self.assertEqual(response.json()[0]["name"], "Test Experiment") + + def test_get_early_access_features(self): + EarlyAccessFeature.objects.create( + team=self.team, + name="Test EAF", + description="Test Description", + feature=self.feature, + ) + + response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/early_access_features/") + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.json()), 1) + self.assertEqual(response.json()[0]["name"], "Test EAF") + + def test_get_feature_flags(self): + FeatureFlag.objects.create( + team=self.team, + name="Test Flag", + key="test-flag", + feature=self.feature, + ) + + response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/feature_flags/") + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.assertEqual(len(response.json()), 1) + self.assertEqual(response.json()[0]["key"], "test-flag") + + def test_cannot_create_feature_without_name(self): + response = self.client.post( + f"/api/projects/{self.team.id}/features/", + { + "team": self.team.id, + "description": "New Description", + }, + ) + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + self.assertIn("name", response.json()["attr"]) + + def test_cannot_access_feature_from_another_team(self): + other_team = Team.objects.create( + organization=self.organization, + api_token=self.CONFIG_API_TOKEN + "2", + test_account_filters=[ + { + "key": "email", + "value": "@posthog.com", + "operator": "not_icontains", + "type": "person", + } + ], + ) + other_feature = Feature.objects.create( + team=other_team, + name="Other Feature", + ) + + response = self.client.get(f"/api/projects/{self.team.id}/features/{other_feature.id}/") + self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) diff --git a/posthog/models/__init__.py b/posthog/models/__init__.py index fca47f33d53ea..46bd6a6b3febc 100644 --- a/posthog/models/__init__.py +++ b/posthog/models/__init__.py @@ -37,6 +37,7 @@ from .event_property import EventProperty from .experiment import Experiment from .exported_asset import ExportedAsset +from .feature import Feature from .feature_flag import FeatureFlag from .feedback.survey import Survey from .filters import Filter, RetentionFilter @@ -110,6 +111,7 @@ "EventProperty", "Experiment", "ExportedAsset", + "Feature", "FeatureFlag", "Filter", "Group", diff --git a/posthog/models/feature.py b/posthog/models/feature.py index 546e21a9e47dd..79efe261bf361 100644 --- a/posthog/models/feature.py +++ b/posthog/models/feature.py @@ -9,7 +9,7 @@ class StatusType(models.TextChoices): BETA = "beta", "Beta" GENERAL_AVAILABILITY = "general_availability", "GA" - name = models.CharField(max_length=400, blank=True) + name = models.CharField(max_length=400, blank=False) team = models.ForeignKey("Team", on_delete=models.CASCADE) description = models.TextField(blank=True) documentation_url = models.URLField(blank=True) From 00b3f8bbb89d122319a5d500ab76e28bdf2f01da Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 3 Dec 2024 18:03:58 -0800 Subject: [PATCH 16/80] tweak --- posthog/api/early_access_feature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posthog/api/early_access_feature.py b/posthog/api/early_access_feature.py index e64d167bab23d..68c5006cef5bd 100644 --- a/posthog/api/early_access_feature.py +++ b/posthog/api/early_access_feature.py @@ -30,7 +30,7 @@ class MinimalEarlyAccessFeatureSerializer(serializers.ModelSerializer): class Meta: model = EarlyAccessFeature - fields = ["id", "name", "description", "stage", "documentationUrl", "flagKey", "feature"] + fields = ["id", "name", "description", "stage", "documentationUrl", "flagKey"] read_only_fields = fields From a51dd17bef089dbb81a1e65df4ddde25c2f2b815 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 02:14:07 +0000 Subject: [PATCH 17/80] Update query snapshots --- posthog/api/test/__snapshots__/test_survey.ambr | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index a0e4260a92f6c..c471fe273eece 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -50,7 +50,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -73,7 +74,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -96,7 +98,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -255,6 +258,7 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id", T4."id", T4."key", T4."name", @@ -270,6 +274,7 @@ T4."ensure_experience_continuity", T4."usage_dashboard_id", T4."has_enriched_analytics", + T4."feature_id", T5."id", T5."key", T5."name", @@ -284,7 +289,8 @@ T5."performed_rollback", T5."ensure_experience_continuity", T5."usage_dashboard_id", - T5."has_enriched_analytics" + T5."has_enriched_analytics", + T5."feature_id" FROM "posthog_survey" LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_survey"."linked_flag_id" = "posthog_featureflag"."id") LEFT OUTER JOIN "posthog_featureflag" T4 ON ("posthog_survey"."targeting_flag_id" = T4."id") From 38a52c93d3facc66283b843ca0bf83a41c0331e4 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 3 Dec 2024 18:14:41 -0800 Subject: [PATCH 18/80] tweak --- posthog/api/test/test_feature.py | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/posthog/api/test/test_feature.py b/posthog/api/test/test_feature.py index 0839f007074a7..f91dfa82328d3 100644 --- a/posthog/api/test/test_feature.py +++ b/posthog/api/test/test_feature.py @@ -17,17 +17,70 @@ def setUp(self): ) def test_list_features(self): + # Create a feature flag and experiment for the feature, ensure they are not returned in the response + Experiment.objects.create( + team=self.team, + name="Test Experiment", + feature=self.feature, + feature_flag=FeatureFlag.objects.create( + team=self.team, + name="Test Flag for Experiment", + key="test-flag-for-experiment-list", + feature=self.feature, + ), + ) + EarlyAccessFeature.objects.create( + team=self.team, + name="Test EAF", + description="Test Description", + feature=self.feature, + ) + response = self.client.get(f"/api/projects/{self.team.id}/features/") self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(len(response.json()["results"]), 1) self.assertEqual(response.json()["results"][0]["name"], "Test Feature") + # Ensure we are not returning joined data + with self.assertRaises(KeyError): + response.json()["results"][0]["experiments"] + with self.assertRaises(KeyError): + response.json()["results"][0]["feature_flags"] + with self.assertRaises(KeyError): + response.json()["results"][0]["early_access_features"] + def test_retrieve_feature(self): + Experiment.objects.create( + team=self.team, + name="Test Experiment", + feature=self.feature, + feature_flag=FeatureFlag.objects.create( + team=self.team, + name="Test Flag for Experiment", + key="test-flag-for-experiment-retrieve", + feature=self.feature, + ), + ) + EarlyAccessFeature.objects.create( + team=self.team, + name="Test EAF", + description="Test Description", + feature=self.feature, + ) + response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/") self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.json()["name"], "Test Feature") self.assertEqual(response.json()["description"], "Test Description") + # Ensure we are not returning joined data + with self.assertRaises(KeyError): + response.json()["experiments"] + with self.assertRaises(KeyError): + response.json()["feature_flags"] + with self.assertRaises(KeyError): + response.json()["early_access_features"] + def test_create_feature(self): response = self.client.post( f"/api/projects/{self.team.id}/features/", From 89020680f4ffc4f1786a10170dc8035c2362daad Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 02:18:41 +0000 Subject: [PATCH 19/80] Update query snapshots --- .../test_session_recordings.ambr | 48 +++++++++---------- .../test_process_scheduled_changes.ambr | 18 ++++--- .../test/__snapshots__/test_feature_flag.ambr | 15 ++++-- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr index 179684d289047..14e840ce5e423 100644 --- a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr +++ b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr @@ -640,12 +640,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '450' + AND "ee_accesscontrol"."resource_id" = '447' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '450' + AND "ee_accesscontrol"."resource_id" = '447' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -1690,12 +1690,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -2445,12 +2445,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -3136,12 +3136,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -3890,12 +3890,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -4608,12 +4608,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -5408,12 +5408,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -5673,12 +5673,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -6107,12 +6107,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -6573,12 +6573,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -7267,12 +7267,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -8018,12 +8018,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '457' + AND "ee_accesscontrol"."resource_id" = '454' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr index 64eda354dd032..6962e12c051b3 100644 --- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr +++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr @@ -15,7 +15,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -228,7 +229,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."key" = 'flag-1' LIMIT 21 @@ -250,7 +252,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 @@ -305,7 +308,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -424,7 +428,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 @@ -479,7 +484,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index fefcbbffd5d46..891622c50a13d 100644 --- a/posthog/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/test/__snapshots__/test_feature_flag.ambr @@ -209,7 +209,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -232,7 +233,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -255,7 +257,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -385,7 +388,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -729,7 +733,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" From f70dfb84a18cfb18f799846e70993be19c79e81d Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 02:41:38 +0000 Subject: [PATCH 20/80] Update query snapshots --- .../api/test/__snapshots__/test_api_docs.ambr | 1 + .../api/test/__snapshots__/test_decide.ambr | 12 +++++--- .../test_early_access_feature.ambr | 10 +++++-- .../test/__snapshots__/test_feature_flag.ambr | 30 ++++++++++++------- .../api/test/__snapshots__/test_insight.ambr | 8 ++--- .../test_organization_feature_flag.ambr | 24 ++++++++++----- 6 files changed, 55 insertions(+), 30 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_api_docs.ambr b/posthog/api/test/__snapshots__/test_api_docs.ambr index 42c03569e8f25..a7fd962e399bf 100644 --- a/posthog/api/test/__snapshots__/test_api_docs.ambr +++ b/posthog/api/test/__snapshots__/test_api_docs.ambr @@ -38,6 +38,7 @@ '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "filename". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "has_content". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.exported_asset.ExportedAsset" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', + '/home/runner/work/posthog/posthog/posthog/api/feature.py: Warning [FeatureViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature.Feature" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/feature_flag.py: Warning [FeatureFlagViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature_flag.feature_flag.FeatureFlag" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_cache_target_age". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_columns". Consider using a type hint or @extend_schema_field. Defaulting to string.', diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index beb108518df40..02e1dfea0d60d 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -488,7 +488,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -993,7 +994,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1291,7 +1293,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1451,7 +1454,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" diff --git a/posthog/api/test/__snapshots__/test_early_access_feature.ambr b/posthog/api/test/__snapshots__/test_early_access_feature.ambr index 7e33fb1c9d19e..fb86f8a165389 100644 --- a/posthog/api/test/__snapshots__/test_early_access_feature.ambr +++ b/posthog/api/test/__snapshots__/test_early_access_feature.ambr @@ -85,7 +85,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -108,7 +109,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -220,6 +222,7 @@ "posthog_earlyaccessfeature"."stage", "posthog_earlyaccessfeature"."documentation_url", "posthog_earlyaccessfeature"."created_at", + "posthog_earlyaccessfeature"."feature_id", "posthog_featureflag"."id", "posthog_featureflag"."key", "posthog_featureflag"."name", @@ -234,7 +237,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_earlyaccessfeature" LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_earlyaccessfeature"."feature_flag_id" = "posthog_featureflag"."id") WHERE ("posthog_earlyaccessfeature"."stage" = 'beta' diff --git a/posthog/api/test/__snapshots__/test_feature_flag.ambr b/posthog/api/test/__snapshots__/test_feature_flag.ambr index 93dfa76ea2cdb..f653cd3046276 100644 --- a/posthog/api/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_feature_flag.ambr @@ -351,7 +351,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."key" = 'some-feature2' AND "posthog_featureflag"."team_id" = 99999) @@ -604,7 +605,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."key" = 'some-feature-new' AND "posthog_featureflag"."team_id" = 99999) @@ -940,7 +942,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."key" = 'some-feature2' AND "posthog_featureflag"."team_id" = 99999) @@ -1261,7 +1264,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."key" = 'some-feature-new' AND "posthog_featureflag"."team_id" = 99999) @@ -1329,7 +1333,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."key" = 'some-feature2' AND "posthog_featureflag"."team_id" = 99999) @@ -1905,7 +1910,8 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" + "posthog_experiment"."metrics_secondary", + "posthog_experiment"."feature_id" FROM "posthog_experiment" WHERE "posthog_experiment"."exposure_cohort_id" = 99999 ''' @@ -2001,12 +2007,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '313' + AND "ee_accesscontrol"."resource_id" = '315' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '313' + AND "ee_accesscontrol"."resource_id" = '315' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -2021,12 +2027,12 @@ AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'feature_flag' - AND "ee_accesscontrol"."resource_id" = '130' + AND "ee_accesscontrol"."resource_id" = '133' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'feature_flag' - AND "ee_accesscontrol"."resource_id" = '130' + AND "ee_accesscontrol"."resource_id" = '133' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999)) ''' @@ -2106,6 +2112,7 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -2156,7 +2163,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."key" = 'some-feature' AND "posthog_featureflag"."team_id" = 99999) diff --git a/posthog/api/test/__snapshots__/test_insight.ambr b/posthog/api/test/__snapshots__/test_insight.ambr index cea3c1e49dcab..c50f83b2b6c66 100644 --- a/posthog/api/test/__snapshots__/test_insight.ambr +++ b/posthog/api/test/__snapshots__/test_insight.ambr @@ -1380,12 +1380,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '447' + AND "ee_accesscontrol"."resource_id" = '449' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '447' + AND "ee_accesscontrol"."resource_id" = '449' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL @@ -1493,12 +1493,12 @@ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id") WHERE (("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '447' + AND "ee_accesscontrol"."resource_id" = '449' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'project' - AND "ee_accesscontrol"."resource_id" = '447' + AND "ee_accesscontrol"."resource_id" = '449' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr index 351264ee04d8c..941ca3d7095ca 100644 --- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr @@ -73,7 +73,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -909,7 +910,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."key" = 'copied-flag-key' AND "posthog_featureflag"."team_id" = 99999) @@ -1002,7 +1004,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1100,7 +1103,8 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" + "posthog_experiment"."metrics_secondary", + "posthog_experiment"."feature_id" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -1149,7 +1153,8 @@ "posthog_earlyaccessfeature"."description", "posthog_earlyaccessfeature"."stage", "posthog_earlyaccessfeature"."documentation_url", - "posthog_earlyaccessfeature"."created_at" + "posthog_earlyaccessfeature"."created_at", + "posthog_earlyaccessfeature"."feature_id" FROM "posthog_earlyaccessfeature" WHERE "posthog_earlyaccessfeature"."feature_flag_id" = 99999 ''' @@ -1777,7 +1782,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE (NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'copied-flag-key' @@ -2131,7 +2137,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'copied-flag-key' @@ -2291,7 +2298,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_id" FROM "posthog_featureflag" WHERE (NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'key-1' From a3a7a3c5be19cba73944dc7f3e71fcb26b48268e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 03:07:48 +0000 Subject: [PATCH 21/80] Update query snapshots --- posthog/api/test/__snapshots__/test_feature_flag.ambr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_feature_flag.ambr b/posthog/api/test/__snapshots__/test_feature_flag.ambr index f653cd3046276..6a5255be66436 100644 --- a/posthog/api/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_feature_flag.ambr @@ -2027,12 +2027,12 @@ AND "ee_accesscontrol"."team_id" = 99999) OR ("ee_accesscontrol"."organization_member_id" IS NULL AND "ee_accesscontrol"."resource" = 'feature_flag' - AND "ee_accesscontrol"."resource_id" = '133' + AND "ee_accesscontrol"."resource_id" = '135' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999) OR ("posthog_organizationmembership"."user_id" = 99999 AND "ee_accesscontrol"."resource" = 'feature_flag' - AND "ee_accesscontrol"."resource_id" = '133' + AND "ee_accesscontrol"."resource_id" = '135' AND "ee_accesscontrol"."role_id" IS NULL AND "ee_accesscontrol"."team_id" = 99999)) ''' From 6c3e7f88bc74698091e31966ce7719ef3df26c80 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Wed, 4 Dec 2024 17:52:10 -0800 Subject: [PATCH 22/80] address comment --- posthog/migrations/0526_add_features.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/posthog/migrations/0526_add_features.py b/posthog/migrations/0526_add_features.py index f9c41406e791f..720239b82711b 100644 --- a/posthog/migrations/0526_add_features.py +++ b/posthog/migrations/0526_add_features.py @@ -15,26 +15,13 @@ class Migration(migrations.Migration): fields=[ ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), ("team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.team")), - ("name", models.CharField(blank=True, max_length=400)), - ("description", models.TextField(blank=True)), + ("name", models.CharField(max_length=400)), + ("description", models.TextField(default="")), ("documentation_url", models.URLField(blank=True)), ("issue_url", models.URLField(blank=True)), ( - "status", - models.CharField( - choices=[ - ("pre_alpha", "Pre-alpha"), - ("alpha", "Alpha"), - ("beta", "Beta"), - ("general_availability", "GA"), - ], - default="pre_alpha", - max_length=32, - ), - ), - ( - "primary_feature_flag", - models.ForeignKey(null=True, on_delete=models.deletion.RESTRICT, to="posthog.featureflag"), + "primary_early_access_feature", + models.ForeignKey(null=True, on_delete=models.deletion.RESTRICT, to="posthog.earlyaccessfeature"), ), ("created_at", models.DateTimeField(default=timezone.now)), ("updated_at", models.DateTimeField(auto_now=True)), From a32bb35983bc55ba096f6d4c1a1f92e22c62a676 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 10:58:56 -0800 Subject: [PATCH 23/80] tweak --- .../src/layout/navigation-3000/navigationLogic.tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/frontend/src/layout/navigation-3000/navigationLogic.tsx b/frontend/src/layout/navigation-3000/navigationLogic.tsx index b860fc91a671d..6f6105aaa9c54 100644 --- a/frontend/src/layout/navigation-3000/navigationLogic.tsx +++ b/frontend/src/layout/navigation-3000/navigationLogic.tsx @@ -385,15 +385,6 @@ export const navigation3000Logic = kea([ }, }, }, - featureFlags[FEATURE_FLAGS.FEATURE_MANAGEMENT_UI] - ? { - identifier: Scene.FeatureManagement, - label: 'Features', - icon: , - logic: isUsingSidebar ? featureFlagsSidebarLogic : undefined, - to: isUsingSidebar ? undefined : urls.featureManagement(), - } - : null, { identifier: Scene.Notebooks, label: 'Notebooks', @@ -420,7 +411,7 @@ export const navigation3000Logic = kea([ icon: , to: urls.activity(), }, - ].filter(isNotNil) + ] : [ { identifier: Scene.Products, From 3cb58ee77e51f29ea69b6689cd4f0d12bc39a156 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 11:49:04 -0800 Subject: [PATCH 24/80] adjust feature management schema / migration --- ...526_add_features.py => 0529_add_features_table.py} | 10 +++++----- posthog/migrations/max_migration.txt | 2 +- posthog/models/early_access_feature.py | 2 +- posthog/models/experiment.py | 2 +- posthog/models/feature.py | 11 ++--------- posthog/models/feature_flag/feature_flag.py | 2 +- 6 files changed, 11 insertions(+), 18 deletions(-) rename posthog/migrations/{0526_add_features.py => 0529_add_features_table.py} (89%) diff --git a/posthog/migrations/0526_add_features.py b/posthog/migrations/0529_add_features_table.py similarity index 89% rename from posthog/migrations/0526_add_features.py rename to posthog/migrations/0529_add_features_table.py index 720239b82711b..a52fa91361e55 100644 --- a/posthog/migrations/0526_add_features.py +++ b/posthog/migrations/0529_add_features_table.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ("posthog", "0525_hog_function_transpiled"), + ("posthog", "0528_project_field_in_taxonomy"), ] operations = [ @@ -15,7 +15,7 @@ class Migration(migrations.Migration): fields=[ ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), ("team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.team")), - ("name", models.CharField(max_length=400)), + ("name", models.CharField(max_length=400, blank=False)), ("description", models.TextField(default="")), ("documentation_url", models.URLField(blank=True)), ("issue_url", models.URLField(blank=True)), @@ -31,7 +31,7 @@ class Migration(migrations.Migration): ), migrations.AddField( model_name="featureflag", - name="feature", + name="feature_management", field=models.ForeignKey( blank=True, null=True, @@ -41,7 +41,7 @@ class Migration(migrations.Migration): ), migrations.AddField( model_name="experiment", - name="feature", + name="feature_management", field=models.ForeignKey( blank=True, null=True, @@ -51,7 +51,7 @@ class Migration(migrations.Migration): ), migrations.AddField( model_name="earlyaccessfeature", - name="feature", + name="feature_management", field=models.ForeignKey( blank=True, null=True, diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt index 647b659f0832e..3f2f18bb3ab45 100644 --- a/posthog/migrations/max_migration.txt +++ b/posthog/migrations/max_migration.txt @@ -1 +1 @@ -0528_project_field_in_taxonomy +0529_add_features_table \ No newline at end of file diff --git a/posthog/models/early_access_feature.py b/posthog/models/early_access_feature.py index 78128f1978840..af7adde4531c0 100644 --- a/posthog/models/early_access_feature.py +++ b/posthog/models/early_access_feature.py @@ -30,7 +30,7 @@ class Stage(models.TextChoices): stage = models.CharField(max_length=40, choices=Stage.choices) documentation_url = models.URLField(max_length=800, blank=True) created_at = models.DateTimeField(auto_now_add=True) - feature = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) + feature_management = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) def __str__(self) -> str: return self.name diff --git a/posthog/models/experiment.py b/posthog/models/experiment.py index 741b5fe7630ea..c8767434c90b2 100644 --- a/posthog/models/experiment.py +++ b/posthog/models/experiment.py @@ -45,7 +45,7 @@ class ExperimentType(models.TextChoices): saved_metrics: models.ManyToManyField = models.ManyToManyField( "ExperimentSavedMetric", blank=True, related_name="experiments", through="ExperimentToSavedMetric" ) - feature = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) + feature_management = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) def get_feature_flag_key(self): return self.feature_flag.key diff --git a/posthog/models/feature.py b/posthog/models/feature.py index 79efe261bf361..49b0b2626a6a2 100644 --- a/posthog/models/feature.py +++ b/posthog/models/feature.py @@ -3,19 +3,12 @@ class Feature(models.Model): - class StatusType(models.TextChoices): - PRE_ALPHA = "pre_alpha", "Pre-alpha" - ALPHA = "alpha", "Alpha" - BETA = "beta", "Beta" - GENERAL_AVAILABILITY = "general_availability", "GA" - name = models.CharField(max_length=400, blank=False) team = models.ForeignKey("Team", on_delete=models.CASCADE) - description = models.TextField(blank=True) + description = models.TextField(default="") documentation_url = models.URLField(blank=True) issue_url = models.URLField(blank=True) - status = models.CharField(max_length=32, choices=StatusType.choices, default="pre_alpha") - primary_feature_flag = models.ForeignKey("FeatureFlag", on_delete=models.RESTRICT, blank=False) + primary_early_access_feature = models.ForeignKey("EarlyAccessFeature", on_delete=models.RESTRICT, blank=False) created_at = models.DateTimeField(default=timezone.now) updated_at = models.DateTimeField(auto_now=True) archived = models.BooleanField(default=False) diff --git a/posthog/models/feature_flag/feature_flag.py b/posthog/models/feature_flag/feature_flag.py index dc59b4956bccd..3e1fc5c1e4b56 100644 --- a/posthog/models/feature_flag/feature_flag.py +++ b/posthog/models/feature_flag/feature_flag.py @@ -53,7 +53,7 @@ class FeatureFlag(models.Model): ) # whether a feature is sending us rich analytics, like views & interactions. has_enriched_analytics = models.BooleanField(default=False, null=True, blank=True) - feature = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) + feature_management = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) class Meta: constraints = [models.UniqueConstraint(fields=["team", "key"], name="unique key for team")] From 2ed54915ffa15e418c8db900487d5a05c691c0ce Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 11:53:25 -0800 Subject: [PATCH 25/80] rm unnecessary diffs --- .../api/test/__snapshots__/test_api_docs.ambr | 4 +- .../api/test/__snapshots__/test_decide.ambr | 758 ++++-------------- .../test_early_access_feature.ambr | 270 ++----- .../test/__snapshots__/test_feature_flag.ambr | 352 +++++++- .../test_organization_feature_flag.ambr | 447 +++++------ .../api/test/__snapshots__/test_survey.ambr | 493 ++++-------- 6 files changed, 945 insertions(+), 1379 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_api_docs.ambr b/posthog/api/test/__snapshots__/test_api_docs.ambr index 987bc750b8c8b..42c03569e8f25 100644 --- a/posthog/api/test/__snapshots__/test_api_docs.ambr +++ b/posthog/api/test/__snapshots__/test_api_docs.ambr @@ -34,10 +34,10 @@ '/home/runner/work/posthog/posthog/posthog/api/event.py: Warning [EventViewSet]: could not derive type of path parameter "id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/event.py: Warning [EventViewSet]: could not derive type of path parameter "project_id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', "/home/runner/work/posthog/posthog/posthog/api/event_definition.py: Error [EventDefinitionViewSet]: exception raised while getting serializer. Hint: Is get_serializer_class() returning None or is get_queryset() not working without a request? Ignoring the view for now. (Exception: 'AnonymousUser' object has no attribute 'organization')", + '/home/runner/work/posthog/posthog/posthog/api/event_definition.py: Warning [EventDefinitionViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.event_definition.EventDefinition" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "filename". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "has_content". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.exported_asset.ExportedAsset" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', - '/home/runner/work/posthog/posthog/posthog/api/feature.py: Warning [FeatureViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature.Feature" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/feature_flag.py: Warning [FeatureFlagViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature_flag.feature_flag.FeatureFlag" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_cache_target_age". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_columns". Consider using a type hint or @extend_schema_field. Defaulting to string.', @@ -55,11 +55,11 @@ '/home/runner/work/posthog/posthog/posthog/api/organization.py: Warning [OrganizationViewSet > OrganizationSerializer]: unable to resolve type hint for function "get_metadata". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/person.py: Warning [SessionRecordingViewSet > SessionRecordingSerializer > MinimalPersonSerializer]: unable to resolve type hint for function "get_distinct_ids". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/plugin_log_entry.py: Warning [PluginLogEntryViewSet]: could not derive type of path parameter "plugin_config_id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', - '/home/runner/work/posthog/posthog/posthog/api/plugin_log_entry.py: Warning [PluginLogEntryViewSet]: could not derive type of path parameter "project_id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/project.py: Warning [ProjectViewSet > ProjectBackwardCompatSerializer]: could not resolve field on model with path "default_modifiers". This is likely a custom field that does some unknown magic. Maybe consider annotating the field/property? Defaulting to "string". (Exception: Project has no field named \'default_modifiers\')', '/home/runner/work/posthog/posthog/posthog/api/project.py: Warning [ProjectViewSet > ProjectBackwardCompatSerializer]: could not resolve field on model with path "person_on_events_querying_enabled". This is likely a custom field that does some unknown magic. Maybe consider annotating the field/property? Defaulting to "string". (Exception: Project has no field named \'person_on_events_querying_enabled\')', '/home/runner/work/posthog/posthog/posthog/api/project.py: Warning [ProjectViewSet > ProjectBackwardCompatSerializer]: unable to resolve type hint for function "get_product_intents". Consider using a type hint or @extend_schema_field. Defaulting to string.', "/home/runner/work/posthog/posthog/posthog/api/property_definition.py: Error [PropertyDefinitionViewSet]: exception raised while getting serializer. Hint: Is get_serializer_class() returning None or is get_queryset() not working without a request? Ignoring the view for now. (Exception: 'AnonymousUser' object has no attribute 'organization')", + '/home/runner/work/posthog/posthog/posthog/api/property_definition.py: Warning [PropertyDefinitionViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.property_definition.PropertyDefinition" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/proxy_record.py: Warning [ProxyRecordViewset]: could not derive type of path parameter "id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/proxy_record.py: Warning [ProxyRecordViewset]: could not derive type of path parameter "organization_id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/query.py: Error [QueryViewSet]: unable to guess serializer. This is graceful fallback handling for APIViews. Consider using GenericAPIView as view base class, if view is under your control. Either way you may want to add a serializer_class (or method). Ignoring view for now.', diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index 432caf0681fcb..56f6257a978d2 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -516,59 +516,14 @@ ''' # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.23 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.24 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.25 ''' SELECT 1 AS "a" FROM "posthog_grouptypemapping" - WHERE "posthog_grouptypemapping"."project_id" = 99999 + WHERE "posthog_grouptypemapping"."team_id" = 99999 LIMIT 1 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.26 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.24 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -631,7 +586,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.27 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.25 ''' SELECT "posthog_productintent"."id", "posthog_productintent"."team_id", @@ -645,7 +600,7 @@ WHERE "posthog_productintent"."team_id" = 99999 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.28 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.26 ''' SELECT "posthog_productintent"."product_type", "posthog_productintent"."created_at", @@ -655,7 +610,7 @@ WHERE "posthog_productintent"."team_id" = 99999 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.29 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.27 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -687,6 +642,45 @@ LIMIT 21 ''' # --- +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.28 + ''' + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."active" + AND NOT "posthog_featureflag"."deleted" + AND "posthog_featureflag"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.29 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginconfig"."web_token", + "posthog_pluginsourcefile"."updated_at", + "posthog_plugin"."updated_at", + "posthog_pluginconfig"."updated_at" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.3 ''' SELECT "posthog_team"."id", @@ -759,41 +753,15 @@ # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.30 ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.31 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginconfig"."web_token", - "posthog_pluginsourcefile"."updated_at", - "posthog_plugin"."updated_at", - "posthog_pluginconfig"."updated_at" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."type" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."transpiled" IS NOT NULL + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) ''' # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.4 @@ -1141,81 +1109,6 @@ ''' # --- # name: TestDecide.test_flag_with_behavioural_cohorts.10 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestDecide.test_flag_with_behavioural_cohorts.11 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestDecide.test_flag_with_behavioural_cohorts.12 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1285,7 +1178,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.13 +# name: TestDecide.test_flag_with_behavioural_cohorts.11 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1294,52 +1187,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.14 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_flag_with_behavioural_cohorts.15 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestDecide.test_flag_with_behavioural_cohorts.16 +# name: TestDecide.test_flag_with_behavioural_cohorts.12 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1364,7 +1212,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.17 +# name: TestDecide.test_flag_with_behavioural_cohorts.13 ''' SELECT "posthog_group"."id", "posthog_group"."team_id", @@ -1380,7 +1228,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.18 +# name: TestDecide.test_flag_with_behavioural_cohorts.14 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1405,7 +1253,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.19 +# name: TestDecide.test_flag_with_behavioural_cohorts.15 ''' SELECT "posthog_group"."id", "posthog_group"."team_id", @@ -1513,51 +1361,6 @@ ''' # --- # name: TestDecide.test_flag_with_behavioural_cohorts.5 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_flag_with_behavioural_cohorts.6 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestDecide.test_flag_with_behavioural_cohorts.7 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -1589,7 +1392,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.8 +# name: TestDecide.test_flag_with_behavioural_cohorts.6 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1659,7 +1462,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.9 +# name: TestDecide.test_flag_with_behavioural_cohorts.7 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -1675,37 +1478,16 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts +# name: TestDecide.test_flag_with_behavioural_cohorts.8 ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id", - "posthog_team"."id", + SELECT "posthog_team"."id", "posthog_team"."uuid", "posthog_team"."organization_id", "posthog_team"."project_id", @@ -1759,24 +1541,48 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_hogfunction" - INNER JOIN "posthog_team" ON ("posthog_hogfunction"."team_id" = "posthog_team"."id") - WHERE ("posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."filters" @> '{"filter_test_accounts": true}'::jsonb) + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.1 +# name: TestDecide.test_flag_with_behavioural_cohorts.9 ''' - SELECT "posthog_team"."id", + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id", + "posthog_team"."id", "posthog_team"."uuid", "posthog_team"."organization_id", "posthog_team"."project_id", @@ -1830,14 +1636,22 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 + FROM "posthog_hogfunction" + INNER JOIN "posthog_team" ON ("posthog_hogfunction"."team_id" = "posthog_team"."id") + WHERE ("posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."filters" @> '{"filter_test_accounts": true}'::jsonb) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.10 +# name: TestDecide.test_flag_with_regular_cohorts.1 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1900,19 +1714,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.11 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestDecide.test_flag_with_regular_cohorts.12 +# name: TestDecide.test_flag_with_regular_cohorts.10 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1982,7 +1784,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.13 +# name: TestDecide.test_flag_with_regular_cohorts.11 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1991,52 +1793,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.14 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_flag_with_regular_cohorts.15 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestDecide.test_flag_with_regular_cohorts.16 +# name: TestDecide.test_flag_with_regular_cohorts.12 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -2061,7 +1818,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.17 +# name: TestDecide.test_flag_with_regular_cohorts.13 ''' SELECT (("posthog_person"."properties" -> '$some_prop_1') = '"something_1"'::jsonb AND "posthog_person"."properties" ? '$some_prop_1' @@ -2073,7 +1830,7 @@ AND "posthog_person"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.18 +# name: TestDecide.test_flag_with_regular_cohorts.14 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -2098,7 +1855,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.19 +# name: TestDecide.test_flag_with_regular_cohorts.15 ''' SELECT (("posthog_person"."properties" -> '$some_prop_1') = '"something_1"'::jsonb AND "posthog_person"."properties" ? '$some_prop_1' @@ -2202,51 +1959,6 @@ ''' # --- # name: TestDecide.test_flag_with_regular_cohorts.5 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_flag_with_regular_cohorts.6 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestDecide.test_flag_with_regular_cohorts.7 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -2278,7 +1990,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.8 +# name: TestDecide.test_flag_with_regular_cohorts.6 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2348,94 +2060,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.9 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "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"."feature_id" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_web_app_queries - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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" - FROM "posthog_team" - WHERE "posthog_team"."api_token" = 'token123' - LIMIT 21 - ''' -# --- -# name: TestDecide.test_web_app_queries.1 +# name: TestDecide.test_flag_with_regular_cohorts.7 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -2451,44 +2076,14 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries.10 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestDecide.test_web_app_queries.11 +# name: TestDecide.test_flag_with_regular_cohorts.8 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2551,7 +2146,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_web_app_queries.12 +# name: TestDecide.test_flag_with_regular_cohorts.9 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -2563,7 +2158,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_web_app_queries.13 +# name: TestDecide.test_web_app_queries ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2619,30 +2214,37 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 + WHERE "posthog_team"."api_token" = 'token123' LIMIT 21 ''' # --- -# name: TestDecide.test_web_app_queries.14 +# name: TestDecide.test_web_app_queries.1 ''' - SELECT COUNT(*) AS "__count" + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries.15 +# name: TestDecide.test_web_app_queries.10 ''' SELECT "posthog_pluginconfig"."id", "posthog_pluginconfig"."web_token", @@ -2658,83 +2260,19 @@ AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries.16 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_web_app_queries.17 +# name: TestDecide.test_web_app_queries.11 ''' SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" + "posthog_hogfunction"."type" FROM "posthog_hogfunction" WHERE ("posthog_hogfunction"."enabled" AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."transpiled" IS NOT NULL AND "posthog_hogfunction"."type" IN ('site_destination', 'site_app')) ''' # --- -# name: TestDecide.test_web_app_queries.18 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginconfig"."web_token", - "posthog_pluginsourcefile"."updated_at", - "posthog_plugin"."updated_at", - "posthog_pluginconfig"."updated_at" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_web_app_queries.19 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginconfig"."web_token", - "posthog_pluginsourcefile"."updated_at", - "posthog_plugin"."updated_at", - "posthog_pluginconfig"."updated_at" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- # name: TestDecide.test_web_app_queries.2 ''' SELECT "posthog_pluginconfig"."id", @@ -3015,10 +2553,10 @@ # name: TestDecide.test_web_app_queries.9 ''' SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" + "posthog_pluginsourcefile"."updated_at", + "posthog_plugin"."updated_at", + "posthog_pluginconfig"."updated_at" FROM "posthog_pluginconfig" INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") diff --git a/posthog/api/test/__snapshots__/test_early_access_feature.ambr b/posthog/api/test/__snapshots__/test_early_access_feature.ambr index f6c7d7de2593a..608eb81e1b382 100644 --- a/posthog/api/test/__snapshots__/test_early_access_feature.ambr +++ b/posthog/api/test/__snapshots__/test_early_access_feature.ambr @@ -85,8 +85,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -94,88 +93,6 @@ ''' # --- # name: TestPreviewList.test_early_access_features.10 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestPreviewList.test_early_access_features.11 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "posthog_team"."extra_settings", - "posthog_team"."modifiers", - "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", - "posthog_team"."external_data_workspace_id", - "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestPreviewList.test_early_access_features.12 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -184,52 +101,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestPreviewList.test_early_access_features.13 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestPreviewList.test_early_access_features.14 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestPreviewList.test_early_access_features.15 +# name: TestPreviewList.test_early_access_features.11 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -261,7 +133,7 @@ LIMIT 21 ''' # --- -# name: TestPreviewList.test_early_access_features.16 +# name: TestPreviewList.test_early_access_features.12 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -324,7 +196,7 @@ LIMIT 21 ''' # --- -# name: TestPreviewList.test_early_access_features.17 +# name: TestPreviewList.test_early_access_features.13 ''' SELECT "posthog_earlyaccessfeature"."id", "posthog_earlyaccessfeature"."team_id", @@ -334,7 +206,6 @@ "posthog_earlyaccessfeature"."stage", "posthog_earlyaccessfeature"."documentation_url", "posthog_earlyaccessfeature"."created_at", - "posthog_earlyaccessfeature"."feature_id", "posthog_featureflag"."id", "posthog_featureflag"."key", "posthog_featureflag"."name", @@ -349,13 +220,11 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_earlyaccessfeature" - INNER JOIN "posthog_team" ON ("posthog_earlyaccessfeature"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_earlyaccessfeature"."feature_flag_id" = "posthog_featureflag"."id") WHERE ("posthog_earlyaccessfeature"."stage" = 'beta' - AND "posthog_team"."project_id" = 99999) + AND "posthog_earlyaccessfeature"."team_id" = 99999) ''' # --- # name: TestPreviewList.test_early_access_features.2 @@ -513,51 +382,6 @@ ''' # --- # name: TestPreviewList.test_early_access_features.6 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestPreviewList.test_early_access_features.7 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestPreviewList.test_early_access_features.8 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -580,6 +404,81 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- +# name: TestPreviewList.test_early_access_features.7 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestPreviewList.test_early_access_features.8 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- # name: TestPreviewList.test_early_access_features.9 ''' SELECT "posthog_team"."id", @@ -636,6 +535,13 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" diff --git a/posthog/api/test/__snapshots__/test_feature_flag.ambr b/posthog/api/test/__snapshots__/test_feature_flag.ambr index 50652146afad9..8250f4f667393 100644 --- a/posthog/api/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_feature_flag.ambr @@ -338,7 +338,61 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_iterator ''' SELECT "posthog_team"."id", - "posthog_team"."project_id" + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -532,7 +586,61 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_with_cohort_flag_adds_cohort_props_as_default_too ''' SELECT "posthog_team"."id", - "posthog_team"."project_id" + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -810,7 +918,61 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_with_default_person_properties_adjustment ''' SELECT "posthog_team"."id", - "posthog_team"."project_id" + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -832,8 +994,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature2' @@ -1022,7 +1183,61 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_with_default_person_properties_adjustment.7 ''' SELECT "posthog_team"."id", - "posthog_team"."project_id" + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -1044,8 +1259,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature-new' @@ -1083,7 +1297,61 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_with_experience_continuity_flag ''' SELECT "posthog_team"."id", - "posthog_team"."project_id" + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -1105,8 +1373,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature2' @@ -1571,8 +1838,7 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary", - "posthog_experiment"."feature_id" + "posthog_experiment"."metrics_secondary" FROM "posthog_experiment" WHERE "posthog_experiment"."exposure_cohort_id" = 99999 ''' @@ -1773,7 +2039,6 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -1811,7 +2076,61 @@ # name: TestFeatureFlag.test_creating_static_cohort.8 ''' SELECT "posthog_team"."id", - "posthog_team"."project_id" + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -1833,8 +2152,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature' diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr index bd2f2de071156..2734c9be79617 100644 --- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr @@ -73,8 +73,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -137,6 +136,13 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" @@ -145,18 +151,6 @@ ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.12 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.13 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -212,13 +206,6 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" @@ -226,61 +213,19 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.14 - ''' - SELECT COUNT(*) AS "__count" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.15 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.16 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.13 ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.17 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.14 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -350,7 +295,16 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.18 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.15 + ''' + SELECT COUNT(*) AS "__count" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."active" + AND NOT "posthog_featureflag"."deleted" + AND "posthog_featureflag"."team_id" = 99999) + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.16 ''' SELECT "posthog_dashboardtile"."id" FROM "posthog_dashboardtile" @@ -361,7 +315,7 @@ AND "posthog_dashboardtile"."dashboard_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.19 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.17 ''' SELECT "posthog_organization"."id", "posthog_organization"."name", @@ -387,16 +341,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.2 - ''' - SELECT 1 AS "a" - FROM "posthog_organizationmembership" - WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid - AND "posthog_organizationmembership"."user_id" = 99999) - LIMIT 1 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.20 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.18 ''' SELECT "posthog_dashboardtile"."id" FROM "posthog_dashboardtile" @@ -407,7 +352,7 @@ AND "posthog_dashboardtile"."dashboard_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.21 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.19 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -470,7 +415,16 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.22 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.2 + ''' + SELECT 1 AS "a" + FROM "posthog_organizationmembership" + WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid + AND "posthog_organizationmembership"."user_id" = 99999) + LIMIT 1 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.20 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -505,7 +459,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.23 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.21 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -575,7 +529,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.24 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.22 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -638,7 +592,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.25 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.23 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -656,7 +610,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.26 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.24 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -691,7 +645,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.27 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.25 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -715,7 +669,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.28 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.26 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -785,7 +739,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.29 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.27 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -848,32 +802,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.3 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "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"."feature_id" - FROM "posthog_featureflag" - INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") - WHERE ("posthog_featureflag"."key" = 'copied-flag-key' - AND "posthog_team"."project_id" = 99999) - LIMIT 21 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.30 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.28 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -908,7 +837,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.31 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.29 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -978,7 +907,30 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.32 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.3 + ''' + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."key" = 'copied-flag-key' + AND "posthog_featureflag"."team_id" = 99999) + LIMIT 21 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.30 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1041,7 +993,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.33 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.31 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -1059,7 +1011,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.34 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.32 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -1094,7 +1046,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.35 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.33 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1118,7 +1070,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.36 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.34 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1188,7 +1140,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.37 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.35 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -1211,7 +1163,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.38 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.36 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1274,7 +1226,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.39 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.37 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -1286,33 +1238,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.4 - ''' - SELECT "posthog_organization"."id", - "posthog_organization"."name", - "posthog_organization"."slug", - "posthog_organization"."logo_media_id", - "posthog_organization"."created_at", - "posthog_organization"."updated_at", - "posthog_organization"."plugins_access_level", - "posthog_organization"."for_internal_metrics", - "posthog_organization"."is_member_join_email_enabled", - "posthog_organization"."enforce_2fa", - "posthog_organization"."is_hipaa", - "posthog_organization"."customer_id", - "posthog_organization"."available_product_features", - "posthog_organization"."usage", - "posthog_organization"."never_drop_data", - "posthog_organization"."customer_trust_scores", - "posthog_organization"."setup_section_2_completed", - "posthog_organization"."personalization", - "posthog_organization"."domain_whitelist" - FROM "posthog_organization" - WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid - LIMIT 21 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.40 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.38 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1382,7 +1308,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.41 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.39 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1391,52 +1317,33 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.42 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.43 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.4 ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) + SELECT "posthog_organization"."id", + "posthog_organization"."name", + "posthog_organization"."slug", + "posthog_organization"."logo_media_id", + "posthog_organization"."created_at", + "posthog_organization"."updated_at", + "posthog_organization"."plugins_access_level", + "posthog_organization"."for_internal_metrics", + "posthog_organization"."is_member_join_email_enabled", + "posthog_organization"."enforce_2fa", + "posthog_organization"."is_hipaa", + "posthog_organization"."customer_id", + "posthog_organization"."available_product_features", + "posthog_organization"."usage", + "posthog_organization"."never_drop_data", + "posthog_organization"."customer_trust_scores", + "posthog_organization"."setup_section_2_completed", + "posthog_organization"."personalization", + "posthog_organization"."domain_whitelist" + FROM "posthog_organization" + WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid + LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.44 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.40 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1506,7 +1413,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.45 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.41 ''' SELECT "posthog_experiment"."id", "posthog_experiment"."name", @@ -1527,13 +1434,12 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary", - "posthog_experiment"."feature_id" + "posthog_experiment"."metrics_secondary" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.46 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.42 ''' SELECT "posthog_survey"."id", "posthog_survey"."team_id", @@ -1568,7 +1474,7 @@ WHERE "posthog_survey"."linked_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.47 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.43 ''' SELECT "posthog_earlyaccessfeature"."id", "posthog_earlyaccessfeature"."team_id", @@ -1577,13 +1483,12 @@ "posthog_earlyaccessfeature"."description", "posthog_earlyaccessfeature"."stage", "posthog_earlyaccessfeature"."documentation_url", - "posthog_earlyaccessfeature"."created_at", - "posthog_earlyaccessfeature"."feature_id" + "posthog_earlyaccessfeature"."created_at" FROM "posthog_earlyaccessfeature" WHERE "posthog_earlyaccessfeature"."feature_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.48 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.44 ''' SELECT "posthog_organizationmembership"."id", "posthog_organizationmembership"."organization_id", @@ -1617,7 +1522,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.49 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.45 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1642,6 +1547,73 @@ AND "posthog_featureflagdashboards"."feature_flag_id" = 99999) ''' # --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.46 + ''' + SELECT "posthog_organizationmembership"."id", + "posthog_organizationmembership"."organization_id", + "posthog_organizationmembership"."user_id", + "posthog_organizationmembership"."level", + "posthog_organizationmembership"."joined_at", + "posthog_organizationmembership"."updated_at", + "posthog_organization"."id", + "posthog_organization"."name", + "posthog_organization"."slug", + "posthog_organization"."logo_media_id", + "posthog_organization"."created_at", + "posthog_organization"."updated_at", + "posthog_organization"."plugins_access_level", + "posthog_organization"."for_internal_metrics", + "posthog_organization"."is_member_join_email_enabled", + "posthog_organization"."enforce_2fa", + "posthog_organization"."is_hipaa", + "posthog_organization"."customer_id", + "posthog_organization"."available_product_features", + "posthog_organization"."usage", + "posthog_organization"."never_drop_data", + "posthog_organization"."customer_trust_scores", + "posthog_organization"."setup_section_2_completed", + "posthog_organization"."personalization", + "posthog_organization"."domain_whitelist" + FROM "posthog_organizationmembership" + INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id") + WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid + AND "posthog_organizationmembership"."user_id" = 99999) + LIMIT 21 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.47 + ''' + SELECT "posthog_instancesetting"."id", + "posthog_instancesetting"."key", + "posthog_instancesetting"."raw_value" + FROM "posthog_instancesetting" + WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_V2_ENABLED' + ORDER BY "posthog_instancesetting"."id" ASC + LIMIT 1 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.48 + ''' + SELECT "posthog_instancesetting"."id", + "posthog_instancesetting"."key", + "posthog_instancesetting"."raw_value" + FROM "posthog_instancesetting" + WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_ENABLED' + ORDER BY "posthog_instancesetting"."id" ASC + LIMIT 1 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.49 + ''' + SELECT "posthog_instancesetting"."id", + "posthog_instancesetting"."key", + "posthog_instancesetting"."raw_value" + FROM "posthog_instancesetting" + WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_V2_ENABLED' + ORDER BY "posthog_instancesetting"."id" ASC + LIMIT 1 + ''' +# --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.5 ''' SELECT "posthog_team"."id", @@ -1701,43 +1673,19 @@ "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" - WHERE "posthog_team"."project_id" = 99999 - ORDER BY "posthog_team"."id" ASC - LIMIT 1 + WHERE "posthog_team"."id" = 99999 + LIMIT 21 ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.50 ''' - SELECT "posthog_organizationmembership"."id", - "posthog_organizationmembership"."organization_id", - "posthog_organizationmembership"."user_id", - "posthog_organizationmembership"."level", - "posthog_organizationmembership"."joined_at", - "posthog_organizationmembership"."updated_at", - "posthog_organization"."id", - "posthog_organization"."name", - "posthog_organization"."slug", - "posthog_organization"."logo_media_id", - "posthog_organization"."created_at", - "posthog_organization"."updated_at", - "posthog_organization"."plugins_access_level", - "posthog_organization"."for_internal_metrics", - "posthog_organization"."is_member_join_email_enabled", - "posthog_organization"."enforce_2fa", - "posthog_organization"."is_hipaa", - "posthog_organization"."customer_id", - "posthog_organization"."available_product_features", - "posthog_organization"."usage", - "posthog_organization"."never_drop_data", - "posthog_organization"."customer_trust_scores", - "posthog_organization"."setup_section_2_completed", - "posthog_organization"."personalization", - "posthog_organization"."domain_whitelist" - FROM "posthog_organizationmembership" - INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id") - WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid - AND "posthog_organizationmembership"."user_id" = 99999) - LIMIT 21 + SELECT "posthog_instancesetting"."id", + "posthog_instancesetting"."key", + "posthog_instancesetting"."raw_value" + FROM "posthog_instancesetting" + WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_ENABLED' + ORDER BY "posthog_instancesetting"."id" ASC + LIMIT 1 ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.51 @@ -1930,13 +1878,11 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" - INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE (NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'copied-flag-key' - AND "posthog_team"."project_id" = 99999) + AND "posthog_featureflag"."team_id" = 99999) ORDER BY "posthog_featureflag"."id" ASC LIMIT 1 ''' @@ -2286,13 +2232,11 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" - INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'copied-flag-key' - AND "posthog_team"."project_id" = 99999) + AND "posthog_featureflag"."team_id" = 99999) ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.9 @@ -2448,8 +2392,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE (NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'key-1' diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index f1cff55bdad87..d7913780c7035 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -27,11 +27,10 @@ ''' SELECT COUNT(*) AS "__count" FROM "posthog_survey" - INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") WHERE (NOT "posthog_survey"."archived" AND "posthog_survey"."end_date" IS NULL AND "posthog_survey"."start_date" IS NOT NULL - AND "posthog_team"."project_id" = 99999 + AND "posthog_survey"."team_id" = 99999 AND NOT ("posthog_survey"."type" = 'api')) ''' # --- @@ -51,8 +50,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -60,88 +58,6 @@ ''' # --- # name: TestSurveysAPIList.test_list_surveys.10 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.11 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "posthog_team"."extra_settings", - "posthog_team"."modifiers", - "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", - "posthog_team"."external_data_workspace_id", - "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.12 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -150,52 +66,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.13 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.14 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.15 +# name: TestSurveysAPIList.test_list_surveys.11 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -218,7 +89,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.16 +# name: TestSurveysAPIList.test_list_surveys.12 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -281,7 +152,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.17 +# name: TestSurveysAPIList.test_list_surveys.13 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -293,7 +164,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.18 +# name: TestSurveysAPIList.test_list_surveys.14 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -363,7 +234,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.19 +# name: TestSurveysAPIList.test_list_surveys.15 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -372,127 +243,18 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.2 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.20 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.21 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.22 +# name: TestSurveysAPIList.test_list_surveys.16 ''' SELECT COUNT(*) AS "__count" FROM "posthog_survey" - INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") WHERE (NOT "posthog_survey"."archived" AND "posthog_survey"."end_date" IS NULL AND "posthog_survey"."start_date" IS NOT NULL - AND "posthog_team"."project_id" = 99999 + AND "posthog_survey"."team_id" = 99999 AND NOT ("posthog_survey"."type" = 'api')) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.23 +# name: TestSurveysAPIList.test_list_surveys.17 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -524,7 +286,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.24 +# name: TestSurveysAPIList.test_list_surveys.18 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -587,7 +349,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.25 +# name: TestSurveysAPIList.test_list_surveys.19 ''' SELECT "posthog_survey"."id", "posthog_survey"."team_id", @@ -633,6 +395,21 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", + T4."id", + T4."key", + T4."name", + T4."filters", + T4."rollout_percentage", + T4."team_id", + T4."created_by_id", + T4."created_at", + T4."deleted", + T4."active", + T4."rollback_conditions", + T4."performed_rollback", + T4."ensure_experience_continuity", + T4."usage_dashboard_id", + T4."has_enriched_analytics", T5."id", T5."key", T5."name", @@ -647,32 +424,79 @@ T5."performed_rollback", T5."ensure_experience_continuity", T5."usage_dashboard_id", - T5."has_enriched_analytics", - T6."id", - T6."key", - T6."name", - T6."filters", - T6."rollout_percentage", - T6."team_id", - T6."created_by_id", - T6."created_at", - T6."deleted", - T6."active", - T6."rollback_conditions", - T6."performed_rollback", - T6."ensure_experience_continuity", - T6."usage_dashboard_id", - T6."has_enriched_analytics" + T5."has_enriched_analytics" FROM "posthog_survey" - INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_survey"."linked_flag_id" = "posthog_featureflag"."id") - LEFT OUTER JOIN "posthog_featureflag" T5 ON ("posthog_survey"."targeting_flag_id" = T5."id") - LEFT OUTER JOIN "posthog_featureflag" T6 ON ("posthog_survey"."internal_targeting_flag_id" = T6."id") - WHERE ("posthog_team"."project_id" = 99999 + LEFT OUTER JOIN "posthog_featureflag" T4 ON ("posthog_survey"."targeting_flag_id" = T4."id") + LEFT OUTER JOIN "posthog_featureflag" T5 ON ("posthog_survey"."internal_targeting_flag_id" = T5."id") + WHERE ("posthog_survey"."team_id" = 99999 AND NOT ("posthog_survey"."archived")) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.26 +# name: TestSurveysAPIList.test_list_surveys.2 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.20 ''' SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id", "posthog_action"."id", @@ -789,51 +613,6 @@ ''' # --- # name: TestSurveysAPIList.test_list_surveys.6 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginsourcefile"."transpiled", - "posthog_pluginconfig"."web_token", - "posthog_plugin"."config_schema", - "posthog_pluginconfig"."config" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.7 - ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.8 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -856,6 +635,81 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- +# name: TestSurveysAPIList.test_list_surveys.7 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.8 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- # name: TestSurveysAPIList.test_list_surveys.9 ''' SELECT "posthog_team"."id", @@ -912,6 +766,13 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" From 36b654d6ce8da65551130ce9a1586dfa82f46ee1 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 11:56:30 -0800 Subject: [PATCH 26/80] rm unnecessary diffs --- .../api/test/__snapshots__/test_api_docs.ambr | 3 +- .../api/test/__snapshots__/test_decide.ambr | 761 ++++++++++++++---- .../test_early_access_feature.ambr | 263 ++++-- .../test/__snapshots__/test_feature_flag.ambr | 336 +------- .../test_organization_feature_flag.ambr | 428 +++++----- .../api/test/__snapshots__/test_survey.ambr | 490 +++++++---- 6 files changed, 1347 insertions(+), 934 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_api_docs.ambr b/posthog/api/test/__snapshots__/test_api_docs.ambr index 42c03569e8f25..54c41fff888b5 100644 --- a/posthog/api/test/__snapshots__/test_api_docs.ambr +++ b/posthog/api/test/__snapshots__/test_api_docs.ambr @@ -34,7 +34,6 @@ '/home/runner/work/posthog/posthog/posthog/api/event.py: Warning [EventViewSet]: could not derive type of path parameter "id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/event.py: Warning [EventViewSet]: could not derive type of path parameter "project_id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', "/home/runner/work/posthog/posthog/posthog/api/event_definition.py: Error [EventDefinitionViewSet]: exception raised while getting serializer. Hint: Is get_serializer_class() returning None or is get_queryset() not working without a request? Ignoring the view for now. (Exception: 'AnonymousUser' object has no attribute 'organization')", - '/home/runner/work/posthog/posthog/posthog/api/event_definition.py: Warning [EventDefinitionViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.event_definition.EventDefinition" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "filename". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "has_content". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.exported_asset.ExportedAsset" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', @@ -55,11 +54,11 @@ '/home/runner/work/posthog/posthog/posthog/api/organization.py: Warning [OrganizationViewSet > OrganizationSerializer]: unable to resolve type hint for function "get_metadata". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/person.py: Warning [SessionRecordingViewSet > SessionRecordingSerializer > MinimalPersonSerializer]: unable to resolve type hint for function "get_distinct_ids". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/plugin_log_entry.py: Warning [PluginLogEntryViewSet]: could not derive type of path parameter "plugin_config_id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', + '/home/runner/work/posthog/posthog/posthog/api/plugin_log_entry.py: Warning [PluginLogEntryViewSet]: could not derive type of path parameter "project_id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/project.py: Warning [ProjectViewSet > ProjectBackwardCompatSerializer]: could not resolve field on model with path "default_modifiers". This is likely a custom field that does some unknown magic. Maybe consider annotating the field/property? Defaulting to "string". (Exception: Project has no field named \'default_modifiers\')', '/home/runner/work/posthog/posthog/posthog/api/project.py: Warning [ProjectViewSet > ProjectBackwardCompatSerializer]: could not resolve field on model with path "person_on_events_querying_enabled". This is likely a custom field that does some unknown magic. Maybe consider annotating the field/property? Defaulting to "string". (Exception: Project has no field named \'person_on_events_querying_enabled\')', '/home/runner/work/posthog/posthog/posthog/api/project.py: Warning [ProjectViewSet > ProjectBackwardCompatSerializer]: unable to resolve type hint for function "get_product_intents". Consider using a type hint or @extend_schema_field. Defaulting to string.', "/home/runner/work/posthog/posthog/posthog/api/property_definition.py: Error [PropertyDefinitionViewSet]: exception raised while getting serializer. Hint: Is get_serializer_class() returning None or is get_queryset() not working without a request? Ignoring the view for now. (Exception: 'AnonymousUser' object has no attribute 'organization')", - '/home/runner/work/posthog/posthog/posthog/api/property_definition.py: Warning [PropertyDefinitionViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.property_definition.PropertyDefinition" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/proxy_record.py: Warning [ProxyRecordViewset]: could not derive type of path parameter "id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/proxy_record.py: Warning [ProxyRecordViewset]: could not derive type of path parameter "organization_id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. ) or annotating the parameter type with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/query.py: Error [QueryViewSet]: unable to guess serializer. This is graceful fallback handling for APIViews. Consider using GenericAPIView as view base class, if view is under your control. Either way you may want to add a serializer_class (or method). Ignoring view for now.', diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index 56f6257a978d2..bb98b5da34e98 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -516,14 +516,59 @@ ''' # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.23 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.24 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.25 ''' SELECT 1 AS "a" FROM "posthog_grouptypemapping" - WHERE "posthog_grouptypemapping"."team_id" = 99999 + WHERE "posthog_grouptypemapping"."project_id" = 99999 LIMIT 1 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.24 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.26 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -586,7 +631,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.25 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.27 ''' SELECT "posthog_productintent"."id", "posthog_productintent"."team_id", @@ -600,7 +645,7 @@ WHERE "posthog_productintent"."team_id" = 99999 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.26 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.28 ''' SELECT "posthog_productintent"."product_type", "posthog_productintent"."created_at", @@ -610,7 +655,7 @@ WHERE "posthog_productintent"."team_id" = 99999 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.27 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.29 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -642,45 +687,6 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.28 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.29 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginconfig"."web_token", - "posthog_pluginsourcefile"."updated_at", - "posthog_plugin"."updated_at", - "posthog_pluginconfig"."updated_at" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.3 ''' SELECT "posthog_team"."id", @@ -753,15 +759,41 @@ # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.30 ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."type" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."transpiled" IS NOT NULL - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."active" + AND NOT "posthog_featureflag"."deleted" + AND "posthog_featureflag"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.31 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginconfig"."web_token", + "posthog_pluginsourcefile"."updated_at", + "posthog_plugin"."updated_at", + "posthog_pluginconfig"."updated_at" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.4 @@ -1109,6 +1141,81 @@ ''' # --- # name: TestDecide.test_flag_with_behavioural_cohorts.10 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.11 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.12 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1178,7 +1285,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.11 +# name: TestDecide.test_flag_with_behavioural_cohorts.13 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1187,7 +1294,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.12 +# name: TestDecide.test_flag_with_behavioural_cohorts.14 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.15 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.16 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1212,7 +1364,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.13 +# name: TestDecide.test_flag_with_behavioural_cohorts.17 ''' SELECT "posthog_group"."id", "posthog_group"."team_id", @@ -1228,7 +1380,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.14 +# name: TestDecide.test_flag_with_behavioural_cohorts.18 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1253,7 +1405,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.15 +# name: TestDecide.test_flag_with_behavioural_cohorts.19 ''' SELECT "posthog_group"."id", "posthog_group"."team_id", @@ -1362,11 +1514,56 @@ # --- # name: TestDecide.test_flag_with_behavioural_cohorts.5 ''' - SELECT "posthog_user"."id", - "posthog_user"."password", - "posthog_user"."last_login", - "posthog_user"."first_name", - "posthog_user"."last_name", + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.6 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.7 + ''' + SELECT "posthog_user"."id", + "posthog_user"."password", + "posthog_user"."last_login", + "posthog_user"."first_name", + "posthog_user"."last_name", "posthog_user"."is_staff", "posthog_user"."date_joined", "posthog_user"."uuid", @@ -1392,7 +1589,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.6 +# name: TestDecide.test_flag_with_behavioural_cohorts.8 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1462,7 +1659,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.7 +# name: TestDecide.test_flag_with_behavioural_cohorts.9 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -1485,9 +1682,29 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.8 +# name: TestDecide.test_flag_with_regular_cohorts ''' - SELECT "posthog_team"."id", + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id", + "posthog_team"."id", "posthog_team"."uuid", "posthog_team"."organization_id", "posthog_team"."project_id", @@ -1541,48 +1758,24 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestDecide.test_flag_with_behavioural_cohorts.9 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 + FROM "posthog_hogfunction" + INNER JOIN "posthog_team" ON ("posthog_hogfunction"."team_id" = "posthog_team"."id") + WHERE ("posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."filters" @> '{"filter_test_accounts": true}'::jsonb) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts +# name: TestDecide.test_flag_with_regular_cohorts.1 ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id", - "posthog_team"."id", + SELECT "posthog_team"."id", "posthog_team"."uuid", "posthog_team"."organization_id", "posthog_team"."project_id", @@ -1636,22 +1829,14 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_hogfunction" - INNER JOIN "posthog_team" ON ("posthog_hogfunction"."team_id" = "posthog_team"."id") - WHERE ("posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."filters" @> '{"filter_test_accounts": true}'::jsonb) + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.1 +# name: TestDecide.test_flag_with_regular_cohorts.10 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1714,7 +1899,19 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.10 +# name: TestDecide.test_flag_with_regular_cohorts.11 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.12 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1784,7 +1981,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.11 +# name: TestDecide.test_flag_with_regular_cohorts.13 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1793,7 +1990,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.12 +# name: TestDecide.test_flag_with_regular_cohorts.14 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.15 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.16 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1818,7 +2060,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.13 +# name: TestDecide.test_flag_with_regular_cohorts.17 ''' SELECT (("posthog_person"."properties" -> '$some_prop_1') = '"something_1"'::jsonb AND "posthog_person"."properties" ? '$some_prop_1' @@ -1830,7 +2072,7 @@ AND "posthog_person"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.14 +# name: TestDecide.test_flag_with_regular_cohorts.18 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1855,7 +2097,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.15 +# name: TestDecide.test_flag_with_regular_cohorts.19 ''' SELECT (("posthog_person"."properties" -> '$some_prop_1') = '"something_1"'::jsonb AND "posthog_person"."properties" ? '$some_prop_1' @@ -1959,6 +2201,51 @@ ''' # --- # name: TestDecide.test_flag_with_regular_cohorts.5 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.6 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.7 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -1990,7 +2277,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.6 +# name: TestDecide.test_flag_with_regular_cohorts.8 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2060,7 +2347,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.7 +# name: TestDecide.test_flag_with_regular_cohorts.9 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -2083,7 +2370,122 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.8 +# name: TestDecide.test_web_app_queries + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" + FROM "posthog_team" + WHERE "posthog_team"."api_token" = 'token123' + LIMIT 21 + ''' +# --- +# name: TestDecide.test_web_app_queries.1 + ''' + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."active" + AND NOT "posthog_featureflag"."deleted" + AND "posthog_featureflag"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_web_app_queries.10 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_web_app_queries.11 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2146,7 +2548,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.9 +# name: TestDecide.test_web_app_queries.12 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -2158,7 +2560,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_web_app_queries +# name: TestDecide.test_web_app_queries.13 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2214,37 +2616,30 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" - WHERE "posthog_team"."api_token" = 'token123' + WHERE "posthog_team"."id" = 99999 LIMIT 21 ''' # --- -# name: TestDecide.test_web_app_queries.1 +# name: TestDecide.test_web_app_queries.14 ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries.10 +# name: TestDecide.test_web_app_queries.15 ''' SELECT "posthog_pluginconfig"."id", "posthog_pluginconfig"."web_token", @@ -2260,19 +2655,83 @@ AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries.11 +# name: TestDecide.test_web_app_queries.16 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_web_app_queries.17 ''' SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."type" + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" FROM "posthog_hogfunction" WHERE ("posthog_hogfunction"."enabled" AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."transpiled" IS NOT NULL AND "posthog_hogfunction"."type" IN ('site_destination', 'site_app')) ''' # --- +# name: TestDecide.test_web_app_queries.18 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginconfig"."web_token", + "posthog_pluginsourcefile"."updated_at", + "posthog_plugin"."updated_at", + "posthog_pluginconfig"."updated_at" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_web_app_queries.19 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginconfig"."web_token", + "posthog_pluginsourcefile"."updated_at", + "posthog_plugin"."updated_at", + "posthog_pluginconfig"."updated_at" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- # name: TestDecide.test_web_app_queries.2 ''' SELECT "posthog_pluginconfig"."id", @@ -2553,10 +3012,10 @@ # name: TestDecide.test_web_app_queries.9 ''' SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", "posthog_pluginconfig"."web_token", - "posthog_pluginsourcefile"."updated_at", - "posthog_plugin"."updated_at", - "posthog_pluginconfig"."updated_at" + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" FROM "posthog_pluginconfig" INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") diff --git a/posthog/api/test/__snapshots__/test_early_access_feature.ambr b/posthog/api/test/__snapshots__/test_early_access_feature.ambr index 608eb81e1b382..9e528aa3a5f0a 100644 --- a/posthog/api/test/__snapshots__/test_early_access_feature.ambr +++ b/posthog/api/test/__snapshots__/test_early_access_feature.ambr @@ -93,6 +93,88 @@ ''' # --- # name: TestPreviewList.test_early_access_features.10 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestPreviewList.test_early_access_features.11 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."modifiers", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", + "posthog_team"."external_data_workspace_last_synced_at" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestPreviewList.test_early_access_features.12 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -101,7 +183,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestPreviewList.test_early_access_features.11 +# name: TestPreviewList.test_early_access_features.13 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestPreviewList.test_early_access_features.14 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestPreviewList.test_early_access_features.15 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -133,7 +260,7 @@ LIMIT 21 ''' # --- -# name: TestPreviewList.test_early_access_features.12 +# name: TestPreviewList.test_early_access_features.16 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -196,7 +323,7 @@ LIMIT 21 ''' # --- -# name: TestPreviewList.test_early_access_features.13 +# name: TestPreviewList.test_early_access_features.17 ''' SELECT "posthog_earlyaccessfeature"."id", "posthog_earlyaccessfeature"."team_id", @@ -222,9 +349,10 @@ "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics" FROM "posthog_earlyaccessfeature" + INNER JOIN "posthog_team" ON ("posthog_earlyaccessfeature"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_earlyaccessfeature"."feature_flag_id" = "posthog_featureflag"."id") WHERE ("posthog_earlyaccessfeature"."stage" = 'beta' - AND "posthog_earlyaccessfeature"."team_id" = 99999) + AND "posthog_team"."project_id" = 99999) ''' # --- # name: TestPreviewList.test_early_access_features.2 @@ -382,6 +510,51 @@ ''' # --- # name: TestPreviewList.test_early_access_features.6 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestPreviewList.test_early_access_features.7 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestPreviewList.test_early_access_features.8 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -404,81 +577,6 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestPreviewList.test_early_access_features.7 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestPreviewList.test_early_access_features.8 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- # name: TestPreviewList.test_early_access_features.9 ''' SELECT "posthog_team"."id", @@ -535,13 +633,6 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" diff --git a/posthog/api/test/__snapshots__/test_feature_flag.ambr b/posthog/api/test/__snapshots__/test_feature_flag.ambr index 8250f4f667393..a00efc8ba764b 100644 --- a/posthog/api/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_feature_flag.ambr @@ -338,61 +338,7 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_iterator ''' SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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"."project_id" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -586,61 +532,7 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_with_cohort_flag_adds_cohort_props_as_default_too ''' SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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"."project_id" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -918,61 +810,7 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_with_default_person_properties_adjustment ''' SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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"."project_id" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -1183,61 +1021,7 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_with_default_person_properties_adjustment.7 ''' SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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"."project_id" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -1297,61 +1081,7 @@ # name: TestCohortGenerationForFeatureFlag.test_creating_static_cohort_with_experience_continuity_flag ''' SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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"."project_id" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 @@ -2076,61 +1806,7 @@ # name: TestFeatureFlag.test_creating_static_cohort.8 ''' SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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"."project_id" FROM "posthog_team" WHERE "posthog_team"."id" = 99999 LIMIT 21 diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr index 2734c9be79617..e20c804218649 100644 --- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr @@ -136,13 +136,6 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" @@ -151,6 +144,18 @@ ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.12 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.13 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -206,6 +211,13 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" @@ -213,19 +225,61 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.13 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.14 ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 + SELECT COUNT(*) AS "__count" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."active" + AND NOT "posthog_featureflag"."deleted" + AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.14 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.15 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.16 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.17 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -295,16 +349,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.15 - ''' - SELECT COUNT(*) AS "__count" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.16 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.18 ''' SELECT "posthog_dashboardtile"."id" FROM "posthog_dashboardtile" @@ -315,7 +360,7 @@ AND "posthog_dashboardtile"."dashboard_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.17 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.19 ''' SELECT "posthog_organization"."id", "posthog_organization"."name", @@ -341,7 +386,16 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.18 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.2 + ''' + SELECT 1 AS "a" + FROM "posthog_organizationmembership" + WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid + AND "posthog_organizationmembership"."user_id" = 99999) + LIMIT 1 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.20 ''' SELECT "posthog_dashboardtile"."id" FROM "posthog_dashboardtile" @@ -352,7 +406,7 @@ AND "posthog_dashboardtile"."dashboard_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.19 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.21 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -415,16 +469,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.2 - ''' - SELECT 1 AS "a" - FROM "posthog_organizationmembership" - WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid - AND "posthog_organizationmembership"."user_id" = 99999) - LIMIT 1 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.20 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.22 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -459,7 +504,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.21 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.23 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -529,7 +574,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.22 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.24 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -592,7 +637,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.23 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.25 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -610,7 +655,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.24 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.26 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -645,7 +690,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.25 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.27 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -669,7 +714,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.26 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.28 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -739,7 +784,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.27 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.29 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -802,7 +847,31 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.28 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.3 + ''' + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") + WHERE ("posthog_featureflag"."key" = 'copied-flag-key' + AND "posthog_team"."project_id" = 99999) + LIMIT 21 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.30 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -837,7 +906,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.29 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.31 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -907,30 +976,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.3 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."key" = 'copied-flag-key' - AND "posthog_featureflag"."team_id" = 99999) - LIMIT 21 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.30 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.32 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -993,7 +1039,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.31 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.33 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -1011,7 +1057,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.32 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.34 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -1046,7 +1092,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.33 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.35 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1070,7 +1116,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.34 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.36 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1140,7 +1186,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.35 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.37 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -1163,7 +1209,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.36 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.38 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1226,7 +1272,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.37 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.39 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -1238,7 +1284,33 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.38 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.4 + ''' + SELECT "posthog_organization"."id", + "posthog_organization"."name", + "posthog_organization"."slug", + "posthog_organization"."logo_media_id", + "posthog_organization"."created_at", + "posthog_organization"."updated_at", + "posthog_organization"."plugins_access_level", + "posthog_organization"."for_internal_metrics", + "posthog_organization"."is_member_join_email_enabled", + "posthog_organization"."enforce_2fa", + "posthog_organization"."is_hipaa", + "posthog_organization"."customer_id", + "posthog_organization"."available_product_features", + "posthog_organization"."usage", + "posthog_organization"."never_drop_data", + "posthog_organization"."customer_trust_scores", + "posthog_organization"."setup_section_2_completed", + "posthog_organization"."personalization", + "posthog_organization"."domain_whitelist" + FROM "posthog_organization" + WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid + LIMIT 21 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.40 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1308,7 +1380,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.39 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.41 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1317,33 +1389,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.4 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.42 ''' - SELECT "posthog_organization"."id", - "posthog_organization"."name", - "posthog_organization"."slug", - "posthog_organization"."logo_media_id", - "posthog_organization"."created_at", - "posthog_organization"."updated_at", - "posthog_organization"."plugins_access_level", - "posthog_organization"."for_internal_metrics", - "posthog_organization"."is_member_join_email_enabled", - "posthog_organization"."enforce_2fa", - "posthog_organization"."is_hipaa", - "posthog_organization"."customer_id", - "posthog_organization"."available_product_features", - "posthog_organization"."usage", - "posthog_organization"."never_drop_data", - "posthog_organization"."customer_trust_scores", - "posthog_organization"."setup_section_2_completed", - "posthog_organization"."personalization", - "posthog_organization"."domain_whitelist" - FROM "posthog_organization" - WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid - LIMIT 21 + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.40 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.43 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.44 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1413,7 +1504,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.41 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.45 ''' SELECT "posthog_experiment"."id", "posthog_experiment"."name", @@ -1439,7 +1530,7 @@ WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.42 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.46 ''' SELECT "posthog_survey"."id", "posthog_survey"."team_id", @@ -1474,7 +1565,7 @@ WHERE "posthog_survey"."linked_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.43 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.47 ''' SELECT "posthog_earlyaccessfeature"."id", "posthog_earlyaccessfeature"."team_id", @@ -1488,7 +1579,7 @@ WHERE "posthog_earlyaccessfeature"."feature_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.44 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.48 ''' SELECT "posthog_organizationmembership"."id", "posthog_organizationmembership"."organization_id", @@ -1522,7 +1613,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.45 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.49 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1547,73 +1638,6 @@ AND "posthog_featureflagdashboards"."feature_flag_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.46 - ''' - SELECT "posthog_organizationmembership"."id", - "posthog_organizationmembership"."organization_id", - "posthog_organizationmembership"."user_id", - "posthog_organizationmembership"."level", - "posthog_organizationmembership"."joined_at", - "posthog_organizationmembership"."updated_at", - "posthog_organization"."id", - "posthog_organization"."name", - "posthog_organization"."slug", - "posthog_organization"."logo_media_id", - "posthog_organization"."created_at", - "posthog_organization"."updated_at", - "posthog_organization"."plugins_access_level", - "posthog_organization"."for_internal_metrics", - "posthog_organization"."is_member_join_email_enabled", - "posthog_organization"."enforce_2fa", - "posthog_organization"."is_hipaa", - "posthog_organization"."customer_id", - "posthog_organization"."available_product_features", - "posthog_organization"."usage", - "posthog_organization"."never_drop_data", - "posthog_organization"."customer_trust_scores", - "posthog_organization"."setup_section_2_completed", - "posthog_organization"."personalization", - "posthog_organization"."domain_whitelist" - FROM "posthog_organizationmembership" - INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id") - WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid - AND "posthog_organizationmembership"."user_id" = 99999) - LIMIT 21 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.47 - ''' - SELECT "posthog_instancesetting"."id", - "posthog_instancesetting"."key", - "posthog_instancesetting"."raw_value" - FROM "posthog_instancesetting" - WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_V2_ENABLED' - ORDER BY "posthog_instancesetting"."id" ASC - LIMIT 1 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.48 - ''' - SELECT "posthog_instancesetting"."id", - "posthog_instancesetting"."key", - "posthog_instancesetting"."raw_value" - FROM "posthog_instancesetting" - WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_ENABLED' - ORDER BY "posthog_instancesetting"."id" ASC - LIMIT 1 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.49 - ''' - SELECT "posthog_instancesetting"."id", - "posthog_instancesetting"."key", - "posthog_instancesetting"."raw_value" - FROM "posthog_instancesetting" - WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_V2_ENABLED' - ORDER BY "posthog_instancesetting"."id" ASC - LIMIT 1 - ''' -# --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.5 ''' SELECT "posthog_team"."id", @@ -1673,19 +1697,43 @@ "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 + WHERE "posthog_team"."project_id" = 99999 + ORDER BY "posthog_team"."id" ASC + LIMIT 1 ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.50 ''' - SELECT "posthog_instancesetting"."id", - "posthog_instancesetting"."key", - "posthog_instancesetting"."raw_value" - FROM "posthog_instancesetting" - WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_ENABLED' - ORDER BY "posthog_instancesetting"."id" ASC - LIMIT 1 + SELECT "posthog_organizationmembership"."id", + "posthog_organizationmembership"."organization_id", + "posthog_organizationmembership"."user_id", + "posthog_organizationmembership"."level", + "posthog_organizationmembership"."joined_at", + "posthog_organizationmembership"."updated_at", + "posthog_organization"."id", + "posthog_organization"."name", + "posthog_organization"."slug", + "posthog_organization"."logo_media_id", + "posthog_organization"."created_at", + "posthog_organization"."updated_at", + "posthog_organization"."plugins_access_level", + "posthog_organization"."for_internal_metrics", + "posthog_organization"."is_member_join_email_enabled", + "posthog_organization"."enforce_2fa", + "posthog_organization"."is_hipaa", + "posthog_organization"."customer_id", + "posthog_organization"."available_product_features", + "posthog_organization"."usage", + "posthog_organization"."never_drop_data", + "posthog_organization"."customer_trust_scores", + "posthog_organization"."setup_section_2_completed", + "posthog_organization"."personalization", + "posthog_organization"."domain_whitelist" + FROM "posthog_organizationmembership" + INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id") + WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid + AND "posthog_organizationmembership"."user_id" = 99999) + LIMIT 21 ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.51 @@ -1880,9 +1928,10 @@ "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" + INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE (NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'copied-flag-key' - AND "posthog_featureflag"."team_id" = 99999) + AND "posthog_team"."project_id" = 99999) ORDER BY "posthog_featureflag"."id" ASC LIMIT 1 ''' @@ -2234,9 +2283,10 @@ "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" + INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'copied-flag-key' - AND "posthog_featureflag"."team_id" = 99999) + AND "posthog_team"."project_id" = 99999) ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.9 diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index d7913780c7035..b29c45cab0c1b 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -27,10 +27,11 @@ ''' SELECT COUNT(*) AS "__count" FROM "posthog_survey" + INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") WHERE (NOT "posthog_survey"."archived" AND "posthog_survey"."end_date" IS NULL AND "posthog_survey"."start_date" IS NOT NULL - AND "posthog_survey"."team_id" = 99999 + AND "posthog_team"."project_id" = 99999 AND NOT ("posthog_survey"."type" = 'api')) ''' # --- @@ -58,6 +59,88 @@ ''' # --- # name: TestSurveysAPIList.test_list_surveys.10 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.11 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."modifiers", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", + "posthog_team"."external_data_workspace_last_synced_at" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.12 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -66,7 +149,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.11 +# name: TestSurveysAPIList.test_list_surveys.13 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.14 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.15 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -89,7 +217,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.12 +# name: TestSurveysAPIList.test_list_surveys.16 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -152,7 +280,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.13 +# name: TestSurveysAPIList.test_list_surveys.17 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -164,7 +292,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.14 +# name: TestSurveysAPIList.test_list_surveys.18 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -234,7 +362,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.15 +# name: TestSurveysAPIList.test_list_surveys.19 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -243,18 +371,127 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.16 +# name: TestSurveysAPIList.test_list_surveys.2 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_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"."ingested_event", + "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"."person_processing_opt_out", + "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_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "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"."primary_dashboard_id", + "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" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.20 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.21 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.22 ''' SELECT COUNT(*) AS "__count" FROM "posthog_survey" + INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") WHERE (NOT "posthog_survey"."archived" AND "posthog_survey"."end_date" IS NULL AND "posthog_survey"."start_date" IS NOT NULL - AND "posthog_survey"."team_id" = 99999 + AND "posthog_team"."project_id" = 99999 AND NOT ("posthog_survey"."type" = 'api')) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.17 +# name: TestSurveysAPIList.test_list_surveys.23 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -286,7 +523,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.18 +# name: TestSurveysAPIList.test_list_surveys.24 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -349,7 +586,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.19 +# name: TestSurveysAPIList.test_list_surveys.25 ''' SELECT "posthog_survey"."id", "posthog_survey"."team_id", @@ -395,21 +632,6 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", - T4."id", - T4."key", - T4."name", - T4."filters", - T4."rollout_percentage", - T4."team_id", - T4."created_by_id", - T4."created_at", - T4."deleted", - T4."active", - T4."rollback_conditions", - T4."performed_rollback", - T4."ensure_experience_continuity", - T4."usage_dashboard_id", - T4."has_enriched_analytics", T5."id", T5."key", T5."name", @@ -424,79 +646,32 @@ T5."performed_rollback", T5."ensure_experience_continuity", T5."usage_dashboard_id", - T5."has_enriched_analytics" + T5."has_enriched_analytics", + T6."id", + T6."key", + T6."name", + T6."filters", + T6."rollout_percentage", + T6."team_id", + T6."created_by_id", + T6."created_at", + T6."deleted", + T6."active", + T6."rollback_conditions", + T6."performed_rollback", + T6."ensure_experience_continuity", + T6."usage_dashboard_id", + T6."has_enriched_analytics" FROM "posthog_survey" + INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_survey"."linked_flag_id" = "posthog_featureflag"."id") - LEFT OUTER JOIN "posthog_featureflag" T4 ON ("posthog_survey"."targeting_flag_id" = T4."id") - LEFT OUTER JOIN "posthog_featureflag" T5 ON ("posthog_survey"."internal_targeting_flag_id" = T5."id") - WHERE ("posthog_survey"."team_id" = 99999 + LEFT OUTER JOIN "posthog_featureflag" T5 ON ("posthog_survey"."targeting_flag_id" = T5."id") + LEFT OUTER JOIN "posthog_featureflag" T6 ON ("posthog_survey"."internal_targeting_flag_id" = T6."id") + WHERE ("posthog_team"."project_id" = 99999 AND NOT ("posthog_survey"."archived")) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.2 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.20 +# name: TestSurveysAPIList.test_list_surveys.26 ''' SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id", "posthog_action"."id", @@ -613,6 +788,51 @@ ''' # --- # name: TestSurveysAPIList.test_list_surveys.6 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.7 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.8 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -635,81 +855,6 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.7 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_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"."ingested_event", - "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"."person_processing_opt_out", - "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_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "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"."primary_dashboard_id", - "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" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.8 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- # name: TestSurveysAPIList.test_list_surveys.9 ''' SELECT "posthog_team"."id", @@ -766,13 +911,6 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" From 9887ea495357dbf5034eeb8b9f413c4f79eb78b6 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 12:03:44 -0800 Subject: [PATCH 27/80] rm unnecessary diffs --- .../__snapshots__/test_process_scheduled_changes.ambr | 3 +-- posthog/test/__snapshots__/test_feature_flag.ambr | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr index 67d990aa5ff77..46fad47a49142 100644 --- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr +++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr @@ -15,8 +15,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index 4e7d98e374fd4..d564d0137a391 100644 --- a/posthog/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/test/__snapshots__/test_feature_flag.ambr @@ -209,8 +209,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -983,8 +982,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1527,8 +1525,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" From 6ec3092ee7111d0d0d23898ce5b0099bf66b2334 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:11:54 +0000 Subject: [PATCH 28/80] Update query snapshots --- posthog/api/test/__snapshots__/test_survey.ambr | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index b29c45cab0c1b..b6ca871f5d33e 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -51,7 +51,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -210,7 +211,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -632,6 +634,7 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id", T5."id", T5."key", T5."name", @@ -647,6 +650,7 @@ T5."ensure_experience_continuity", T5."usage_dashboard_id", T5."has_enriched_analytics", + T5."feature_management_id", T6."id", T6."key", T6."name", @@ -661,7 +665,8 @@ T6."performed_rollback", T6."ensure_experience_continuity", T6."usage_dashboard_id", - T6."has_enriched_analytics" + T6."has_enriched_analytics", + T6."feature_management_id" FROM "posthog_survey" INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_survey"."linked_flag_id" = "posthog_featureflag"."id") @@ -848,7 +853,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" From 4e4ce636e334a4d1e61000a6541ce41a8549d9fa Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:43:44 +0000 Subject: [PATCH 29/80] Update query snapshots --- .../test_process_scheduled_changes.ambr | 24 ++++++++++++------- .../test/__snapshots__/test_feature_flag.ambr | 15 ++++++++---- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr index 46fad47a49142..c84a6286e90e1 100644 --- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr +++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr @@ -15,7 +15,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -101,7 +102,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -354,7 +356,8 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" + "posthog_experiment"."metrics_secondary", + "posthog_experiment"."feature_management_id" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -457,7 +460,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 @@ -512,7 +516,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -835,7 +840,8 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" + "posthog_experiment"."metrics_secondary", + "posthog_experiment"."feature_management_id" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -998,7 +1004,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."key" = 'flag-1' LIMIT 21 @@ -1096,7 +1103,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index d564d0137a391..1b5dce6b40cd6 100644 --- a/posthog/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/test/__snapshots__/test_feature_flag.ambr @@ -209,7 +209,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -368,7 +369,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -826,7 +828,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -982,7 +985,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1525,7 +1529,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" From 4adbf166593dfd6009b39d68cc93d575889cbccf Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 13:59:49 -0800 Subject: [PATCH 30/80] rm unnecessary diffs --- .../api/test/__snapshots__/test_survey.ambr | 14 ++++------- .../test_process_scheduled_changes.ambr | 24 +++++++------------ 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index b6ca871f5d33e..b29c45cab0c1b 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -51,8 +51,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -211,8 +210,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -634,7 +632,6 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id", T5."id", T5."key", T5."name", @@ -650,7 +647,6 @@ T5."ensure_experience_continuity", T5."usage_dashboard_id", T5."has_enriched_analytics", - T5."feature_management_id", T6."id", T6."key", T6."name", @@ -665,8 +661,7 @@ T6."performed_rollback", T6."ensure_experience_continuity", T6."usage_dashboard_id", - T6."has_enriched_analytics", - T6."feature_management_id" + T6."has_enriched_analytics" FROM "posthog_survey" INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_survey"."linked_flag_id" = "posthog_featureflag"."id") @@ -853,8 +848,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr index c84a6286e90e1..46fad47a49142 100644 --- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr +++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr @@ -15,8 +15,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -102,8 +101,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -356,8 +354,7 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary", - "posthog_experiment"."feature_management_id" + "posthog_experiment"."metrics_secondary" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -460,8 +457,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 @@ -516,8 +512,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -840,8 +835,7 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary", - "posthog_experiment"."feature_management_id" + "posthog_experiment"."metrics_secondary" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -1004,8 +998,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE "posthog_featureflag"."key" = 'flag-1' LIMIT 21 @@ -1103,8 +1096,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 From c7fdde6ae789207a81ddc9dbb1d76754622665cf Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:11:59 +0000 Subject: [PATCH 31/80] Update query snapshots --- posthog/api/test/__snapshots__/test_survey.ambr | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index b29c45cab0c1b..b6ca871f5d33e 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -51,7 +51,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -210,7 +211,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -632,6 +634,7 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id", T5."id", T5."key", T5."name", @@ -647,6 +650,7 @@ T5."ensure_experience_continuity", T5."usage_dashboard_id", T5."has_enriched_analytics", + T5."feature_management_id", T6."id", T6."key", T6."name", @@ -661,7 +665,8 @@ T6."performed_rollback", T6."ensure_experience_continuity", T6."usage_dashboard_id", - T6."has_enriched_analytics" + T6."has_enriched_analytics", + T6."feature_management_id" FROM "posthog_survey" INNER JOIN "posthog_team" ON ("posthog_survey"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_survey"."linked_flag_id" = "posthog_featureflag"."id") @@ -848,7 +853,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" From 6a5bf26773853eb634a6fa4a0c6a5a84f4452f7b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:17:51 +0000 Subject: [PATCH 32/80] Update query snapshots --- .../test_process_scheduled_changes.ambr | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr index 46fad47a49142..c84a6286e90e1 100644 --- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr +++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr @@ -15,7 +15,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -101,7 +102,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -354,7 +356,8 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" + "posthog_experiment"."metrics_secondary", + "posthog_experiment"."feature_management_id" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -457,7 +460,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 @@ -512,7 +516,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -835,7 +840,8 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" + "posthog_experiment"."metrics_secondary", + "posthog_experiment"."feature_management_id" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -998,7 +1004,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."key" = 'flag-1' LIMIT 21 @@ -1096,7 +1103,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 From 6ca7b960ab971b7ff9e173fa806e222c0851f96b Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 14:39:10 -0800 Subject: [PATCH 33/80] tweak --- posthog/api/feature.py | 16 ++++++++-------- posthog/api/test/test_feature.py | 21 ++++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/posthog/api/feature.py b/posthog/api/feature.py index 8a1fc0cc0cbdc..7358571646104 100644 --- a/posthog/api/feature.py +++ b/posthog/api/feature.py @@ -18,7 +18,7 @@ class Meta: "documentation_url", "issue_url", "status", - "primary_feature_flag_id", + "primary_early_access_feature_id", "created_at", "updated_at", "archived", @@ -29,10 +29,10 @@ def create(self, validated_data): validated_data["team_id"] = self.context["team_id"] return super().create(validated_data) - def get_primary_feature_flag(self, feature: Feature): + def get_primary_early_access_feature(self, feature: Feature): from posthog.api.feature_flag import FeatureFlagSerializer - return FeatureFlagSerializer(feature.primary_feature_flag, context=self.context).data + return FeatureFlagSerializer(feature.primary_early_access_feature, context=self.context).data def get_early_access_features(self, feature: Feature): from posthog.api.early_access_feature import EarlyAccessFeatureSerializer @@ -59,8 +59,8 @@ def safely_get_queryset(self, queryset) -> QuerySet: # Base queryset with team filtering queryset = Feature.objects.filter(team_id=self.team_id) - if self.action == "primary_feature_flag": - queryset = queryset.select_related("primary_feature_flag") + if self.action == "primary_early_access_feature": + queryset = queryset.select_related("primary_early_access_feature") elif self.action == "experiments": queryset = queryset.prefetch_related("experiment_set") elif self.action == "early_access_features": @@ -71,14 +71,14 @@ def safely_get_queryset(self, queryset) -> QuerySet: return queryset @action(detail=True, methods=["get"]) - def primary_feature_flag(self, request, pk=None, **kwargs): + def primary_early_access_feature(self, request, pk=None, **kwargs): """ Get primary feature flag associated with a specific feature. """ feature = self.get_object() serializer = self.get_serializer(feature) - primary_feature_flag = serializer.get_primary_feature_flag(feature) - return Response(primary_feature_flag) + primary_early_access_feature = serializer.get_primary_early_access_feature(feature) + return Response(primary_early_access_feature) @action(detail=True, methods=["get"]) def feature_flags(self, request, pk=None, **kwargs): diff --git a/posthog/api/test/test_feature.py b/posthog/api/test/test_feature.py index f91dfa82328d3..ee622363eb2d6 100644 --- a/posthog/api/test/test_feature.py +++ b/posthog/api/test/test_feature.py @@ -13,7 +13,6 @@ def setUp(self): description="Test Description", documentation_url="http://example.com", issue_url="http://github.com/example", - status="beta", ) def test_list_features(self): @@ -21,19 +20,19 @@ def test_list_features(self): Experiment.objects.create( team=self.team, name="Test Experiment", - feature=self.feature, + feature_management=self.feature, feature_flag=FeatureFlag.objects.create( team=self.team, name="Test Flag for Experiment", key="test-flag-for-experiment-list", - feature=self.feature, + feature_management=self.feature, ), ) EarlyAccessFeature.objects.create( team=self.team, name="Test EAF", description="Test Description", - feature=self.feature, + feature_management=self.feature, ) response = self.client.get(f"/api/projects/{self.team.id}/features/") @@ -53,19 +52,19 @@ def test_retrieve_feature(self): Experiment.objects.create( team=self.team, name="Test Experiment", - feature=self.feature, + feature_management=self.feature, feature_flag=FeatureFlag.objects.create( team=self.team, name="Test Flag for Experiment", key="test-flag-for-experiment-retrieve", - feature=self.feature, + feature_management=self.feature, ), ) EarlyAccessFeature.objects.create( team=self.team, name="Test EAF", description="Test Description", - feature=self.feature, + feature_management=self.feature, ) response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/") @@ -118,7 +117,7 @@ def test_get_primary_feature_flag(self): team=self.team, name="Test Flag", key="test-flag", - feature=self.feature, + feature_management=self.feature, ) self.feature.primary_feature_flag = flag self.feature.save() @@ -136,7 +135,7 @@ def test_get_experiments(self): name="Test Flag", key="test-flag", ), - feature=self.feature, + feature_management=self.feature, description="Test Description", ) @@ -150,7 +149,7 @@ def test_get_early_access_features(self): team=self.team, name="Test EAF", description="Test Description", - feature=self.feature, + feature_management=self.feature, ) response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/early_access_features/") @@ -163,7 +162,7 @@ def test_get_feature_flags(self): team=self.team, name="Test Flag", key="test-flag", - feature=self.feature, + feature_management=self.feature, ) response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/feature_flags/") From 49d23d80756b6062233b36e928807cda48ff804a Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 14:40:58 -0800 Subject: [PATCH 34/80] tweak --- posthog/api/test/test_feature.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/posthog/api/test/test_feature.py b/posthog/api/test/test_feature.py index ee622363eb2d6..eb559efd2a8fd 100644 --- a/posthog/api/test/test_feature.py +++ b/posthog/api/test/test_feature.py @@ -112,17 +112,19 @@ def test_delete_not_allowed(self): response = self.client.delete(f"/api/projects/{self.team.id}/features/{self.feature.id}/") self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) - def test_get_primary_feature_flag(self): + def test_get_primary_early_access_feature(self): flag = FeatureFlag.objects.create( team=self.team, name="Test Flag", key="test-flag", feature_management=self.feature, ) - self.feature.primary_feature_flag = flag + self.feature.primary_early_access_feature = flag self.feature.save() - response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/primary_feature_flag/") + response = self.client.get( + f"/api/projects/{self.team.id}/features/{self.feature.id}/primary_early_access_feature/" + ) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.json()["key"], "test-flag") From a1141c24eadfab42a402b01d4e7f5db2659d5ad5 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 15:04:59 -0800 Subject: [PATCH 35/80] fix typecheck and tests --- posthog/api/feature.py | 12 ++++-------- posthog/api/test/test_feature.py | 6 ++---- posthog/models/scopes.py | 1 + 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/posthog/api/feature.py b/posthog/api/feature.py index 7358571646104..464dc160eafc6 100644 --- a/posthog/api/feature.py +++ b/posthog/api/feature.py @@ -76,8 +76,7 @@ def primary_early_access_feature(self, request, pk=None, **kwargs): Get primary feature flag associated with a specific feature. """ feature = self.get_object() - serializer = self.get_serializer(feature) - primary_early_access_feature = serializer.get_primary_early_access_feature(feature) + primary_early_access_feature = FeatureSerializer().get_primary_early_access_feature(feature) return Response(primary_early_access_feature) @action(detail=True, methods=["get"]) @@ -86,8 +85,7 @@ def feature_flags(self, request, pk=None, **kwargs): Get all feature flags associated with a specific feature. """ feature = self.get_object() - serializer = self.get_serializer(feature) - flags = serializer.get_feature_flags(feature) + flags = FeatureSerializer().get_feature_flags(feature) return Response(flags) @action(detail=True, methods=["get"]) @@ -96,8 +94,7 @@ def experiments(self, request, pk=None, **kwargs): Get experiments associated with a specific feature. """ feature = self.get_object() - serializer = self.get_serializer(feature) - experiments = serializer.get_experiments(feature) + experiments = FeatureSerializer().get_experiments(feature) return Response(experiments) @action(detail=True, methods=["get"]) @@ -106,6 +103,5 @@ def early_access_features(self, request, pk=None, **kwargs): Get early access features associated with a specific feature. """ feature = self.get_object() - serializer = self.get_serializer(feature) - early_access_features = serializer.get_early_access_features(feature) + early_access_features = FeatureSerializer().get_early_access_features(feature) return Response(early_access_features) diff --git a/posthog/api/test/test_feature.py b/posthog/api/test/test_feature.py index eb559efd2a8fd..d2f90b23e4b84 100644 --- a/posthog/api/test/test_feature.py +++ b/posthog/api/test/test_feature.py @@ -113,13 +113,11 @@ def test_delete_not_allowed(self): self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) def test_get_primary_early_access_feature(self): - flag = FeatureFlag.objects.create( + eaf = EarlyAccessFeature.objects.create( team=self.team, name="Test Flag", - key="test-flag", - feature_management=self.feature, ) - self.feature.primary_early_access_feature = flag + self.feature.primary_early_access_feature = eaf self.feature.save() response = self.client.get( diff --git a/posthog/models/scopes.py b/posthog/models/scopes.py index 2bd0d48b405e5..92b61bd707fea 100644 --- a/posthog/models/scopes.py +++ b/posthog/models/scopes.py @@ -26,6 +26,7 @@ "experiment", "export", "feature_flag", + "feature", "group", "insight", "query", # Covers query and events endpoints From cace51689a4ea7be652cc38cdf4b99dd2528f5ca Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Mon, 9 Dec 2024 18:08:23 -0800 Subject: [PATCH 36/80] fix typecheck and tests --- posthog/api/feature.py | 9 ++++----- posthog/api/test/test_feature.py | 5 +---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/posthog/api/feature.py b/posthog/api/feature.py index 464dc160eafc6..15975aa987663 100644 --- a/posthog/api/feature.py +++ b/posthog/api/feature.py @@ -17,7 +17,6 @@ class Meta: "description", "documentation_url", "issue_url", - "status", "primary_early_access_feature_id", "created_at", "updated_at", @@ -30,9 +29,9 @@ def create(self, validated_data): return super().create(validated_data) def get_primary_early_access_feature(self, feature: Feature): - from posthog.api.feature_flag import FeatureFlagSerializer + from posthog.api.early_access_feature import EarlyAccessFeatureSerializer - return FeatureFlagSerializer(feature.primary_early_access_feature, context=self.context).data + return EarlyAccessFeatureSerializer(feature.primary_early_access_feature, context=self.context).data def get_early_access_features(self, feature: Feature): from posthog.api.early_access_feature import EarlyAccessFeatureSerializer @@ -45,9 +44,9 @@ def get_experiments(self, feature: Feature): return WebExperimentsAPISerializer(feature.experiment_set, many=True).data def get_feature_flags(self, feature: Feature): - from posthog.api.feature_flag import FeatureFlagSerializer + from posthog.api.feature_flag import MinimalFeatureFlagSerializer - return FeatureFlagSerializer(feature.featureflag_set, context=self.context, many=True).data + return MinimalFeatureFlagSerializer(feature.featureflag_set, context=self.context, many=True).data class FeatureViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDestroyModel, viewsets.ModelViewSet): diff --git a/posthog/api/test/test_feature.py b/posthog/api/test/test_feature.py index d2f90b23e4b84..7dc3f29d3e53b 100644 --- a/posthog/api/test/test_feature.py +++ b/posthog/api/test/test_feature.py @@ -89,7 +89,6 @@ def test_create_feature(self): "description": "New Description", "documentation_url": "http://example.com/new", "issue_url": "http://github.com/example/new", - "status": "alpha", }, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) @@ -101,12 +100,10 @@ def test_update_feature(self): f"/api/projects/{self.team.id}/features/{self.feature.id}/", { "name": "Updated Feature", - "status": "beta", }, ) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.json()["name"], "Updated Feature") - self.assertEqual(response.json()["status"], "beta") def test_delete_not_allowed(self): response = self.client.delete(f"/api/projects/{self.team.id}/features/{self.feature.id}/") @@ -124,7 +121,7 @@ def test_get_primary_early_access_feature(self): f"/api/projects/{self.team.id}/features/{self.feature.id}/primary_early_access_feature/" ) self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertEqual(response.json()["key"], "test-flag") + self.assertEqual(response.json()["name"], "Test Flag") def test_get_experiments(self): Experiment.objects.create( From 701eed7b802e8553b54f807d783213ed9c279714 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 02:44:36 +0000 Subject: [PATCH 37/80] Update query snapshots --- .../api/test/__snapshots__/test_api_docs.ambr | 1 + .../api/test/__snapshots__/test_decide.ambr | 12 ++++++---- .../test_early_access_feature.ambr | 10 +++++--- .../test/__snapshots__/test_feature_flag.ambr | 22 +++++++++++------ .../test_organization_feature_flag.ambr | 24 ++++++++++++------- 5 files changed, 47 insertions(+), 22 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_api_docs.ambr b/posthog/api/test/__snapshots__/test_api_docs.ambr index 54c41fff888b5..987bc750b8c8b 100644 --- a/posthog/api/test/__snapshots__/test_api_docs.ambr +++ b/posthog/api/test/__snapshots__/test_api_docs.ambr @@ -37,6 +37,7 @@ '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "filename". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "has_content". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.exported_asset.ExportedAsset" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', + '/home/runner/work/posthog/posthog/posthog/api/feature.py: Warning [FeatureViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature.Feature" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/feature_flag.py: Warning [FeatureFlagViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature_flag.feature_flag.FeatureFlag" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_cache_target_age". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_columns". Consider using a type hint or @extend_schema_field. Defaulting to string.', diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index bb98b5da34e98..c3f680244ba25 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -773,7 +773,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1675,7 +1676,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -2363,7 +2365,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -2449,7 +2452,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" diff --git a/posthog/api/test/__snapshots__/test_early_access_feature.ambr b/posthog/api/test/__snapshots__/test_early_access_feature.ambr index 9e528aa3a5f0a..a616e87f68ef3 100644 --- a/posthog/api/test/__snapshots__/test_early_access_feature.ambr +++ b/posthog/api/test/__snapshots__/test_early_access_feature.ambr @@ -85,7 +85,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -333,6 +334,7 @@ "posthog_earlyaccessfeature"."stage", "posthog_earlyaccessfeature"."documentation_url", "posthog_earlyaccessfeature"."created_at", + "posthog_earlyaccessfeature"."feature_management_id", "posthog_featureflag"."id", "posthog_featureflag"."key", "posthog_featureflag"."name", @@ -347,7 +349,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_earlyaccessfeature" INNER JOIN "posthog_team" ON ("posthog_earlyaccessfeature"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_earlyaccessfeature"."feature_flag_id" = "posthog_featureflag"."id") @@ -570,7 +573,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" diff --git a/posthog/api/test/__snapshots__/test_feature_flag.ambr b/posthog/api/test/__snapshots__/test_feature_flag.ambr index a00efc8ba764b..4e8b07ce20eb9 100644 --- a/posthog/api/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_feature_flag.ambr @@ -360,7 +360,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature2' @@ -554,7 +555,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature-new' @@ -832,7 +834,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature2' @@ -1043,7 +1046,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature-new' @@ -1103,7 +1107,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature2' @@ -1568,7 +1573,8 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" + "posthog_experiment"."metrics_secondary", + "posthog_experiment"."feature_management_id" FROM "posthog_experiment" WHERE "posthog_experiment"."exposure_cohort_id" = 99999 ''' @@ -1769,6 +1775,7 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -1828,7 +1835,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature' diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr index e20c804218649..8ab2c1d2c894f 100644 --- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr @@ -73,7 +73,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -863,7 +864,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'copied-flag-key' @@ -1202,7 +1204,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1525,7 +1528,8 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" + "posthog_experiment"."metrics_secondary", + "posthog_experiment"."feature_management_id" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -1574,7 +1578,8 @@ "posthog_earlyaccessfeature"."description", "posthog_earlyaccessfeature"."stage", "posthog_earlyaccessfeature"."documentation_url", - "posthog_earlyaccessfeature"."created_at" + "posthog_earlyaccessfeature"."created_at", + "posthog_earlyaccessfeature"."feature_management_id" FROM "posthog_earlyaccessfeature" WHERE "posthog_earlyaccessfeature"."feature_flag_id" = 99999 ''' @@ -1926,7 +1931,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE (NOT "posthog_featureflag"."deleted" @@ -2281,7 +2287,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."deleted" @@ -2442,7 +2449,8 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" + "posthog_featureflag"."has_enriched_analytics", + "posthog_featureflag"."feature_management_id" FROM "posthog_featureflag" WHERE (NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'key-1' From f242d4f76af3edcb0deb2a46c49f90c1066024de Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 16:53:43 -0800 Subject: [PATCH 38/80] rework for v0 model --- posthog/api/feature.py | 68 ++++----- posthog/api/test/test_feature.py | 135 ++++-------------- posthog/migrations/0529_add_features_table.py | 62 -------- .../migrations/0533_feature_mgmt_tables.py | 79 ++++++++++ posthog/migrations/max_migration.txt | 2 +- posthog/models/__init__.py | 3 +- posthog/models/early_access_feature.py | 1 - posthog/models/experiment.py | 1 - posthog/models/feature.py | 20 ++- posthog/models/feature_flag/feature_flag.py | 1 - 10 files changed, 147 insertions(+), 225 deletions(-) delete mode 100644 posthog/migrations/0529_add_features_table.py create mode 100644 posthog/migrations/0533_feature_mgmt_tables.py diff --git a/posthog/api/feature.py b/posthog/api/feature.py index 15975aa987663..2c3e53afd9983 100644 --- a/posthog/api/feature.py +++ b/posthog/api/feature.py @@ -2,12 +2,21 @@ from rest_framework.response import Response from rest_framework.decorators import action from django.db.models import QuerySet -from posthog.models import Feature +from posthog.models import Feature, FeatureAlertConfiguration +from posthog.api.alert import AlertSerializer from posthog.api.routing import TeamAndOrgViewSetMixin from posthog.api.forbid_destroy_model import ForbidDestroyModel from posthog.rbac.access_control_api_mixin import AccessControlViewSetMixin +class FeatureAlertConfigurationSerializer(serializers.ModelSerializer): + alert_configuration = AlertSerializer() + + class Meta: + model = FeatureAlertConfiguration + fields = ["alert_configuration", "feature_insight_type"] + + class FeatureSerializer(serializers.ModelSerializer): class Meta: model = Feature @@ -19,13 +28,16 @@ class Meta: "issue_url", "primary_early_access_feature_id", "created_at", - "updated_at", + "created_by", "archived", "deleted", ] def create(self, validated_data): + request = self.context["request"] + validated_data["team_id"] = self.context["team_id"] + validated_data["created_by"] = request.user return super().create(validated_data) def get_primary_early_access_feature(self, feature: Feature): @@ -33,20 +45,9 @@ def get_primary_early_access_feature(self, feature: Feature): return EarlyAccessFeatureSerializer(feature.primary_early_access_feature, context=self.context).data - def get_early_access_features(self, feature: Feature): - from posthog.api.early_access_feature import EarlyAccessFeatureSerializer - - return EarlyAccessFeatureSerializer(feature.earlyaccessfeature_set, many=True).data - - def get_experiments(self, feature: Feature): - from posthog.api.web_experiment import WebExperimentsAPISerializer - - return WebExperimentsAPISerializer(feature.experiment_set, many=True).data - - def get_feature_flags(self, feature: Feature): - from posthog.api.feature_flag import MinimalFeatureFlagSerializer - - return MinimalFeatureFlagSerializer(feature.featureflag_set, context=self.context, many=True).data + def get_alerts(self, feature: Feature): + alerts = FeatureAlertConfigurationSerializer(source="alerts", many=True, read_only=True) + return AlertSerializer(alerts, many=True).data class FeatureViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDestroyModel, viewsets.ModelViewSet): @@ -60,12 +61,8 @@ def safely_get_queryset(self, queryset) -> QuerySet: if self.action == "primary_early_access_feature": queryset = queryset.select_related("primary_early_access_feature") - elif self.action == "experiments": - queryset = queryset.prefetch_related("experiment_set") - elif self.action == "early_access_features": - queryset = queryset.prefetch_related("earlyaccessfeature_set") - elif self.action == "feature_flags": - queryset = queryset.prefetch_related("featureflag_set") + elif self.action == "alerts": + queryset = queryset.prefetch_related("alerts") return queryset @@ -79,28 +76,11 @@ def primary_early_access_feature(self, request, pk=None, **kwargs): return Response(primary_early_access_feature) @action(detail=True, methods=["get"]) - def feature_flags(self, request, pk=None, **kwargs): - """ - Get all feature flags associated with a specific feature. - """ - feature = self.get_object() - flags = FeatureSerializer().get_feature_flags(feature) - return Response(flags) - - @action(detail=True, methods=["get"]) - def experiments(self, request, pk=None, **kwargs): - """ - Get experiments associated with a specific feature. - """ - feature = self.get_object() - experiments = FeatureSerializer().get_experiments(feature) - return Response(experiments) - - @action(detail=True, methods=["get"]) - def early_access_features(self, request, pk=None, **kwargs): + def alerts(self, request, pk=None, **kwargs): """ - Get early access features associated with a specific feature. + Get all alerts associated with a specific feature. """ feature = self.get_object() - early_access_features = FeatureSerializer().get_early_access_features(feature) - return Response(early_access_features) + alerts_for_feature = FeatureAlertConfiguration.objects.filter(feature=feature).all() + alerts = FeatureAlertConfigurationSerializer(alerts_for_feature, many=True).data + return Response(alerts) diff --git a/posthog/api/test/test_feature.py b/posthog/api/test/test_feature.py index 7dc3f29d3e53b..d9efae282f90b 100644 --- a/posthog/api/test/test_feature.py +++ b/posthog/api/test/test_feature.py @@ -1,71 +1,48 @@ from rest_framework import status -from posthog.models import Feature, FeatureFlag, Experiment, EarlyAccessFeature, Team +from posthog.models import AlertConfiguration, EarlyAccessFeature, Feature, FeatureAlertConfiguration, Insight from posthog.test.base import APIBaseTest class TestFeatureAPI(APIBaseTest): def setUp(self): super().setUp() + self.early_access_feature = EarlyAccessFeature.objects.create( + team=self.team, + name="Test EAF", + description="Test Description", + ) self.feature = Feature.objects.create( team=self.team, name="Test Feature", description="Test Description", documentation_url="http://example.com", issue_url="http://github.com/example", + primary_early_access_feature=self.early_access_feature, ) def test_list_features(self): - # Create a feature flag and experiment for the feature, ensure they are not returned in the response - Experiment.objects.create( - team=self.team, - name="Test Experiment", - feature_management=self.feature, - feature_flag=FeatureFlag.objects.create( - team=self.team, - name="Test Flag for Experiment", - key="test-flag-for-experiment-list", - feature_management=self.feature, - ), - ) - EarlyAccessFeature.objects.create( - team=self.team, - name="Test EAF", - description="Test Description", - feature_management=self.feature, - ) - response = self.client.get(f"/api/projects/{self.team.id}/features/") self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(len(response.json()["results"]), 1) self.assertEqual(response.json()["results"][0]["name"], "Test Feature") + self.assertEqual( + response.json()["results"][0]["primary_early_access_feature_id"], f"{self.early_access_feature.id}" + ) # Ensure we are not returning joined data with self.assertRaises(KeyError): - response.json()["results"][0]["experiments"] - with self.assertRaises(KeyError): - response.json()["results"][0]["feature_flags"] + response.json()["results"][0]["alerts"] with self.assertRaises(KeyError): - response.json()["results"][0]["early_access_features"] + response.json()["results"][0]["primary_early_access_feature"] def test_retrieve_feature(self): - Experiment.objects.create( - team=self.team, - name="Test Experiment", - feature_management=self.feature, - feature_flag=FeatureFlag.objects.create( - team=self.team, - name="Test Flag for Experiment", - key="test-flag-for-experiment-retrieve", - feature_management=self.feature, - ), - ) - EarlyAccessFeature.objects.create( + eaf = EarlyAccessFeature.objects.create( team=self.team, name="Test EAF", description="Test Description", - feature_management=self.feature, ) + self.feature.primary_early_access_feature = eaf response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/") self.assertEqual(response.status_code, status.HTTP_200_OK) @@ -74,11 +51,9 @@ def test_retrieve_feature(self): # Ensure we are not returning joined data with self.assertRaises(KeyError): - response.json()["experiments"] + response.json()["results"][0]["alerts"] with self.assertRaises(KeyError): - response.json()["feature_flags"] - with self.assertRaises(KeyError): - response.json()["early_access_features"] + response.json()["results"][0]["primary_early_access_feature"] def test_create_feature(self): response = self.client.post( @@ -123,78 +98,20 @@ def test_get_primary_early_access_feature(self): self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.json()["name"], "Test Flag") - def test_get_experiments(self): - Experiment.objects.create( + def test_get_alerts(self): + insight = Insight.objects.create( team=self.team, - name="Test Experiment", - feature_flag=FeatureFlag.objects.create( - team=self.team, - name="Test Flag", - key="test-flag", - ), - feature_management=self.feature, - description="Test Description", + filters={"events": [{"id": "$pageview", "type": "events", "name": "pageview"}]}, ) - - response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/experiments/") - self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertEqual(len(response.json()), 1) - self.assertEqual(response.json()[0]["name"], "Test Experiment") - - def test_get_early_access_features(self): - EarlyAccessFeature.objects.create( + alert = AlertConfiguration.objects.create(team=self.team, name="Test Alert", insight=insight) + FeatureAlertConfiguration.objects.create( team=self.team, - name="Test EAF", - description="Test Description", - feature_management=self.feature, + feature=self.feature, + alert_configuration=alert, + feature_insight_type="success_metric", ) - response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/early_access_features/") + response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/alerts/") self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(len(response.json()), 1) - self.assertEqual(response.json()[0]["name"], "Test EAF") - - def test_get_feature_flags(self): - FeatureFlag.objects.create( - team=self.team, - name="Test Flag", - key="test-flag", - feature_management=self.feature, - ) - - response = self.client.get(f"/api/projects/{self.team.id}/features/{self.feature.id}/feature_flags/") - self.assertEqual(response.status_code, status.HTTP_200_OK) - self.assertEqual(len(response.json()), 1) - self.assertEqual(response.json()[0]["key"], "test-flag") - - def test_cannot_create_feature_without_name(self): - response = self.client.post( - f"/api/projects/{self.team.id}/features/", - { - "team": self.team.id, - "description": "New Description", - }, - ) - self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - self.assertIn("name", response.json()["attr"]) - - def test_cannot_access_feature_from_another_team(self): - other_team = Team.objects.create( - organization=self.organization, - api_token=self.CONFIG_API_TOKEN + "2", - test_account_filters=[ - { - "key": "email", - "value": "@posthog.com", - "operator": "not_icontains", - "type": "person", - } - ], - ) - other_feature = Feature.objects.create( - team=other_team, - name="Other Feature", - ) - - response = self.client.get(f"/api/projects/{self.team.id}/features/{other_feature.id}/") - self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) + self.assertEqual(response.json()[0]["feature_insight_type"], "success_metric") diff --git a/posthog/migrations/0529_add_features_table.py b/posthog/migrations/0529_add_features_table.py deleted file mode 100644 index a52fa91361e55..0000000000000 --- a/posthog/migrations/0529_add_features_table.py +++ /dev/null @@ -1,62 +0,0 @@ -# Generated by Django 3.2.18 on 2023-06-22 11:08 - -from django.db import migrations, models -from django.utils import timezone - - -class Migration(migrations.Migration): - dependencies = [ - ("posthog", "0528_project_field_in_taxonomy"), - ] - - operations = [ - migrations.CreateModel( - name="Feature", - fields=[ - ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.team")), - ("name", models.CharField(max_length=400, blank=False)), - ("description", models.TextField(default="")), - ("documentation_url", models.URLField(blank=True)), - ("issue_url", models.URLField(blank=True)), - ( - "primary_early_access_feature", - models.ForeignKey(null=True, on_delete=models.deletion.RESTRICT, to="posthog.earlyaccessfeature"), - ), - ("created_at", models.DateTimeField(default=timezone.now)), - ("updated_at", models.DateTimeField(auto_now=True)), - ("archived", models.BooleanField(default=False)), - ("deleted", models.BooleanField(default=False)), - ], - ), - migrations.AddField( - model_name="featureflag", - name="feature_management", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=models.deletion.SET_NULL, - to="posthog.feature", - ), - ), - migrations.AddField( - model_name="experiment", - name="feature_management", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=models.deletion.SET_NULL, - to="posthog.feature", - ), - ), - migrations.AddField( - model_name="earlyaccessfeature", - name="feature_management", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=models.deletion.SET_NULL, - to="posthog.feature", - ), - ), - ] diff --git a/posthog/migrations/0533_feature_mgmt_tables.py b/posthog/migrations/0533_feature_mgmt_tables.py new file mode 100644 index 0000000000000..0306b3a1d0ee3 --- /dev/null +++ b/posthog/migrations/0533_feature_mgmt_tables.py @@ -0,0 +1,79 @@ +# Generated by Django 3.2.18 on 2023-06-22 11:08 + +from django.db import migrations, models +from django.conf import settings + +import posthog.models.utils + + +class Migration(migrations.Migration): + dependencies = [ + ("posthog", "0532_taxonomy_unique_on_project"), + ] + + operations = [ + migrations.CreateModel( + name="Feature", + fields=[ + ( + "id", + models.UUIDField( + default=posthog.models.utils.UUIDT, + editable=False, + primary_key=True, + serialize=False, + ), + ), + ("team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.team")), + ("name", models.CharField(max_length=400, blank=False)), + ("description", models.TextField(default="")), + ("documentation_url", models.URLField(blank=True)), + ("issue_url", models.URLField(blank=True)), + ( + "primary_early_access_feature", + models.ForeignKey(null=True, on_delete=models.deletion.RESTRICT, to="posthog.earlyaccessfeature"), + ), + ("created_at", models.DateTimeField(auto_now_add=True)), + ( + "created_by", + models.ForeignKey( + blank=True, null=True, on_delete=models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL + ), + ), + ("archived", models.BooleanField(default=False)), + ("deleted", models.BooleanField(default=False)), + ], + ), + migrations.CreateModel( + name="FeatureAlertConfiguration", + fields=[ + ( + "team", + models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.Team"), + ), + ( + "feature", + models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.Feature"), + ), + ( + "alert_configuration", + models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.AlertConfiguration"), + ), + ( + "feature_insight_type", + models.CharField( + max_length=32, + choices=[("success_metric", "Success Metric"), ("faiure_metric", "Failure Metric")], + ), + ), + ], + ), + migrations.AddField( + model_name="Feature", + name="alerts", + field=models.ManyToManyField( + to="posthog.AlertConfiguration", + through="posthog.FeatureAlertConfiguration", + ), + ), + ] diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt index 01fc03d62a8a0..e83d28ef4234f 100644 --- a/posthog/migrations/max_migration.txt +++ b/posthog/migrations/max_migration.txt @@ -1 +1 @@ -0532_taxonomy_unique_on_project +0533_feature_mgmt_tables \ No newline at end of file diff --git a/posthog/models/__init__.py b/posthog/models/__init__.py index 7ba2ca8f9d8ea..92536d60727fb 100644 --- a/posthog/models/__init__.py +++ b/posthog/models/__init__.py @@ -42,7 +42,7 @@ from .event_property import EventProperty from .experiment import Experiment from .exported_asset import ExportedAsset -from .feature import Feature +from .feature import Feature, FeatureAlertConfiguration from .feature_flag import FeatureFlag from .feedback.survey import Survey from .filters import Filter, RetentionFilter @@ -119,6 +119,7 @@ "Experiment", "ExportedAsset", "Feature", + "FeatureAlertConfiguration", "FeatureFlag", "Filter", "Group", diff --git a/posthog/models/early_access_feature.py b/posthog/models/early_access_feature.py index af7adde4531c0..453e184c7e18b 100644 --- a/posthog/models/early_access_feature.py +++ b/posthog/models/early_access_feature.py @@ -30,7 +30,6 @@ class Stage(models.TextChoices): stage = models.CharField(max_length=40, choices=Stage.choices) documentation_url = models.URLField(max_length=800, blank=True) created_at = models.DateTimeField(auto_now_add=True) - feature_management = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) def __str__(self) -> str: return self.name diff --git a/posthog/models/experiment.py b/posthog/models/experiment.py index c8767434c90b2..87119d292b689 100644 --- a/posthog/models/experiment.py +++ b/posthog/models/experiment.py @@ -45,7 +45,6 @@ class ExperimentType(models.TextChoices): saved_metrics: models.ManyToManyField = models.ManyToManyField( "ExperimentSavedMetric", blank=True, related_name="experiments", through="ExperimentToSavedMetric" ) - feature_management = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) def get_feature_flag_key(self): return self.feature_flag.key diff --git a/posthog/models/feature.py b/posthog/models/feature.py index 49b0b2626a6a2..29816bc11e536 100644 --- a/posthog/models/feature.py +++ b/posthog/models/feature.py @@ -1,15 +1,25 @@ from django.db import models -from django.utils import timezone +from posthog.models.utils import UUIDModel, CreatedMetaFields -class Feature(models.Model): + +class Feature(CreatedMetaFields, UUIDModel): name = models.CharField(max_length=400, blank=False) - team = models.ForeignKey("Team", on_delete=models.CASCADE) + team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE) description = models.TextField(default="") documentation_url = models.URLField(blank=True) issue_url = models.URLField(blank=True) primary_early_access_feature = models.ForeignKey("EarlyAccessFeature", on_delete=models.RESTRICT, blank=False) - created_at = models.DateTimeField(default=timezone.now) - updated_at = models.DateTimeField(auto_now=True) + alerts = models.ManyToManyField("posthog.AlertConfiguration", through="posthog.FeatureAlertConfiguration") archived = models.BooleanField(default=False) deleted = models.BooleanField(default=False) + + +class FeatureAlertConfiguration(models.Model): + team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE) + feature = models.ForeignKey("posthog.Feature", on_delete=models.CASCADE) + alert_configuration = models.ForeignKey("posthog.AlertConfiguration", on_delete=models.CASCADE) + feature_insight_type = models.CharField( + max_length=32, + choices=[("success_metric", "Success Metric"), ("faiure_metric", "Failure Metric")], + ) diff --git a/posthog/models/feature_flag/feature_flag.py b/posthog/models/feature_flag/feature_flag.py index 3e1fc5c1e4b56..beca926b7fbac 100644 --- a/posthog/models/feature_flag/feature_flag.py +++ b/posthog/models/feature_flag/feature_flag.py @@ -53,7 +53,6 @@ class FeatureFlag(models.Model): ) # whether a feature is sending us rich analytics, like views & interactions. has_enriched_analytics = models.BooleanField(default=False, null=True, blank=True) - feature_management = models.ForeignKey("posthog.Feature", on_delete=models.SET_NULL, null=True) class Meta: constraints = [models.UniqueConstraint(fields=["team", "key"], name="unique key for team")] From 64bc53352ef966ce584bcd4ca4a49995c7267a3c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 01:06:38 +0000 Subject: [PATCH 39/80] Update query snapshots --- posthog/api/test/__snapshots__/test_survey.ambr | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index 736a24fee67d0..f4e08a30e1622 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -487,8 +487,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -2179,8 +2178,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" From ca68d2477b0df61c14fd4c9befa1691ab5721f8d Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 01:08:24 +0000 Subject: [PATCH 40/80] Update query snapshots --- .../api/test/__snapshots__/test_decide.ambr | 54 +------------------ .../test_early_access_feature.ambr | 10 ++-- .../test/__snapshots__/test_feature_flag.ambr | 22 +++----- .../test_organization_feature_flag.ambr | 24 +++------ 4 files changed, 20 insertions(+), 90 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index 430c981ae94da..049ef77b360b5 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -923,8 +923,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -2189,30 +2188,6 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.9 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "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"."feature_management_id" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- # name: TestDecide.test_flag_with_regular_cohorts ''' SELECT "posthog_hogfunction"."id", @@ -3237,30 +3212,6 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.9 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "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"."feature_management_id" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- # name: TestDecide.test_web_app_queries ''' SELECT "posthog_team"."id", @@ -3340,8 +3291,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" diff --git a/posthog/api/test/__snapshots__/test_early_access_feature.ambr b/posthog/api/test/__snapshots__/test_early_access_feature.ambr index 0f04d67ec5780..c7820616d0cfd 100644 --- a/posthog/api/test/__snapshots__/test_early_access_feature.ambr +++ b/posthog/api/test/__snapshots__/test_early_access_feature.ambr @@ -85,8 +85,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -546,7 +545,6 @@ "posthog_earlyaccessfeature"."stage", "posthog_earlyaccessfeature"."documentation_url", "posthog_earlyaccessfeature"."created_at", - "posthog_earlyaccessfeature"."feature_management_id", "posthog_featureflag"."id", "posthog_featureflag"."key", "posthog_featureflag"."name", @@ -561,8 +559,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_earlyaccessfeature" INNER JOIN "posthog_team" ON ("posthog_earlyaccessfeature"."team_id" = "posthog_team"."id") LEFT OUTER JOIN "posthog_featureflag" ON ("posthog_earlyaccessfeature"."feature_flag_id" = "posthog_featureflag"."id") @@ -1029,8 +1026,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" diff --git a/posthog/api/test/__snapshots__/test_feature_flag.ambr b/posthog/api/test/__snapshots__/test_feature_flag.ambr index 4e8b07ce20eb9..a00efc8ba764b 100644 --- a/posthog/api/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_feature_flag.ambr @@ -360,8 +360,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature2' @@ -555,8 +554,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature-new' @@ -834,8 +832,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature2' @@ -1046,8 +1043,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature-new' @@ -1107,8 +1103,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature2' @@ -1573,8 +1568,7 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary", - "posthog_experiment"."feature_management_id" + "posthog_experiment"."metrics_secondary" FROM "posthog_experiment" WHERE "posthog_experiment"."exposure_cohort_id" = 99999 ''' @@ -1775,7 +1769,6 @@ "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -1835,8 +1828,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'some-feature' diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr index 991ada49dbb0e..5b8721a2cd48f 100644 --- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr @@ -73,8 +73,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -950,8 +949,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."key" = 'copied-flag-key' @@ -1353,8 +1351,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1826,8 +1823,7 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary", - "posthog_experiment"."feature_management_id" + "posthog_experiment"."metrics_secondary" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -1876,8 +1872,7 @@ "posthog_earlyaccessfeature"."description", "posthog_earlyaccessfeature"."stage", "posthog_earlyaccessfeature"."documentation_url", - "posthog_earlyaccessfeature"."created_at", - "posthog_earlyaccessfeature"."feature_management_id" + "posthog_earlyaccessfeature"."created_at" FROM "posthog_earlyaccessfeature" WHERE "posthog_earlyaccessfeature"."feature_flag_id" = 99999 ''' @@ -2244,8 +2239,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE (NOT "posthog_featureflag"."deleted" @@ -2600,8 +2594,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" INNER JOIN "posthog_team" ON ("posthog_featureflag"."team_id" = "posthog_team"."id") WHERE ("posthog_featureflag"."deleted" @@ -2762,8 +2755,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE (NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'key-1' From e7b07ef4194542f09d29d90edff828595c860e60 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 17:09:49 -0800 Subject: [PATCH 41/80] tweak --- posthog/api/feature.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/posthog/api/feature.py b/posthog/api/feature.py index 2c3e53afd9983..7703c51f6d0c0 100644 --- a/posthog/api/feature.py +++ b/posthog/api/feature.py @@ -4,6 +4,7 @@ from django.db.models import QuerySet from posthog.models import Feature, FeatureAlertConfiguration from posthog.api.alert import AlertSerializer +from posthog.api.early_access_feature import EarlyAccessFeatureSerializer from posthog.api.routing import TeamAndOrgViewSetMixin from posthog.api.forbid_destroy_model import ForbidDestroyModel from posthog.rbac.access_control_api_mixin import AccessControlViewSetMixin @@ -41,14 +42,8 @@ def create(self, validated_data): return super().create(validated_data) def get_primary_early_access_feature(self, feature: Feature): - from posthog.api.early_access_feature import EarlyAccessFeatureSerializer - return EarlyAccessFeatureSerializer(feature.primary_early_access_feature, context=self.context).data - def get_alerts(self, feature: Feature): - alerts = FeatureAlertConfigurationSerializer(source="alerts", many=True, read_only=True) - return AlertSerializer(alerts, many=True).data - class FeatureViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDestroyModel, viewsets.ModelViewSet): scope_object = "feature" @@ -78,7 +73,8 @@ def primary_early_access_feature(self, request, pk=None, **kwargs): @action(detail=True, methods=["get"]) def alerts(self, request, pk=None, **kwargs): """ - Get all alerts associated with a specific feature. + Get all alerts associated with a specific feature. These alerts are used to track + success and failure metrics for the feature. """ feature = self.get_object() alerts_for_feature = FeatureAlertConfiguration.objects.filter(feature=feature).all() From ad6d33656b64be4cdc62e23f6701290a202d51f1 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 17:10:36 -0800 Subject: [PATCH 42/80] remove unnecessary diff --- posthog/api/test/__snapshots__/test_api_docs.ambr | 1 - 1 file changed, 1 deletion(-) diff --git a/posthog/api/test/__snapshots__/test_api_docs.ambr b/posthog/api/test/__snapshots__/test_api_docs.ambr index 0798a6ee9aba6..862d8507dbb75 100644 --- a/posthog/api/test/__snapshots__/test_api_docs.ambr +++ b/posthog/api/test/__snapshots__/test_api_docs.ambr @@ -37,7 +37,6 @@ '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "filename". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "has_content". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.exported_asset.ExportedAsset" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', - '/home/runner/work/posthog/posthog/posthog/api/feature.py: Warning [FeatureViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature.Feature" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/feature_flag.py: Warning [FeatureFlagViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature_flag.feature_flag.FeatureFlag" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_cache_target_age". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_columns". Consider using a type hint or @extend_schema_field. Defaulting to string.', From 8c8026c69560f6e8a05fa68f776fe2648465ea0a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 01:11:10 +0000 Subject: [PATCH 43/80] Update query snapshots --- .../test_process_scheduled_changes.ambr | 24 +++++++------------ .../test/__snapshots__/test_feature_flag.ambr | 9 +++---- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr index d527b6c0b3abe..563d97146fefe 100644 --- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr +++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr @@ -15,8 +15,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -135,8 +134,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -550,8 +548,7 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary", - "posthog_experiment"."feature_management_id" + "posthog_experiment"."metrics_secondary" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -642,8 +639,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 @@ -698,8 +694,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1171,8 +1166,7 @@ "posthog_experiment"."type", "posthog_experiment"."variants", "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary", - "posthog_experiment"."feature_management_id" + "posthog_experiment"."metrics_secondary" FROM "posthog_experiment" WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' @@ -1335,8 +1329,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE "posthog_featureflag"."key" = 'flag-1' LIMIT 21 @@ -1641,8 +1634,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE "posthog_featureflag"."id" = 99999 LIMIT 21 diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index d644e973ccc3c..26e3b9acfa02a 100644 --- a/posthog/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/test/__snapshots__/test_feature_flag.ambr @@ -209,8 +209,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -1467,8 +1466,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" @@ -2172,8 +2170,7 @@ "posthog_featureflag"."performed_rollback", "posthog_featureflag"."ensure_experience_continuity", "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics", - "posthog_featureflag"."feature_management_id" + "posthog_featureflag"."has_enriched_analytics" FROM "posthog_featureflag" WHERE ("posthog_featureflag"."active" AND NOT "posthog_featureflag"."deleted" From a9792c394116d69094b9a5f3d0482dc10d82fa11 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 17:27:07 -0800 Subject: [PATCH 44/80] tweak --- posthog/models/feature.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/posthog/models/feature.py b/posthog/models/feature.py index 29816bc11e536..b65386fe19a59 100644 --- a/posthog/models/feature.py +++ b/posthog/models/feature.py @@ -9,7 +9,9 @@ class Feature(CreatedMetaFields, UUIDModel): description = models.TextField(default="") documentation_url = models.URLField(blank=True) issue_url = models.URLField(blank=True) - primary_early_access_feature = models.ForeignKey("EarlyAccessFeature", on_delete=models.RESTRICT, blank=False) + primary_early_access_feature = models.ForeignKey( + "posthog.EarlyAccessFeature", on_delete=models.RESTRICT, blank=False + ) alerts = models.ManyToManyField("posthog.AlertConfiguration", through="posthog.FeatureAlertConfiguration") archived = models.BooleanField(default=False) deleted = models.BooleanField(default=False) From 2e721a614115e8754ace918588ac037459ddeb11 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 01:33:43 +0000 Subject: [PATCH 45/80] Update query snapshots --- posthog/api/test/__snapshots__/test_api_docs.ambr | 1 + 1 file changed, 1 insertion(+) diff --git a/posthog/api/test/__snapshots__/test_api_docs.ambr b/posthog/api/test/__snapshots__/test_api_docs.ambr index 862d8507dbb75..0798a6ee9aba6 100644 --- a/posthog/api/test/__snapshots__/test_api_docs.ambr +++ b/posthog/api/test/__snapshots__/test_api_docs.ambr @@ -37,6 +37,7 @@ '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "filename". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "has_content". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.exported_asset.ExportedAsset" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', + '/home/runner/work/posthog/posthog/posthog/api/feature.py: Warning [FeatureViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature.Feature" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/feature_flag.py: Warning [FeatureFlagViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature_flag.feature_flag.FeatureFlag" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_cache_target_age". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_columns". Consider using a type hint or @extend_schema_field. Defaulting to string.', From 8c70d49221be2bb1434788b789ceb82a5461b081 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 17:44:31 -0800 Subject: [PATCH 46/80] tweak --- posthog/migrations/0533_feature_mgmt_tables.py | 1 + 1 file changed, 1 insertion(+) diff --git a/posthog/migrations/0533_feature_mgmt_tables.py b/posthog/migrations/0533_feature_mgmt_tables.py index 0306b3a1d0ee3..d058044fe6cb3 100644 --- a/posthog/migrations/0533_feature_mgmt_tables.py +++ b/posthog/migrations/0533_feature_mgmt_tables.py @@ -47,6 +47,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name="FeatureAlertConfiguration", fields=[ + ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False)), ( "team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.Team"), From 5061056f6970e4c58e986a64db2e22310e882bdf Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 17:53:40 -0800 Subject: [PATCH 47/80] tweak --- posthog/migrations/0533_feature_mgmt_tables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posthog/migrations/0533_feature_mgmt_tables.py b/posthog/migrations/0533_feature_mgmt_tables.py index d058044fe6cb3..fea315b03656d 100644 --- a/posthog/migrations/0533_feature_mgmt_tables.py +++ b/posthog/migrations/0533_feature_mgmt_tables.py @@ -31,7 +31,7 @@ class Migration(migrations.Migration): ("issue_url", models.URLField(blank=True)), ( "primary_early_access_feature", - models.ForeignKey(null=True, on_delete=models.deletion.RESTRICT, to="posthog.earlyaccessfeature"), + models.ForeignKey(on_delete=models.deletion.RESTRICT, to="posthog.earlyaccessfeature"), ), ("created_at", models.DateTimeField(auto_now_add=True)), ( From cfa0c4d956dead0d654ba646cedbb316aa9d9791 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 17:55:15 -0800 Subject: [PATCH 48/80] tweak --- posthog/api/test/__snapshots__/test_api_docs.ambr | 1 - 1 file changed, 1 deletion(-) diff --git a/posthog/api/test/__snapshots__/test_api_docs.ambr b/posthog/api/test/__snapshots__/test_api_docs.ambr index 0798a6ee9aba6..862d8507dbb75 100644 --- a/posthog/api/test/__snapshots__/test_api_docs.ambr +++ b/posthog/api/test/__snapshots__/test_api_docs.ambr @@ -37,7 +37,6 @@ '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "filename". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "has_content". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.exported_asset.ExportedAsset" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', - '/home/runner/work/posthog/posthog/posthog/api/feature.py: Warning [FeatureViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature.Feature" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/feature_flag.py: Warning [FeatureFlagViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature_flag.feature_flag.FeatureFlag" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_cache_target_age". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_columns". Consider using a type hint or @extend_schema_field. Defaulting to string.', From 227295ec034dbe14a98881f256ed6ea48672da9a Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 17:56:23 -0800 Subject: [PATCH 49/80] tweak --- frontend/src/types.ts | 1 + posthog/models/scopes.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 317b046e7acf6..c2f20923208c6 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -3885,6 +3885,7 @@ export type APIScopeObject = | 'event_definition' | 'experiment' | 'export' + | 'feature' | 'feature_flag' | 'group' | 'insight' diff --git a/posthog/models/scopes.py b/posthog/models/scopes.py index 92b61bd707fea..6f7e088f3ff3c 100644 --- a/posthog/models/scopes.py +++ b/posthog/models/scopes.py @@ -25,8 +25,8 @@ "event_definition", "experiment", "export", - "feature_flag", "feature", + "feature_flag", "group", "insight", "query", # Covers query and events endpoints From 6fe434c76beb793db7a57df0327d1cddf3a53253 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 18:11:24 -0800 Subject: [PATCH 50/80] fix migration --- posthog/migrations/0533_feature_mgmt_tables.py | 10 +++++++++- posthog/models/feature.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/posthog/migrations/0533_feature_mgmt_tables.py b/posthog/migrations/0533_feature_mgmt_tables.py index fea315b03656d..6ce30c73a7384 100644 --- a/posthog/migrations/0533_feature_mgmt_tables.py +++ b/posthog/migrations/0533_feature_mgmt_tables.py @@ -47,7 +47,15 @@ class Migration(migrations.Migration): migrations.CreateModel( name="FeatureAlertConfiguration", fields=[ - ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False)), + ( + "id", + models.UUIDField( + default=posthog.models.utils.UUIDT, + editable=False, + primary_key=True, + serialize=False, + ), + ), ( "team", models.ForeignKey(on_delete=models.deletion.CASCADE, to="posthog.Team"), diff --git a/posthog/models/feature.py b/posthog/models/feature.py index b65386fe19a59..6730b37dcbcb6 100644 --- a/posthog/models/feature.py +++ b/posthog/models/feature.py @@ -17,7 +17,7 @@ class Feature(CreatedMetaFields, UUIDModel): deleted = models.BooleanField(default=False) -class FeatureAlertConfiguration(models.Model): +class FeatureAlertConfiguration(models.Model, UUIDModel): team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE) feature = models.ForeignKey("posthog.Feature", on_delete=models.CASCADE) alert_configuration = models.ForeignKey("posthog.AlertConfiguration", on_delete=models.CASCADE) From 374b9c55fddfed8859220ae86ff6f80e653d477a Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 17 Dec 2024 18:14:44 -0800 Subject: [PATCH 51/80] tweak --- posthog/models/feature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posthog/models/feature.py b/posthog/models/feature.py index 6730b37dcbcb6..d3463f4a32cf3 100644 --- a/posthog/models/feature.py +++ b/posthog/models/feature.py @@ -17,7 +17,7 @@ class Feature(CreatedMetaFields, UUIDModel): deleted = models.BooleanField(default=False) -class FeatureAlertConfiguration(models.Model, UUIDModel): +class FeatureAlertConfiguration(UUIDModel): team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE) feature = models.ForeignKey("posthog.Feature", on_delete=models.CASCADE) alert_configuration = models.ForeignKey("posthog.AlertConfiguration", on_delete=models.CASCADE) From 6964217670ab4685c591279209bb0913a481448c Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Wed, 18 Dec 2024 10:44:28 -0800 Subject: [PATCH 52/80] fix test --- posthog/api/feature.py | 1 + posthog/api/test/test_feature.py | 1 + 2 files changed, 2 insertions(+) diff --git a/posthog/api/feature.py b/posthog/api/feature.py index 7703c51f6d0c0..c2c43ebac5077 100644 --- a/posthog/api/feature.py +++ b/posthog/api/feature.py @@ -39,6 +39,7 @@ def create(self, validated_data): validated_data["team_id"] = self.context["team_id"] validated_data["created_by"] = request.user + validated_data["primary_early_access_feature_id"] = request.data.get("primary_early_access_feature_id") return super().create(validated_data) def get_primary_early_access_feature(self, feature: Feature): diff --git a/posthog/api/test/test_feature.py b/posthog/api/test/test_feature.py index d9efae282f90b..0f31c429279ad 100644 --- a/posthog/api/test/test_feature.py +++ b/posthog/api/test/test_feature.py @@ -64,6 +64,7 @@ def test_create_feature(self): "description": "New Description", "documentation_url": "http://example.com/new", "issue_url": "http://github.com/example/new", + "primary_early_access_feature_id": self.early_access_feature.id, }, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) From 3f1f88b1784b0e90edfdc9128eebf792f1858ed0 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:59:12 +0000 Subject: [PATCH 53/80] Update query snapshots --- posthog/api/test/__snapshots__/test_api_docs.ambr | 1 + 1 file changed, 1 insertion(+) diff --git a/posthog/api/test/__snapshots__/test_api_docs.ambr b/posthog/api/test/__snapshots__/test_api_docs.ambr index 862d8507dbb75..0798a6ee9aba6 100644 --- a/posthog/api/test/__snapshots__/test_api_docs.ambr +++ b/posthog/api/test/__snapshots__/test_api_docs.ambr @@ -37,6 +37,7 @@ '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "filename". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet > ExportedAssetSerializer]: unable to resolve type hint for function "has_content". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/exports.py: Warning [ExportedAssetViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.exported_asset.ExportedAsset" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', + '/home/runner/work/posthog/posthog/posthog/api/feature.py: Warning [FeatureViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature.Feature" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/feature_flag.py: Warning [FeatureFlagViewSet]: could not derive type of path parameter "project_id" because model "posthog.models.feature_flag.feature_flag.FeatureFlag" contained no such field. Consider annotating parameter with @extend_schema. Defaulting to "string".', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_cache_target_age". Consider using a type hint or @extend_schema_field. Defaulting to string.', '/home/runner/work/posthog/posthog/posthog/api/insight.py: Warning [EnterpriseInsightsViewSet > InsightSerializer]: unable to resolve type hint for function "get_columns". Consider using a type hint or @extend_schema_field. Defaulting to string.', From 8e8b56268b517f212bae7c60385f103bc0525720 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 19:20:19 +0000 Subject: [PATCH 54/80] Update UI snapshots for `chromium` (1) --- ...layer-success--recent-recordings--dark.png | Bin 61201 -> 61172 bytes ...ayer-success--recent-recordings--light.png | Bin 60544 -> 60614 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/frontend/__snapshots__/replay-player-success--recent-recordings--dark.png b/frontend/__snapshots__/replay-player-success--recent-recordings--dark.png index 2392b90f5511754ebc974700aaef5113ce2abe18..d28c472590301a40167cb9ba9b198a7b55c62f57 100644 GIT binary patch delta 20930 zcmZs?by!s28$CMMiU<}cDbg)c(mE)JbT>#hNXGz21w=(aS{g*UB!{5}kdm&UhLG-# zA!qL9^Zni5{pZf(S8&?o3RQja>0&t3qsLSmzJ8FH zH`Ap{W=DHoXirS-VzNu}uKqnV?p^ZkIJTm9#~xd;zcGQ;esRsoF^NjZ!PCp@I{jk? zhQ-b}wNi_&8mOiQlcyEALzH?W9Q;+)YsIfyAjrnHT--`Ku)5D@*Y9hFJ8RpiWeZhb&HnQq$y1*h})=cZFxB^Dam)CGY)@ta`o!fsVXAS4 zQNFRy3pDdEHh1sbxkW4XBO)RqIyyQ&o|2l{&fcDe3Zk-gaG<55+nkw+NJvNs4^Lw} z%+o5eu&@}))7t#PlKeR&WTMPEvY=qSD?unSGP1}BJz42A`|aD!5b4O6n4#asf9mU> z&lYDYBnXKCH8Y(;t)k?NjEt ze@pDFt#kUUoLyYZb%s{=y=y0jh6I_In0R^nz^(iGirv@8;MZg$#h^E3-i znGgqS*29Gc4;PwEO-;e#aRz+;@};<}jI(ZMs6g*zZ&~eldom_5acz29WnlrP+;tYT z@%8?pLaS&ihm=HaJ~m|Tqy zvoUWR930}X7hvqKbyWSLp?D(omc9>4on-LO(jk=5h?Kgzy7@^KSn9EMV0gFcj6ST%Iw0xb8ENArdE zE3abaJ*Iqzhlho@xVQubhyMQkJ3e0HI8~>IbZ~Qbuk$%_wy;=e`f|5OA2l;Sf1ie? z*6eSDp#7LW%9)9eZ?_gVnIK>rgGNJyI^Po!x0QSM?(L1c^b{D@j)AG~?&jv^R?NeQ z2n(}SyI;9AIPc3C|C*3i%p%p~!R8zN3K0pRy<-n7RH*nYcT<-V?q*}MTub#1rj zMk}nwQ2go9)m{0@##Sc*J8iY*j|UI(_VPkioque~b^ROOnwq9VeO8Kz&(iGjtjg3ui zd3kwYU?3QbqGG7Ozm&H2kFYQ$u(_hs5uToN3k!lagG=qv93c8|nlPBy%O4#wnBNs8 zE0eWy(1eIv|G z(fEF;TGp))-<#)D9wQ06k>97$S4nAo9D6Q{+`M^{Gi%@iO#MT< zc5IP6meg~mPmSdk%^14WHn#gRduM{E?LbN%7nj>BOuo*5#fFyAsmt-mcKXRAVo{+$ z6XFQ?aky}}ZwqO$U$QqObVR&rpOrfCxaE5gcS3tlBTuK4SyuM%6pwC=-yfqSk%}II zs@dEt51cn;i1fATg%xK8;dxEnc(O*cLf%-p&DqZCS0*{AysT_(B+Y==AkIpGKVl(> z4(g`c4$fWMoEq!vn_gr>bDz1PVq>#fpt*yoVDM_sM4oZ#9Ir-XbR^mi?>G+Rs!md+ za$dPb{miO26>h{%woL>hT#okGFMtw;dT!A8l63^g`BCdgS^FaP~3G_G$DKt@949S}HGccXV0xm_rZ zC@n2@aoIhfdp0-Pn|@gMQ7L(Fb)QMt!IW;(_k?s|?)*b5>IaYbg_W^eD}@LRiHYNh ziHWr*w+@d53)_&FV6fD2b!hTy(&eeMcU;WwfBVhRoH}L}7Mb^MA>6mJ!x@gncg*08 z`#){Q#)j6$GIqZk^Wa?$63I;PA2(a;p4tqpp;(lX{&seP2^(u{Jbk&9qg$SM8ZWfF zXXnYZvVzI$E4LM%z-lNeDrO|{d|fo`DUb?sk6>hCW*!~UrtlQtgv5RtONDW$Xo*t} z8hQDIsA`vHcJJ4$c$=6&c;?GCLr#TU0iVBBX4g=9ZAYa0`)lTPb##dO%vn{#AQ$3bsi3ey zXJ;FVf1Asr@22niWCLwWnQ@Zs_Yx5OmJi8pF7 ztJmmN)f_=e>pmS=k9QsLaA|Ig2U+|kYB)7ZU%8{lOgM`6Dv9R^&Y50LS{(h~8BmKNFHA2ksh z{M2lTc=~pD3M5$YL&RzOI{fn|5=Y!xU#g#~bBXileBIgAix*C@mk;SgT<3bH8HkAR zMD|z^lG!zo;*I+<5sV?fczJoP2dcg|Z-9^kf7Y>AAH=S*4xOz*IDw%PZ$_>_u`=Zd>bF}MPmA<@buR9 z)nCd^6`LcNEF~p1wSifdkHiHg36y_eutzZ2moL=G$Z7jfE&xj*Od``Gez=UctC*R zGryWjJe7#~f3KL0Ne|mAuc#w!qWg!9qa(z{ypZ5U z?5AI|S62X+;^~Y(+lOT6YFy@)wtueF;1@*ISfDbK(Vo%KQQM(H!piE=nUD-c2sK#xK)oNWcw#mh;lDt7Ryd6OjpnqU0>DKg#VD%8ZHFVv` z(@z^8eeKou!Ok0bd3NSAiD!Si&LmcU5WjOTEZ|hT!XB!awK|%Po$t_!k}KrUUDf2W z9V!!kxAohw$Z>UQtT|(2MPOA9`}b>jtX`%0eO57FjLA~i{w8*)uVH#5yf#DpF$|V{ z$sX&*W_;`mxwj1{Bpmx4_C=ixCE}NVm0I>tlt;`PhTgj6uE-zTlzEPq(7Z^8m8z+hW@^+ZXc9zL7?O5gO{v?LaG zR4!A~P}8mu$jz00>~A%1tXp^^6PCq&ibZeJ!QK-x-5`hd_V#26`v^@vbG4Pu`ScsC z!C2Z!!UY)Yo>T;*>>aHl=~Y(|4-aJGT4IELgkIh2BNz&dkD%%YLs{!aGo zvt!l+a`-nYN!}G3SM$&hQKaCas4NmHA;*zQoomHgCn@B91hwdIAKW6hE2*H&8>)UZ zmW%C@tl+w>DV0&gniYS%VQm!wl)afe9UaWlKy_ALUdOm2IV%&G1F#pp1^0TXZqlbw z0Mu^xDxUQKvj}nUVL*UXP-sg_v$$spc!+Yb zTr9Wb_6Wm(WRfd16;C2A7Ny|HuE><(V`P-lA~Cr-h%DO6!vOnpr ztUSCBJ+X?~UmoC)z#Gl`p6v1S_7&=vOIsTEr6aUP-#!BYLpBqR_YEWicZg!lk--&$ z!GZwA5y@cFe4m$ED0r-m`<{85hzkw3(ykI(a|IwaHX*v-dg}2N_=2<3cw+kQ#G{ju z?SCgR9A&!p$ifeGbrLN-F#4w~ek%gS@|3 zC=Rg+sjdurXuWY2F*rNkkb`szU#?FeaJcn}T>#3!b45f%PQg;-=X277o=WC;Z&~Nj z{BXWC-`Z$HrbT9R*t^vsnly^WsO;g!qNB{N7b+@Rfn=6FNkRew_L!1pf5`Ls{FcMq zJa}NUBZs+;-^{j*uN6`CHeY^bdJ*22AtNaJI3vjfMBR z?ze5skC71z1z$O*+-y~a_(NI=XZbi+N#{M!4syRY@jSVwqx4Ewucq7}4jZXOILh1U zgX9uofGO0l9WZ(!ER2GGHf{BnsogV)PJReBhO9;l200m018`A}SmErNn8lu)c$J5n zd!d24uX%&7pLeYUFSNZO^D$GwC%wpkL%DUVo&8b0BqL*4uLP6qjhkz%0alawIqB)? zU%tq`eak}sGMKz;ea&unxU;hpgs6Lk2XT_^Fj!sou7~ODASF;jGWV#c7U$-)eZ1bh zc>@4G*<(zuaVk2Sd^E#(oT;;wd!EkuDP-m+(r)NR51TN-k#p zu+o$MrK+m4v~-nWQP`I+x8aP;%%IB}9i1qMi;P4}!#xRpwL*4dKD!pV2yvuff!;$1 z@qVQT>g-h4X+Tk;F4fM<-r;(I4PLR?tUL2hp&iN1NFjSH&gDCwD{x=Z2L^lZ zto)FTu+XJGI}3o{5_tDgm!ZOwfyv22uhPsOP}ovR7r(w)y!=c=WN&HG4J`K2$vyaK zg>!Umt#53-;`)VCQW^Ro}R*|hUz-K!}x1iloy{U3(HZrJOpiXa=C>` z9<(j9clTGnG{@pru^nAq<-LU~ zC={)@`(x4b&&gIel)nEp8;n0h3c?PgAZBJ}bdi2^ zc(~UTt-QQEE#eoXudk2K@s6!>(=FTLQ!E15{B?YzB(klfW+zOb{Z;)@(Z$JHM2ho% zLGjBYvEP=P_(~8V&VgigA-;_akLlJ(p3e)@-5INce4jV&zYLMKnJTn@x0N%~0eB7@ zZC&y)4OP{W6eGS2i@X@Fqu*CyFj{hu(V`95?w4@NNE_M#CS3 zM<>tg*M|`YOBF7Q$({M~=!GtTz`K)(+2$Xnw+DPO{9T~qa`>A*f-&jnB&An0!IWI1 zZU!m&b;V{krof>33cKFwOQYb?5_3KCB+!7=Uko1~ua(2pkD}aFMBm0FCMB)A{7EqY zc^TlIR~V^-|g& znazoxtqqfta7&d=&pmHnAD@ptmQ;#&??!@t^vF}_DW5z<%mb9Q_bPr&c;g1-}HM3>p-M6WYLolVo36e;EqwXcY5NL&01CBb{j2!*qt%PB_QHsR5hB<<2Cg&rCJMNj zWpL#oVq=yB_T2hAAhcG@$5BG5yHVli^i4*k#v>Rk@X`Fm=a|ycyX_M7EHVn1)qQ&U zAVJ5;#Lk5R*!z;l;C~?upFlLFw-qPn%UW-4O@WeR>fRhspIbv|@>ZOPV6>VV?)zM@ zN0JE9zmwfBuibtaXKV5pe00lgG%)@bU}E_{IMwo8%Mc-u1qGBI%lOA#EWJp zxc|N?+Rt~sVKz+C5MxU8zpKIS9Q^bjF3DDabTrpMqpV*48hi_j3M=__+Vtz!jR)7a zrkYtS!G*1plapPTW(?-lH75a33y*c3cS7EXifBy%U<8~0TjW)Go9C8eZ>ryiowl}M zNqpI!&uc5DZ~q7QBqWPhg&^#|k~|pn zBF|eg2J;AV+)f{NJv5$Y8WHJuS~E8cdSA*8QaTCt0IShP$IhkL$p-`*UEQ(&$~@y* z@x}9jUu0ovMNTGu50BeE5T#oPJCp_++3T#!0|4kr-xCrLY&U3bveAKSS+6RQdiM`@ z?yaJxm?37SWmj?lX8M;oZw!LI_t<8`hmWr`D>;8ek1pcB@m$To*jyBKtML(DSt`B@ z|J))WQS|Mhuz9}>Ir(LO{AlSSk73PVx!l{p(4haORg5+4%D!7n6#%|$N=nHhwQks3 zj*dk+k;K=JK~pz0q`AL>(iryy01^T_#=oSz{60J&Q09RgxexO7_2bQ&eeVzL;o%g4 zWQw7o_l0QB;|{E-`guM3SuapdT&EWm7Z)87p_*EvLBc`*(!oKoIpqI5Jo~(#d_HPrAM_``H0EG`1v0N$JM^-=;>~)zTAt7ieZ)xer+#D5n znyLi2O8M3h0i}{v`asb2-8Lqf4xb+w*gWP2X)e9}AMO<%xl<<2&R*r1V(7N=j6$Oo zgUQe;+5n^W*cekw^QWIbUzqvlMZ*A``GMT_>(|`R6-GvV(pwS&o7hbb?bI%_DgTb$*6|4|tHyx~tUM2BGKS!^kGbDq|a?NVMsRJLvI{ z4p{nt^E&31M?N$(l#_#0OcwD4?M|8ur!j|?RxIsAwJs+6_FXEZ{YmKF-c9gk(|>|G z&n!L^Bh#c(;)I~IVn|6TOy(GOA1?nu^5FCc>RlIgpTNqZ{LUBi9fix$JOi`f##|1c zc$Hi6@87Ijs-S_xmf4^@Ht|L=XYLD|&@paxc4fuck(62YE+|@B1%_02?~4B0mI2a% z)+t^FOmA#=(grqcNPTs**Yxa@!pQ;MJvhJPP#ItuuaeT8nU6YNy+ymyD^U*>c?}@K zv>P=6HJ~JR&=!X#=-{#KWo2a>6IC&DBq-PA_AxiA0J31eQ?Jdsi{`7KD!|PD==-6B zeGaXBao!WvZlg8kdBw^RzW`MZ`U9Cb4@pP@(=yfqSl*>2+spB`{P6(Q1FAnoV%KA~ zWfCN{4nW`dE^NMllt?NaB_kNuCu=tWOW3dR94n~zvEtP$fbYkFy3yJ_ktE{&Y!^3r z;e3)^T!;&D1UWgy7#LiJH);6gdxJl~DhBA}?0dR8Iv_y|7dBJo8KCZ9e!hZA;fU9Aa-cWb-MivX&%>kSW%pBn zO;)nyw}ZXCz0RMVZJ86Qn^!VkM*RAz>L#lT=zWf-JNXz z;&Of1QW!R|kV-+BZb7>LAE?}x_v$U`u?ki-yWPbe(sax!kaf%7Tcd;)yH73kLKlL=IyZ_W7>LDDap^AO7vp8 zNmi=$^z=@SkINiJXAZyod+Ms!=x3%Q;rF;wt7juQnHKCI2ZusPNepjAj9$R4qq8*u z^Xi}Sa3r;^8sxAntv^vw3GFu$^^pBlZtHfImaEf!slLzaYke)uEZR%PQ(yRkd;k{( ztF4@;B^{=J+_6I=>XG&9{IfQKLL7aKHkC%JTVH(Jtav1+Smy-T+fW+pe@Wc_JBdM+ ztEM|tKYpideNxU*?&sWDqQsepgQ7$A`-%zy+sQX_#Ij;aU3lvkO?dNlT1TRK?nWootB|n)=T{Z(Az{cZhx(hi+yEf$X@iu zI@mMM&G{)6^aw*B=>zr%Fe;QCe0+Q~5cL{h{=(=;1r4w3I57%&Y^n+XA}0y7g2uB% z_+UVDgwl-aVbVbu1X^JW<*pAnhENIsMM9?LaQr}9t}X<$-8z-;gGQs z%9Q&Yrg$pH#p%#NPZhkxJSIPeN&0x;l6^s1hWPt_yp8~Uv22ziO_j&`Q}Z#)b6^G1 zJiE6TD5?LesNB=yene56B-ruo%X1DYf$WrHei}8~OiYfT> z$iE#<(edPp%+(-3^{5IM|2GI$OMq7*v$}h2%J;|h_r1@`e>@y9armrv`+p!Hu&tw` z+H=`CnmRtuv6L5Sa4GU#!1dooPfunGX52ES=JKobQL-_I$l%{Qw427uLC^lYV={eKeA`mTLQc z1Y@H8o*HeKN5$XU@Tc5sM9Mc8c0L64r~AbfxrcZldvaGkzzAHs9-`{|Wb9bmi3s*- zR-t}{3yX(8-k?mYnRMeRR9{2{BtaSY`TAeh5QdkJ4_RDM7@+dPcV}k@WM&s~3|_Io?vLsasNqgdhUY!S*3D|HT;7<2yyWmLMqw^g}rQbu8}jEd~} zs-=GYTVnRzJcMy<TD#Zg@bjK`2?{+g`1WrT0O1*yuc2eXEfN(PqKW9ra7^gWi9U z9!{K`h!Yew!?WkVLdf?$iCg1*fxD7fs z&}Ov@e{VJ7;dPJ#(G$&hHZVQg`)|xbIA| zGY81}v*L4rt1b@4=bxBILDfBY^NRq4RQgyg73xdk+sL&Z=o!r8pZL?^$8~z*7fn~+ z1f1jb+{@;nhK^(uGj4>FW^saC31`6fKu&&2UR4R@$N$9x7pt686wUUg7&*L39Kj*CmWolb6(E&Vy1m;(MOA z9qAkL{&g3W3wsG8v5r@FW)|j_3s{q=2|guBx5N5EE~sD^5VyIlA9Gnc+Gz<95%1@* z$h`;<_aMr=f1m>x&E{#ZlrYX=WsM>j=ewJ--Q{h@L}GG3L`Q2#TUZ1_Ay*H1O3KRS zitZ~1$}5xuWm2q`Qe+rZh#yu@9=w@6z}=Vo!|>SNE?*{uS|uygW$Uk+j*bqg1fw1{ zULoOdC`U~u50jad)zOq4)U%p{(CC%RMIgFIe=qN|!$+qNGeZ zPyK$Yc69@**A*ztk_f6fGVc2Mi~Bo`w$&4g%8jPa^|xtO!K30Mg{`Vkqz&0CGR3 zNPBr@rNsD;k@56x(gVTNk8Q}|+$qB{h5#~&kQ%%`@~MCTXvr69NhQ3j&>l#ou0y>q zqL8uCoece0M_b#ImH@5tOpnF*Fgi&Tz9%GuMmZzn^n9iMzmAGj-2-4MK1=!iZ3n=d z3VE&U-EGJUAOorjpG49iO05;JL7Nm@hTB-W=Dn?*Y=XFu-RGQ~Ozt)gCsnzZq=-bcE|5yZ*Vy7F zPv<2$6Fru9qI)d5+0PO#MSYCb`t#!A)ti*h9&vH`9$Ol5>){a}ZUB>1oUrK%AY7}4 z^Mo84n<9#0zJvrLwxM)DS_v-C;t2Xk=VnL9hj%sa4nCq53Xffk`b&2#;8+13qvKL{ zouu|V0W(%^d*;}*`zPpD^7ir^X!DZ9ypGcpz7lRD{fq7d0>Ml6b>(Ch;qGi}$eGJT zyE%tucl@pbDt|3kzJHzLOLNlYBM-|xISvK}Q%t;D`>aGQ;)?qQYXGZMyVkwPG2$9^ zt0gVo!aC@3Zgr1jg7?4rG(n=IMIUj;$??(5OkMh>AALN)Fv0g*FJ;k?TEKW*n{HG3 zl>kuKyhloV#Q5fp9K=r$UV_wuuD_o$Z5>$-NQco(t1Bh0fv=4n#u_?>3 z&fUr4 z(81bKmD|cC_mv0KKDnopF5|D-ujUGXtkjhtptm=0M<>Q(eG(zgTdc6E3IAN@>+Or& zYF%4f%g)Y&98U9qfYQR80x6!Et>@lv$vQheFg$9FAE~Sa@cNY`*YZ?R7+K?=bUzINT+#nl!++B8Fi#V|vb?OKZmylo=q;`woo{o`o+699;59ot49G=%2Q|U(b+zM`ymPrnVHN?OjIdDMVo#{id}LZHoyf?jx4pE!D?UY zLwXclyn5s4x~SE^_r1Nui#rO(}H#VBIfo?*yH$yHq=q6%&UuY_4 zaiPL%b__R_WMypZe&l^ZHz?Wg3 zGjN?AC@G~SrC?---Fl9|*R$*@Vj9U~=__v2X?x`T8>mQ{(86HpQ$8-Y82IP1vOVho zNh9O}a-bpT3MnoBNuJ{kY9QjQVYCdBcQG{=<^ySwy;Ao?9;8yngS1#`8Onjq)h*u{ zF3;24TOW|~vi{S82D=la+Ji@DK*2`o_4uK=PweO9cs52+8Ro?33-`ee)Ggl&4pw^R zxzy$h1qIkBsV;1UBq+VE^NI!LOpCo{CfwP|fe7G?}N=bOi6Q z0t?GKZEa6mLMVZ1za6oucn^MStg1lnEeqHsWX>nH8I`wFtM>&nVaja@cnn{ zNTGNwUm$Oh27y_I)D48zF;ryDLnQBBfx=1Aw#SlY_;@++t`Q7WE zM3Ux39cxj(t%VonOD%emj+&_phSV+7N=pG1{WT0tOM82?(BM6p>ZYMMP%Ly)m1HCQ zbPf=p1qZpwn?Jkgo`m>PP8hR7wHKcNAKz+ek0lNS3>yIgsI5VXG;wb`NX}1(mLm4i zlz3U2M`lJsH=6wJ?m`oeAdFD-@;>$4!bx)a)#GSzCSf$Gy49}2?adjX4Ud$PpBh~2 z8)?-;X+PPSVFJYY5pf*_Ts~pP2_QZd@t1}*bF=FLi>pWQ&wv-zuyMDV+Sps>`%iaI zKtgs2e6|(^x{57aRrv)4Mn1+P@3TJL8^hL~XZHF(kC_D(y;Ad&1Rvb|9 zG9>wI^eq|u!NzE@Ouv=9JpZVU$MDKMNyhB3owM@d3bs8A9}6ileTj=Rpo*WEuUK9- zTpvfxV(+q8F?I$1eiAF1cPivKI#g|mgU(J!4}kRgZ$N5uolihOL+84MiOJ8XN)*cB z)FpabutIlz{qv6qXFe-z=(N;TG-3MJ)5Q3K0()RPb;<>Di-fSS&h_IK5nuvdUe2hV zy8GrM$|qG1(QEW!IukL{i`Pe9#lOYjHh+eE|s7IIXoaprpyM@*f42$tuIF{NYC0DNCK1z z-yWXzA4>|&^ZcFq--HF;x{}>p2l$0P+%BYB_7>Et7C1t*`f3kdOia}|EwP(fesFLw z+oHs|mHVQo2kPo5t*Bt1{;pgrJ7a|Vpy3|RS-I76IKQTEix(=j?Edj|yTD_(fKb|d zU(~N)?5NykxWeEcNZ#)_)-^xe7d7fW-J4a)lsImx4`Wf_BX_tyHkOVUj^T=LZE7Lc zE_CU6>mXU@&Xs9IAZjl@)h)N}uL)6gu(jPCVK@s-fu0?my7b(jm-9&Y>|?1r_cck# z2r6*Ny47w9v`z9(LOTH2Ug$+uYL}zuZaDnaNQo3-uEUWJ9f19*JFY6Zf2I^1TQ%&0 zMO*6WdLQrg)P4I_gNRhLwY3%1)0-U_$RZe?>&@u1pBNh<`&-AR7)tu4X@*um{L!$a zA4GW7Z{?6V&hO3<@Xp!U$EJR^_C#D|>Fo{ibI|7c1jy@WCJR~cYqqu=Q^Fy;&b!PC zadm|H1_P`R$0~UMnSV0nZ>NEUziO81o!IO5e!5{5;hzhzAnR8!Kq$Eh5kSpJzT5gB z2=fAJI9(l~qPBJ-EI8J0fBzKW0m&-K$pH&OfzgyWA<5$_<(*t{&|PzQghnvw01jox zo*fb*Nr;Q96I;o+&2!V}beG3b-bYACsAwr)Umqo%4!rX5adBZ@M@**1`ucD?{c*j! zM(9%gtV0PV`leigRf&|N<;v@Kfg=*JePp~pKEbSz%pKr~n4z*AwuiKjS9d~I35PDT z3zZ{>z%igDgj~wDq6gmmwd}1I@m31*Wz6u;ngzN(Ta#Fqx_GTIJ<1MGPZg5>VC27aeMkzA1%hh|a^Ub)Nfn__}p>H9<9N6#5Y#VFwY=0w8 zH@}>TLNngD6@1^-P5mm@`E8;eAc3=$WI;&wGU&9xLo$(Xm9K*`hM1hQ-3WLh^dx-< z>&QubYVX1kadhi0`fNJndXdA#X%=w2}pj zkCu>>XS=(?t6GGE=6qo&UzdZ8&h)EJEDte#a45}~f{)87FopqZ@~^|lSHeJ1hCz6} zPZB4cS!$9xC9b1`N|xkm1qRQt(|A;dVaVZcJ(eKtWtFAFGf?8O(8;G_ zj~jtx5!psXlUV~2+g8fZN*0uI)qcWns*uu?Tw>dfbE+EmJa*$Os#S6^!Tvf4iKy?f zoX?veZSW7(JhG5|8xhvzvqlC8H{9(}3r zrqQd|N!gnd~H$Z3-0Kvb)Y&#A>D?x#~{FGfMbc$6T zAqv~x=hg;nW?woU2mEHhE5#!*!yy_PWOz+)Z}!fnw4oZa@7zRNUaw7IA@^)+7|Gf= z@8R6C@2`v?|6lo-aC3joju?@NlTF3(o#C=iZ3grDwA9 z1Ux#}hHGnfz}q?ELA-!J9Ebqj91EkqmLVh{fT^&X#sQD2k1rJvkOb|I7g4Bjcwu~` z<03-#KL<15#>+gkdNE737n3RPkkhJ+@8^;#49GFsZ%1;?#%(Gpr5Yq9l* zMFpS6juT~51M24P6g8pIMM^V zqIStS4>yAPc*3YfEzI2AyYq!zVvDqOKGB~WAt&+{D~DSuhg~}U{`~?-fUqzj-o7Dc zXID43FJHc#Ic@iY78Pp$`X19gP^g)M!+;mKeh2n~SONuZT#U}#=nH0nkUJ*%+~%me0x(cruRXe}a)Y!!oZrp-^-(?u z%hWZ^0z;(DepTeH!6!sUpm|{zEXnWiaDA8kKKz`7XQk8kB~~Z)@dRe6`D{)$bXm3A z1=i$J7kj)e5lmTJSai5>g+A)?Y9ud;9a@VGYeWGa;oZOY;BeD5deCJOw98`(Xo=LB z{caFNOJ|h=T&|$_rn~zuaI2(_f8SC0&M3=ZpfJRHnw@yt15J z2SP3}$#xT4TF$8OrZ8Kgqr?AOfzMUtK10o~tX-=O^$%=RR~Hwy+})EpBsi$$HM>6yj%jgBQyH8cX`69vS9(|JjPx;2 z^XZ$~%kRNI55+u$()=hmnWXUX<>e?nU+x<^b&e@aMP5d3@-9YsNmlHCaqEJFydypF z$_Vr;_IFdr?n8;#b((ihIo0l6Uvtlvv;Kki6sBHV7xmcK8eT{ZoFY{E9JL=!`4M^~ zEmOP}*yei(wZMGPd14WRiql~V8|dz?fY6gbO~&1lhK}NoMh8_GjPmtbg`vPtBvjuJ z_MNdt@`TgU9Ky-eE?^jss3dmx)GmkaOjh5`n_FX73@idR$l%QZ$LIT-rQW%xeD