From 0846ff68cb199f6b6bf1a544f3832f6f005f9712 Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Fri, 22 Nov 2024 13:26:38 -0800 Subject: [PATCH 01/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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/37] 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'