:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(flags): add an organization-level flag_evaluations mode (#105446)
Phil Haack26c7c644aea8
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex b2856b5dc8ae..1ac066ff87d9 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5424,6 +5424,10 @@ snapshots:hash: v1.k794b7964.62481a20890d8d9702570d58b69f47580c91399daa635cab23d9e8da75d2636f.4zz_BsbTTGbjpB2UW_cLkBiMwGDI54MGoQlD9_b9hV8lemon-ui-object-tags--default--light:hash: v1.k794b7964.1a69b09d2bc7612599daf0a1228b103250debc4afa2224fb8005e3c9b7f63326.bYCI4pCGFv3tFdGcQfIkfzDcOnpuLhD10S33l9BYIYg+ lemon-ui-object-tags--editable-tags-in-narrow-container--dark:+ hash: v1.k794b7964.6538590671c5bcd8feb77e0400c8532705932f4f55856dd6a99a6abcdc00b6e3.ca3qOKbmxmRDrNfdNRCEg9I9Wvnkrs7PHzA0tvpXTIM+ lemon-ui-object-tags--editable-tags-in-narrow-container--light:+ hash: v1.k794b7964.8b8f244a4387d0d1165067851b5758f5ad5429fae2b4a4e87eb7c53cdfdd4e18.MekQJYDe11n-5XnhJV5phxqMh5OqTw36CTFCk_BZNnwlemon-ui-object-tags--static-only--dark:hash: v1.k794b7964.62481a20890d8d9702570d58b69f47580c91399daa635cab23d9e8da75d2636f.oAaWHdceTRTQOchqDXvZ7-ym0DB_CpRpPyXnqlKugwolemon-ui-object-tags--static-only--light:diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.tsindex bfdf52b4e32e..b7b81f35f04b 100644--- a/frontend/src/generated/core/api.schemas.ts+++ b/frontend/src/generated/core/api.schemas.ts@@ -866,6 +866,14 @@ export const AvailableSetupTaskIdsEnumApi = {UsePosthogInSlack: 'use_posthog_in_slack',} as const+export type FlagEvaluationsModeEnumApi = (typeof FlagEvaluationsModeEnumApi)[keyof typeof FlagEvaluationsModeEnumApi]++export const FlagEvaluationsModeEnumApi = {+ Number0: 0,+ Number1: 1,+ Number2: 2,+} as const+/*** * `AED` - AED* * `AFN` - AFN@@ -2694,6 +2702,8 @@ export interface ProjectBackwardCompatApi {*/readonly user_access_level: string | nullreadonly managed_viewsets: ProjectBackwardCompatApiManagedViewsets+ /** Which table this project's feature flag usage data is read from. PostHog sets it for the whole organization. 0 reads the events table. 1 and 2 read the flag_evaluations table. */+ readonly flag_evaluations_mode: FlagEvaluationsModeEnumApirevenue_analytics_config?: TeamRevenueAnalyticsConfigApimarketing_analytics_config?: TeamMarketingAnalyticsConfigApicustomer_analytics_config?: TeamCustomerAnalyticsConfigApi@@ -3561,6 +3571,8 @@ export interface PatchedProjectBackwardCompatApi {*/readonly user_access_level?: string | nullreadonly managed_viewsets?: PatchedProjectBackwardCompatApiManagedViewsets+ /** Which table this project's feature flag usage data is read from. PostHog sets it for the whole organization. 0 reads the events table. 1 and 2 read the flag_evaluations table. */+ readonly flag_evaluations_mode?: FlagEvaluationsModeEnumApirevenue_analytics_config?: TeamRevenueAnalyticsConfigApimarketing_analytics_config?: TeamMarketingAnalyticsConfigApicustomer_analytics_config?: TeamCustomerAnalyticsConfigApidiff --git a/frontend/src/lib/api.mock.ts b/frontend/src/lib/api.mock.tsindex b7ff4b29adac..9560293ebb21 100644--- a/frontend/src/lib/api.mock.ts+++ b/frontend/src/lib/api.mock.ts@@ -180,6 +180,7 @@ export const MOCK_DEFAULT_TEAM: TeamType = {base_currency: CurrencyCode.USD,default_evaluation_contexts_enabled: false,managed_viewsets: { revenue_analytics: true },+ flag_evaluations_mode: 0,receive_org_level_activity_logs: false,require_evaluation_contexts: false,feature_flag_policy_config: {diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 23af1d225c45..80615cb1339f 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -341,8 +341,6 @@ export const FEATURE_FLAGS = {FEATURE_FLAG_REQUEST_USAGE: 'feature-flag-request-usage', // owner: #team-feature-flagsFIELD_NOTES: 'field-notes', // owner: @adamleithpFLAG_EVALUATION_TAGS: 'flag-evaluation-tags', // owner: @dmarticus #team-feature-flags- FLAG_EVALUATIONS_HOGQL_TABLE: 'flag-evaluations-hogql-table', // owner: #team-feature-flags, also read by the backend to expose posthog.flag_evaluations- FLAG_EVALUATIONS_USAGE_TAB: 'flag-evaluations-usage-tab', // owner: #team-feature-flags, reads the Usage tab from flag_evaluations instead of eventsFLAGGED_FEATURE_INDICATOR: 'flagged-feature-indicator', // owner: @benjackwhiteFLAT_NAV: 'flat-nav', // owner: @rafaeelaudibert #team-growth multivariate=control,test, swaps the tree-based Browse tab for the flat sidebar, see FlatNavBrowse.tsxGITHUB_FIRST_SELF_DRIVING_ONBOARDING: 'github-first-self-driving-onboarding', // owner: #team-self-driving@@ -523,8 +521,8 @@ export const FEATURE_FLAGS = {SSO_SETTINGS_REDESIGN: 'sso-settings-redesign', // owner: @reecejones #team-platform-featuresSTREAMLIT_APPS: 'streamlit-apps', // owner: @sakceSUBSCRIPTION_AI_PROMPT: 'ai-subscriptions', // owner: #team-analytics-platform, gates AI prompt-based subscriptions- SUBSCRIPTION_SUMMARY_COPY_EXPERIMENT: 'subscription-summary-copy-experiment',SUBSCRIPTION_SLACK_GALLERY: 'subscription-slack-gallery', // owner: #team-analytics-platform, enables gallery delivery after the worker rollout completes+ SUBSCRIPTION_SUMMARY_COPY_EXPERIMENT: 'subscription-summary-copy-experiment',SURVEY_HEADLINE_SUMMARY: 'survey-headline-summary', // owner: @adboio #team-surveysSURVEYS_ERROR_TRACKING_CROSS_SELL: 'surveys-in-error-tracking', // owner: @adboio #team-surveysSURVEYS_FORM_BUILDER: 'surveys-form-builder', // owner: @adboio #team-surveysdiff --git a/frontend/src/scenes/feature-flags/featureFlagUsageLogic.test.ts b/frontend/src/scenes/feature-flags/featureFlagUsageLogic.test.tsindex 36cc7240f210..c7942b19a0fb 100644--- a/frontend/src/scenes/feature-flags/featureFlagUsageLogic.test.ts+++ b/frontend/src/scenes/feature-flags/featureFlagUsageLogic.test.ts@@ -1,10 +1,12 @@+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'+import { router } from 'kea-router'import { expectLogic } from 'kea-test-utils'-import { FEATURE_FLAGS } from 'lib/constants'-import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'+import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'import { useMocks } from '~/mocks/jest'import { NodeKind, TrendsQuery } from '~/queries/schema/schema-general'import { initKeaTests } from '~/test/init'@@ -16,12 +18,11 @@ import { DEFAULT_USAGE_DATE_RANGE, FlagUsageQuery } from './featureFlagUsageQuerconst FLAG_ID = 1-const BOTH_EVALUATION_FLAGS = {- [FEATURE_FLAGS.FLAG_EVALUATIONS_USAGE_TAB]: true,- [FEATURE_FLAGS.FLAG_EVALUATIONS_HOGQL_TABLE]: true,+function setFlagEvaluationsMode(mode: FlagEvaluationsModeEnumApi): void {+ teamLogic.actions.loadCurrentTeamSuccess({ ...MOCK_DEFAULT_TEAM, flag_evaluations_mode: mode })}-// Every chart reads the events table unless a test enables both evaluation flags.+// Every chart reads the events table unless a test moves the team off the Events mode.function trendsSource(query: FlagUsageQuery): TrendsQuery {if (query.kind !== NodeKind.InsightVizNode) {throw new Error(`Expected an events-table trend, got ${query.kind}`)@@ -54,18 +55,12 @@ describe('featureFlagUsageLogic', () => {logic.mount()})- afterEach(() => {- // The flag set persists across tests, so a test that enables one must not leak it.- enabledFeaturesLogic.actions.setFeatureFlags([], {})- })-it.each([- ['neither flag', {}, false],- ['the usage-tab flag alone', { [FEATURE_FLAGS.FLAG_EVALUATIONS_USAGE_TAB]: true }, false],- ['the HogQL-table flag alone', { [FEATURE_FLAGS.FLAG_EVALUATIONS_HOGQL_TABLE]: true }, false],- ['both flags', BOTH_EVALUATION_FLAGS, true],- ])('reads flag_evaluations with %s', (_name, variants, readsEvaluations) => {- enabledFeaturesLogic.actions.setFeatureFlags([], variants)+ ['events', FlagEvaluationsModeEnumApi.Number0, false],+ ['read flag evaluations', FlagEvaluationsModeEnumApi.Number1, true],+ ['flag evaluations only', FlagEvaluationsModeEnumApi.Number2, true],+ ])('reads flag_evaluations for the %s mode: %s', (_name, mode, readsEvaluations) => {+ setFlagEvaluationsMode(mode)expect(logic.values.readsFlagEvaluationsTable).toEqual(readsEvaluations)expect(logic.values.usageCharts.map((chart) => chart.query.kind)).toEqual(@@ -76,7 +71,7 @@ describe('featureFlagUsageLogic', () => {})it('holds the date range inside the retention window when reading flag_evaluations', async () => {- enabledFeaturesLogic.actions.setFeatureFlags([], BOTH_EVALUATION_FLAGS)+ setFlagEvaluationsMode(FlagEvaluationsModeEnumApi.Number1)await expectLogic(logic, () => {logic.actions.setDates('-180d', null)diff --git a/frontend/src/scenes/feature-flags/featureFlagUsageLogic.ts b/frontend/src/scenes/feature-flags/featureFlagUsageLogic.tsindex a447dfa2f187..c0e26f0fadba 100644--- a/frontend/src/scenes/feature-flags/featureFlagUsageLogic.ts+++ b/frontend/src/scenes/feature-flags/featureFlagUsageLogic.ts@@ -1,13 +1,13 @@import { LogicWrapper, MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'import { actionToUrl, router, urlToAction } from 'kea-router'-import { FEATURE_FLAGS } from 'lib/constants'-import { FeatureFlagsSet, featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'+import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'import { Noun, groupsModel } from '~/models/groupsModel'import { DateRange } from '~/queries/schema/schema-general'-import { DateMappingOption, FeatureFlagType } from '~/types'+import { DateMappingOption, FeatureFlagType, TeamPublicType, TeamType } from '~/types'import { featureFlagLogic } from './featureFlagLogic'import {@@ -23,6 +23,8 @@ import {flagEvaluationsDateOptions,} from './featureFlagUsageQueries'+const EVENTS_MODE = FlagEvaluationsModeEnumApi.Number0+// The Usage tab only renders for persisted flags, so unlike featureFlagLogic this// logic never mounts for 'new'/'link' ids.export interface FeatureFlagUsageLogicProps {@@ -31,9 +33,9 @@ export interface FeatureFlagUsageLogicProps {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface featureFlagUsageLogicValues {- featureFlags: FeatureFlagsSet // enabledFeaturesLogicfeatureFlag: FeatureFlagType // featureFlagLogicaggregationLabel: (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Noun // groupsModel+ currentTeam: TeamPublicType | TeamType | null // teamLogicaggregationGroupTypeIndex: number | null | undefineddateOptions: DateMappingOption[] | undefineddateRange: DateRange@@ -62,7 +64,7 @@ export interface featureFlagUsageLogicMeta {flagKey: (featureFlag: FeatureFlagType) => stringaggregationGroupTypeIndex: (featureFlag: FeatureFlagType) => number | null | undefinedhasEnrichedAnalytics: (featureFlag: FeatureFlagType) => boolean | undefined- readsFlagEvaluationsTable: (featureFlags: FeatureFlagsSet) => boolean+ readsFlagEvaluationsTable: (currentTeam: TeamPublicType | TeamType | null) => booleandateRange: (selectedDateRange: DateRange, readsFlagEvaluationsTable: boolean) => DateRangedateOptions: (readsFlagEvaluationsTable: boolean) => DateMappingOption[] | undefinedusageCharts: (@@ -93,8 +95,8 @@ export const featureFlagUsageLogic: LogicWrapper<featureFlagUsageLogicType> = ke['featureFlag'],groupsModel,['aggregationLabel'],- enabledFeaturesLogic,- ['featureFlags'],+ teamLogic,+ ['currentTeam'],],})),actions({@@ -121,13 +123,13 @@ export const featureFlagUsageLogic: LogicWrapper<featureFlagUsageLogicType> = ke(s) => [s.featureFlag],(featureFlag: FeatureFlagType): boolean | undefined => featureFlag.has_enriched_analytics,],- // The usage-tab flag alone is not enough: flag_evaluations is missing from the HogQL catalog- // of an organization without flag-evaluations-hogql-table, so a query against it fails there.+ // The backend adds flag_evaluations to the HogQL catalog whenever the organization's stored mode is+ // above Events. This field is above Events only when the stored mode is, so a query here never hits+ // a missing table.readsFlagEvaluationsTable: [- (s) => [s.featureFlags],- (featureFlags: FeatureFlagsSet): boolean =>- !!featureFlags[FEATURE_FLAGS.FLAG_EVALUATIONS_USAGE_TAB] &&- !!featureFlags[FEATURE_FLAGS.FLAG_EVALUATIONS_HOGQL_TABLE],+ (s) => [s.currentTeam],+ (currentTeam: TeamPublicType | TeamType | null): boolean =>+ (currentTeam?.flag_evaluations_mode ?? EVENTS_MODE) !== EVENTS_MODE,],// flag_evaluations holds 90 days, so a longer range would show fewer rows than the events// table. The clamp covers the date picker, a shared link, and a range typed into the URL.diff --git a/frontend/src/scenes/feature-flags/featureFlagUsageQueries.ts b/frontend/src/scenes/feature-flags/featureFlagUsageQueries.tsindex eb5858732c89..bb4e832d2cc1 100644--- a/frontend/src/scenes/feature-flags/featureFlagUsageQueries.ts+++ b/frontend/src/scenes/feature-flags/featureFlagUsageQueries.ts@@ -181,8 +181,8 @@ function enrichedSeries(event: '$feature_view' | '$feature_interaction', seriesL]}-// Not a root table, so the `posthog.` prefix is part of the name. An organization without the-// flag-evaluations-hogql-table flag has no such table, and these queries fail to resolve for it.+// Not a root table, so the `posthog.` prefix is part of the name. A team on the Events mode without+// the flag-evaluations-hogql-table flag has no such table, and these queries fail to resolve for it.const FLAG_EVALUATIONS_TABLE = 'posthog.flag_evaluations'/** How long a row stays in flag_evaluations. The events table keeps $feature_flag_called forever. */diff --git a/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts b/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.tsindex f7408c465fd1..34801360ac78 100644--- a/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts+++ b/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts@@ -59,6 +59,7 @@ const EDITABLE_INSTANCE_SETTINGS = ['RATE_LIMIT_ENABLED','RATE_LIMITING_ALLOW_LIST_TEAMS','FLAGS_LOG_BODIES_TEAMS',+ 'FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS','CLICKHOUSE_KILL_SWITCH','CLICKHOUSE_KILL_SWITCH_LIGHT_TEAMS','CLICKHOUSE_KILL_SWITCH_FULL_TEAMS',diff --git a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx b/frontend/src/scenes/team-activity/teamActivityDescriber.tsxindex fa904cfa0116..421861b6de11 100644--- a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx+++ b/frontend/src/scenes/team-activity/teamActivityDescriber.tsx@@ -760,6 +760,7 @@ const TEAM_PROPERTIES_MAPPING: Record<web_analytics_pre_aggregated_tables_enabled: () => null,web_analytics_pre_aggregated_tables_version: () => null,managed_viewsets: () => null,+ flag_evaluations_mode: () => null,workflows_config: () => null,feature_flag_policy_config: () => null,}diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex f637e2b15972..1ee714692171 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -39,7 +39,7 @@ import { Params, Scene, SceneConfig, SceneTab } from 'scenes/sceneTypes'import { SessionRecordingPlayerMode } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'import { SurveyRatingScaleValue, WEB_SAFE_FONTS } from 'scenes/surveys/constants'-import type { OrganizationNotificationLockApi } from '~/generated/core/api.schemas'+import type { FlagEvaluationsModeEnumApi, OrganizationNotificationLockApi } from '~/generated/core/api.schemas'import { RootAssistantMessage } from '~/queries/schema/schema-assistant-messages'import type {CoreEvent,@@ -912,6 +912,7 @@ export interface TeamType extends TeamBasicType {core_events_config: { core_events: CoreEvent[] }base_currency: CurrencyCodemanaged_viewsets: Record<DataWarehouseManagedViewsetKind, boolean>+ flag_evaluations_mode: FlagEvaluationsModeEnumApireceive_org_level_activity_logs: boolean | nullcustomer_analytics_config: CustomerAnalyticsConfigworkflows_config: WorkflowsConfigdiff --git a/nodejs/src/common/utils/team-manager.test.ts b/nodejs/src/common/utils/team-manager.test.tsindex 51d509774889..998b9f18b1b2 100644--- a/nodejs/src/common/utils/team-manager.test.ts+++ b/nodejs/src/common/utils/team-manager.test.ts@@ -2,13 +2,14 @@ import { randomUUID } from 'crypto'import { forSnapshot } from '~/tests/helpers/snapshots'import {+ createOrganization,createTeam,createTestTeamFixture,getTeam,insertRow,updateOrganizationAvailableFeatures,} from '~/tests/helpers/sql'-import { Hub, Team } from '~/types'+import { FlagEvaluationsMode, Hub, Team } from '~/types'import { defaultConfig } from '../config/config'import { closeHub, createHub } from './db/hub'@@ -73,6 +74,7 @@ describe('TeamManager()', () => {"cookieless_server_hash_mode": 2,"drop_events_older_than_seconds": null,"extra_settings": null,+ "flag_evaluations_mode": 0,"heatmaps_opt_in": null,"id": "<TEAM_ID>","ingested_event": true,@@ -243,6 +245,21 @@ describe('TeamManager()', () => {expect(newTeam!.minimal_flag_called_events).toBe(true)})+ it("reads flag_evaluations_mode from the team's organization", async () => {+ const newTeamId = await createTeam(postgres, organizationId)+ const otherOrganizationId = await createOrganization(postgres)+ const otherTeamId = await createTeam(postgres, otherOrganizationId)+ await insertRow(postgres, 'feature_flags_organizationfeatureflagsconfig', {+ organization_id: organizationId,+ flag_evaluations_mode: FlagEvaluationsMode.ReadFlagEvaluations,+ })++ expect((await teamManager.getTeam(newTeamId))!.flag_evaluations_mode).toBe(+ FlagEvaluationsMode.ReadFlagEvaluations+ )+ expect((await teamManager.getTeam(otherTeamId))!.flag_evaluations_mode).toBe(FlagEvaluationsMode.Events)+ })+it('does not leak minimal_flag_called_events across teams', async () => {const teamA = await createTeam(postgres, organizationId)const teamB = await createTeam(postgres, organizationId)diff --git a/nodejs/src/common/utils/team-manager.ts b/nodejs/src/common/utils/team-manager.tsindex 003b729b5095..69c4581b9249 100644--- a/nodejs/src/common/utils/team-manager.ts+++ b/nodejs/src/common/utils/team-manager.ts@@ -152,10 +152,12 @@ export class TeamManager {t.extra_settings,extract('epoch' from t.drop_events_older_than) as drop_events_older_than_seconds,COALESCE(cfg.minimal_flag_called_events, false) AS minimal_flag_called_events,+ COALESCE(ocfg.flag_evaluations_mode, 0) AS flag_evaluations_mode,o.available_product_featuresFROM posthog_team tJOIN posthog_organization o ON o.id = t.organization_idLEFT JOIN feature_flags_teamfeatureflagsconfig cfg ON cfg.team_id = t.id+ LEFT JOIN feature_flags_organizationfeatureflagsconfig ocfg ON ocfg.organization_id = t.organization_idWHERE t.id = ANY($1) OR t.api_token = ANY($2)`,[teamIds, tokens],diff --git a/nodejs/src/ingestion/framework/ingestion-warning-handling-chunk-pipeline.test.ts b/nodejs/src/ingestion/framework/ingestion-warning-handling-chunk-pipeline.test.tsindex a02ea85b3a40..60b859c410c2 100644--- a/nodejs/src/ingestion/framework/ingestion-warning-handling-chunk-pipeline.test.ts+++ b/nodejs/src/ingestion/framework/ingestion-warning-handling-chunk-pipeline.test.ts@@ -4,7 +4,7 @@ import { IngestionWarningsOutput } from '~/common/outputs'import { IngestionOutputs } from '~/common/outputs/ingestion-outputs'import * as ingestionWarnings from '~/ingestion/common/ingestion-warnings'import { createMockIngestionOutputs } from '~/tests/helpers/mock-ingestion-outputs'-import { Team } from '~/types'+import { FlagEvaluationsMode, Team } from '~/types'import { createContext, createNewChunkPipeline, createOkContext } from './helpers'import { IngestionWarningHandlingChunkPipeline } from './ingestion-warning-handling-chunk-pipeline'@@ -41,6 +41,7 @@ function createTestTeam(overrides: Partial<Team> = {}): Team {ingested_event: true,person_display_name_properties: null,minimal_flag_called_events: false,+ flag_evaluations_mode: FlagEvaluationsMode.Events,test_account_filters: null,cookieless_server_hash_mode: null,timezone: 'UTC',diff --git a/nodejs/src/types.ts b/nodejs/src/types.tsindex db8d5e5c9755..53b929eb7928 100644--- a/nodejs/src/types.ts+++ b/nodejs/src/types.ts@@ -185,6 +185,13 @@ export interface JobSpec {payload?: Record<string, JobPayloadFieldOptions>}+/** Mirrors FlagEvaluationsMode on OrganizationFeatureFlagsConfig in the Django feature_flags product. */+export enum FlagEvaluationsMode {+ Events = 0,+ ReadFlagEvaluations = 1,+ FlagEvaluationsOnly = 2,+}+export enum CookielessServerHashMode {Disabled = 0,Stateless = 1,@@ -277,6 +284,7 @@ export interface Team {ingested_event: booleanperson_display_name_properties: string[] | nullminimal_flag_called_events: boolean+ flag_evaluations_mode: FlagEvaluationsModetest_account_filters:| (EventPropertyFilter | PersonPropertyFilter | ElementPropertyFilter | CohortPropertyFilter)[]| nulldiff --git a/nodejs/tests/helpers/ingestion-e2e.ts b/nodejs/tests/helpers/ingestion-e2e.tsindex 1d4293487218..35159cde7b9c 100644--- a/nodejs/tests/helpers/ingestion-e2e.ts+++ b/nodejs/tests/helpers/ingestion-e2e.ts@@ -47,7 +47,15 @@ import {import { IntegrationManagerService } from '../../src/cdp/services/managers/integration-manager.service'import { EncryptedFields } from '../../src/cdp/utils/encryption-utils'-import { PipelineEvent, PluginsServerConfig, ProjectId, RawClickHouseEvent, RedisPool, Team } from '../../src/types'+import {+ FlagEvaluationsMode,+ PipelineEvent,+ PluginsServerConfig,+ ProjectId,+ RawClickHouseEvent,+ RedisPool,+ Team,+} from '../../src/types'import { Clickhouse } from './clickhouse'import { waitForExpect } from './expectations'import { TEST_KAFKA_TOPICS, ensureKafkaTopics } from './kafka'@@ -68,6 +76,7 @@ export const DEFAULT_TEAM: Team = {ingested_event: true,person_display_name_properties: null,minimal_flag_called_events: false,+ flag_evaluations_mode: FlagEvaluationsMode.Events,test_account_filters: null,cookieless_server_hash_mode: null,timezone: 'UTC',diff --git a/nodejs/tests/helpers/team.ts b/nodejs/tests/helpers/team.tsindex 1ff52c85286e..3f9780a19afe 100644--- a/nodejs/tests/helpers/team.ts+++ b/nodejs/tests/helpers/team.ts@@ -1,4 +1,4 @@-import { ProjectId, Team } from '../../src/types'+import { FlagEvaluationsMode, ProjectId, Team } from '../../src/types'/*** Helper function to create a Team object for tests with sensible defaults.@@ -21,6 +21,7 @@ export function createTestTeam(overrides: Partial<Team> = {}): Team {ingested_event: true,person_display_name_properties: null,minimal_flag_called_events: false,+ flag_evaluations_mode: FlagEvaluationsMode.Events,test_account_filters: null,cookieless_server_hash_mode: null,timezone: 'UTC',diff --git a/nodejs/tests/ingestion/framework/pipelines.integration.test.ts b/nodejs/tests/ingestion/framework/pipelines.integration.test.tsindex 8f4614abdf44..6fdaef460fea 100644--- a/nodejs/tests/ingestion/framework/pipelines.integration.test.ts+++ b/nodejs/tests/ingestion/framework/pipelines.integration.test.ts@@ -16,7 +16,7 @@ import { PipelineConfig } from '~/ingestion/framework/result-handling-pipeline'import { PipelineResult, dlq, drop, ok, redirect } from '~/ingestion/framework/results'import { ProcessingStep } from '~/ingestion/framework/steps'import { createMockIngestionOutputs } from '~/tests/helpers/mock-ingestion-outputs'-import { ProjectId, Team } from '~/types'+import { FlagEvaluationsMode, ProjectId, Team } from '~/types'const createTestTeam = (overrides: Partial<Team> = {}): Team => ({id: 1,@@ -33,6 +33,7 @@ const createTestTeam = (overrides: Partial<Team> = {}): Team => ({ingested_event: true,person_display_name_properties: null,minimal_flag_called_events: false,+ flag_evaluations_mode: FlagEvaluationsMode.Events,test_account_filters: null,cookieless_server_hash_mode: null,timezone: 'UTC',diff --git a/nodejs/tests/ingestion/person-properties-metadata.e2e.test.ts b/nodejs/tests/ingestion/person-properties-metadata.e2e.test.tsindex c0c1d506b77c..cf5557f58705 100644--- a/nodejs/tests/ingestion/person-properties-metadata.e2e.test.ts+++ b/nodejs/tests/ingestion/person-properties-metadata.e2e.test.ts@@ -23,7 +23,7 @@ import {} from '~/tests/helpers/ingestion-e2e'import { createTestIngestionOutputs, createTestMonitoringOutputs } from '~/tests/helpers/ingestion-outputs'import { createUserTeamAndOrganization, fetchPostgresPersons, uniqueTestId } from '~/tests/helpers/sql'-import { PipelineEvent, PluginsServerConfig, ProjectId, Team } from '~/types'+import { FlagEvaluationsMode, PipelineEvent, PluginsServerConfig, ProjectId, Team } from '~/types'jest.mock('~/common/utils/token-bucket', () => {const mockConsume = jest.fn().mockReturnValue(true)@@ -55,6 +55,7 @@ const DEFAULT_TEAM: Team = {ingested_event: true,person_display_name_properties: null,minimal_flag_called_events: false,+ flag_evaluations_mode: FlagEvaluationsMode.Events,test_account_filters: null,cookieless_server_hash_mode: null,timezone: 'UTC',diff --git a/posthog/api/project.py b/posthog/api/project.pyindex 5ab7a038151a..6b58949a80b3 100644--- a/posthog/api/project.py+++ b/posthog/api/project.py@@ -122,6 +122,8 @@ from products.access_control.backend.presentation.access_control import (UserAccessControlSerializerMixin,)from products.access_control.backend.presentation.access_control_settings import AccessControlSettingsViewSetMixin+from products.feature_flags.backend.facade.enums import FlagEvaluationsMode+from products.feature_flags.backend.facade.flags import get_usage_tab_flag_evaluations_modefrom products.feature_flags.backend.models import TeamFeatureFlagDefaultsConfigfrom products.feature_flags.backend.models.evaluation_context import (EvaluationContext,@@ -602,6 +604,12 @@ class ProjectBackwardCompatSerializer(product_intents = serializers.SerializerMethodField() # Compat with TeamSerializeravailable_setup_task_ids = serializers.SerializerMethodField() # Compat with TeamSerializermanaged_viewsets = serializers.SerializerMethodField() # Compat with TeamSerializer+ flag_evaluations_mode = serializers.SerializerMethodField( # Compat with TeamSerializer+ help_text=(+ "Which table this project's feature flag usage data is read from. PostHog sets it for the "+ "whole organization. 0 reads the events table. 1 and 2 read the flag_evaluations table."+ )+ )# These are @property attrs on Team, not Django model fields — declare explicitly so drf-spectacular can resolve themdefault_modifiers = serializers.DictField(read_only=True) # Compat with TeamSerializerperson_on_events_querying_enabled = serializers.BooleanField(read_only=True) # Compat with TeamSerializer@@ -742,6 +750,7 @@ class ProjectBackwardCompatSerializer("project_id", # Compat with TeamSerializer"user_access_level", # Compat with TeamSerializer"managed_viewsets", # Compat with TeamSerializer+ "flag_evaluations_mode", # Compat with TeamSerializer"revenue_analytics_config", # Compat with TeamSerializer"marketing_analytics_config", # Compat with TeamSerializer"customer_analytics_config", # Compat with TeamSerializer@@ -783,6 +792,7 @@ class ProjectBackwardCompatSerializer("project_id","user_access_level","managed_viewsets",+ "flag_evaluations_mode",)team_passthrough_fields = {@@ -961,6 +971,10 @@ class ProjectBackwardCompatSerializer()return {kind: (kind in enabled_set) for kind, _ in DataWarehouseManagedViewSetKind.choices}+ @extend_schema_field(serializers.ChoiceField(choices=FlagEvaluationsMode.choices))+ def get_flag_evaluations_mode(self, obj: Project) -> int:+ return get_usage_tab_flag_evaluations_mode(obj.organization_id)+@staticmethoddef validate_revenue_analytics_config(value):return TeamSerializer.validate_revenue_analytics_config(value)diff --git a/posthog/api/team.py b/posthog/api/team.pyindex b450b4a0a318..ab7095e4953d 100644--- a/posthog/api/team.py+++ b/posthog/api/team.py@@ -124,6 +124,8 @@ from products.access_control.backend.presentation.access_control import ()from products.access_control.backend.presentation.access_control_settings import AccessControlSettingsViewSetMixinfrom products.customer_analytics.backend.facade.team_extension import TeamCustomerAnalyticsConfig+from products.feature_flags.backend.facade.enums import FlagEvaluationsMode+from products.feature_flags.backend.facade.flags import get_usage_tab_flag_evaluations_modefrom products.feature_flags.backend.models.evaluation_context import EvaluationContext, normalize_context_namefrom products.feature_flags.backend.models.team_feature_flag_policy_config import TeamFeatureFlagPolicyConfigfrom products.logs.backend.models import TeamLogsConfig@@ -1345,6 +1347,12 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixinlive_events_token = serializers.SerializerMethodField()product_intents = serializers.SerializerMethodField()managed_viewsets = serializers.SerializerMethodField()+ flag_evaluations_mode = serializers.SerializerMethodField(+ help_text=(+ "Which table this project's feature flag usage data is read from. PostHog sets it for the "+ "whole organization. 0 reads the events table. 1 and 2 read the flag_evaluations table."+ )+ )available_setup_task_ids = serializers.SerializerMethodField()revenue_analytics_config = TeamRevenueAnalyticsConfigSerializer(required=False)marketing_analytics_config = TeamMarketingAnalyticsConfigSerializer(required=False)@@ -1389,6 +1397,7 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixin"live_events_token","product_intents","managed_viewsets",+ "flag_evaluations_mode","available_setup_task_ids",)@@ -1412,6 +1421,7 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixin"user_access_level","product_intents","managed_viewsets",+ "flag_evaluations_mode","available_setup_task_ids",)@@ -1476,6 +1486,10 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixinreturn {kind: (kind in enabled_set) for kind, _ in DataWarehouseManagedViewSetKind.choices}+ @extend_schema_field(serializers.ChoiceField(choices=FlagEvaluationsMode.choices))+ def get_flag_evaluations_mode(self, obj: Team) -> int:+ return get_usage_tab_flag_evaluations_mode(obj.organization_id)+@extend_schema_field(serializers.ListField(child=serializers.ChoiceField(choices=[(e.value, e.value) for e in SetupTaskId])))diff --git a/posthog/api/test/__snapshots__/test_element.ambr b/posthog/api/test/__snapshots__/test_element.ambrindex 12a4a9e90235..211952e4a75b 100644--- a/posthog/api/test/__snapshots__/test_element.ambr+++ b/posthog/api/test/__snapshots__/test_element.ambr@@ -91,6 +91,44 @@'''# ---# name: TestElement.test_element_stats_postgres_queries_are_as_expected.10+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestElement.test_element_stats_postgres_queries_are_as_expected.11'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -110,7 +148,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestElement.test_element_stats_postgres_queries_are_as_expected.11+# name: TestElement.test_element_stats_postgres_queries_are_as_expected.12'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -129,7 +167,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestElement.test_element_stats_postgres_queries_are_as_expected.12+# name: TestElement.test_element_stats_postgres_queries_are_as_expected.13'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -436,6 +474,15 @@'''# ---# name: TestElement.test_element_stats_postgres_queries_are_as_expected.7+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestElement.test_element_stats_postgres_queries_are_as_expected.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -499,7 +546,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestElement.test_element_stats_postgres_queries_are_as_expected.8+# name: TestElement.test_element_stats_postgres_queries_are_as_expected.9'''SELECT "posthog_teamrevenueanalyticsconfig"."team_id","posthog_teamrevenueanalyticsconfig"."filter_test_accounts",@@ -512,41 +559,3 @@LIMIT 21'''# ----# name: TestElement.test_element_stats_postgres_queries_are_as_expected.9- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ---diff --git a/posthog/api/test/test_event.py b/posthog/api/test/test_event.pyindex 5b3e31d7a687..af3785c7c677 100644--- a/posthog/api/test/test_event.py+++ b/posthog/api/test/test_event.py@@ -115,8 +115,9 @@ class TestEvents(ClickhouseTestMixin, APIBaseTest):# into get_restricted_properties_for_team, which lets is_property_access_control_enabled# skip its per-call Team+organization lookup. +1 for the saved-expressions fetch in the# HogQL database build. +1 for the flag-cache TTL instance setting, cold-cache here but- # TTL-cached per worker in production.- with self.assertNumQueries(16):+ # TTL-cached per worker in production. +1 for the organization's flag_evaluations mode lookup in+ # the HogQL database build.+ with self.assertNumQueries(17):response = self.client.get(f"/api/projects/{self.team.id}/events/?event=event_name").json()assert response["results"][0]["event"] == "event_name"@@ -152,8 +153,9 @@ class TestEvents(ClickhouseTestMixin, APIBaseTest):# Was 24 before passing team=team into get_restricted_properties_for_team, which lets# is_property_access_control_enabled skip its per-call Team+organization lookup.# +1 for the saved-expressions fetch in the HogQL database build. +1 for the flag-cache- # TTL instance setting, cold-cache here but TTL-cached per worker in production.- expected_queries = 23 if settings.CLICKHOUSE_HOGQL_USE_NEW_EVENTS_SCHEMA else 24+ # TTL instance setting, cold-cache here but TTL-cached per worker in production. +1 for+ # the organization's flag_evaluations mode lookup in the HogQL database build.+ expected_queries = 24 if settings.CLICKHOUSE_HOGQL_USE_NEW_EVENTS_SCHEMA else 25with self.assertNumQueries(expected_queries):response = self.client.get(diff --git a/posthog/api/test/test_person.py b/posthog/api/test/test_person.pyindex 9ecd4b1a00be..8e3c7671cae4 100644--- a/posthog/api/test/test_person.py+++ b/posthog/api/test/test_person.py@@ -2178,8 +2178,9 @@ class TestPerson(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):# so listing persons no longer pays a per-request Team lookup (was 16). +1 for the# saved-expressions fetch in the HogQL database build. +1 each for the shared-database# kill-switch and flag-cache TTL instance settings, cold-cache here but TTL-cached per- # worker in production.- with self.assertNumQueries(17):+ # worker in production. +1 for the organization's flag_evaluations mode lookup in the HogQL+ # database build.+ with self.assertNumQueries(18):response = self.client.get("/api/person/?limit=10").json()self.assertEqual(len(response["results"]), 9)returned_ids += [x["distinct_ids"][0] for x in response["results"]]@@ -2191,8 +2192,9 @@ class TestPerson(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):self.assertEqual(returned_ids, created_ids, returned_ids)# 16 as above, plus the include_total counting queries (was 20); the count runs a second- # HogQL database build, which pays the saved-expressions fetch again.- with self.assertNumQueries(19):+ # HogQL database build, which pays the saved-expressions fetch again. +2 because each of+ # the two HogQL database builds looks up the organization's flag_evaluations mode.+ with self.assertNumQueries(21):response_include_total = self.client.get("/api/person/?limit=10&include_total").json()self.assertEqual(response_include_total["count"], 20) # With `include_total`, the total count is returned toodiff --git a/posthog/api/test/test_project.py b/posthog/api/test/test_project.pyindex da4f67d5f5b6..315b13d066c2 100644--- a/posthog/api/test/test_project.py+++ b/posthog/api/test/test_project.py@@ -15,6 +15,7 @@ from posthog.api.team import TeamCustomerAnalyticsConfigSerializerfrom posthog.api.test.test_team import EnvironmentToProjectRewriteClient, team_api_test_factoryfrom posthog.constants import AvailableFeaturefrom posthog.models.activity_logging.activity_log import ActivityLog+from posthog.models.instance_setting import override_instance_configfrom posthog.models.organization import Organization, OrganizationMembershipfrom posthog.models.person.util import get_person_by_uuidfrom posthog.models.personal_api_key import PersonalAPIKey@@ -26,6 +27,8 @@ from posthog.test.persons import create_person, delete_personfrom products.customer_analytics.backend.facade.team_extension import TeamCustomerAnalyticsConfigfrom products.experiments.backend.models.team_experiments_config import TeamExperimentsConfig+from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfig+from products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsModeclass TestProjectAPI(team_api_test_factory()): # type: ignore@@ -1033,6 +1036,7 @@ class TestProjectAPI(team_api_test_factory()): # type: ignore"project_id","user_access_level","managed_viewsets",+ "flag_evaluations_mode","base_currency","capture_dead_clicks","cookieless_server_hash_mode",@@ -1046,6 +1050,50 @@ class TestProjectAPI(team_api_test_factory()): # type: ignore# project_id on a Project equals its own id (Project ↔ Team is 1:1)self.assertEqual(data["project_id"], self.project.id)+ def test_flag_evaluations_mode_is_read_only(self):+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).update(+ flag_evaluations_mode=FlagEvaluationsMode.READ_FLAG_EVALUATIONS+ )++ response = self.client.patch(+ f"/api/projects/{self.project.id}/", {"flag_evaluations_mode": FlagEvaluationsMode.EVENTS}+ )++ self.assertEqual(response.status_code, status.HTTP_200_OK)+ self.assertEqual(response.json()["flag_evaluations_mode"], FlagEvaluationsMode.READ_FLAG_EVALUATIONS)+ self.assertEqual(+ OrganizationFeatureFlagsConfig.objects.get(organization=self.organization).flag_evaluations_mode,+ FlagEvaluationsMode.READ_FLAG_EVALUATIONS,+ )++ @parameterized.expand(+ [+ (+ "read_flag_evaluations_reads_events",+ FlagEvaluationsMode.READ_FLAG_EVALUATIONS,+ FlagEvaluationsMode.EVENTS,+ ),+ (+ "flag_evaluations_only_keeps_its_mode",+ FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY,+ FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY,+ ),+ ]+ )+ def test_flag_evaluations_mode_while_the_usage_tab_is_forced_to_events(self, _name, stored_mode, expected_mode):+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).update(+ flag_evaluations_mode=stored_mode+ )++ with override_instance_config("FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS", True):+ response = self.client.get(f"/api/projects/{self.project.id}/")++ self.assertEqual(response.json()["flag_evaluations_mode"], expected_mode)+ self.assertEqual(+ OrganizationFeatureFlagsConfig.objects.get(organization=self.organization).flag_evaluations_mode,+ stored_mode,+ )+def test_retrieve_project_does_not_500_when_broker_unavailable(self):# Regression: get_product_intents used to call calculate_product_activation.delay()# on every retrieve, which 500s the whole endpoint when the broker is down. It nowdiff --git a/posthog/api/test/test_team.py b/posthog/api/test/test_team.pyindex 40f5e5c3147c..a432a20a23da 100644--- a/posthog/api/test/test_team.py+++ b/posthog/api/test/test_team.py@@ -11,6 +11,7 @@ from django.core.cache import cachefrom django.db import OperationalErrorfrom django.http import HttpResponsefrom django.test import SimpleTestCase, TransactionTestCase, override_settings+from django.test.client import RequestFactoryfrom django.utils import timezonefrom parameterized import parameterized@@ -33,7 +34,7 @@ from posthog.models.group_type_mapping import (GROUP_TYPES_STALE_CACHE_KEY_PREFIX,cached_group_types_for_team,)-from posthog.models.instance_setting import get_instance_setting+from posthog.models.instance_setting import get_instance_setting, override_instance_configfrom posthog.models.oauth import OAuthAccessToken, OAuthApplicationfrom posthog.models.organization import Organization, OrganizationMembershipfrom posthog.models.personal_api_key import PersonalAPIKey@@ -43,11 +44,13 @@ from posthog.models.team import Teamfrom posthog.models.user import Userfrom posthog.models.utils import generate_random_token_personal, hash_key_valuefrom posthog.test.test_utils import create_group_type_mapping_without_created_at-from posthog.utils import get_instance_realm+from posthog.utils import get_context_for_template, get_instance_realmfrom products.access_control.backend.models.access_control import AccessControlfrom products.conversations.backend.playbook import compose_support_playbookfrom products.dashboards.backend.models.dashboard import Dashboard+from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfig+from products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsModefrom products.workflows.backend.facade.team_extension import TeamWorkflowsConfig@@ -2925,6 +2928,33 @@ def create_team(organization: Organization, name: str = "Test team", timezone: sclass TestTeamAPI(team_api_test_factory()): # type: ignore+ @parameterized.expand(+ [+ (+ "read_flag_evaluations_reads_events",+ FlagEvaluationsMode.READ_FLAG_EVALUATIONS,+ FlagEvaluationsMode.EVENTS,+ ),+ (+ "flag_evaluations_only_keeps_its_mode",+ FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY,+ FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY,+ ),+ ]+ )+ def test_page_load_team_follows_the_usage_tab_switch(self, _name, stored_mode, expected_mode):+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).update(+ flag_evaluations_mode=stored_mode+ )+ request = RequestFactory().get("/")+ request.user = self.user+ request.session = self.client.session++ with override_instance_config("FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS", True):+ context = get_context_for_template("index.html", request)++ self.assertEqual(context["posthog_app_context"]["current_team"]["flag_evaluations_mode"], expected_mode)+def test_teams_outside_personal_api_key_scoped_teams_not_listed(self):# Scope to a primary team (team.id == project.id) so the env→project rewrite can address it directly._, scoped_team = Project.objects.create_with_team(organization=self.organization, initiating_user=self.user)diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambrindex c9c15af2f43b..f4a9a4b67e19 100644--- a/posthog/hogql/database/test/__snapshots__/test_database.ambr+++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr@@ -30,6 +30,15 @@'''# ---# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.1'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -93,45 +102,46 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.1+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.10'''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ SELECT "posthog_datawarehousejoin"."created_by_id",+ "posthog_datawarehousejoin"."created_at",+ "posthog_datawarehousejoin"."deleted",+ "posthog_datawarehousejoin"."deleted_at",+ "posthog_datawarehousejoin"."id",+ "posthog_datawarehousejoin"."team_id",+ "posthog_datawarehousejoin"."source_table_name",+ "posthog_datawarehousejoin"."source_table_key",+ "posthog_datawarehousejoin"."joining_table_name",+ "posthog_datawarehousejoin"."joining_table_key",+ "posthog_datawarehousejoin"."field_name",+ "posthog_datawarehousejoin"."configuration"+ FROM "posthog_datawarehousejoin"+ WHERE ("posthog_datawarehousejoin"."team_id" = 99999+ AND NOT ("posthog_datawarehousejoin"."deleted"+ AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.10+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.11+ '''+ SELECT "data_tools_datawarehouseexpression"."deleted",+ "data_tools_datawarehouseexpression"."deleted_at",+ "data_tools_datawarehouseexpression"."id",+ "data_tools_datawarehouseexpression"."team_id",+ "data_tools_datawarehouseexpression"."created_at",+ "data_tools_datawarehouseexpression"."created_by_id",+ "data_tools_datawarehouseexpression"."table_name",+ "data_tools_datawarehouseexpression"."field_name",+ "data_tools_datawarehouseexpression"."expression",+ "data_tools_datawarehouseexpression"."connection_id"+ FROM "data_tools_datawarehouseexpression"+ WHERE ("data_tools_datawarehouseexpression"."team_id" = 99999+ AND NOT ("data_tools_datawarehouseexpression"."deleted"+ AND "data_tools_datawarehouseexpression"."deleted" IS NOT NULL)+ AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)+ '''+# ---+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.12'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -164,7 +174,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.11+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.13'''SELECT "posthog_datawarehousecredential"."created_by_id","posthog_datawarehousecredential"."created_at",@@ -183,6 +193,44 @@'''# ---# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.2+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.3'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -202,7 +250,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.3+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.4'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -221,7 +269,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.4+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.5'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -254,7 +302,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.5+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.6'''SELECT "posthog_datawarehousecredential"."created_by_id","posthog_datawarehousecredential"."created_at",@@ -272,7 +320,16 @@AND "posthog_datawarehousecredential"."team_id" = 99999)'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.6+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.7+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -336,7 +393,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.7+# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.9'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -374,45 +431,6 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.8- '''- SELECT "posthog_datawarehousejoin"."created_by_id",- "posthog_datawarehousejoin"."created_at",- "posthog_datawarehousejoin"."deleted",- "posthog_datawarehousejoin"."deleted_at",- "posthog_datawarehousejoin"."id",- "posthog_datawarehousejoin"."team_id",- "posthog_datawarehousejoin"."source_table_name",- "posthog_datawarehousejoin"."source_table_key",- "posthog_datawarehousejoin"."joining_table_name",- "posthog_datawarehousejoin"."joining_table_key",- "posthog_datawarehousejoin"."field_name",- "posthog_datawarehousejoin"."configuration"- FROM "posthog_datawarehousejoin"- WHERE ("posthog_datawarehousejoin"."team_id" = 99999- AND NOT ("posthog_datawarehousejoin"."deleted"- AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))- '''-# ----# name: TestDatabase.test_database_with_warehouse_tables_and_saved_queries_n_plus_1.9- '''- SELECT "data_tools_datawarehouseexpression"."deleted",- "data_tools_datawarehouseexpression"."deleted_at",- "data_tools_datawarehouseexpression"."id",- "data_tools_datawarehouseexpression"."team_id",- "data_tools_datawarehouseexpression"."created_at",- "data_tools_datawarehouseexpression"."created_by_id",- "data_tools_datawarehouseexpression"."table_name",- "data_tools_datawarehouseexpression"."field_name",- "data_tools_datawarehouseexpression"."expression",- "data_tools_datawarehouseexpression"."connection_id"- FROM "data_tools_datawarehouseexpression"- WHERE ("data_tools_datawarehouseexpression"."team_id" = 99999- AND NOT ("data_tools_datawarehouseexpression"."deleted"- AND "data_tools_datawarehouseexpression"."deleted" IS NOT NULL)- AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)- '''-# ---# name: TestDatabase.test_serialize_database_no_person_on_events'''{diff --git a/posthog/hogql/database/test/test_database.py b/posthog/hogql/database/test/test_database.pyindex 5928184d66da..7d36d0b93a6f 100644--- a/posthog/hogql/database/test/test_database.py+++ b/posthog/hogql/database/test/test_database.py@@ -940,8 +940,9 @@ class TestDatabase(BaseTest, QueryMatchingTest):@patch("posthog.hogql.query.sync_execute", return_value=([], []))def test_database_with_warehouse_tables_and_saved_queries_n_plus_1(self, patch_execute):# +1 vs the pre-bulk-credential baseline: one bulk credential fetch replaces the per-row- # credential joins (decrypt once per credential, not per table/view).- max_queries = FuzzyInt(6, 8)+ # credential joins (decrypt once per credential, not per table/view). +1 more for the+ # organization's flag_evaluations mode, which is_flag_evaluations_table_enabled reads once per build.+ max_queries = FuzzyInt(7, 9)credential = DataWarehouseCredential.objects.create(team=self.team, access_key="_accesskey", access_secret="_secret")@@ -998,8 +999,8 @@ class TestDatabase(BaseTest, QueryMatchingTest):# initialization team query doesn't run; the extra query is the single bulk credential fetch# (credentials are decrypted once each here instead of re-decrypted per table/view row),- # plus the saved-expressions fetch- with self.assertNumQueries(6):+ # plus the saved-expressions fetch and the organization's flag_evaluations mode+ with self.assertNumQueries(7):modifiers = create_default_modifiers_for_team(self.team, modifiers=HogQLQueryModifiers(useMaterializedViews=True))diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambrindex 247c351a3334..d27f553a12d7 100644--- a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr+++ b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr@@ -991,6 +991,15 @@'''# ---# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.28+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.29'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -1054,44 +1063,6 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.29- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ---# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.3'''SELECT "posthog_user"."id",@@ -1139,6 +1110,44 @@'''# ---# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.30+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.31'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -1158,7 +1167,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.31+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.32'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -1177,7 +1186,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.32+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.33'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -1210,7 +1219,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.33+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.34'''SELECT "posthog_propertydefinition"."id","posthog_propertydefinition"."team_id",@@ -1234,7 +1243,7 @@5 /* ... */))'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.34+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.35'''SELECT "posthog_user"."id","posthog_user"."password",@@ -1280,7 +1289,7 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.35+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.36'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -1325,7 +1334,7 @@LIMIT 21'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.36+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.37'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -1463,7 +1472,7 @@LIMIT 21'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.37+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.38'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -1517,7 +1526,7 @@LIMIT 21'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.38+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.39'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -1540,16 +1549,9 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.39+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.4'''- SELECT "posthog_organizationmembership"."id",- "posthog_organizationmembership"."organization_id",- "posthog_organizationmembership"."user_id",- "posthog_organizationmembership"."level",- "posthog_organizationmembership"."joined_at",- "posthog_organizationmembership"."updated_at",- "posthog_organizationmembership"."invited_by_id",- "posthog_organization"."id",+ SELECT "posthog_organization"."id","posthog_organization"."name","posthog_organization"."slug","posthog_organization"."logo_media_id",@@ -1587,14 +1589,21 @@"posthog_organization"."personalization","posthog_organization"."domain_whitelist","posthog_organization"."is_platform"- FROM "posthog_organizationmembership"- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")- WHERE "posthog_organizationmembership"."user_id" = 99999+ FROM "posthog_organization"+ WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid+ LIMIT 21'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.4+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.40'''- SELECT "posthog_organization"."id",+ SELECT "posthog_organizationmembership"."id",+ "posthog_organizationmembership"."organization_id",+ "posthog_organizationmembership"."user_id",+ "posthog_organizationmembership"."level",+ "posthog_organizationmembership"."joined_at",+ "posthog_organizationmembership"."updated_at",+ "posthog_organizationmembership"."invited_by_id",+ "posthog_organization"."id","posthog_organization"."name","posthog_organization"."slug","posthog_organization"."logo_media_id",@@ -1632,12 +1641,12 @@"posthog_organization"."personalization","posthog_organization"."domain_whitelist","posthog_organization"."is_platform"- FROM "posthog_organization"- WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid- LIMIT 21+ FROM "posthog_organizationmembership"+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")+ WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.40+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.41'''SELECT COUNT(*) AS "__count"FROM "posthog_sessionrecordingplaylist"@@ -1648,7 +1657,7 @@AND NOT "posthog_sessionrecordingplaylist"."deleted")'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.41+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.42'''SELECT "posthog_sessionrecordingplaylist"."id","posthog_sessionrecordingplaylist"."short_id",@@ -1860,7 +1869,7 @@LIMIT 94'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.42+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.43'''SELECT "posthog_sessionrecordingplaylistitem"."playlist_id" AS "playlist_id",COUNT("posthog_sessionrecordingplaylistitem"."id") AS "c"@@ -1877,7 +1886,7 @@GROUP BY 1'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.43+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.44'''SELECT "posthog_sessionrecordingplaylistitem"."playlist_id" AS "playlist_id","posthog_sessionrecordingplaylistitem"."recording_id" AS "recording_id"@@ -1891,7 +1900,7 @@5 /* ... */))'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.44+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.45'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -1900,7 +1909,7 @@AND "posthog_sessionrecordingviewed"."session_id" IN ('00000000-0000-0000-0000-000000000000'))'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.45+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.46'''SELECT COUNT(*) AS "__count"FROM "posthog_sessionrecordingviewed"@@ -1908,7 +1917,7 @@AND "posthog_sessionrecordingviewed"."user_id" = 99999)'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.46+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.47'''SELECT COUNT(*)FROM@@ -1920,7 +1929,7 @@AND NOT ("posthog_comment"."item_id" IS NULL))) subquery'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.47+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.48'''SELECT COUNT(*)FROM@@ -1931,7 +1940,7 @@AND NOT ("posthog_sharingconfiguration"."recording_id" IS NULL))) subquery'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.48+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.49'''SELECT COUNT(*)FROMdiff --git a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambrindex 99699254f18d..3470c5a0f134 100644--- a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr+++ b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr@@ -99,6 +99,44 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.10+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.11'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -118,7 +156,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.11+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.12'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -137,7 +175,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.12+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.13'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -170,7 +208,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.13+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.14'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -198,7 +236,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.14+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.15'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -209,7 +247,7 @@'old_session'))'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.15+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.16'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -490,6 +528,15 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.6+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.7'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -543,7 +590,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.7+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -607,7 +654,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.8+# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.9'''SELECT "posthog_teamrevenueanalyticsconfig"."team_id","posthog_teamrevenueanalyticsconfig"."filter_test_accounts",@@ -620,44 +667,6 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.9- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing'''SELECT "posthog_user"."id",@@ -750,6 +759,44 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.10+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.11'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -769,7 +816,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.11+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.12'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -788,7 +835,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.12+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.13'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -821,7 +868,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.13+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.14'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -848,7 +895,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.14+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.15'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -858,7 +905,7 @@'session1'))'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.15+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.16'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -1138,6 +1185,15 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.6+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.7'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -1191,7 +1247,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.7+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -1255,7 +1311,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.8+# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.9'''SELECT "posthog_teamrevenueanalyticsconfig"."team_id","posthog_teamrevenueanalyticsconfig"."filter_test_accounts",@@ -1268,44 +1324,6 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.9- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots'''SELECT "posthog_user"."id",@@ -1398,6 +1416,44 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.10+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.11'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -1417,7 +1473,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.11+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.12'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -1436,7 +1492,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.12+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.13'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -1469,7 +1525,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.13+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.14'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -1495,7 +1551,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.14+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.15'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -1504,7 +1560,7 @@AND "posthog_sessionrecordingviewed"."session_id" IN ('session_with_duration'))'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.15+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.16'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -1783,6 +1839,15 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.6+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.7'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -1836,7 +1901,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.7+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -1900,7 +1965,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.8+# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.9'''SELECT "posthog_teamrevenueanalyticsconfig"."team_id","posthog_teamrevenueanalyticsconfig"."filter_test_accounts",@@ -1913,45 +1978,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.9- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids'''SELECT "posthog_user"."id","posthog_user"."password",@@ -2043,6 +2070,44 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.10+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.11'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -2062,7 +2127,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.11+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.12'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -2081,7 +2146,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.12+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.13'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -2114,7 +2179,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.13+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.14'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -2140,7 +2205,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.14+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.15'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -2149,7 +2214,7 @@AND "posthog_sessionrecordingviewed"."session_id" IN ('session_many_ids'))'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.15+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.16'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -2428,6 +2493,15 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.6+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.7'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -2481,7 +2555,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.7+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -2545,7 +2619,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.8+# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.9'''SELECT "posthog_teamrevenueanalyticsconfig"."team_id","posthog_teamrevenueanalyticsconfig"."filter_test_accounts",@@ -2558,44 +2632,6 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.9- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_'''SELECT "posthog_user"."id",@@ -2688,6 +2724,44 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.10+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.11'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -2707,7 +2781,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.11+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.12'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -2726,7 +2800,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.12+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.13'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -2759,7 +2833,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.13+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.14'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -2786,7 +2860,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.14+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.15'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -2796,7 +2870,7 @@'at_base_time'))'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.15+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.16'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -3076,6 +3150,15 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.6+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.7'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -3129,7 +3212,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.7+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -3193,7 +3276,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.8+# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.9'''SELECT "posthog_teamrevenueanalyticsconfig"."team_id","posthog_teamrevenueanalyticsconfig"."filter_test_accounts",@@ -3206,44 +3289,6 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.9- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending'''SELECT "posthog_user"."id",@@ -3336,6 +3381,44 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.10+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.11'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -3355,7 +3438,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.11+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.12'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -3374,7 +3457,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.12+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.13'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -3407,7 +3490,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.13+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.14'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -3434,7 +3517,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.14+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.15'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -3444,7 +3527,7 @@'at_base_time'))'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.15+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.16'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -3724,6 +3807,15 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.6+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.7'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -3777,7 +3869,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.7+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -3841,7 +3933,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.8+# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.9'''SELECT "posthog_teamrevenueanalyticsconfig"."team_id","posthog_teamrevenueanalyticsconfig"."filter_test_accounts",@@ -3854,44 +3946,6 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.9- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending'''SELECT "posthog_user"."id",@@ -3984,6 +4038,44 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.10+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.11'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -4003,7 +4095,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.11+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.12'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -4022,7 +4114,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.12+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.13'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -4055,7 +4147,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.13+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.14'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -4082,7 +4174,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.14+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.15'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -4092,7 +4184,7 @@'at_base_time_plus_20'))'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.15+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.16'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -4372,6 +4464,15 @@'''# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.6+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.7'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -4425,7 +4526,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.7+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.8'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -4489,7 +4590,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.8+# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.9'''SELECT "posthog_teamrevenueanalyticsconfig"."team_id","posthog_teamrevenueanalyticsconfig"."filter_test_accounts",@@ -4502,44 +4603,6 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.9- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons'''SELECT "posthog_user"."id",@@ -4633,63 +4696,323 @@# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.10'''- SELECT "data_tools_datawarehouseexpression"."deleted",- "data_tools_datawarehouseexpression"."deleted_at",- "data_tools_datawarehouseexpression"."id",- "data_tools_datawarehouseexpression"."team_id",- "data_tools_datawarehouseexpression"."created_at",- "data_tools_datawarehouseexpression"."created_by_id",- "data_tools_datawarehouseexpression"."table_name",- "data_tools_datawarehouseexpression"."field_name",- "data_tools_datawarehouseexpression"."expression",- "data_tools_datawarehouseexpression"."connection_id"- FROM "data_tools_datawarehouseexpression"- WHERE ("data_tools_datawarehouseexpression"."team_id" = 99999- AND NOT ("data_tools_datawarehouseexpression"."deleted"- AND "data_tools_datawarehouseexpression"."deleted" IS NOT NULL)- AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)+ SELECT "posthog_datawarehousejoin"."created_by_id",+ "posthog_datawarehousejoin"."created_at",+ "posthog_datawarehousejoin"."deleted",+ "posthog_datawarehousejoin"."deleted_at",+ "posthog_datawarehousejoin"."id",+ "posthog_datawarehousejoin"."team_id",+ "posthog_datawarehousejoin"."source_table_name",+ "posthog_datawarehousejoin"."source_table_key",+ "posthog_datawarehousejoin"."joining_table_name",+ "posthog_datawarehousejoin"."joining_table_key",+ "posthog_datawarehousejoin"."field_name",+ "posthog_datawarehousejoin"."configuration"+ FROM "posthog_datawarehousejoin"+ WHERE ("posthog_datawarehousejoin"."team_id" = 99999+ AND NOT ("posthog_datawarehousejoin"."deleted"+ AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.100'''- SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"- FROM "posthog_sessionrecordingviewed"- WHERE ("posthog_sessionrecordingviewed"."team_id" = 99999- AND "posthog_sessionrecordingviewed"."user_id" = 99999- AND "posthog_sessionrecordingviewed"."session_id" IN ('6',- '5',- '4',- '3',- '2',- '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_organizationmembership"."invited_by_id",+ "posthog_organization"."id",+ "posthog_organization"."name",+ "posthog_organization"."slug",+ "posthog_organization"."logo_media_id",+ "posthog_organization"."created_at",+ "posthog_organization"."updated_at",+ "posthog_organization"."is_active",+ "posthog_organization"."is_not_active_reason",+ "posthog_organization"."session_cookie_age",+ "posthog_organization"."is_member_join_email_enabled",+ "posthog_organization"."is_ai_data_processing_approved",+ "posthog_organization"."is_ai_training_opted_in",+ "posthog_organization"."is_ai_training_locked",+ "posthog_organization"."is_ai_training_cta_shown",+ "posthog_organization"."enforce_2fa",+ "posthog_organization"."enforce_verified_domains",+ "posthog_organization"."members_can_invite",+ "posthog_organization"."members_can_create_projects",+ "posthog_organization"."members_can_use_personal_api_keys",+ "posthog_organization"."members_can_see_org_members",+ "posthog_organization"."uses_most_specific_access_resolution",+ "posthog_organization"."allow_publicly_shared_resources",+ "posthog_organization"."read_only_mcp_access",+ "posthog_organization"."default_role_id",+ "posthog_organization"."plugins_access_level",+ "posthog_organization"."for_internal_metrics",+ "posthog_organization"."default_anonymize_ips",+ "posthog_organization"."is_pending_deletion",+ "posthog_organization"."customer_id",+ "posthog_organization"."available_product_features",+ "posthog_organization"."usage",+ "posthog_organization"."never_drop_data",+ "posthog_organization"."customer_trust_scores",+ "posthog_organization"."has_active_subscription",+ "posthog_organization"."setup_section_2_completed",+ "posthog_organization"."personalization",+ "posthog_organization"."domain_whitelist",+ "posthog_organization"."is_platform"+ 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: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.101'''- SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id",- "posthog_user"."email" AS "user__email"- FROM "posthog_sessionrecordingviewed"- INNER JOIN "posthog_user" ON ("posthog_sessionrecordingviewed"."user_id" = "posthog_user"."id")- WHERE ("posthog_sessionrecordingviewed"."session_id" IN ('6',- '5',- '4',- '3',- '2',- '1')- AND "posthog_sessionrecordingviewed"."team_id" = 99999- AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.102- '''- 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",+ SELECT "posthog_datawarehousesavedquery"."created_by_id",+ "posthog_datawarehousesavedquery"."created_at",+ "posthog_datawarehousesavedquery"."updated_at",+ "posthog_datawarehousesavedquery"."deleted",+ "posthog_datawarehousesavedquery"."deleted_at",+ "posthog_datawarehousesavedquery"."id",+ "posthog_datawarehousesavedquery"."name",+ "posthog_datawarehousesavedquery"."team_id",+ "posthog_datawarehousesavedquery"."latest_error",+ "posthog_datawarehousesavedquery"."columns",+ "posthog_datawarehousesavedquery"."column_order",+ "posthog_datawarehousesavedquery"."external_tables",+ "posthog_datawarehousesavedquery"."query",+ "posthog_datawarehousesavedquery"."query_revision",+ "posthog_datawarehousesavedquery"."status",+ "posthog_datawarehousesavedquery"."last_run_at",+ "posthog_datawarehousesavedquery"."sync_frequency_interval",+ "posthog_datawarehousesavedquery"."table_id",+ "posthog_datawarehousesavedquery"."is_materialized",+ "posthog_datawarehousesavedquery"."deleted_name",+ "posthog_datawarehousesavedquery"."managed_viewset_id",+ "posthog_datawarehousesavedquery"."folder_id",+ "posthog_datawarehousesavedquery"."origin",+ "posthog_datawarehousesavedquery"."is_test",+ "posthog_datawarehousesavedquery"."expires_at",+ "posthog_datawarehousesavedquery"."semantic_enrichment_hash",+ "posthog_datawarehousesavedquery"."incremental_config",+ "posthog_datawarehousesavedquery"."incremental_state",+ "posthog_datawarehousetable"."created_by_id",+ "posthog_datawarehousetable"."created_at",+ "posthog_datawarehousetable"."updated_at",+ "posthog_datawarehousetable"."deleted",+ "posthog_datawarehousetable"."deleted_at",+ "posthog_datawarehousetable"."id",+ "posthog_datawarehousetable"."name",+ "posthog_datawarehousetable"."format",+ "posthog_datawarehousetable"."team_id",+ "posthog_datawarehousetable"."url_pattern",+ "posthog_datawarehousetable"."queryable_folder",+ "posthog_datawarehousetable"."credential_id",+ "posthog_datawarehousetable"."external_data_source_id",+ "posthog_datawarehousetable"."created_via",+ "posthog_datawarehousetable"."columns",+ "posthog_datawarehousetable"."column_order",+ "posthog_datawarehousetable"."options",+ "posthog_datawarehousetable"."row_count",+ "posthog_datawarehousetable"."size_in_s3_mib",+ "posthog_datawarehousemanagedviewset"."created_by_id",+ "posthog_datawarehousemanagedviewset"."created_at",+ "posthog_datawarehousemanagedviewset"."updated_at",+ "posthog_datawarehousemanagedviewset"."id",+ "posthog_datawarehousemanagedviewset"."team_id",+ "posthog_datawarehousemanagedviewset"."kind"+ FROM "posthog_datawarehousesavedquery"+ LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")+ LEFT OUTER JOIN "posthog_datawarehousemanagedviewset" ON ("posthog_datawarehousesavedquery"."managed_viewset_id" = "posthog_datawarehousemanagedviewset"."id")+ WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999+ AND NOT ("posthog_datawarehousesavedquery"."deleted"+ AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL))+ ORDER BY "posthog_datawarehousesavedquery"."name" ASC+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.102+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.103+ '''+ SELECT "posthog_datawarehousejoin"."created_by_id",+ "posthog_datawarehousejoin"."created_at",+ "posthog_datawarehousejoin"."deleted",+ "posthog_datawarehousejoin"."deleted_at",+ "posthog_datawarehousejoin"."id",+ "posthog_datawarehousejoin"."team_id",+ "posthog_datawarehousejoin"."source_table_name",+ "posthog_datawarehousejoin"."source_table_key",+ "posthog_datawarehousejoin"."joining_table_name",+ "posthog_datawarehousejoin"."joining_table_key",+ "posthog_datawarehousejoin"."field_name",+ "posthog_datawarehousejoin"."configuration"+ FROM "posthog_datawarehousejoin"+ WHERE ("posthog_datawarehousejoin"."team_id" = 99999+ AND NOT ("posthog_datawarehousejoin"."deleted"+ AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.104+ '''+ SELECT "data_tools_datawarehouseexpression"."deleted",+ "data_tools_datawarehouseexpression"."deleted_at",+ "data_tools_datawarehouseexpression"."id",+ "data_tools_datawarehouseexpression"."team_id",+ "data_tools_datawarehouseexpression"."created_at",+ "data_tools_datawarehouseexpression"."created_by_id",+ "data_tools_datawarehouseexpression"."table_name",+ "data_tools_datawarehouseexpression"."field_name",+ "data_tools_datawarehouseexpression"."expression",+ "data_tools_datawarehouseexpression"."connection_id"+ FROM "data_tools_datawarehouseexpression"+ WHERE ("data_tools_datawarehouseexpression"."team_id" = 99999+ AND NOT ("data_tools_datawarehouseexpression"."deleted"+ AND "data_tools_datawarehouseexpression"."deleted" IS NOT NULL)+ AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.105+ '''+ SELECT "posthog_datawarehousetable"."created_by_id",+ "posthog_datawarehousetable"."created_at",+ "posthog_datawarehousetable"."updated_at",+ "posthog_datawarehousetable"."deleted",+ "posthog_datawarehousetable"."deleted_at",+ "posthog_datawarehousetable"."id",+ "posthog_datawarehousetable"."name",+ "posthog_datawarehousetable"."format",+ "posthog_datawarehousetable"."team_id",+ "posthog_datawarehousetable"."url_pattern",+ "posthog_datawarehousetable"."queryable_folder",+ "posthog_datawarehousetable"."credential_id",+ "posthog_datawarehousetable"."external_data_source_id",+ "posthog_datawarehousetable"."created_via",+ "posthog_datawarehousetable"."columns",+ "posthog_datawarehousetable"."column_order",+ "posthog_datawarehousetable"."options",+ "posthog_datawarehousetable"."row_count",+ "posthog_datawarehousetable"."size_in_s3_mib"+ FROM "posthog_datawarehousetable"+ LEFT OUTER JOIN "posthog_externaldatasource" ON ("posthog_datawarehousetable"."external_data_source_id" = "posthog_externaldatasource"."id")+ WHERE ("posthog_datawarehousetable"."team_id" = 99999+ AND NOT ("posthog_datawarehousetable"."deleted"+ AND "posthog_datawarehousetable"."deleted" IS NOT NULL)+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND NOT ("posthog_externaldatasource"."access_method" = 'direct'+ AND "posthog_externaldatasource"."access_method" IS NOT NULL))+ ORDER BY "posthog_datawarehousetable"."created_at" DESC+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.106+ '''+ SELECT "posthog_sessionrecording"."id",+ "posthog_sessionrecording"."session_id",+ "posthog_sessionrecording"."team_id",+ "posthog_sessionrecording"."created_at",+ "posthog_sessionrecording"."deleted",+ "posthog_sessionrecording"."distinct_id",+ "posthog_sessionrecording"."duration",+ "posthog_sessionrecording"."active_seconds",+ "posthog_sessionrecording"."inactive_seconds",+ "posthog_sessionrecording"."start_time",+ "posthog_sessionrecording"."end_time",+ "posthog_sessionrecording"."click_count",+ "posthog_sessionrecording"."keypress_count",+ "posthog_sessionrecording"."mouse_activity_count",+ "posthog_sessionrecording"."console_log_count",+ "posthog_sessionrecording"."console_warn_count",+ "posthog_sessionrecording"."console_error_count",+ "posthog_sessionrecording"."start_url",+ "posthog_sessionrecording"."retention_period_days"+ FROM "posthog_sessionrecording"+ WHERE ("posthog_sessionrecording"."session_id" IN ('1',+ '2',+ '3',+ '4',+ '5',+ '6')+ AND "posthog_sessionrecording"."team_id" = 99999)+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.107+ '''+ SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"+ FROM "posthog_sessionrecordingviewed"+ WHERE ("posthog_sessionrecordingviewed"."team_id" = 99999+ AND "posthog_sessionrecordingviewed"."user_id" = 99999+ AND "posthog_sessionrecordingviewed"."session_id" IN ('6',+ '5',+ '4',+ '3',+ '2',+ '1'))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.108+ '''+ SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id",+ "posthog_user"."email" AS "user__email"+ FROM "posthog_sessionrecordingviewed"+ INNER JOIN "posthog_user" ON ("posthog_sessionrecordingviewed"."user_id" = "posthog_user"."id")+ WHERE ("posthog_sessionrecordingviewed"."session_id" IN ('6',+ '5',+ '4',+ '3',+ '2',+ '1')+ AND "posthog_sessionrecordingviewed"."team_id" = 99999+ AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.109+ '''+ 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","posthog_user"."current_organization_id","posthog_user"."current_team_id","posthog_user"."email",@@ -4726,7 +5049,26 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.103+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.11+ '''+ SELECT "data_tools_datawarehouseexpression"."deleted",+ "data_tools_datawarehouseexpression"."deleted_at",+ "data_tools_datawarehouseexpression"."id",+ "data_tools_datawarehouseexpression"."team_id",+ "data_tools_datawarehouseexpression"."created_at",+ "data_tools_datawarehouseexpression"."created_by_id",+ "data_tools_datawarehouseexpression"."table_name",+ "data_tools_datawarehouseexpression"."field_name",+ "data_tools_datawarehouseexpression"."expression",+ "data_tools_datawarehouseexpression"."connection_id"+ FROM "data_tools_datawarehouseexpression"+ WHERE ("data_tools_datawarehouseexpression"."team_id" = 99999+ AND NOT ("data_tools_datawarehouseexpression"."deleted"+ AND "data_tools_datawarehouseexpression"."deleted" IS NOT NULL)+ AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.110'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -4771,7 +5113,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.104+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.111'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -4909,7 +5251,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.105+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.112'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -4963,7 +5305,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.106+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.113'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -4986,7 +5328,7 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.107+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.114'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -5038,7 +5380,16 @@WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.108+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.115+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.116'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -5092,7 +5443,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.109+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.117'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -5156,40 +5507,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.11- '''- SELECT "posthog_datawarehousetable"."created_by_id",- "posthog_datawarehousetable"."created_at",- "posthog_datawarehousetable"."updated_at",- "posthog_datawarehousetable"."deleted",- "posthog_datawarehousetable"."deleted_at",- "posthog_datawarehousetable"."id",- "posthog_datawarehousetable"."name",- "posthog_datawarehousetable"."format",- "posthog_datawarehousetable"."team_id",- "posthog_datawarehousetable"."url_pattern",- "posthog_datawarehousetable"."queryable_folder",- "posthog_datawarehousetable"."credential_id",- "posthog_datawarehousetable"."external_data_source_id",- "posthog_datawarehousetable"."created_via",- "posthog_datawarehousetable"."columns",- "posthog_datawarehousetable"."column_order",- "posthog_datawarehousetable"."options",- "posthog_datawarehousetable"."row_count",- "posthog_datawarehousetable"."size_in_s3_mib"- FROM "posthog_datawarehousetable"- LEFT OUTER JOIN "posthog_externaldatasource" ON ("posthog_datawarehousetable"."external_data_source_id" = "posthog_externaldatasource"."id")- WHERE ("posthog_datawarehousetable"."team_id" = 99999- AND NOT ("posthog_datawarehousetable"."deleted"- AND "posthog_datawarehousetable"."deleted" IS NOT NULL)- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND NOT ("posthog_externaldatasource"."access_method" = 'direct'- AND "posthog_externaldatasource"."access_method" IS NOT NULL))- ORDER BY "posthog_datawarehousetable"."created_at" DESC- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.110+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.118'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -5227,7 +5545,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.111+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.119'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -5247,7 +5565,40 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.112+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.12+ '''+ SELECT "posthog_datawarehousetable"."created_by_id",+ "posthog_datawarehousetable"."created_at",+ "posthog_datawarehousetable"."updated_at",+ "posthog_datawarehousetable"."deleted",+ "posthog_datawarehousetable"."deleted_at",+ "posthog_datawarehousetable"."id",+ "posthog_datawarehousetable"."name",+ "posthog_datawarehousetable"."format",+ "posthog_datawarehousetable"."team_id",+ "posthog_datawarehousetable"."url_pattern",+ "posthog_datawarehousetable"."queryable_folder",+ "posthog_datawarehousetable"."credential_id",+ "posthog_datawarehousetable"."external_data_source_id",+ "posthog_datawarehousetable"."created_via",+ "posthog_datawarehousetable"."columns",+ "posthog_datawarehousetable"."column_order",+ "posthog_datawarehousetable"."options",+ "posthog_datawarehousetable"."row_count",+ "posthog_datawarehousetable"."size_in_s3_mib"+ FROM "posthog_datawarehousetable"+ LEFT OUTER JOIN "posthog_externaldatasource" ON ("posthog_datawarehousetable"."external_data_source_id" = "posthog_externaldatasource"."id")+ WHERE ("posthog_datawarehousetable"."team_id" = 99999+ AND NOT ("posthog_datawarehousetable"."deleted"+ AND "posthog_datawarehousetable"."deleted" IS NOT NULL)+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND NOT ("posthog_externaldatasource"."access_method" = 'direct'+ AND "posthog_externaldatasource"."access_method" IS NOT NULL))+ ORDER BY "posthog_datawarehousetable"."created_at" DESC+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.120'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -5266,7 +5617,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.113+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.121'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -5299,7 +5650,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.114+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.122'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -5331,7 +5682,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.115+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.123'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -5346,7 +5697,7 @@'1'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.116+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.124'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -5363,7 +5714,7 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.117+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.125'''SELECT "posthog_user"."id","posthog_user"."password",@@ -5409,7 +5760,7 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.118+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.126'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -5454,7 +5805,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.119+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.127'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -5592,53 +5943,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.12- '''- 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",- "posthog_user"."current_organization_id",- "posthog_user"."current_team_id",- "posthog_user"."email",- "posthog_user"."pending_email",- "posthog_user"."distinct_id",- "posthog_user"."is_email_verified",- "posthog_user"."credentials_reviewed_at",- "posthog_user"."requested_2fa_reset_at",- "posthog_user"."has_seen_product_intro_for",- "posthog_user"."strapi_id",- "posthog_user"."is_active",- "posthog_user"."role_at_organization",- "posthog_user"."theme_mode",- "posthog_user"."partial_notification_settings",- "posthog_user"."anonymize_data",- "posthog_user"."allow_impersonation",- "posthog_user"."toolbar_mode",- "posthog_user"."hedgehog_config",- "posthog_user"."allow_sidebar_suggestions",- "posthog_user"."shortcut_position",- "posthog_user"."passkeys_enabled_for_2fa",- "posthog_user"."hide_mcp_hints",- "posthog_user"."ui_configuration",- "posthog_user"."onboarding_skipped_at",- "posthog_user"."onboarding_skipped_reason",- "posthog_user"."onboarding_skipped_organization_id",- "posthog_user"."onboarding_delegated_to_invite_id",- "posthog_user"."onboarding_delegated_to_organization_id",- "posthog_user"."onboarding_delegation_accepted_at",- "posthog_user"."events_column_config",- "posthog_user"."email_opt_in"- FROM "posthog_user"- WHERE ("posthog_user"."is_active"- AND "posthog_user"."id" = 99999)- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.120+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.128'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -5692,7 +5997,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.121+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.129'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -5715,7 +6020,53 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.122+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.13+ '''+ 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",+ "posthog_user"."current_organization_id",+ "posthog_user"."current_team_id",+ "posthog_user"."email",+ "posthog_user"."pending_email",+ "posthog_user"."distinct_id",+ "posthog_user"."is_email_verified",+ "posthog_user"."credentials_reviewed_at",+ "posthog_user"."requested_2fa_reset_at",+ "posthog_user"."has_seen_product_intro_for",+ "posthog_user"."strapi_id",+ "posthog_user"."is_active",+ "posthog_user"."role_at_organization",+ "posthog_user"."theme_mode",+ "posthog_user"."partial_notification_settings",+ "posthog_user"."anonymize_data",+ "posthog_user"."allow_impersonation",+ "posthog_user"."toolbar_mode",+ "posthog_user"."hedgehog_config",+ "posthog_user"."allow_sidebar_suggestions",+ "posthog_user"."shortcut_position",+ "posthog_user"."passkeys_enabled_for_2fa",+ "posthog_user"."hide_mcp_hints",+ "posthog_user"."ui_configuration",+ "posthog_user"."onboarding_skipped_at",+ "posthog_user"."onboarding_skipped_reason",+ "posthog_user"."onboarding_skipped_organization_id",+ "posthog_user"."onboarding_delegated_to_invite_id",+ "posthog_user"."onboarding_delegated_to_organization_id",+ "posthog_user"."onboarding_delegation_accepted_at",+ "posthog_user"."events_column_config",+ "posthog_user"."email_opt_in"+ FROM "posthog_user"+ WHERE ("posthog_user"."is_active"+ AND "posthog_user"."id" = 99999)+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.130'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -5767,7 +6118,16 @@WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.123+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.131+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.132'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -5821,7 +6181,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.124+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.133'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -5885,7 +6245,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.125+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.134'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -5923,7 +6283,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.126+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.135'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -5943,7 +6303,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.127+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.136'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -5962,7 +6322,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.128+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.137'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -5995,7 +6355,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.129+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.138'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -6028,7 +6388,23 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.13+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.139+ '''+ SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"+ FROM "posthog_sessionrecordingviewed"+ WHERE ("posthog_sessionrecordingviewed"."team_id" = 99999+ AND "posthog_sessionrecordingviewed"."user_id" = 99999+ AND "posthog_sessionrecordingviewed"."session_id" IN ('8',+ '7',+ '6',+ '5',+ '4',+ '3',+ '2',+ '1'))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.14'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -6073,23 +6449,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.130- '''- SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"- FROM "posthog_sessionrecordingviewed"- WHERE ("posthog_sessionrecordingviewed"."team_id" = 99999- AND "posthog_sessionrecordingviewed"."user_id" = 99999- AND "posthog_sessionrecordingviewed"."session_id" IN ('8',- '7',- '6',- '5',- '4',- '3',- '2',- '1'))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.131+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.140'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -6107,7 +6467,7 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.132+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.141'''SELECT "posthog_user"."id","posthog_user"."password",@@ -6153,7 +6513,7 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.133+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.142'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -6198,7 +6558,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.134+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.143'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -6336,7 +6696,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.135+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.144'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -6390,7 +6750,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.136+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.145'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -6413,7 +6773,7 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.137+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.146'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -6465,7 +6825,16 @@WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.138+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.147+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.148'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -6519,7 +6888,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.139+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.149'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -6583,7 +6952,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.14+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.15'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -6721,7 +7090,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.140+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.150'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -6759,7 +7128,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.141+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.151'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -6779,7 +7148,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.142+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.152'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -6798,7 +7167,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.143+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.153'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -6831,7 +7200,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.144+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.154'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -6865,7 +7234,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.145+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.155'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -6882,7 +7251,7 @@'1'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.146+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.156'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -6901,7 +7270,7 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.147+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.157'''SELECT "posthog_user"."id","posthog_user"."password",@@ -6947,7 +7316,7 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.148+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.158'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -6992,7 +7361,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.149+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.159'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -7130,7 +7499,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.15+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.16'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -7184,7 +7553,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.150+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.160'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -7238,7 +7607,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.151+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.161'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -7261,7 +7630,7 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.152+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.162'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -7313,7 +7682,16 @@WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.153+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.163+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.164'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -7367,7 +7745,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.154+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.165'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -7431,7 +7809,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.155+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.166'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -7469,7 +7847,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.156+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.167'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -7489,7 +7867,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.157+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.168'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -7508,7 +7886,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.158+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.169'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -7541,7 +7919,30 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.159+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.17+ '''+ SELECT "ee_accesscontrol"."id",+ "ee_accesscontrol"."team_id",+ "ee_accesscontrol"."access_level",+ "ee_accesscontrol"."resource",+ "ee_accesscontrol"."resource_id",+ "ee_accesscontrol"."organization_member_id",+ "ee_accesscontrol"."role_id",+ "ee_accesscontrol"."created_by_id",+ "ee_accesscontrol"."created_at",+ "ee_accesscontrol"."updated_at"+ FROM "ee_accesscontrol"+ 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"."role_id" IS NULL+ AND "ee_accesscontrol"."team_id" = 99999)+ OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ AND "posthog_organizationmembership"."user_id" = 99999+ AND "ee_accesscontrol"."role_id" IS NULL+ AND "ee_accesscontrol"."team_id" = 99999))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.170'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -7576,30 +7977,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.16- '''- SELECT "ee_accesscontrol"."id",- "ee_accesscontrol"."team_id",- "ee_accesscontrol"."access_level",- "ee_accesscontrol"."resource",- "ee_accesscontrol"."resource_id",- "ee_accesscontrol"."organization_member_id",- "ee_accesscontrol"."role_id",- "ee_accesscontrol"."created_by_id",- "ee_accesscontrol"."created_at",- "ee_accesscontrol"."updated_at"- FROM "ee_accesscontrol"- 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"."role_id" IS NULL- AND "ee_accesscontrol"."team_id" = 99999)- OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid- AND "posthog_organizationmembership"."user_id" = 99999- AND "ee_accesscontrol"."role_id" IS NULL- AND "ee_accesscontrol"."team_id" = 99999))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.160+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.171'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -7617,7 +7995,7 @@'1'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.161+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.172'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -7637,58 +8015,6 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.17- '''- SELECT "posthog_organizationmembership"."id",- "posthog_organizationmembership"."organization_id",- "posthog_organizationmembership"."user_id",- "posthog_organizationmembership"."level",- "posthog_organizationmembership"."joined_at",- "posthog_organizationmembership"."updated_at",- "posthog_organizationmembership"."invited_by_id",- "posthog_organization"."id",- "posthog_organization"."name",- "posthog_organization"."slug",- "posthog_organization"."logo_media_id",- "posthog_organization"."created_at",- "posthog_organization"."updated_at",- "posthog_organization"."is_active",- "posthog_organization"."is_not_active_reason",- "posthog_organization"."session_cookie_age",- "posthog_organization"."is_member_join_email_enabled",- "posthog_organization"."is_ai_data_processing_approved",- "posthog_organization"."is_ai_training_opted_in",- "posthog_organization"."is_ai_training_locked",- "posthog_organization"."is_ai_training_cta_shown",- "posthog_organization"."enforce_2fa",- "posthog_organization"."enforce_verified_domains",- "posthog_organization"."members_can_invite",- "posthog_organization"."members_can_create_projects",- "posthog_organization"."members_can_use_personal_api_keys",- "posthog_organization"."members_can_see_org_members",- "posthog_organization"."uses_most_specific_access_resolution",- "posthog_organization"."allow_publicly_shared_resources",- "posthog_organization"."read_only_mcp_access",- "posthog_organization"."default_role_id",- "posthog_organization"."plugins_access_level",- "posthog_organization"."for_internal_metrics",- "posthog_organization"."default_anonymize_ips",- "posthog_organization"."is_pending_deletion",- "posthog_organization"."customer_id",- "posthog_organization"."available_product_features",- "posthog_organization"."usage",- "posthog_organization"."never_drop_data",- "posthog_organization"."customer_trust_scores",- "posthog_organization"."has_active_subscription",- "posthog_organization"."setup_section_2_completed",- "posthog_organization"."personalization",- "posthog_organization"."domain_whitelist",- "posthog_organization"."is_platform"- FROM "posthog_organizationmembership"- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")- WHERE "posthog_organizationmembership"."user_id" = 99999- '''-# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.18'''SELECT "posthog_organizationmembership"."id",@@ -7738,73 +8064,16 @@"posthog_organization"."is_platform"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+ WHERE "posthog_organizationmembership"."user_id" = 99999'''# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.19'''- SELECT "posthog_datawarehousesavedquery"."created_by_id",- "posthog_datawarehousesavedquery"."created_at",- "posthog_datawarehousesavedquery"."updated_at",- "posthog_datawarehousesavedquery"."deleted",- "posthog_datawarehousesavedquery"."deleted_at",- "posthog_datawarehousesavedquery"."id",- "posthog_datawarehousesavedquery"."name",- "posthog_datawarehousesavedquery"."team_id",- "posthog_datawarehousesavedquery"."latest_error",- "posthog_datawarehousesavedquery"."columns",- "posthog_datawarehousesavedquery"."column_order",- "posthog_datawarehousesavedquery"."external_tables",- "posthog_datawarehousesavedquery"."query",- "posthog_datawarehousesavedquery"."query_revision",- "posthog_datawarehousesavedquery"."status",- "posthog_datawarehousesavedquery"."last_run_at",- "posthog_datawarehousesavedquery"."sync_frequency_interval",- "posthog_datawarehousesavedquery"."table_id",- "posthog_datawarehousesavedquery"."is_materialized",- "posthog_datawarehousesavedquery"."deleted_name",- "posthog_datawarehousesavedquery"."managed_viewset_id",- "posthog_datawarehousesavedquery"."folder_id",- "posthog_datawarehousesavedquery"."origin",- "posthog_datawarehousesavedquery"."is_test",- "posthog_datawarehousesavedquery"."expires_at",- "posthog_datawarehousesavedquery"."semantic_enrichment_hash",- "posthog_datawarehousesavedquery"."incremental_config",- "posthog_datawarehousesavedquery"."incremental_state",- "posthog_datawarehousetable"."created_by_id",- "posthog_datawarehousetable"."created_at",- "posthog_datawarehousetable"."updated_at",- "posthog_datawarehousetable"."deleted",- "posthog_datawarehousetable"."deleted_at",- "posthog_datawarehousetable"."id",- "posthog_datawarehousetable"."name",- "posthog_datawarehousetable"."format",- "posthog_datawarehousetable"."team_id",- "posthog_datawarehousetable"."url_pattern",- "posthog_datawarehousetable"."queryable_folder",- "posthog_datawarehousetable"."credential_id",- "posthog_datawarehousetable"."external_data_source_id",- "posthog_datawarehousetable"."created_via",- "posthog_datawarehousetable"."columns",- "posthog_datawarehousetable"."column_order",- "posthog_datawarehousetable"."options",- "posthog_datawarehousetable"."row_count",- "posthog_datawarehousetable"."size_in_s3_mib",- "posthog_datawarehousemanagedviewset"."created_by_id",- "posthog_datawarehousemanagedviewset"."created_at",- "posthog_datawarehousemanagedviewset"."updated_at",- "posthog_datawarehousemanagedviewset"."id",- "posthog_datawarehousemanagedviewset"."team_id",- "posthog_datawarehousemanagedviewset"."kind"- FROM "posthog_datawarehousesavedquery"- LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")- LEFT OUTER JOIN "posthog_datawarehousemanagedviewset" ON ("posthog_datawarehousesavedquery"."managed_viewset_id" = "posthog_datawarehousemanagedviewset"."id")- WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999- AND NOT ("posthog_datawarehousesavedquery"."deleted"- AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL))- ORDER BY "posthog_datawarehousesavedquery"."name" ASC+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1'''# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.2@@ -7939,13 +8208,131 @@"posthog_organization"."personalization","posthog_organization"."domain_whitelist","posthog_organization"."is_platform"- FROM "posthog_team"- INNER JOIN "posthog_organization" ON ("posthog_team"."organization_id" = "posthog_organization"."id")- WHERE "posthog_team"."id" = 99999+ FROM "posthog_team"+ INNER JOIN "posthog_organization" ON ("posthog_team"."organization_id" = "posthog_organization"."id")+ WHERE "posthog_team"."id" = 99999+ LIMIT 21+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.20+ '''+ SELECT "posthog_organizationmembership"."id",+ "posthog_organizationmembership"."organization_id",+ "posthog_organizationmembership"."user_id",+ "posthog_organizationmembership"."level",+ "posthog_organizationmembership"."joined_at",+ "posthog_organizationmembership"."updated_at",+ "posthog_organizationmembership"."invited_by_id",+ "posthog_organization"."id",+ "posthog_organization"."name",+ "posthog_organization"."slug",+ "posthog_organization"."logo_media_id",+ "posthog_organization"."created_at",+ "posthog_organization"."updated_at",+ "posthog_organization"."is_active",+ "posthog_organization"."is_not_active_reason",+ "posthog_organization"."session_cookie_age",+ "posthog_organization"."is_member_join_email_enabled",+ "posthog_organization"."is_ai_data_processing_approved",+ "posthog_organization"."is_ai_training_opted_in",+ "posthog_organization"."is_ai_training_locked",+ "posthog_organization"."is_ai_training_cta_shown",+ "posthog_organization"."enforce_2fa",+ "posthog_organization"."enforce_verified_domains",+ "posthog_organization"."members_can_invite",+ "posthog_organization"."members_can_create_projects",+ "posthog_organization"."members_can_use_personal_api_keys",+ "posthog_organization"."members_can_see_org_members",+ "posthog_organization"."uses_most_specific_access_resolution",+ "posthog_organization"."allow_publicly_shared_resources",+ "posthog_organization"."read_only_mcp_access",+ "posthog_organization"."default_role_id",+ "posthog_organization"."plugins_access_level",+ "posthog_organization"."for_internal_metrics",+ "posthog_organization"."default_anonymize_ips",+ "posthog_organization"."is_pending_deletion",+ "posthog_organization"."customer_id",+ "posthog_organization"."available_product_features",+ "posthog_organization"."usage",+ "posthog_organization"."never_drop_data",+ "posthog_organization"."customer_trust_scores",+ "posthog_organization"."has_active_subscription",+ "posthog_organization"."setup_section_2_completed",+ "posthog_organization"."personalization",+ "posthog_organization"."domain_whitelist",+ "posthog_organization"."is_platform"+ 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: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.20+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.21+ '''+ SELECT "posthog_datawarehousesavedquery"."created_by_id",+ "posthog_datawarehousesavedquery"."created_at",+ "posthog_datawarehousesavedquery"."updated_at",+ "posthog_datawarehousesavedquery"."deleted",+ "posthog_datawarehousesavedquery"."deleted_at",+ "posthog_datawarehousesavedquery"."id",+ "posthog_datawarehousesavedquery"."name",+ "posthog_datawarehousesavedquery"."team_id",+ "posthog_datawarehousesavedquery"."latest_error",+ "posthog_datawarehousesavedquery"."columns",+ "posthog_datawarehousesavedquery"."column_order",+ "posthog_datawarehousesavedquery"."external_tables",+ "posthog_datawarehousesavedquery"."query",+ "posthog_datawarehousesavedquery"."query_revision",+ "posthog_datawarehousesavedquery"."status",+ "posthog_datawarehousesavedquery"."last_run_at",+ "posthog_datawarehousesavedquery"."sync_frequency_interval",+ "posthog_datawarehousesavedquery"."table_id",+ "posthog_datawarehousesavedquery"."is_materialized",+ "posthog_datawarehousesavedquery"."deleted_name",+ "posthog_datawarehousesavedquery"."managed_viewset_id",+ "posthog_datawarehousesavedquery"."folder_id",+ "posthog_datawarehousesavedquery"."origin",+ "posthog_datawarehousesavedquery"."is_test",+ "posthog_datawarehousesavedquery"."expires_at",+ "posthog_datawarehousesavedquery"."semantic_enrichment_hash",+ "posthog_datawarehousesavedquery"."incremental_config",+ "posthog_datawarehousesavedquery"."incremental_state",+ "posthog_datawarehousetable"."created_by_id",+ "posthog_datawarehousetable"."created_at",+ "posthog_datawarehousetable"."updated_at",+ "posthog_datawarehousetable"."deleted",+ "posthog_datawarehousetable"."deleted_at",+ "posthog_datawarehousetable"."id",+ "posthog_datawarehousetable"."name",+ "posthog_datawarehousetable"."format",+ "posthog_datawarehousetable"."team_id",+ "posthog_datawarehousetable"."url_pattern",+ "posthog_datawarehousetable"."queryable_folder",+ "posthog_datawarehousetable"."credential_id",+ "posthog_datawarehousetable"."external_data_source_id",+ "posthog_datawarehousetable"."created_via",+ "posthog_datawarehousetable"."columns",+ "posthog_datawarehousetable"."column_order",+ "posthog_datawarehousetable"."options",+ "posthog_datawarehousetable"."row_count",+ "posthog_datawarehousetable"."size_in_s3_mib",+ "posthog_datawarehousemanagedviewset"."created_by_id",+ "posthog_datawarehousemanagedviewset"."created_at",+ "posthog_datawarehousemanagedviewset"."updated_at",+ "posthog_datawarehousemanagedviewset"."id",+ "posthog_datawarehousemanagedviewset"."team_id",+ "posthog_datawarehousemanagedviewset"."kind"+ FROM "posthog_datawarehousesavedquery"+ LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")+ LEFT OUTER JOIN "posthog_datawarehousemanagedviewset" ON ("posthog_datawarehousesavedquery"."managed_viewset_id" = "posthog_datawarehousemanagedviewset"."id")+ WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999+ AND NOT ("posthog_datawarehousesavedquery"."deleted"+ AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL))+ ORDER BY "posthog_datawarehousesavedquery"."name" ASC+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.22'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -7983,7 +8370,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.21+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.23'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -8003,7 +8390,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.22+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.24'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -8022,7 +8409,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.23+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.25'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -8055,7 +8442,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.24+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.26'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -8081,7 +8468,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.25+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.27'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -8090,7 +8477,7 @@AND "posthog_sessionrecordingviewed"."session_id" IN ('1'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.26+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.28'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -8101,7 +8488,7 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.27+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.29'''SELECT "posthog_user"."id","posthog_user"."password",@@ -8147,7 +8534,61 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.28+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.3+ '''+ SELECT "posthog_organizationmembership"."id",+ "posthog_organizationmembership"."organization_id",+ "posthog_organizationmembership"."user_id",+ "posthog_organizationmembership"."level",+ "posthog_organizationmembership"."joined_at",+ "posthog_organizationmembership"."updated_at",+ "posthog_organizationmembership"."invited_by_id",+ "posthog_organization"."id",+ "posthog_organization"."name",+ "posthog_organization"."slug",+ "posthog_organization"."logo_media_id",+ "posthog_organization"."created_at",+ "posthog_organization"."updated_at",+ "posthog_organization"."is_active",+ "posthog_organization"."is_not_active_reason",+ "posthog_organization"."session_cookie_age",+ "posthog_organization"."is_member_join_email_enabled",+ "posthog_organization"."is_ai_data_processing_approved",+ "posthog_organization"."is_ai_training_opted_in",+ "posthog_organization"."is_ai_training_locked",+ "posthog_organization"."is_ai_training_cta_shown",+ "posthog_organization"."enforce_2fa",+ "posthog_organization"."enforce_verified_domains",+ "posthog_organization"."members_can_invite",+ "posthog_organization"."members_can_create_projects",+ "posthog_organization"."members_can_use_personal_api_keys",+ "posthog_organization"."members_can_see_org_members",+ "posthog_organization"."uses_most_specific_access_resolution",+ "posthog_organization"."allow_publicly_shared_resources",+ "posthog_organization"."read_only_mcp_access",+ "posthog_organization"."default_role_id",+ "posthog_organization"."plugins_access_level",+ "posthog_organization"."for_internal_metrics",+ "posthog_organization"."default_anonymize_ips",+ "posthog_organization"."is_pending_deletion",+ "posthog_organization"."customer_id",+ "posthog_organization"."available_product_features",+ "posthog_organization"."usage",+ "posthog_organization"."never_drop_data",+ "posthog_organization"."customer_trust_scores",+ "posthog_organization"."has_active_subscription",+ "posthog_organization"."setup_section_2_completed",+ "posthog_organization"."personalization",+ "posthog_organization"."domain_whitelist",+ "posthog_organization"."is_platform"+ 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: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.30'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -8192,7 +8633,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.29+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.31'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -8244,101 +8685,48 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",- "posthog_team"."llm_gateway_enabled_at",- "posthog_team"."llm_gateway_revoked_at",- "posthog_team"."llm_gateway_overspend_allowance_usd",- "posthog_team"."heatmaps_opt_in",- "posthog_team"."receive_org_level_activity_logs",- "posthog_team"."web_analytics_pre_aggregated_tables_enabled",- "posthog_team"."web_analytics_pre_aggregated_tables_version",- "posthog_team"."flags_persistence_default",- "posthog_team"."feature_flag_confirmation_enabled",- "posthog_team"."feature_flag_confirmation_message",- "posthog_team"."default_evaluation_environments_enabled",- "posthog_team"."require_evaluation_environment_tags",- "posthog_team"."default_evaluation_contexts_enabled",- "posthog_team"."require_evaluation_contexts",- "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"."human_friendly_comparison_periods",- "posthog_team"."cookieless_server_hash_mode",- "posthog_team"."primary_dashboard_id",- "posthog_team"."default_data_theme",- "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"."api_query_rate_limit",- "posthog_team"."drop_events_older_than",- "posthog_team"."base_currency",- "posthog_team"."business_model",- "posthog_organization"."id",- "posthog_organization"."name",- "posthog_organization"."slug",- "posthog_organization"."logo_media_id",- "posthog_organization"."created_at",- "posthog_organization"."updated_at",- "posthog_organization"."is_active",- "posthog_organization"."is_not_active_reason",- "posthog_organization"."session_cookie_age",- "posthog_organization"."is_member_join_email_enabled",- "posthog_organization"."is_ai_data_processing_approved",- "posthog_organization"."is_ai_training_opted_in",- "posthog_organization"."is_ai_training_locked",- "posthog_organization"."is_ai_training_cta_shown",- "posthog_organization"."enforce_2fa",- "posthog_organization"."enforce_verified_domains",- "posthog_organization"."members_can_invite",- "posthog_organization"."members_can_create_projects",- "posthog_organization"."members_can_use_personal_api_keys",- "posthog_organization"."members_can_see_org_members",- "posthog_organization"."uses_most_specific_access_resolution",- "posthog_organization"."allow_publicly_shared_resources",- "posthog_organization"."read_only_mcp_access",- "posthog_organization"."default_role_id",- "posthog_organization"."plugins_access_level",- "posthog_organization"."for_internal_metrics",- "posthog_organization"."default_anonymize_ips",- "posthog_organization"."is_pending_deletion",- "posthog_organization"."customer_id",- "posthog_organization"."available_product_features",- "posthog_organization"."usage",- "posthog_organization"."never_drop_data",- "posthog_organization"."customer_trust_scores",- "posthog_organization"."has_active_subscription",- "posthog_organization"."setup_section_2_completed",- "posthog_organization"."personalization",- "posthog_organization"."domain_whitelist",- "posthog_organization"."is_platform"- FROM "posthog_team"- INNER JOIN "posthog_organization" ON ("posthog_team"."organization_id" = "posthog_organization"."id")- WHERE "posthog_team"."id" = 99999- LIMIT 21- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.3- '''- SELECT "posthog_organizationmembership"."id",- "posthog_organizationmembership"."organization_id",- "posthog_organizationmembership"."user_id",- "posthog_organizationmembership"."level",- "posthog_organizationmembership"."joined_at",- "posthog_organizationmembership"."updated_at",- "posthog_organizationmembership"."invited_by_id",+ "posthog_team"."llm_gateway_enabled_at",+ "posthog_team"."llm_gateway_revoked_at",+ "posthog_team"."llm_gateway_overspend_allowance_usd",+ "posthog_team"."heatmaps_opt_in",+ "posthog_team"."receive_org_level_activity_logs",+ "posthog_team"."web_analytics_pre_aggregated_tables_enabled",+ "posthog_team"."web_analytics_pre_aggregated_tables_version",+ "posthog_team"."flags_persistence_default",+ "posthog_team"."feature_flag_confirmation_enabled",+ "posthog_team"."feature_flag_confirmation_message",+ "posthog_team"."default_evaluation_environments_enabled",+ "posthog_team"."require_evaluation_environment_tags",+ "posthog_team"."default_evaluation_contexts_enabled",+ "posthog_team"."require_evaluation_contexts",+ "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"."human_friendly_comparison_periods",+ "posthog_team"."cookieless_server_hash_mode",+ "posthog_team"."primary_dashboard_id",+ "posthog_team"."default_data_theme",+ "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"."api_query_rate_limit",+ "posthog_team"."drop_events_older_than",+ "posthog_team"."base_currency",+ "posthog_team"."business_model","posthog_organization"."id","posthog_organization"."name","posthog_organization"."slug",@@ -8377,14 +8765,13 @@"posthog_organization"."personalization","posthog_organization"."domain_whitelist","posthog_organization"."is_platform"- 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)+ FROM "posthog_team"+ INNER JOIN "posthog_organization" ON ("posthog_team"."organization_id" = "posthog_organization"."id")+ WHERE "posthog_team"."id" = 99999LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.30+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.32'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -8438,7 +8825,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.31+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.33'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -8461,7 +8848,7 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.32+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.34'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -8513,7 +8900,16 @@WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.33+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.35+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.36'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -8567,7 +8963,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.34+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.37'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -8631,7 +9027,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.35+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.38'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -8669,7 +9065,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.36+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.39'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -8689,7 +9085,30 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.37+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.4+ '''+ SELECT "ee_accesscontrol"."id",+ "ee_accesscontrol"."team_id",+ "ee_accesscontrol"."access_level",+ "ee_accesscontrol"."resource",+ "ee_accesscontrol"."resource_id",+ "ee_accesscontrol"."organization_member_id",+ "ee_accesscontrol"."role_id",+ "ee_accesscontrol"."created_by_id",+ "ee_accesscontrol"."created_at",+ "ee_accesscontrol"."updated_at"+ FROM "ee_accesscontrol"+ 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"."role_id" IS NULL+ AND "ee_accesscontrol"."team_id" = 99999)+ OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ AND "posthog_organizationmembership"."user_id" = 99999+ AND "ee_accesscontrol"."role_id" IS NULL+ AND "ee_accesscontrol"."team_id" = 99999))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.40'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -8708,7 +9127,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.38+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.41'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -8741,7 +9160,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.39+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.42'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -8768,30 +9187,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.4- '''- SELECT "ee_accesscontrol"."id",- "ee_accesscontrol"."team_id",- "ee_accesscontrol"."access_level",- "ee_accesscontrol"."resource",- "ee_accesscontrol"."resource_id",- "ee_accesscontrol"."organization_member_id",- "ee_accesscontrol"."role_id",- "ee_accesscontrol"."created_by_id",- "ee_accesscontrol"."created_at",- "ee_accesscontrol"."updated_at"- FROM "ee_accesscontrol"- 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"."role_id" IS NULL- AND "ee_accesscontrol"."team_id" = 99999)- OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid- AND "posthog_organizationmembership"."user_id" = 99999- AND "ee_accesscontrol"."role_id" IS NULL- AND "ee_accesscontrol"."team_id" = 99999))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.40+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.43'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -8801,7 +9197,7 @@'1'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.41+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.44'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -8813,7 +9209,7 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.42+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.45'''SELECT "posthog_user"."id","posthog_user"."password",@@ -8859,7 +9255,7 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.43+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.46'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -8904,7 +9300,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.44+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.47'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -9042,7 +9438,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.45+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.48'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -9096,7 +9492,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.46+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.49'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -9119,7 +9515,7 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.47+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.5'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -9171,7 +9567,68 @@WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.48+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.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_organizationmembership"."invited_by_id",+ "posthog_organization"."id",+ "posthog_organization"."name",+ "posthog_organization"."slug",+ "posthog_organization"."logo_media_id",+ "posthog_organization"."created_at",+ "posthog_organization"."updated_at",+ "posthog_organization"."is_active",+ "posthog_organization"."is_not_active_reason",+ "posthog_organization"."session_cookie_age",+ "posthog_organization"."is_member_join_email_enabled",+ "posthog_organization"."is_ai_data_processing_approved",+ "posthog_organization"."is_ai_training_opted_in",+ "posthog_organization"."is_ai_training_locked",+ "posthog_organization"."is_ai_training_cta_shown",+ "posthog_organization"."enforce_2fa",+ "posthog_organization"."enforce_verified_domains",+ "posthog_organization"."members_can_invite",+ "posthog_organization"."members_can_create_projects",+ "posthog_organization"."members_can_use_personal_api_keys",+ "posthog_organization"."members_can_see_org_members",+ "posthog_organization"."uses_most_specific_access_resolution",+ "posthog_organization"."allow_publicly_shared_resources",+ "posthog_organization"."read_only_mcp_access",+ "posthog_organization"."default_role_id",+ "posthog_organization"."plugins_access_level",+ "posthog_organization"."for_internal_metrics",+ "posthog_organization"."default_anonymize_ips",+ "posthog_organization"."is_pending_deletion",+ "posthog_organization"."customer_id",+ "posthog_organization"."available_product_features",+ "posthog_organization"."usage",+ "posthog_organization"."never_drop_data",+ "posthog_organization"."customer_trust_scores",+ "posthog_organization"."has_active_subscription",+ "posthog_organization"."setup_section_2_completed",+ "posthog_organization"."personalization",+ "posthog_organization"."domain_whitelist",+ "posthog_organization"."is_platform"+ FROM "posthog_organizationmembership"+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")+ WHERE "posthog_organizationmembership"."user_id" = 99999+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.51+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.52'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -9225,7 +9682,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.49+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.53'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -9289,59 +9746,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.5- '''- SELECT "posthog_organizationmembership"."id",- "posthog_organizationmembership"."organization_id",- "posthog_organizationmembership"."user_id",- "posthog_organizationmembership"."level",- "posthog_organizationmembership"."joined_at",- "posthog_organizationmembership"."updated_at",- "posthog_organizationmembership"."invited_by_id",- "posthog_organization"."id",- "posthog_organization"."name",- "posthog_organization"."slug",- "posthog_organization"."logo_media_id",- "posthog_organization"."created_at",- "posthog_organization"."updated_at",- "posthog_organization"."is_active",- "posthog_organization"."is_not_active_reason",- "posthog_organization"."session_cookie_age",- "posthog_organization"."is_member_join_email_enabled",- "posthog_organization"."is_ai_data_processing_approved",- "posthog_organization"."is_ai_training_opted_in",- "posthog_organization"."is_ai_training_locked",- "posthog_organization"."is_ai_training_cta_shown",- "posthog_organization"."enforce_2fa",- "posthog_organization"."enforce_verified_domains",- "posthog_organization"."members_can_invite",- "posthog_organization"."members_can_create_projects",- "posthog_organization"."members_can_use_personal_api_keys",- "posthog_organization"."members_can_see_org_members",- "posthog_organization"."uses_most_specific_access_resolution",- "posthog_organization"."allow_publicly_shared_resources",- "posthog_organization"."read_only_mcp_access",- "posthog_organization"."default_role_id",- "posthog_organization"."plugins_access_level",- "posthog_organization"."for_internal_metrics",- "posthog_organization"."default_anonymize_ips",- "posthog_organization"."is_pending_deletion",- "posthog_organization"."customer_id",- "posthog_organization"."available_product_features",- "posthog_organization"."usage",- "posthog_organization"."never_drop_data",- "posthog_organization"."customer_trust_scores",- "posthog_organization"."has_active_subscription",- "posthog_organization"."setup_section_2_completed",- "posthog_organization"."personalization",- "posthog_organization"."domain_whitelist",- "posthog_organization"."is_platform"- FROM "posthog_organizationmembership"- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")- WHERE "posthog_organizationmembership"."user_id" = 99999- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.50+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.54'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -9379,7 +9784,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.51+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.55'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -9399,7 +9804,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.52+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.56'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -9418,7 +9823,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.53+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.57'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -9451,7 +9856,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.54+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.58'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -9479,7 +9884,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.55+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.59'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -9490,7 +9895,16 @@'1'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.56+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.6+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.60'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -9503,7 +9917,7 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.57+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.61'''SELECT "posthog_user"."id","posthog_user"."password",@@ -9549,7 +9963,7 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.58+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.62'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -9594,7 +10008,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.59+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.63'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -9732,61 +10146,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.6- '''- SELECT "posthog_organizationmembership"."id",- "posthog_organizationmembership"."organization_id",- "posthog_organizationmembership"."user_id",- "posthog_organizationmembership"."level",- "posthog_organizationmembership"."joined_at",- "posthog_organizationmembership"."updated_at",- "posthog_organizationmembership"."invited_by_id",- "posthog_organization"."id",- "posthog_organization"."name",- "posthog_organization"."slug",- "posthog_organization"."logo_media_id",- "posthog_organization"."created_at",- "posthog_organization"."updated_at",- "posthog_organization"."is_active",- "posthog_organization"."is_not_active_reason",- "posthog_organization"."session_cookie_age",- "posthog_organization"."is_member_join_email_enabled",- "posthog_organization"."is_ai_data_processing_approved",- "posthog_organization"."is_ai_training_opted_in",- "posthog_organization"."is_ai_training_locked",- "posthog_organization"."is_ai_training_cta_shown",- "posthog_organization"."enforce_2fa",- "posthog_organization"."enforce_verified_domains",- "posthog_organization"."members_can_invite",- "posthog_organization"."members_can_create_projects",- "posthog_organization"."members_can_use_personal_api_keys",- "posthog_organization"."members_can_see_org_members",- "posthog_organization"."uses_most_specific_access_resolution",- "posthog_organization"."allow_publicly_shared_resources",- "posthog_organization"."read_only_mcp_access",- "posthog_organization"."default_role_id",- "posthog_organization"."plugins_access_level",- "posthog_organization"."for_internal_metrics",- "posthog_organization"."default_anonymize_ips",- "posthog_organization"."is_pending_deletion",- "posthog_organization"."customer_id",- "posthog_organization"."available_product_features",- "posthog_organization"."usage",- "posthog_organization"."never_drop_data",- "posthog_organization"."customer_trust_scores",- "posthog_organization"."has_active_subscription",- "posthog_organization"."setup_section_2_completed",- "posthog_organization"."personalization",- "posthog_organization"."domain_whitelist",- "posthog_organization"."is_platform"- 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: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.60+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.64'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -9840,7 +10200,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.61+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.65'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -9863,7 +10223,7 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.62+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.66'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -9915,7 +10275,16 @@WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.63+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.67+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.68'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -9969,7 +10338,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.64+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.69'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -10033,7 +10402,61 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.65+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.7+ '''+ SELECT "posthog_organizationmembership"."id",+ "posthog_organizationmembership"."organization_id",+ "posthog_organizationmembership"."user_id",+ "posthog_organizationmembership"."level",+ "posthog_organizationmembership"."joined_at",+ "posthog_organizationmembership"."updated_at",+ "posthog_organizationmembership"."invited_by_id",+ "posthog_organization"."id",+ "posthog_organization"."name",+ "posthog_organization"."slug",+ "posthog_organization"."logo_media_id",+ "posthog_organization"."created_at",+ "posthog_organization"."updated_at",+ "posthog_organization"."is_active",+ "posthog_organization"."is_not_active_reason",+ "posthog_organization"."session_cookie_age",+ "posthog_organization"."is_member_join_email_enabled",+ "posthog_organization"."is_ai_data_processing_approved",+ "posthog_organization"."is_ai_training_opted_in",+ "posthog_organization"."is_ai_training_locked",+ "posthog_organization"."is_ai_training_cta_shown",+ "posthog_organization"."enforce_2fa",+ "posthog_organization"."enforce_verified_domains",+ "posthog_organization"."members_can_invite",+ "posthog_organization"."members_can_create_projects",+ "posthog_organization"."members_can_use_personal_api_keys",+ "posthog_organization"."members_can_see_org_members",+ "posthog_organization"."uses_most_specific_access_resolution",+ "posthog_organization"."allow_publicly_shared_resources",+ "posthog_organization"."read_only_mcp_access",+ "posthog_organization"."default_role_id",+ "posthog_organization"."plugins_access_level",+ "posthog_organization"."for_internal_metrics",+ "posthog_organization"."default_anonymize_ips",+ "posthog_organization"."is_pending_deletion",+ "posthog_organization"."customer_id",+ "posthog_organization"."available_product_features",+ "posthog_organization"."usage",+ "posthog_organization"."never_drop_data",+ "posthog_organization"."customer_trust_scores",+ "posthog_organization"."has_active_subscription",+ "posthog_organization"."setup_section_2_completed",+ "posthog_organization"."personalization",+ "posthog_organization"."domain_whitelist",+ "posthog_organization"."is_platform"+ 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: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.70'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -10071,7 +10494,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.66+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.71'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -10091,7 +10514,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.67+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.72'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -10110,7 +10533,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.68+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.73'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -10143,7 +10566,7 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.69+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.74'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -10172,71 +10595,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.7- '''- SELECT "posthog_datawarehousesavedquery"."created_by_id",- "posthog_datawarehousesavedquery"."created_at",- "posthog_datawarehousesavedquery"."updated_at",- "posthog_datawarehousesavedquery"."deleted",- "posthog_datawarehousesavedquery"."deleted_at",- "posthog_datawarehousesavedquery"."id",- "posthog_datawarehousesavedquery"."name",- "posthog_datawarehousesavedquery"."team_id",- "posthog_datawarehousesavedquery"."latest_error",- "posthog_datawarehousesavedquery"."columns",- "posthog_datawarehousesavedquery"."column_order",- "posthog_datawarehousesavedquery"."external_tables",- "posthog_datawarehousesavedquery"."query",- "posthog_datawarehousesavedquery"."query_revision",- "posthog_datawarehousesavedquery"."status",- "posthog_datawarehousesavedquery"."last_run_at",- "posthog_datawarehousesavedquery"."sync_frequency_interval",- "posthog_datawarehousesavedquery"."table_id",- "posthog_datawarehousesavedquery"."is_materialized",- "posthog_datawarehousesavedquery"."deleted_name",- "posthog_datawarehousesavedquery"."managed_viewset_id",- "posthog_datawarehousesavedquery"."folder_id",- "posthog_datawarehousesavedquery"."origin",- "posthog_datawarehousesavedquery"."is_test",- "posthog_datawarehousesavedquery"."expires_at",- "posthog_datawarehousesavedquery"."semantic_enrichment_hash",- "posthog_datawarehousesavedquery"."incremental_config",- "posthog_datawarehousesavedquery"."incremental_state",- "posthog_datawarehousetable"."created_by_id",- "posthog_datawarehousetable"."created_at",- "posthog_datawarehousetable"."updated_at",- "posthog_datawarehousetable"."deleted",- "posthog_datawarehousetable"."deleted_at",- "posthog_datawarehousetable"."id",- "posthog_datawarehousetable"."name",- "posthog_datawarehousetable"."format",- "posthog_datawarehousetable"."team_id",- "posthog_datawarehousetable"."url_pattern",- "posthog_datawarehousetable"."queryable_folder",- "posthog_datawarehousetable"."credential_id",- "posthog_datawarehousetable"."external_data_source_id",- "posthog_datawarehousetable"."created_via",- "posthog_datawarehousetable"."columns",- "posthog_datawarehousetable"."column_order",- "posthog_datawarehousetable"."options",- "posthog_datawarehousetable"."row_count",- "posthog_datawarehousetable"."size_in_s3_mib",- "posthog_datawarehousemanagedviewset"."created_by_id",- "posthog_datawarehousemanagedviewset"."created_at",- "posthog_datawarehousemanagedviewset"."updated_at",- "posthog_datawarehousemanagedviewset"."id",- "posthog_datawarehousemanagedviewset"."team_id",- "posthog_datawarehousemanagedviewset"."kind"- FROM "posthog_datawarehousesavedquery"- LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")- LEFT OUTER JOIN "posthog_datawarehousemanagedviewset" ON ("posthog_datawarehousesavedquery"."managed_viewset_id" = "posthog_datawarehousemanagedviewset"."id")- WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999- AND NOT ("posthog_datawarehousesavedquery"."deleted"- AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL))- ORDER BY "posthog_datawarehousesavedquery"."name" ASC- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.70+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.75'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -10248,7 +10607,7 @@'1'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.71+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.76'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -10262,7 +10621,7 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.72+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.77'''SELECT "posthog_user"."id","posthog_user"."password",@@ -10308,7 +10667,7 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.73+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.78'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -10353,7 +10712,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.74+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.79'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -10491,7 +10850,71 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.75+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.8+ '''+ SELECT "posthog_datawarehousesavedquery"."created_by_id",+ "posthog_datawarehousesavedquery"."created_at",+ "posthog_datawarehousesavedquery"."updated_at",+ "posthog_datawarehousesavedquery"."deleted",+ "posthog_datawarehousesavedquery"."deleted_at",+ "posthog_datawarehousesavedquery"."id",+ "posthog_datawarehousesavedquery"."name",+ "posthog_datawarehousesavedquery"."team_id",+ "posthog_datawarehousesavedquery"."latest_error",+ "posthog_datawarehousesavedquery"."columns",+ "posthog_datawarehousesavedquery"."column_order",+ "posthog_datawarehousesavedquery"."external_tables",+ "posthog_datawarehousesavedquery"."query",+ "posthog_datawarehousesavedquery"."query_revision",+ "posthog_datawarehousesavedquery"."status",+ "posthog_datawarehousesavedquery"."last_run_at",+ "posthog_datawarehousesavedquery"."sync_frequency_interval",+ "posthog_datawarehousesavedquery"."table_id",+ "posthog_datawarehousesavedquery"."is_materialized",+ "posthog_datawarehousesavedquery"."deleted_name",+ "posthog_datawarehousesavedquery"."managed_viewset_id",+ "posthog_datawarehousesavedquery"."folder_id",+ "posthog_datawarehousesavedquery"."origin",+ "posthog_datawarehousesavedquery"."is_test",+ "posthog_datawarehousesavedquery"."expires_at",+ "posthog_datawarehousesavedquery"."semantic_enrichment_hash",+ "posthog_datawarehousesavedquery"."incremental_config",+ "posthog_datawarehousesavedquery"."incremental_state",+ "posthog_datawarehousetable"."created_by_id",+ "posthog_datawarehousetable"."created_at",+ "posthog_datawarehousetable"."updated_at",+ "posthog_datawarehousetable"."deleted",+ "posthog_datawarehousetable"."deleted_at",+ "posthog_datawarehousetable"."id",+ "posthog_datawarehousetable"."name",+ "posthog_datawarehousetable"."format",+ "posthog_datawarehousetable"."team_id",+ "posthog_datawarehousetable"."url_pattern",+ "posthog_datawarehousetable"."queryable_folder",+ "posthog_datawarehousetable"."credential_id",+ "posthog_datawarehousetable"."external_data_source_id",+ "posthog_datawarehousetable"."created_via",+ "posthog_datawarehousetable"."columns",+ "posthog_datawarehousetable"."column_order",+ "posthog_datawarehousetable"."options",+ "posthog_datawarehousetable"."row_count",+ "posthog_datawarehousetable"."size_in_s3_mib",+ "posthog_datawarehousemanagedviewset"."created_by_id",+ "posthog_datawarehousemanagedviewset"."created_at",+ "posthog_datawarehousemanagedviewset"."updated_at",+ "posthog_datawarehousemanagedviewset"."id",+ "posthog_datawarehousemanagedviewset"."team_id",+ "posthog_datawarehousemanagedviewset"."kind"+ FROM "posthog_datawarehousesavedquery"+ LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")+ LEFT OUTER JOIN "posthog_datawarehousemanagedviewset" ON ("posthog_datawarehousesavedquery"."managed_viewset_id" = "posthog_datawarehousemanagedviewset"."id")+ WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999+ AND NOT ("posthog_datawarehousesavedquery"."deleted"+ AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL))+ ORDER BY "posthog_datawarehousesavedquery"."name" ASC+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.80'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -10545,7 +10968,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.76+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.81'''SELECT "ee_accesscontrol"."id","ee_accesscontrol"."team_id",@@ -10568,7 +10991,7 @@AND "ee_accesscontrol"."team_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.77+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.82'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -10620,7 +11043,16 @@WHERE "posthog_organizationmembership"."user_id" = 99999'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.78+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.83+ '''+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.84'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -10674,7 +11106,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.79+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.85'''SELECT "posthog_datawarehousesavedquery"."created_by_id","posthog_datawarehousesavedquery"."created_at",@@ -10738,45 +11170,7 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.8- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.80+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.86'''SELECT "posthog_externaldatasource"."created_by_id","posthog_externaldatasource"."created_at",@@ -10814,7 +11208,7 @@AND "posthog_externaldatasource"."source_type" IN ('Stripe'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.81+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.87'''SELECT "posthog_datawarehousejoin"."created_by_id","posthog_datawarehousejoin"."created_at",@@ -10834,7 +11228,7 @@AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.82+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.88'''SELECT "data_tools_datawarehouseexpression"."deleted","data_tools_datawarehouseexpression"."deleted_at",@@ -10853,7 +11247,7 @@AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.83+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.89'''SELECT "posthog_datawarehousetable"."created_by_id","posthog_datawarehousetable"."created_at",@@ -10886,7 +11280,45 @@ORDER BY "posthog_datawarehousetable"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.84+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.9+ '''+ SELECT "posthog_externaldatasource"."created_by_id",+ "posthog_externaldatasource"."created_at",+ "posthog_externaldatasource"."updated_at",+ "posthog_externaldatasource"."deleted",+ "posthog_externaldatasource"."deleted_at",+ "posthog_externaldatasource"."id",+ "posthog_externaldatasource"."source_id",+ "posthog_externaldatasource"."connection_id",+ "posthog_externaldatasource"."destination_id",+ "posthog_externaldatasource"."team_id",+ "posthog_externaldatasource"."sync_frequency",+ "posthog_externaldatasource"."status",+ "posthog_externaldatasource"."source_type",+ "posthog_externaldatasource"."api_version",+ "posthog_externaldatasource"."job_inputs",+ "posthog_externaldatasource"."connection_metadata",+ "posthog_externaldatasource"."are_tables_created",+ "posthog_externaldatasource"."prefix",+ "posthog_externaldatasource"."description",+ "posthog_externaldatasource"."created_via",+ "posthog_externaldatasource"."access_method",+ "posthog_externaldatasource"."direct_query_enabled",+ "posthog_externaldatasource"."auto_sync_new_schemas",+ "posthog_externaldatasource"."auto_sync_schema_patterns",+ "posthog_externaldatasource"."revenue_analytics_enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"+ FROM "posthog_externaldatasource"+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")+ WHERE ("posthog_externaldatasource"."team_id" = 99999+ AND NOT ("posthog_externaldatasource"."deleted"+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)+ AND "posthog_externaldatasource"."source_type" IN ('Stripe'))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.90'''SELECT "posthog_sessionrecording"."id","posthog_sessionrecording"."session_id",@@ -10916,7 +11348,7 @@AND "posthog_sessionrecording"."team_id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.85+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.91'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"FROM "posthog_sessionrecordingviewed"@@ -10929,7 +11361,7 @@'1'))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.86+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.92'''SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id","posthog_user"."email" AS "user__email"@@ -10944,7 +11376,7 @@AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.87+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.93'''SELECT "posthog_user"."id","posthog_user"."password",@@ -10990,7 +11422,7 @@AND "posthog_user"."id" = 99999)'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.88+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.94'''SELECT "posthog_organization"."id","posthog_organization"."name",@@ -11035,7 +11467,7 @@LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.89+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.95'''SELECT "posthog_team"."id","posthog_team"."uuid",@@ -11151,126 +11583,29 @@"posthog_organization"."members_can_see_org_members","posthog_organization"."uses_most_specific_access_resolution","posthog_organization"."allow_publicly_shared_resources",- "posthog_organization"."read_only_mcp_access",- "posthog_organization"."default_role_id",- "posthog_organization"."plugins_access_level",- "posthog_organization"."for_internal_metrics",- "posthog_organization"."default_anonymize_ips",- "posthog_organization"."is_pending_deletion",- "posthog_organization"."customer_id",- "posthog_organization"."available_product_features",- "posthog_organization"."usage",- "posthog_organization"."never_drop_data",- "posthog_organization"."customer_trust_scores",- "posthog_organization"."has_active_subscription",- "posthog_organization"."setup_section_2_completed",- "posthog_organization"."personalization",- "posthog_organization"."domain_whitelist",- "posthog_organization"."is_platform"- FROM "posthog_team"- INNER JOIN "posthog_organization" ON ("posthog_team"."organization_id" = "posthog_organization"."id")- WHERE "posthog_team"."id" = 99999- LIMIT 21- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.9- '''- SELECT "posthog_datawarehousejoin"."created_by_id",- "posthog_datawarehousejoin"."created_at",- "posthog_datawarehousejoin"."deleted",- "posthog_datawarehousejoin"."deleted_at",- "posthog_datawarehousejoin"."id",- "posthog_datawarehousejoin"."team_id",- "posthog_datawarehousejoin"."source_table_name",- "posthog_datawarehousejoin"."source_table_key",- "posthog_datawarehousejoin"."joining_table_name",- "posthog_datawarehousejoin"."joining_table_key",- "posthog_datawarehousejoin"."field_name",- "posthog_datawarehousejoin"."configuration"- FROM "posthog_datawarehousejoin"- WHERE ("posthog_datawarehousejoin"."team_id" = 99999- AND NOT ("posthog_datawarehousejoin"."deleted"- AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.90- '''- SELECT "posthog_organizationmembership"."id",- "posthog_organizationmembership"."organization_id",- "posthog_organizationmembership"."user_id",- "posthog_organizationmembership"."level",- "posthog_organizationmembership"."joined_at",- "posthog_organizationmembership"."updated_at",- "posthog_organizationmembership"."invited_by_id",- "posthog_organization"."id",- "posthog_organization"."name",- "posthog_organization"."slug",- "posthog_organization"."logo_media_id",- "posthog_organization"."created_at",- "posthog_organization"."updated_at",- "posthog_organization"."is_active",- "posthog_organization"."is_not_active_reason",- "posthog_organization"."session_cookie_age",- "posthog_organization"."is_member_join_email_enabled",- "posthog_organization"."is_ai_data_processing_approved",- "posthog_organization"."is_ai_training_opted_in",- "posthog_organization"."is_ai_training_locked",- "posthog_organization"."is_ai_training_cta_shown",- "posthog_organization"."enforce_2fa",- "posthog_organization"."enforce_verified_domains",- "posthog_organization"."members_can_invite",- "posthog_organization"."members_can_create_projects",- "posthog_organization"."members_can_use_personal_api_keys",- "posthog_organization"."members_can_see_org_members",- "posthog_organization"."uses_most_specific_access_resolution",- "posthog_organization"."allow_publicly_shared_resources",- "posthog_organization"."read_only_mcp_access",- "posthog_organization"."default_role_id",- "posthog_organization"."plugins_access_level",- "posthog_organization"."for_internal_metrics",- "posthog_organization"."default_anonymize_ips",- "posthog_organization"."is_pending_deletion",- "posthog_organization"."customer_id",- "posthog_organization"."available_product_features",- "posthog_organization"."usage",- "posthog_organization"."never_drop_data",- "posthog_organization"."customer_trust_scores",- "posthog_organization"."has_active_subscription",- "posthog_organization"."setup_section_2_completed",- "posthog_organization"."personalization",- "posthog_organization"."domain_whitelist",- "posthog_organization"."is_platform"- 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: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.91- '''- SELECT "ee_accesscontrol"."id",- "ee_accesscontrol"."team_id",- "ee_accesscontrol"."access_level",- "ee_accesscontrol"."resource",- "ee_accesscontrol"."resource_id",- "ee_accesscontrol"."organization_member_id",- "ee_accesscontrol"."role_id",- "ee_accesscontrol"."created_by_id",- "ee_accesscontrol"."created_at",- "ee_accesscontrol"."updated_at"- FROM "ee_accesscontrol"- 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"."role_id" IS NULL- AND "ee_accesscontrol"."team_id" = 99999)- OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid- AND "posthog_organizationmembership"."user_id" = 99999- AND "ee_accesscontrol"."role_id" IS NULL- AND "ee_accesscontrol"."team_id" = 99999))+ "posthog_organization"."read_only_mcp_access",+ "posthog_organization"."default_role_id",+ "posthog_organization"."plugins_access_level",+ "posthog_organization"."for_internal_metrics",+ "posthog_organization"."default_anonymize_ips",+ "posthog_organization"."is_pending_deletion",+ "posthog_organization"."customer_id",+ "posthog_organization"."available_product_features",+ "posthog_organization"."usage",+ "posthog_organization"."never_drop_data",+ "posthog_organization"."customer_trust_scores",+ "posthog_organization"."has_active_subscription",+ "posthog_organization"."setup_section_2_completed",+ "posthog_organization"."personalization",+ "posthog_organization"."domain_whitelist",+ "posthog_organization"."is_platform"+ FROM "posthog_team"+ INNER JOIN "posthog_organization" ON ("posthog_team"."organization_id" = "posthog_organization"."id")+ WHERE "posthog_team"."id" = 99999+ LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.92+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.96'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -11319,10 +11654,35 @@"posthog_organization"."is_platform"FROM "posthog_organizationmembership"INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")- WHERE "posthog_organizationmembership"."user_id" = 99999+ WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ AND "posthog_organizationmembership"."user_id" = 99999)+ LIMIT 21'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.93+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.97+ '''+ SELECT "ee_accesscontrol"."id",+ "ee_accesscontrol"."team_id",+ "ee_accesscontrol"."access_level",+ "ee_accesscontrol"."resource",+ "ee_accesscontrol"."resource_id",+ "ee_accesscontrol"."organization_member_id",+ "ee_accesscontrol"."role_id",+ "ee_accesscontrol"."created_by_id",+ "ee_accesscontrol"."created_at",+ "ee_accesscontrol"."updated_at"+ FROM "ee_accesscontrol"+ 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"."role_id" IS NULL+ AND "ee_accesscontrol"."team_id" = 99999)+ OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ AND "posthog_organizationmembership"."user_id" = 99999+ AND "ee_accesscontrol"."role_id" IS NULL+ AND "ee_accesscontrol"."team_id" = 99999))+ '''+# ---+# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.98'''SELECT "posthog_organizationmembership"."id","posthog_organizationmembership"."organization_id",@@ -11371,213 +11731,15 @@"posthog_organization"."is_platform"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: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.94- '''- SELECT "posthog_datawarehousesavedquery"."created_by_id",- "posthog_datawarehousesavedquery"."created_at",- "posthog_datawarehousesavedquery"."updated_at",- "posthog_datawarehousesavedquery"."deleted",- "posthog_datawarehousesavedquery"."deleted_at",- "posthog_datawarehousesavedquery"."id",- "posthog_datawarehousesavedquery"."name",- "posthog_datawarehousesavedquery"."team_id",- "posthog_datawarehousesavedquery"."latest_error",- "posthog_datawarehousesavedquery"."columns",- "posthog_datawarehousesavedquery"."column_order",- "posthog_datawarehousesavedquery"."external_tables",- "posthog_datawarehousesavedquery"."query",- "posthog_datawarehousesavedquery"."query_revision",- "posthog_datawarehousesavedquery"."status",- "posthog_datawarehousesavedquery"."last_run_at",- "posthog_datawarehousesavedquery"."sync_frequency_interval",- "posthog_datawarehousesavedquery"."table_id",- "posthog_datawarehousesavedquery"."is_materialized",- "posthog_datawarehousesavedquery"."deleted_name",- "posthog_datawarehousesavedquery"."managed_viewset_id",- "posthog_datawarehousesavedquery"."folder_id",- "posthog_datawarehousesavedquery"."origin",- "posthog_datawarehousesavedquery"."is_test",- "posthog_datawarehousesavedquery"."expires_at",- "posthog_datawarehousesavedquery"."semantic_enrichment_hash",- "posthog_datawarehousesavedquery"."incremental_config",- "posthog_datawarehousesavedquery"."incremental_state",- "posthog_datawarehousetable"."created_by_id",- "posthog_datawarehousetable"."created_at",- "posthog_datawarehousetable"."updated_at",- "posthog_datawarehousetable"."deleted",- "posthog_datawarehousetable"."deleted_at",- "posthog_datawarehousetable"."id",- "posthog_datawarehousetable"."name",- "posthog_datawarehousetable"."format",- "posthog_datawarehousetable"."team_id",- "posthog_datawarehousetable"."url_pattern",- "posthog_datawarehousetable"."queryable_folder",- "posthog_datawarehousetable"."credential_id",- "posthog_datawarehousetable"."external_data_source_id",- "posthog_datawarehousetable"."created_via",- "posthog_datawarehousetable"."columns",- "posthog_datawarehousetable"."column_order",- "posthog_datawarehousetable"."options",- "posthog_datawarehousetable"."row_count",- "posthog_datawarehousetable"."size_in_s3_mib",- "posthog_datawarehousemanagedviewset"."created_by_id",- "posthog_datawarehousemanagedviewset"."created_at",- "posthog_datawarehousemanagedviewset"."updated_at",- "posthog_datawarehousemanagedviewset"."id",- "posthog_datawarehousemanagedviewset"."team_id",- "posthog_datawarehousemanagedviewset"."kind"- FROM "posthog_datawarehousesavedquery"- LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")- LEFT OUTER JOIN "posthog_datawarehousemanagedviewset" ON ("posthog_datawarehousesavedquery"."managed_viewset_id" = "posthog_datawarehousemanagedviewset"."id")- WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999- AND NOT ("posthog_datawarehousesavedquery"."deleted"- AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL))- ORDER BY "posthog_datawarehousesavedquery"."name" ASC- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.95- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."api_version",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."direct_query_enabled",- "posthog_externaldatasource"."auto_sync_new_schemas",- "posthog_externaldatasource"."auto_sync_schema_patterns",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND "posthog_externaldatasource"."source_type" IN ('Stripe'))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.96- '''- SELECT "posthog_datawarehousejoin"."created_by_id",- "posthog_datawarehousejoin"."created_at",- "posthog_datawarehousejoin"."deleted",- "posthog_datawarehousejoin"."deleted_at",- "posthog_datawarehousejoin"."id",- "posthog_datawarehousejoin"."team_id",- "posthog_datawarehousejoin"."source_table_name",- "posthog_datawarehousejoin"."source_table_key",- "posthog_datawarehousejoin"."joining_table_name",- "posthog_datawarehousejoin"."joining_table_key",- "posthog_datawarehousejoin"."field_name",- "posthog_datawarehousejoin"."configuration"- FROM "posthog_datawarehousejoin"- WHERE ("posthog_datawarehousejoin"."team_id" = 99999- AND NOT ("posthog_datawarehousejoin"."deleted"- AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.97- '''- SELECT "data_tools_datawarehouseexpression"."deleted",- "data_tools_datawarehouseexpression"."deleted_at",- "data_tools_datawarehouseexpression"."id",- "data_tools_datawarehouseexpression"."team_id",- "data_tools_datawarehouseexpression"."created_at",- "data_tools_datawarehouseexpression"."created_by_id",- "data_tools_datawarehouseexpression"."table_name",- "data_tools_datawarehouseexpression"."field_name",- "data_tools_datawarehouseexpression"."expression",- "data_tools_datawarehouseexpression"."connection_id"- FROM "data_tools_datawarehouseexpression"- WHERE ("data_tools_datawarehouseexpression"."team_id" = 99999- AND NOT ("data_tools_datawarehouseexpression"."deleted"- AND "data_tools_datawarehouseexpression"."deleted" IS NOT NULL)- AND "data_tools_datawarehouseexpression"."connection_id" IS NULL)- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.98- '''- SELECT "posthog_datawarehousetable"."created_by_id",- "posthog_datawarehousetable"."created_at",- "posthog_datawarehousetable"."updated_at",- "posthog_datawarehousetable"."deleted",- "posthog_datawarehousetable"."deleted_at",- "posthog_datawarehousetable"."id",- "posthog_datawarehousetable"."name",- "posthog_datawarehousetable"."format",- "posthog_datawarehousetable"."team_id",- "posthog_datawarehousetable"."url_pattern",- "posthog_datawarehousetable"."queryable_folder",- "posthog_datawarehousetable"."credential_id",- "posthog_datawarehousetable"."external_data_source_id",- "posthog_datawarehousetable"."created_via",- "posthog_datawarehousetable"."columns",- "posthog_datawarehousetable"."column_order",- "posthog_datawarehousetable"."options",- "posthog_datawarehousetable"."row_count",- "posthog_datawarehousetable"."size_in_s3_mib"- FROM "posthog_datawarehousetable"- LEFT OUTER JOIN "posthog_externaldatasource" ON ("posthog_datawarehousetable"."external_data_source_id" = "posthog_externaldatasource"."id")- WHERE ("posthog_datawarehousetable"."team_id" = 99999- AND NOT ("posthog_datawarehousetable"."deleted"- AND "posthog_datawarehousetable"."deleted" IS NOT NULL)- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL)- AND NOT ("posthog_externaldatasource"."access_method" = 'direct'- AND "posthog_externaldatasource"."access_method" IS NOT NULL))- ORDER BY "posthog_datawarehousetable"."created_at" DESC+ WHERE "posthog_organizationmembership"."user_id" = 99999'''# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.99'''- SELECT "posthog_sessionrecording"."id",- "posthog_sessionrecording"."session_id",- "posthog_sessionrecording"."team_id",- "posthog_sessionrecording"."created_at",- "posthog_sessionrecording"."deleted",- "posthog_sessionrecording"."distinct_id",- "posthog_sessionrecording"."duration",- "posthog_sessionrecording"."active_seconds",- "posthog_sessionrecording"."inactive_seconds",- "posthog_sessionrecording"."start_time",- "posthog_sessionrecording"."end_time",- "posthog_sessionrecording"."click_count",- "posthog_sessionrecording"."keypress_count",- "posthog_sessionrecording"."mouse_activity_count",- "posthog_sessionrecording"."console_log_count",- "posthog_sessionrecording"."console_warn_count",- "posthog_sessionrecording"."console_error_count",- "posthog_sessionrecording"."start_url",- "posthog_sessionrecording"."retention_period_days"- FROM "posthog_sessionrecording"- WHERE ("posthog_sessionrecording"."session_id" IN ('1',- '2',- '3',- '4',- '5',- '6')- AND "posthog_sessionrecording"."team_id" = 99999)+ SELECT "feature_flags_organizationfeatureflagsconfig"."flag_evaluations_mode" AS "flag_evaluations_mode"+ FROM "feature_flags_organizationfeatureflagsconfig"+ WHERE "feature_flags_organizationfeatureflagsconfig"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid+ ORDER BY "feature_flags_organizationfeatureflagsconfig"."organization_id" ASC+ LIMIT 1'''# ---diff --git a/posthog/settings/dynamic_settings.py b/posthog/settings/dynamic_settings.pyindex c6fb4d6e7db9..0e4035dcd071 100644--- a/posthog/settings/dynamic_settings.py+++ b/posthog/settings/dynamic_settings.py@@ -337,6 +337,15 @@ CONSTANCE_CONFIG = {'Per-team /flags request and response body logging. JSON object mapping team_id (string) to a non-empty list of flag-key wildcard patterns; the response is filtered to flags matching any pattern. "{}" disables logging entirely. Examples: \'{"123": ["my-feature", "checkout-*"]}\' logs only matching flag keys for team 123. To capture every flag (rare, noisy), use [\\"*\\"] explicitly. The Rust feature-flags service polls this every ~60s. Limits: at most 100 teams, 50 patterns per team, 256 bytes per pattern.',str,),+ "FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS": (+ get_from_env("FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS", False, type_cast=str_to_bool),+ "When on, the feature flag Usage tab reads the events table for every organization on flag_evaluations "+ "mode 1. Use it when the flag_evaluations table stops receiving rows. Organizations on mode 2 keep reading "+ "flag_evaluations, because once ingestion stops their events writes, events has none of their flag calls. "+ "Stored modes and the flag_evaluations SQL table stay as they are, so turning it off restores every "+ "organization. Takes up to a minute to apply, and a page reload to show.",+ bool,+ ),"REDIRECT_APP_TO_US": (get_from_env("REDIRECT_APP_TO_US", False, type_cast=str_to_bool),"Temporary option to redirect all app traffic from app.posthog.com to us.posthog.com.",@@ -458,6 +467,7 @@ SETTINGS_ALLOWING_API_OVERRIDE = ("RATE_LIMIT_ENABLED","RATE_LIMITING_ALLOW_LIST_TEAMS","FLAGS_LOG_BODIES_TEAMS",+ "FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS","CLICKHOUSE_KILL_SWITCH","CLICKHOUSE_KILL_SWITCH_LIGHT_TEAMS","CLICKHOUSE_KILL_SWITCH_FULL_TEAMS",diff --git a/posthog/settings/feature_flags.py b/posthog/settings/feature_flags.pyindex 2925872f1cbe..47adca53db9c 100644--- a/posthog/settings/feature_flags.py+++ b/posthog/settings/feature_flags.py@@ -155,6 +155,12 @@ TEAM_METADATA_CACHE_VERIFICATION_GRACE_PERIOD_MINUTES: int = get_from_env("TEAM_METADATA_CACHE_VERIFICATION_GRACE_PERIOD_MINUTES", 5, type_cast=int)+# OrganizationFeatureFlagsConfig.flag_evaluations_mode for a new organization. 0 reads+# $feature_flag_called from events. 1 reads it from flag_evaluations. 2 also stops writing it to events+# once ingestion supports that. Until then 2 acts as 1. A change here never moves an existing+# organization.+FLAG_EVALUATIONS_NEW_ORG_MODE: int = get_from_env("FLAG_EVALUATIONS_NEW_ORG_MODE", 0, type_cast=int)+# Feature flag limits to prevent memory issues during flag evaluation/caching.# These limits are configurable via environment variables and can be overridden# in Helm charts per environment.diff --git a/posthog/test/repo_invariants/setup_receivers_baseline.txt b/posthog/test/repo_invariants/setup_receivers_baseline.txtindex bd844b55cd1c..ebf4f7ce19c6 100644--- a/posthog/test/repo_invariants/setup_receivers_baseline.txt+++ b/posthog/test/repo_invariants/setup_receivers_baseline.txt@@ -213,6 +213,7 @@ post_save:products.feature_flags.backend.local_evaluation.evaluation_context_chapost_save:products.feature_flags.backend.local_evaluation.evaluation_context_name_changedpost_save:products.feature_flags.backend.local_evaluation.experiment_changedpost_save:products.feature_flags.backend.local_evaluation.feature_flag_changed+post_save:products.feature_flags.backend.models.organization_feature_flags_config.create_organization_feature_flags_configpost_save:products.feature_flags.backend.session_recording_links.relink_teams_on_key_changepost_save:products.managed_warehouse.backend.models._observe_duckgres_server_savepost_save:products.posthog_ai.backend.receivers.mark_conversation_sandbox_on_first_rundiff --git a/products/feature_flags/backend/api/staff_team_config.py b/products/feature_flags/backend/api/staff_team_config.pyindex 66384dcc0531..8e48697922ef 100644--- a/products/feature_flags/backend/api/staff_team_config.py+++ b/products/feature_flags/backend/api/staff_team_config.py@@ -17,13 +17,16 @@ from posthog.models.team.extensions import get_or_create_team_extensionfrom posthog.permissions import IsStaffUserfrom products.feature_flags.backend.api.staff_cache import _team_ids_field+from products.feature_flags.backend.facade.flags import get_organization_flag_evaluations_modefrom products.feature_flags.backend.flag_limits import (get_max_feature_flags_override_for_team,resolve_max_feature_flags,)from products.feature_flags.backend.models.feature_flag import FeatureFlag+from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfigfrom products.feature_flags.backend.models.team_feature_flags_config import (MAX_FEATURE_FLAGS_OVERRIDE_CEILING,+ FlagEvaluationsMode,PropertyMatchingVersion,TeamFeatureFlagsConfig,)@@ -44,6 +47,7 @@ def _config_row(minimal_flag_called_events: bool,property_matching_version: int,max_feature_flags_override: int | None,+ flag_evaluations_mode: int,feature_flag_count: int,) -> dict[str, Any]:"""Build the row shape shared by list() and set(), which both feed the same staff tools table."""@@ -53,6 +57,7 @@ def _config_row("property_matching_version": property_matching_version,"max_feature_flags_override": max_feature_flags_override,"effective_max_feature_flags": resolve_max_feature_flags(max_feature_flags_override),+ "flag_evaluations_mode": flag_evaluations_mode,"feature_flag_count": feature_flag_count,}@@ -90,6 +95,17 @@ class StaffTeamConfigSerializer(serializers.Serializer):"otherwise the global MAX_FEATURE_FLAGS_PER_TEAM setting."))+ flag_evaluations_mode = serializers.ChoiceField(+ choices=FlagEvaluationsMode.choices,+ help_text=(+ "Which table the $feature_flag_called data of this team's organization is read from. Every team of "+ "an organization shares one mode. 0 reads events, 1 and 2 read flag_evaluations. 2 is reserved for "+ "ingestion to stop writing $feature_flag_called to events. Ingestion ignores 2 until that support "+ "deploys, so 2 acts as 1 until then. This is the stored mode: while the "+ "FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS instance setting is on, an organization on 1 has its Usage tab "+ "read events anyway."+ ),+ )feature_flag_count = serializers.IntegerField(help_text=("Number of feature flags the team has today, excluding soft-deleted ones, counted the "@@ -180,10 +196,9 @@ class FeatureFlagsStaffTeamConfigViewSet(viewsets.ViewSet):# (get_max_feature_flags_override_for_team) and counts through FeatureFlag.objects, whose# RootTeamManager rewrites team_id= to the root. Reading either off the environment team# would show a limit the validator does not enforce.- root_team_id_by_team_id = {- team_id: parent_team_id or team_id- for team_id, parent_team_id in Team.objects.filter(id__in=team_ids).values_list("id", "parent_team_id")- }+ team_rows = list(Team.objects.filter(id__in=team_ids).values_list("id", "parent_team_id", "organization_id"))+ root_team_id_by_team_id = {team_id: parent_team_id or team_id for team_id, parent_team_id, _ in team_rows}+ organization_id_by_team_id = {team_id: organization_id for team_id, _, organization_id in team_rows}root_team_ids = set(root_team_id_by_team_id.values())# Behavior rollouts stay per-team because evaluation readers key on the literal team, so# they come from each team's row. The capacity override comes from the project root.@@ -193,6 +208,9 @@ class FeatureFlagsStaffTeamConfigViewSet(viewsets.ViewSet):"team_id", "max_feature_flags_override"))+ organization_config_by_id = OrganizationFeatureFlagsConfig.objects.in_bulk(+ set(organization_id_by_team_id.values())+ )# FeatureFlag.objects excludes soft-deleted rows, so counting the root team gives the# number check_flag_limits_for_team compares against the limit. Staff reading this number# next to the limit have to see the number the validator sees.@@ -211,12 +229,16 @@ class FeatureFlagsStaffTeamConfigViewSet(viewsets.ViewSet):# An unsaved instance stands in for a legacy team whose row predates this extension,# so the model's own field defaults answer for it rather than a second copy here.config = config_by_team_id.get(team_id) or TeamFeatureFlagsConfig()+ organization_config = (+ organization_config_by_id.get(organization_id_by_team_id[team_id]) or OrganizationFeatureFlagsConfig()+ )results.append(_config_row(team_id=team_id,minimal_flag_called_events=config.minimal_flag_called_events,property_matching_version=config.property_matching_version,max_feature_flags_override=override_by_root_team_id.get(root_team_id),+ flag_evaluations_mode=organization_config.flag_evaluations_mode,feature_flag_count=flag_count_by_root_team_id.get(root_team_id, 0),))@@ -308,6 +330,7 @@ class FeatureFlagsStaffTeamConfigViewSet(viewsets.ViewSet):if team.parent_team_id is Noneelse get_max_feature_flags_override_for_team(team.parent_team_id)),+ flag_evaluations_mode=get_organization_flag_evaluations_mode(team.organization_id),feature_flag_count=FeatureFlag.objects.filter(team_id=team.id).count(),))diff --git a/products/feature_flags/backend/facade/enums.py b/products/feature_flags/backend/facade/enums.pynew file mode 100644index 000000000000..2ef29382844c--- /dev/null+++ b/products/feature_flags/backend/facade/enums.py@@ -0,0 +1,5 @@+"""Exported enums for feature_flags."""++from products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsMode++__all__ = ["FlagEvaluationsMode"]diff --git a/products/feature_flags/backend/facade/flags.py b/products/feature_flags/backend/facade/flags.pyindex c8646152d118..e748b2a50167 100644--- a/products/feature_flags/backend/facade/flags.py+++ b/products/feature_flags/backend/facade/flags.py@@ -1,31 +1,63 @@-"""Feature-flag gates for this product, kept light so core code can import them without pulling-the facade's heavier logic surface onto its import path.+"""Feature-flag gates for this product, and the read of an organization's flag_evaluations mode.+The module stays light so core code can import it without pulling the facade's heavier logic+surface onto its import path."""from typing import TYPE_CHECKING+from uuid import UUIDfrom django.conf import settings+from posthog.models.instance_setting import get_instance_settingfrom posthog.ph_client import feature_enabled_or_false+from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfig+from products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsMode+if TYPE_CHECKING:from posthog.models.team import TeamFLAG_EVALUATIONS_HOGQL_TABLE_FEATURE_FLAG = "flag-evaluations-hogql-table"+def get_organization_flag_evaluations_mode(organization_id: UUID) -> int:+ """The organization's FlagEvaluationsMode value. An organization with no config row reads EVENTS,+ which matches the COALESCE in Node ingestion's team query."""+ mode = (+ OrganizationFeatureFlagsConfig.objects.filter(organization_id=organization_id)+ .values_list("flag_evaluations_mode", flat=True)+ .first()+ )+ return FlagEvaluationsMode.EVENTS if mode is None else mode+++def get_usage_tab_flag_evaluations_mode(organization_id: UUID) -> int:+ """The mode that decides which table the flag Usage tab reads. FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS makes+ it EVENTS for an organization on READ_FLAG_EVALUATIONS and leaves the stored mode unchanged."""+ mode = get_organization_flag_evaluations_mode(organization_id)+ # The switch skips FLAG_EVALUATIONS_ONLY. Once ingestion supports that mode, events holds none of the+ # organization's flag calls, so the Usage tab would show empty days instead of the flag_evaluations rows.+ if mode == FlagEvaluationsMode.READ_FLAG_EVALUATIONS and get_instance_setting(+ "FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS"+ ):+ return FlagEvaluationsMode.EVENTS+ return mode++def is_flag_evaluations_table_enabled(team: "Team") -> bool:"""Gate every surface that exposes `posthog.flag_evaluations` through here.- Cloud-only for now: a self-hosted production instance reads false. Local dev and- end-to-end tests are the exception and read true.+ Reads true when the flag_evaluations mode of the team's organization reads that table, or when the+ flag-evaluations-hogql-table flag is on for the team's organization. A self-hosted production+ instance has neither by default and reads false. Local dev and end-to-end tests are the+ exception and read true."""# The flag is evaluated against PostHog's own analytics project, which a local or end-to-end# environment has no membership in. Evaluating it there would hide the table from both, so# return True to keep it visible in dev and E2E.if settings.DEBUG or settings.E2E_TESTING:return True- return feature_enabled_or_false(+ flag_enabled = feature_enabled_or_false(FLAG_EVALUATIONS_HOGQL_TABLE_FEATURE_FLAG,str(team.organization_id),groups={"organization": str(team.organization_id)},@@ -38,3 +70,7 @@ def is_flag_evaluations_table_enabled(team: "Team") -> bool:only_evaluate_locally=True,send_feature_flag_events=False,)+ # The flag evaluates in memory, so it goes first and a flagged organization skips the query.+ # The Usage tab reads flag_evaluations for any mode above EVENTS, and its query fails when the+ # table is missing from the catalog, so the mode alone has to be enough.+ return flag_enabled or get_organization_flag_evaluations_mode(team.organization_id) != FlagEvaluationsMode.EVENTSdiff --git a/products/feature_flags/backend/flag_evaluations_mode.py b/products/feature_flags/backend/flag_evaluations_mode.pynew file mode 100644index 000000000000..6e1ceadfc84b--- /dev/null+++ b/products/feature_flags/backend/flag_evaluations_mode.py@@ -0,0 +1,90 @@+"""Writes of OrganizationFeatureFlagsConfig.flag_evaluations_mode, one organization at a time."""++from collections.abc import Sequence+from datetime import datetime+from uuid import UUID++from django.db import connection+from django.db.models import QuerySet++from posthog.dataclasses import frozen+from posthog.models import Organization, Team++from products.feature_flags.backend.facade.flags import get_organization_flag_evaluations_mode+from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfig+from products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsMode+++@frozen+class OrganizationModeChange:+ organization_id: UUID+ organization_name: str+ organization_created_at: datetime+ # Teams of the organization, for display only. The write never touches team rows.+ team_count: int+ current_mode: int+ target_mode: int+ # True when the write moved the organization to target_mode, or would on a dry run.+ changed: bool+ # True when the organization is above target_mode and allow_downgrade is off.+ left_above_mode: bool+++def select_organizations(+ *, organization_ids: Sequence[UUID] | None = None, created_after: datetime | None = None+) -> QuerySet[Organization]:+ """Exactly one selector: explicit ids, or every organization created after an instant."""+ if (organization_ids is None) == (created_after is None):+ raise ValueError("Pass exactly one of organization_ids and created_after")+ if organization_ids is not None:+ return Organization.objects.filter(id__in=organization_ids).order_by("created_at")+ return Organization.objects.filter(created_at__gt=created_after).order_by("created_at")+++def _upsert_mode(organization_id: UUID, mode: FlagEvaluationsMode, *, allow_downgrade: bool) -> bool:+ """Write the mode in one statement and report whether a row changed.++ The WHERE clause compares against the stored mode at write time. Without allow_downgrade, a+ concurrent write that raised the organization above `mode` after the caller read it is kept.+ """+ table = OrganizationFeatureFlagsConfig._meta.db_table+ comparison = "<>" if allow_downgrade else "<"+ query = f"""+ INSERT INTO {table} (organization_id, flag_evaluations_mode)+ VALUES (%s, %s)+ ON CONFLICT (organization_id) DO UPDATE+ SET flag_evaluations_mode = EXCLUDED.flag_evaluations_mode+ WHERE {table}.flag_evaluations_mode {comparison} EXCLUDED.flag_evaluations_mode+ """+ with connection.cursor() as cursor:+ cursor.execute(query, [organization_id, int(mode)])+ return cursor.rowcount == 1+++def set_organization_flag_evaluations_mode(+ organization: Organization, mode: FlagEvaluationsMode, *, allow_downgrade: bool, dry_run: bool+) -> OrganizationModeChange:+ """Move the organization to `mode`.++ An organization above `mode` stays where it is unless `allow_downgrade` is set. Once ingestion+ supports FLAG_EVALUATIONS_ONLY, lowering an organization from it restarts events writes and+ leaves a gap in the events table.++ Opens no transaction. A caller that writes several organizations wraps its own loop.+ """+ current_mode = get_organization_flag_evaluations_mode(organization.id)+ changed = current_mode < mode or (allow_downgrade and current_mode > mode)+ # The statement runs only when the read says the mode moves. A missing row reads EVENTS, so a+ # write of EVENTS to it would insert a row and report a change that no reader can see.+ if changed and not dry_run:+ changed = _upsert_mode(organization.id, mode, allow_downgrade=allow_downgrade)+ return OrganizationModeChange(+ organization_id=organization.id,+ organization_name=organization.name,+ organization_created_at=organization.created_at,+ team_count=Team.objects.filter(organization_id=organization.id).count(),+ current_mode=current_mode,+ target_mode=mode,+ changed=changed,+ left_above_mode=current_mode > mode and not allow_downgrade,+ )diff --git a/products/feature_flags/backend/management/commands/set_flag_evaluations_mode.py b/products/feature_flags/backend/management/commands/set_flag_evaluations_mode.pynew file mode 100644index 000000000000..167a6c91a4f4--- /dev/null+++ b/products/feature_flags/backend/management/commands/set_flag_evaluations_mode.py@@ -0,0 +1,116 @@+"""Set OrganizationFeatureFlagsConfig.flag_evaluations_mode on the selected organizations.++New organizations take FLAG_EVALUATIONS_NEW_ORG_MODE when they are created. This command covers+the organizations that existed before that setting changed: a list of ids, or every organization+created after an instant.++Ingestion does not act on mode 2 yet. An organization set to 2 now behaves as mode 1, and it stops+writing $feature_flag_called to events on its own when that support deploys.+"""++import argparse+from datetime import UTC, datetime+from typing import Any+from uuid import UUID++from django.core.management.base import BaseCommand, CommandError, CommandParser+from django.db import transaction++from products.feature_flags.backend.flag_evaluations_mode import (+ select_organizations,+ set_organization_flag_evaluations_mode,+)+from products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsMode+++def _parse_instant(value: str) -> datetime:+ try:+ parsed = datetime.fromisoformat(value)+ except ValueError as error:+ raise argparse.ArgumentTypeError(f"{value!r} is not an ISO 8601 date or datetime") from error+ return parsed if parsed.tzinfo is not None else parsed.replace(tzinfo=UTC)+++class Command(BaseCommand):+ help = "Set the flag_evaluations mode of the selected organizations"++ def add_arguments(self, parser: CommandParser) -> None:+ parser.add_argument(+ "--mode",+ type=int,+ required=True,+ choices=FlagEvaluationsMode.values,+ help=(+ "0 reads events, 1 reads flag_evaluations, 2 also stops writing flag calls to events. "+ "Ingestion does not act on mode 2 yet, so an organization on mode 2 behaves as mode 1 "+ "until that ships. "+ "flag_evaluations holds rows only from the day ingestion started writing them "+ "(2026-09-09 for PostHog Cloud), so on mode 1 or 2 the Usage tab shows no data for earlier days."+ ),+ )+ selector = parser.add_mutually_exclusive_group(required=True)+ selector.add_argument(+ "--organization-id",+ type=UUID,+ action="append",+ dest="organization_ids",+ help="Organization to update. Repeat the flag for more than one.",+ )+ selector.add_argument(+ "--organizations-created-after",+ type=_parse_instant,+ dest="created_after",+ help="Update every organization created after this ISO 8601 instant. A bare date means midnight UTC.",+ )+ parser.add_argument("--dry-run", action="store_true", help="Report the changes and write nothing")+ parser.add_argument(+ "--allow-downgrade",+ action="store_true",+ help=(+ "Also lower organizations that are above --mode. Once ingestion acts on mode 2, lowering "+ "from mode 2 leaves a gap in the events table."+ ),+ )++ def handle(self, *args: Any, **options: Any) -> None:+ mode = FlagEvaluationsMode(options["mode"])+ dry_run: bool = options["dry_run"]+ allow_downgrade: bool = options["allow_downgrade"]+ organization_ids: list[UUID] | None = options["organization_ids"]++ organizations = list(+ select_organizations(organization_ids=organization_ids, created_after=options["created_after"])+ )+ if organization_ids is not None:+ missing = set(organization_ids) - {organization.id for organization in organizations}+ if missing:+ # Fail before writing anything, so a mistyped id does not leave a partial run.+ raise CommandError(f"Unknown organization id(s): {', '.join(sorted(map(str, missing)))}")++ verb = "Would set" if dry_run else "Set"+ self.stdout.write(f"{verb} mode {mode.value} ({mode.label}) on {len(organizations)} organization(s).")+ changed_count = 0+ left_above_count = 0+ with transaction.atomic():+ for organization in organizations:+ change = set_organization_flag_evaluations_mode(+ organization, mode, allow_downgrade=allow_downgrade, dry_run=dry_run+ )+ changed_count += change.changed+ left_above_count += change.left_above_mode+ outcome = (+ f"mode {change.current_mode} -> {change.target_mode}"+ if change.changed+ else f"mode {change.current_mode}, unchanged"+ )+ self.stdout.write(+ f" organization {change.organization_id} (created {change.organization_created_at:%Y-%m-%d}, "+ f"{change.team_count} team(s)): {outcome}"+ )++ self.stdout.write(f"{verb} mode {mode.value} on {changed_count} organization(s).")+ if left_above_count:+ self.stdout.write(+ f"Left {left_above_count} organization(s) above mode {mode.value}. "+ "Pass --allow-downgrade to lower them."+ )diff --git a/products/feature_flags/backend/management/commands/test/test_set_flag_evaluations_mode.py b/products/feature_flags/backend/management/commands/test/test_set_flag_evaluations_mode.pynew file mode 100644index 000000000000..d198cdf3a3c5--- /dev/null+++ b/products/feature_flags/backend/management/commands/test/test_set_flag_evaluations_mode.py@@ -0,0 +1,152 @@+from datetime import timedelta+from io import StringIO+from typing import Any++import time_machine+from posthog.test.base import BaseTest+from unittest.mock import patch++from django.core.management import call_command+from django.core.management.base import CommandError+from django.utils import timezone++from parameterized import parameterized++from posthog.models.instance_setting import override_instance_config+from posthog.models.organization import Organization++from products.feature_flags.backend.facade.flags import get_organization_flag_evaluations_mode+from products.feature_flags.backend.flag_evaluations_mode import (+ OrganizationModeChange,+ set_organization_flag_evaluations_mode,+)+from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfig+from products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsMode+++class TestSetFlagEvaluationsMode(BaseTest):+ def _run(self, *args: str) -> str:+ out = StringIO()+ call_command("set_flag_evaluations_mode", *args, stdout=out)+ return out.getvalue()++ def _stored_mode(self, organization: Organization) -> int | None:+ return (+ OrganizationFeatureFlagsConfig.objects.filter(organization=organization)+ .values_list("flag_evaluations_mode", flat=True)+ .first()+ )++ def _store_mode(self, organization: Organization, mode: FlagEvaluationsMode) -> None:+ OrganizationFeatureFlagsConfig.objects.update_or_create(+ organization=organization, defaults={"flag_evaluations_mode": mode}+ )++ def test_an_organization_without_a_row_gets_one_at_the_target(self) -> None:+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).delete()++ self._run("--mode", "1", "--organization-id", str(self.organization.id))++ self.assertEqual(self._stored_mode(self.organization), FlagEvaluationsMode.READ_FLAG_EVALUATIONS)++ def test_dry_run_reports_and_writes_nothing(self) -> None:+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).delete()++ output = self._run("--mode", "1", "--organization-id", str(self.organization.id), "--dry-run")++ self.assertIn(f"organization {self.organization.id}", output)+ self.assertIn("mode 0 -> 1", output)+ self.assertIn("Would set mode 1 on 1 organization(s).", output)+ self.assertIsNone(self._stored_mode(self.organization))++ @time_machine.travel("2026-09-01T12:00:00Z", tick=False)+ def test_created_after_selects_only_newer_organizations(self) -> None:+ cutoff = timezone.now() - timedelta(minutes=5)+ Organization.objects.filter(id=self.organization.id).update(created_at=cutoff - timedelta(days=1))+ new_organization = Organization.objects.create(name="New organization")++ self._run("--mode", "1", "--organizations-created-after", cutoff.isoformat())++ self.assertEqual(+ get_organization_flag_evaluations_mode(new_organization.id), FlagEvaluationsMode.READ_FLAG_EVALUATIONS+ )+ self.assertEqual(get_organization_flag_evaluations_mode(self.organization.id), FlagEvaluationsMode.EVENTS)++ @parameterized.expand(+ [+ (+ "keeps_a_higher_mode_by_default",+ (),+ FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY,+ "Left 1 organization(s) above mode 1.",+ ),+ (+ "lowers_it_with_allow_downgrade",+ ("--allow-downgrade",),+ FlagEvaluationsMode.READ_FLAG_EVALUATIONS,+ "Set mode 1 on 1 organization(s).",+ ),+ ]+ )+ def test_downgrade_guard(+ self, _name: str, extra_args: tuple[str, ...], expected_mode: int, expected_output: str+ ) -> None:+ self._store_mode(self.organization, FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY)++ output = self._run("--mode", "1", "--organization-id", str(self.organization.id), *extra_args)++ self.assertEqual(get_organization_flag_evaluations_mode(self.organization.id), expected_mode)+ self.assertIn(expected_output, output)++ def test_allow_downgrade_lowers_the_stored_mode_while_the_usage_tab_is_forced_to_events(self) -> None:+ self._store_mode(self.organization, FlagEvaluationsMode.READ_FLAG_EVALUATIONS)++ with override_instance_config("FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS", True):+ self._run("--mode", "0", "--organization-id", str(self.organization.id), "--allow-downgrade")++ self.assertEqual(self._stored_mode(self.organization), FlagEvaluationsMode.EVENTS)++ def test_a_raise_after_the_read_is_not_overwritten(self) -> None:+ self._store_mode(self.organization, FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY)++ # The stale read stands in for a staff write that raises the organization between the+ # helper's read and its write.+ with patch(+ "products.feature_flags.backend.flag_evaluations_mode.get_organization_flag_evaluations_mode",+ return_value=FlagEvaluationsMode.EVENTS,+ ):+ change = set_organization_flag_evaluations_mode(+ self.organization, FlagEvaluationsMode.READ_FLAG_EVALUATIONS, allow_downgrade=False, dry_run=False+ )++ self.assertFalse(change.changed)+ self.assertEqual(self._stored_mode(self.organization), FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY)++ def test_unknown_organization_id_fails_before_writing(self) -> None:+ missing_id = "00000000-0000-0000-0000-000000000000"++ with self.assertRaisesMessage(CommandError, missing_id):+ self._run("--mode", "1", "--organization-id", str(self.organization.id), "--organization-id", missing_id)++ self.assertEqual(get_organization_flag_evaluations_mode(self.organization.id), FlagEvaluationsMode.EVENTS)++ def test_a_failure_partway_leaves_every_organization_unchanged(self) -> None:+ second = Organization.objects.create(name="Second organization")++ def fail_on_second(organization: Organization, *args: Any, **kwargs: Any) -> OrganizationModeChange:+ if organization.id == second.id:+ raise RuntimeError("write failed")+ return set_organization_flag_evaluations_mode(organization, *args, **kwargs)++ with (+ patch(+ "products.feature_flags.backend.management.commands.set_flag_evaluations_mode.set_organization_flag_evaluations_mode",+ side_effect=fail_on_second,+ ),+ self.assertRaises(RuntimeError),+ ):+ self._run(+ "--mode", "1", "--organization-id", str(self.organization.id), "--organization-id", str(second.id)+ )++ self.assertEqual(get_organization_flag_evaluations_mode(self.organization.id), FlagEvaluationsMode.EVENTS)diff --git a/products/feature_flags/backend/models/organization_feature_flags_config.py b/products/feature_flags/backend/models/organization_feature_flags_config.pyindex a63289eae444..6865ca70eb89 100644--- a/products/feature_flags/backend/models/organization_feature_flags_config.py+++ b/products/feature_flags/backend/models/organization_feature_flags_config.py@@ -1,7 +1,18 @@+import logging+from typing import TYPE_CHECKING, Any++from django.conf import settingsfrom django.db import models+from django.db.models.signals import post_save+from django.dispatch import receiverfrom products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsMode+if TYPE_CHECKING:+ from posthog.models.organization import Organization++logger = logging.getLogger(__name__)+class OrganizationFeatureFlagsConfig(models.Model):"""Staff-only feature flags settings for an organization.@@ -36,3 +47,31 @@ class OrganizationFeatureFlagsConfig(models.Model):condition=models.Q(flag_evaluations_mode__in=FlagEvaluationsMode.values),)]+++@receiver(post_save, sender="posthog.Organization")+def create_organization_feature_flags_config(+ sender: type[models.Model], instance: "Organization", created: bool, **kwargs: Any+) -> None:+ """Give a new organization its row at FLAG_EVALUATIONS_NEW_ORG_MODE. A later change to the setting+ does not move an existing organization.++ A failure logs and does not block the organization's creation. The organization then has no row+ and reads as EVENTS.+ """+ if not created:+ return+ mode = settings.FLAG_EVALUATIONS_NEW_ORG_MODE+ if mode not in FlagEvaluationsMode.values:+ # The CHECK constraint rejects a mode that FlagEvaluationsMode does not define.+ logger.warning("Ignoring invalid FLAG_EVALUATIONS_NEW_ORG_MODE %r", mode)+ mode = FlagEvaluationsMode.EVENTS+ try:+ # OrganizationManager.bootstrap creates the organization inside a transaction. get_or_create+ # opens a savepoint, so a failed INSERT rolls back only the savepoint and leaves that+ # transaction usable.+ OrganizationFeatureFlagsConfig.objects.get_or_create(+ organization=instance, defaults={"flag_evaluations_mode": mode}+ )+ except Exception as e:+ logger.warning(f"Error creating OrganizationFeatureFlagsConfig: {e}")diff --git a/products/feature_flags/backend/models/team_feature_flags_config.py b/products/feature_flags/backend/models/team_feature_flags_config.pyindex a909f8764ede..658c976665ad 100644--- a/products/feature_flags/backend/models/team_feature_flags_config.py+++ b/products/feature_flags/backend/models/team_feature_flags_config.py@@ -25,7 +25,7 @@ class PropertyMatchingVersion(models.IntegerChoices):class FlagEvaluationsMode(models.IntegerChoices):- """Which table the product reads a team's $feature_flag_called data from. This field does not+ """Which table the product reads an organization's $feature_flag_called data from. This field does notcontrol ingestion. The INGESTION_FLAG_EVALUATIONS_TEAMS allowlist in FlagEvaluationsServicedecides which teams ingestion also writes to flag_evaluations. FLAG_EVALUATIONS_ONLY isreserved for the ingestion change that stops the events writes.@@ -38,7 +38,8 @@ class FlagEvaluationsMode(models.IntegerChoices):READ_FLAG_EVALUATIONS = 1, "Read flag evaluations"# As READ_FLAG_EVALUATIONS, and ingestion stops writing $feature_flag_called to events. Ingestion# ignores this mode until the change that implements it deploys. Until then the mode acts as- # READ_FLAG_EVALUATIONS. A team already on this mode stops the events writes when that change deploys.+ # READ_FLAG_EVALUATIONS. An organization already on this mode stops the events writes when that+ # change deploys.FLAG_EVALUATIONS_ONLY = 2, "Flag evaluations only"@@ -87,8 +88,9 @@ class TeamFeatureFlagsConfig(models.Model):validators=[MinValueValidator(1), MaxValueValidator(MAX_FEATURE_FLAGS_OVERRIDE_CEILING)],)- # The database default keeps older writers, and raw INSERTs that omit this column, valid during- # rolling deploys.+ # Nothing reads or writes this column. OrganizationFeatureFlagsConfig.flag_evaluations_mode holds+ # the mode. The database default keeps older writers, and raw INSERTs that omit this column, valid+ # during rolling deploys.flag_evaluations_mode = models.SmallIntegerField(choices=FlagEvaluationsMode,default=FlagEvaluationsMode.EVENTS,diff --git a/products/feature_flags/backend/test/test_organization_feature_flags_config.py b/products/feature_flags/backend/test/test_organization_feature_flags_config.pynew file mode 100644index 000000000000..5a4006bfa12f--- /dev/null+++ b/products/feature_flags/backend/test/test_organization_feature_flags_config.py@@ -0,0 +1,82 @@+from posthog.test.base import BaseTest+from unittest.mock import patch++from parameterized import parameterized++from posthog.models.instance_setting import override_instance_config+from posthog.models.organization import Organization++from products.feature_flags.backend.facade.flags import is_flag_evaluations_table_enabled+from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfig+from products.feature_flags.backend.models.team_feature_flags_config import FlagEvaluationsMode+++class TestOrganizationFeatureFlagsConfig(BaseTest):+ @parameterized.expand(+ [+ ("events", 0, FlagEvaluationsMode.EVENTS),+ ("read_flag_evaluations", 1, FlagEvaluationsMode.READ_FLAG_EVALUATIONS),+ ("an_invalid_setting_falls_back_to_events", 7, FlagEvaluationsMode.EVENTS),+ ]+ )+ def test_a_new_organization_takes_the_new_org_mode(self, _name, new_org_mode, expected_mode):+ with self.settings(FLAG_EVALUATIONS_NEW_ORG_MODE=new_org_mode):+ organization = Organization.objects.create(name="New organization")++ self.assertEqual(+ OrganizationFeatureFlagsConfig.objects.get(organization=organization).flag_evaluations_mode, expected_mode+ )++ def test_saving_an_existing_organization_keeps_its_mode(self):+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).update(+ flag_evaluations_mode=FlagEvaluationsMode.READ_FLAG_EVALUATIONS+ )++ with self.settings(FLAG_EVALUATIONS_NEW_ORG_MODE=FlagEvaluationsMode.EVENTS):+ self.organization.name = "Renamed"+ self.organization.save()++ self.assertEqual(+ OrganizationFeatureFlagsConfig.objects.get(organization=self.organization).flag_evaluations_mode,+ FlagEvaluationsMode.READ_FLAG_EVALUATIONS,+ )+++class TestFlagEvaluationsTableGate(BaseTest):+ @parameterized.expand(+ [+ ("events_without_the_flag", FlagEvaluationsMode.EVENTS, False, False, False),+ ("events_with_the_flag", FlagEvaluationsMode.EVENTS, True, False, True),+ ("read_flag_evaluations_without_the_flag", FlagEvaluationsMode.READ_FLAG_EVALUATIONS, False, False, True),+ (+ "flag_evaluations_only_without_the_flag",+ FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY,+ False,+ False,+ True,+ ),+ ("no_config_row_without_the_flag", None, False, False, False),+ (+ "read_flag_evaluations_while_the_usage_tab_is_forced_to_events",+ FlagEvaluationsMode.READ_FLAG_EVALUATIONS,+ False,+ True,+ True,+ ),+ ]+ )+ def test_table_is_enabled_by_the_organization_mode_or_the_flag(+ self, _name, mode, flag_enabled, usage_tab_forced_to_events, expected+ ):+ config = OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization)+ if mode is None:+ config.delete()+ else:+ config.update(flag_evaluations_mode=mode)++ with (+ self.settings(DEBUG=False, E2E_TESTING=False),+ patch("products.feature_flags.backend.facade.flags.feature_enabled_or_false", return_value=flag_enabled),+ override_instance_config("FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS", usage_tab_forced_to_events),+ ):+ self.assertEqual(is_flag_evaluations_table_enabled(self.team), expected)diff --git a/products/feature_flags/backend/test/test_staff_team_config_api.py b/products/feature_flags/backend/test/test_staff_team_config_api.pyindex bef69c689783..ea1832fcd753 100644--- a/products/feature_flags/backend/test/test_staff_team_config_api.py+++ b/products/feature_flags/backend/test/test_staff_team_config_api.py@@ -14,8 +14,10 @@ from products.feature_flags.backend.api.staff_team_config import (StaffTeamConfigMutationSerializer,)from products.feature_flags.backend.models.feature_flag import FeatureFlag+from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfigfrom products.feature_flags.backend.models.team_feature_flags_config import (MAX_FEATURE_FLAGS_OVERRIDE_CEILING,+ FlagEvaluationsMode,PropertyMatchingVersion,TeamFeatureFlagsConfig,)@@ -58,6 +60,9 @@ class TestFeatureFlagsStaffTeamConfigAPI(APIBaseTest):)FeatureFlag.objects.create(team=other_team, created_by=self.user, key="other-1", filters={"groups": []})FeatureFlag.objects.create(team=other_team, created_by=self.user, key="other-2", filters={"groups": []})+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).update(+ flag_evaluations_mode=FlagEvaluationsMode.READ_FLAG_EVALUATIONS+ )missing_id = other_team.id + 9999response = self.client.get(_list_url([self.team.id, other_team.id, missing_id]))@@ -69,6 +74,7 @@ class TestFeatureFlagsStaffTeamConfigAPI(APIBaseTest):row["property_matching_version"],row["max_feature_flags_override"],row["effective_max_feature_flags"],+ row["flag_evaluations_mode"],row["feature_flag_count"],)for row in response.json()["results"]@@ -80,15 +86,16 @@ class TestFeatureFlagsStaffTeamConfigAPI(APIBaseTest):self.assertEqual(results,{- self.team.id: (False, 1, None, 2000, 0),- other_team.id: (True, 2, 5000, 5000, 2),+ self.team.id: (False, 1, None, 2000, 1, 0),+ other_team.id: (True, 2, 5000, 5000, 1, 2),},)def test_list_defaults_to_false_when_config_row_is_missing(self):- # Models a legacy team that predates this extension (no auto-created row). list() must- # fall back to defaults rather than 500ing on the missing row.+ # Models a legacy team and organization that predate these extensions (no auto-created rows).+ # list() must fall back to defaults rather than 500ing on the missing rows.TeamFeatureFlagsConfig.objects.filter(team=self.team).delete()+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).delete()response = self.client.get(_list_url([self.team.id]))@@ -102,6 +109,7 @@ class TestFeatureFlagsStaffTeamConfigAPI(APIBaseTest):"property_matching_version": 1,"max_feature_flags_override": None,"effective_max_feature_flags": 2000,+ "flag_evaluations_mode": 0,"feature_flag_count": 0,}],@@ -120,6 +128,10 @@ class TestFeatureFlagsStaffTeamConfigAPI(APIBaseTest):@parameterized.expand([(True,), (False,)])def test_set_updates_db_value_and_enqueues_cache_refresh_tasks(self, new_value):+ OrganizationFeatureFlagsConfig.objects.filter(organization=self.organization).update(+ flag_evaluations_mode=FlagEvaluationsMode.READ_FLAG_EVALUATIONS+ )+with (patch("posthog.tasks.team_metadata.update_team_metadata_cache_task") as mock_metadata_task,patch("products.feature_flags.backend.tasks.update_team_flags_cache") as mock_flags_task,@@ -137,6 +149,7 @@ class TestFeatureFlagsStaffTeamConfigAPI(APIBaseTest):"property_matching_version": 1,"max_feature_flags_override": None,"effective_max_feature_flags": 2000,+ "flag_evaluations_mode": 1,"feature_flag_count": 0,},)diff --git a/products/feature_flags/frontend/generated/api.schemas.ts b/products/feature_flags/frontend/generated/api.schemas.tsindex 163704cb191e..ce18dbc11a7f 100644--- a/products/feature_flags/frontend/generated/api.schemas.ts+++ b/products/feature_flags/frontend/generated/api.schemas.ts@@ -184,6 +184,14 @@ export const PropertyMatchingVersionEnumApi = {Number2: 2,} as const+export type FlagEvaluationsModeEnumApi = (typeof FlagEvaluationsModeEnumApi)[keyof typeof FlagEvaluationsModeEnumApi]++export const FlagEvaluationsModeEnumApi = {+ Number0: 0,+ Number1: 1,+ Number2: 2,+} as const+export interface StaffTeamConfigApi {/** Team id. */team_id: number@@ -201,6 +209,12 @@ export interface StaffTeamConfigApi {max_feature_flags_override: number | null/** The flag-count limit actually enforced for this team: the override when one is set, otherwise the global MAX_FEATURE_FLAGS_PER_TEAM setting. */effective_max_feature_flags: number+ /** Which table the $feature_flag_called data of this team's organization is read from. Every team of an organization shares one mode. 0 reads events, 1 and 2 read flag_evaluations. 2 is reserved for ingestion to stop writing $feature_flag_called to events. Ingestion ignores 2 until that support deploys, so 2 acts as 1 until then. This is the stored mode: while the FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS instance setting is on, an organization on 1 has its Usage tab read events anyway.+ *+ * * `0` - Events+ * * `1` - Read flag evaluations+ * * `2` - Flag evaluations only */+ flag_evaluations_mode: FlagEvaluationsModeEnumApi/** Number of feature flags the team has today, excluding soft-deleted ones, counted the same way the limit is enforced. */feature_flag_count: number}diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex d1882a22a510..4e433d807e26 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -48275,6 +48275,15 @@ export namespace Schemas {readonly notebook: string | null;}+ export type FlagEvaluationsModeEnum = typeof FlagEvaluationsModeEnum[keyof typeof FlagEvaluationsModeEnum];+++ export const FlagEvaluationsModeEnum = {+ Number0: 0,+ Number1: 1,+ Number2: 2,+ } as const;+export interface FlagValueItem {name: unknown;}@@ -77647,6 +77656,8 @@ export namespace Schemas {*/readonly user_access_level?: string | null;readonly managed_viewsets?: PatchedProjectBackwardCompatManagedViewsets;+ /** Which table this project's feature flag usage data is read from. PostHog sets it for the whole organization. 0 reads the events table. 1 and 2 read the flag_evaluations table. */+ readonly flag_evaluations_mode?: FlagEvaluationsModeEnum;revenue_analytics_config?: TeamRevenueAnalyticsConfig;marketing_analytics_config?: TeamMarketingAnalyticsConfig;customer_analytics_config?: TeamCustomerAnalyticsConfig;@@ -82561,6 +82572,8 @@ export namespace Schemas {*/readonly user_access_level: string | null;readonly managed_viewsets: ProjectBackwardCompatManagedViewsets;+ /** Which table this project's feature flag usage data is read from. PostHog sets it for the whole organization. 0 reads the events table. 1 and 2 read the flag_evaluations table. */+ readonly flag_evaluations_mode: FlagEvaluationsModeEnum;revenue_analytics_config?: TeamRevenueAnalyticsConfig;marketing_analytics_config?: TeamMarketingAnalyticsConfig;customer_analytics_config?: TeamCustomerAnalyticsConfig;@@ -97866,6 +97879,12 @@ export namespace Schemas {max_feature_flags_override: number | null;/** The flag-count limit actually enforced for this team: the override when one is set, otherwise the global MAX_FEATURE_FLAGS_PER_TEAM setting. */effective_max_feature_flags: number;+ /** Which table the $feature_flag_called data of this team's organization is read from. Every team of an organization shares one mode. 0 reads events, 1 and 2 read flag_evaluations. 2 is reserved for ingestion to stop writing $feature_flag_called to events. Ingestion ignores 2 until that support deploys, so 2 acts as 1 until then. This is the stored mode: while the FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS instance setting is on, an organization on 1 has its Usage tab read events anyway.+ *+ * * `0` - Events+ * * `1` - Read flag evaluations+ * * `2` - Flag evaluations only */+ flag_evaluations_mode: FlagEvaluationsModeEnum;/** Number of feature flags the team has today, excluding soft-deleted ones, counted the same way the limit is enforced. */feature_flag_count: number;}