:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(dashboards): remove starter-dashboard-v2 experiment code (#66790)
Matt Puad5cf288ee2d0
diff --git a/posthog/api/test/test_signup.py b/posthog/api/test/test_signup.pyindex 3353a888b0a5..ef104e7ee760 100644--- a/posthog/api/test/test_signup.py+++ b/posthog/api/test/test_signup.py@@ -603,14 +603,9 @@ class TestSignupAPI(APIBaseTest):"attr": "password",}, [password, res.json()]- @mock.patch(- "posthog.helpers.signup_dashboard_experiment.get_starter_dashboard_variant",- return_value="test",- )- def test_default_dashboard_is_created_on_signup(self, _mock_variant):+ def test_default_dashboard_is_created_on_signup(self):"""Tests that the default web app dashboard is created on signup.- Note: This feature is currently behind a feature flag."""response = self.client.post(diff --git a/posthog/api/test/test_team.py b/posthog/api/test/test_team.pyindex 054523b348b6..d23052b00169 100644--- a/posthog/api/test/test_team.py+++ b/posthog/api/test/test_team.py@@ -400,11 +400,7 @@ def team_api_test_factory():)@freeze_time("2022-02-08")- @mock.patch(- "posthog.helpers.signup_dashboard_experiment.get_starter_dashboard_variant",- return_value="test",- )- def test_delete_team_activity_log(self, _mock_variant):+ def test_delete_team_activity_log(self):self.organization_membership.level = OrganizationMembership.Level.ADMINself.organization_membership.save()@@ -515,7 +511,7 @@ def team_api_test_factory():# `mock_capture` is patched.team: Team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization)team_pk = team.pk- # create_with_data fires a starter-dashboard exposure capture; only assert delete-time events+ # create_with_data fires capture events; clear them so we only assert delete-time eventsmock_capture.reset_mock()self.assertEqual(Team.objects.filter(organization=self.organization).count(), 2)diff --git a/posthog/helpers/signup_dashboard_experiment.py b/posthog/helpers/signup_dashboard_experiment.pydeleted file mode 100644index 1b30a6af8b69..000000000000--- a/posthog/helpers/signup_dashboard_experiment.py+++ /dev/null@@ -1,83 +0,0 @@-from __future__ import annotations--from typing import TYPE_CHECKING, Literal--import posthoganalytics--from products.dashboards.backend.models.dashboard import Dashboard-from products.dashboards.backend.models.dashboard_templates import DashboardTemplate--if TYPE_CHECKING:- from posthog.models.team.team import Team--STARTER_DASHBOARD_EXPERIMENT_FLAG_KEY = "starter-dashboard-v2"--StarterDashboardVariant = Literal["control", "test"]---def get_starter_dashboard_variant(team: Team) -> StarterDashboardVariant:- """Resolve experiment arm for a newly created non-demo project."""- try:- flag_result = posthoganalytics.get_feature_flag(- STARTER_DASHBOARD_EXPERIMENT_FLAG_KEY,- str(team.uuid),- groups={"organization": str(team.organization_id)},- )- except Exception:- return "control"-- # get_feature_flag is typed as FeatureFlag | None but returns the variant key string at- # runtime; normalise to str so the comparison is well-typed.- return "test" if str(flag_result) == "test" else "control"---def get_signup_dashboard_template(variant: StarterDashboardVariant) -> DashboardTemplate:- if variant == "test":- return DashboardTemplate.default_signup_template()- return DashboardTemplate.legacy_signup_template()---def get_signup_dashboard_name(variant: StarterDashboardVariant) -> str:- return "Your starter dashboard" if variant == "test" else "My App Dashboard"---def create_signup_primary_dashboard(team: Team, *, using: str | None = None) -> Dashboard:- from posthog.helpers.dashboard_templates import create_from_template # noqa: PLC0415 — breaks team import cycle-- variant = get_starter_dashboard_variant(team)- template = get_signup_dashboard_template(variant)-- dashboard = Dashboard.objects.db_manager(using).create(- name=get_signup_dashboard_name(variant),- pinned=True,- team=team,- description=template.dashboard_description or "",- )- create_from_template(dashboard, template)-- if team.extra_settings is None:- team.extra_settings = {}- team.extra_settings["starter_dashboard_variant"] = variant-- report_starter_dashboard_exposure(team, variant)- return dashboard---def report_starter_dashboard_exposure(team: Team, variant: StarterDashboardVariant) -> None:- from posthog.event_usage import report_team_action # noqa: PLC0415 — breaks team import cycle-- # Project-scoped assignment: distinct_id is the environment UUID so each new project- # gets a stable arm independent of which user created it.- report_team_action(- team,- "$feature_flag_called",- properties={- "$feature_flag": STARTER_DASHBOARD_EXPERIMENT_FLAG_KEY,- "$feature_flag_response": variant,- "starter_dashboard_variant": variant,- },- group_properties={- "starter_dashboard_variant": variant,- "starter_dashboard_experiment": STARTER_DASHBOARD_EXPERIMENT_FLAG_KEY,- },- )diff --git a/posthog/models/team/team.py b/posthog/models/team/team.pyindex 80ed9e81e644..7f9a7babe15d 100644--- a/posthog/models/team/team.py+++ b/posthog/models/team/team.py@@ -125,12 +125,22 @@ class TeamManager(models.Manager):team.extra_settings = {}team.extra_settings.setdefault("recorder_script", "posthog-recorder")- # Create default dashboards (A/B via starter-dashboard-v2; demo projects skip above)- from posthog.helpers.signup_dashboard_experiment import ( # noqa: PLC0415 — breaks team import cycle- create_signup_primary_dashboard,+ # Create default dashboards (demo projects skip above)+ from posthog.helpers.dashboard_templates import create_from_template # noqa: PLC0415 — breaks team import cycle++ from products.dashboards.backend.models.dashboard import Dashboard # noqa: PLC0415 — breaks team import cycle+ from products.dashboards.backend.models.dashboard_templates import ( # noqa: PLC0415 — breaks team import cycle+ DashboardTemplate,)- dashboard = create_signup_primary_dashboard(team, using=self.db)+ template = DashboardTemplate.default_signup_template()+ dashboard = Dashboard.objects.db_manager(self.db).create(+ name="Your starter dashboard",+ pinned=True,+ team=team,+ description=template.dashboard_description or "",+ )+ create_from_template(dashboard, template)team.primary_dashboard = dashboard# Create default session recording playlistsdiff --git a/posthog/test/test_team.py b/posthog/test/test_team.pyindex 18dcccf937dd..67c39ca7ee36 100644--- a/posthog/test/test_team.py+++ b/posthog/test/test_team.py@@ -21,11 +21,6 @@ from .base import BaseTestutil.can_enable_actor_on_events = True # ty: ignore[invalid-assignment]-STARTER_DASHBOARD_V2_VARIANT = mock.patch(- "posthog.helpers.signup_dashboard_experiment.get_starter_dashboard_variant",- return_value="test",-)-class TestModelCache(TestCase):def setUp(self):@@ -165,38 +160,14 @@ class TestTeam(BaseTest):[{"key": "id", "type": "cohort", "value": test_users_cohort.pk, "operator": "not_in"}],)- def test_create_team_sets_primary_dashboard_control_by_default(self):- team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization)- assert team.primary_dashboard is not None- assert team.extra_settings is not None- self.assertEqual(team.primary_dashboard.name, "My App Dashboard")- self.assertEqual(DashboardTile.objects.filter(dashboard=team.primary_dashboard).count(), 6)- self.assertEqual(team.extra_settings.get("starter_dashboard_variant"), "control")-- @STARTER_DASHBOARD_V2_VARIANT- def test_create_team_sets_primary_dashboard(self, _mock_variant):+ def test_create_team_sets_primary_dashboard(self):team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization)self.assertIsInstance(team.primary_dashboard, Dashboard)+ assert team.primary_dashboard is not None+ self.assertEqual(team.primary_dashboard.name, "Your starter dashboard")# Ensure insights are created and linked (8 insight tiles + 5 text tiles + 3 button tiles)self.assertEqual(DashboardTile.objects.filter(dashboard=team.primary_dashboard).count(), 16)- assert team.extra_settings is not None- self.assertEqual(team.extra_settings.get("starter_dashboard_variant"), "test")-- @mock.patch("posthog.helpers.signup_dashboard_experiment.posthoganalytics.get_feature_flag", return_value="test")- @mock.patch("posthog.event_usage.report_team_action")- def test_starter_dashboard_experiment_evaluates_feature_flag_per_project(- self, mock_report_team_action, mock_get_feature_flag- ):- team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization)-- mock_get_feature_flag.assert_called_once_with(- "starter-dashboard-v2",- str(team.uuid),- groups={"organization": str(team.organization_id)},- )- mock_report_team_action.assert_called_once()- self.assertEqual(mock_report_team_action.call_args.args[1], "$feature_flag_called")@mock.patch("posthoganalytics.feature_enabled", return_value=True)def test_team_on_cloud_uses_feature_flag_to_determine_person_on_events(self, mock_feature_enabled):@@ -291,8 +262,7 @@ class TestTeam(BaseTest):team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization, extra_settings=input_extra_settings)- # create_with_data also records the starter-dashboard experiment arm in extra_settings- self.assertEqual(team.extra_settings, {**expected_extra_settings, "starter_dashboard_variant": "control"})+ self.assertEqual(team.extra_settings, expected_extra_settings)@parameterized.expand([@@ -312,11 +282,7 @@ class TestTeam(BaseTest):("Weekly active users (WAUs)",),])- @mock.patch(- "posthog.helpers.signup_dashboard_experiment.get_starter_dashboard_variant",- return_value="test",- )- def test_default_dashboard_dau_wau_tiles_use_group_node(self, tile_name, _mock_variant):+ def test_default_dashboard_dau_wau_tiles_use_group_node(self, tile_name):team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization)tile = DashboardTile.objects.get(dashboard=team.primary_dashboard,@@ -339,11 +305,7 @@ class TestTeam(BaseTest):("Retention", "RetentionQuery"),])- @mock.patch(- "posthog.helpers.signup_dashboard_experiment.get_starter_dashboard_variant",- return_value="test",- )- def test_default_dashboard_pageview_only_tiles(self, tile_name, expected_kind, _mock_variant):+ def test_default_dashboard_pageview_only_tiles(self, tile_name, expected_kind):team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization)tile = DashboardTile.objects.get(dashboard=team.primary_dashboard,@@ -356,8 +318,7 @@ class TestTeam(BaseTest):assert "GroupNode" not in str(source)assert "$pageview" in str(source)- @STARTER_DASHBOARD_V2_VARIANT- def test_default_dashboard_funnel_tile_steps_through_pageview_to_autocapture(self, _mock_variant):+ def test_default_dashboard_funnel_tile_steps_through_pageview_to_autocapture(self):team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization)tile = DashboardTile.objects.get(dashboard=team.primary_dashboard,@@ -369,8 +330,7 @@ class TestTeam(BaseTest):assert source["kind"] == "FunnelsQuery"assert [step["event"] for step in source["series"]] == ["$pageview", "$autocapture"]- @STARTER_DASHBOARD_V2_VARIANT- def test_default_dashboard_button_tiles_link_to_related_products(self, _mock_variant):+ def test_default_dashboard_button_tiles_link_to_related_products(self):team = Team.objects.create_with_data(initiating_user=self.user, organization=self.organization)button_tiles = DashboardTile.objects.filter(dashboard=team.primary_dashboard,diff --git a/products/dashboards/backend/models/dashboard_templates.py b/products/dashboards/backend/models/dashboard_templates.pyindex 4e9a32cf7e77..5437e796d594 100644--- a/products/dashboards/backend/models/dashboard_templates.py+++ b/products/dashboards/backend/models/dashboard_templates.py@@ -66,8 +66,8 @@ class DashboardTemplate(UUIDTModel, RootTeamMixin):"""The authoritative hardcoded "Product analytics" template the rest of the codebase relies on(the DEFAULT_APP seed, the DB-absent fallback in create_dashboard_from_template, and the global- template seed used in tests). It is intentionally the legacy shape; the starter-dashboard-v2- test arm opts into the refreshed layout via default_signup_template().+ template seed used in tests). It is intentionally the legacy shape; new projects get the+ refreshed layout via default_signup_template().This OG template is not stored in https://github.com/PostHog/templates-repositoryThe system assumes this template is always present and doesn't wait to import it from the template repository@@ -77,7 +77,7 @@ class DashboardTemplate(UUIDTModel, RootTeamMixin):@staticmethoddef default_signup_template() -> "DashboardTemplate":"""- Refreshed signup dashboard (test arm of the starter-dashboard-v2 experiment).+ Refreshed signup dashboard given to every new non-demo project's primary dashboard.This OG template is not stored in https://github.com/PostHog/templates-repositoryThe system assumes this template is always present and doesn't wait to import it from the template repository"""@@ -511,7 +511,7 @@ class DashboardTemplate(UUIDTModel, RootTeamMixin):@staticmethoddef legacy_signup_template() -> "DashboardTemplate":"""- Pre-2026 default signup dashboard (control arm of starter-dashboard-v2 experiment).+ The legacy "Product analytics" dashboard, still used by the DEFAULT_APP template seed.This OG template is not stored in https://github.com/PostHog/templates-repositoryThe system assumes this template is always present and doesn't wait to import it from the template repository"""