: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(subscriptions): move the subscriptions api into the product (#116833)
Thomas Obermüller026d065d4814
diff --git a/.agents/skills/developing-subscriptions/SKILL.md b/.agents/skills/developing-subscriptions/SKILL.mdindex 6552b820a826..661a7365200e 100644--- a/.agents/skills/developing-subscriptions/SKILL.md+++ b/.agents/skills/developing-subscriptions/SKILL.md@@ -110,19 +110,19 @@ Use a mock destination or test transport for external delivery checks.## 6. Code map-| Concern | Start here |-| --------------------------------------------------- | ------------------------------------------------------- |-| API, serializers, validation, delivery history | `ee/api/subscription.py` |-| Subscription and delivery models | `products/exports/backend/models/subscription.py` |-| Delivery workflows and activities | `products/subscriptions/backend/temporal/` |-| Destination delivery and automatic disable behavior | `products/subscriptions/backend/logic/` |-| What core and other products may import | `products/subscriptions/backend/facade/` |-| Management UI and frontend logic | `products/subscriptions/frontend/` |-| MCP tool definitions | `products/subscriptions/mcp/tools.yaml` |-| API behavior tests | `ee/api/test/test_subscription.py` |-| Destination delivery tests | `products/subscriptions/backend/tests/logic/` |-| Workflow tests | `products/subscriptions/backend/tests/temporal/` |-| Published operational guidance | `products/subscriptions/skills/managing-subscriptions/` |+| Concern | Start here |+| --------------------------------------------------- | ----------------------------------------------------------- |+| API, serializers, validation, delivery history | `products/subscriptions/backend/presentation/views.py` |+| Subscription and delivery models | `products/exports/backend/models/subscription.py` |+| Delivery workflows and activities | `products/subscriptions/backend/temporal/` |+| Destination delivery and automatic disable behavior | `products/subscriptions/backend/logic/` |+| What core and other products may import | `products/subscriptions/backend/facade/` |+| Management UI and frontend logic | `products/subscriptions/frontend/` |+| MCP tool definitions | `products/subscriptions/mcp/tools.yaml` |+| API behavior tests | `products/subscriptions/backend/tests/test_subscription.py` |+| Destination delivery tests | `products/subscriptions/backend/tests/logic/` |+| Workflow tests | `products/subscriptions/backend/tests/temporal/` |+| Published operational guidance | `products/subscriptions/skills/managing-subscriptions/` |## Companion skillsdiff --git a/bin/test/test_find_python_dependencies.py b/bin/test/test_find_python_dependencies.pyindex 3ea74837587d..b34ad54814d4 100644--- a/bin/test/test_find_python_dependencies.py+++ b/bin/test/test_find_python_dependencies.py@@ -59,7 +59,7 @@ class TestFindPythonDependencies(unittest.TestCase):("The utils file (e.g. caching key)", "posthog/utils.py", True),("The underlying query runner", "posthog/hogql_queries/query_runner.py", True),# Non-dependencies - should NOT be included- ("API endpoint that calls the worker", "ee/api/subscription.py", False),+ ("API endpoint that calls the worker", "products/subscriptions/backend/presentation/views.py", False),("Schedule config that starts workflows", "posthog/temporal/schedule.py", False),("Unrelated admin module", "posthog/admin/__init__.py", False),]@@ -85,7 +85,7 @@ class TestFindPythonDependencies(unittest.TestCase):("image_exporter", "products/exports/backend/tasks/image_exporter.py", True),("subscription_utils", "products/subscriptions/backend/logic/subscription_utils.py", True),# Files that should NOT affect the worker- ("api_endpoint", "ee/api/subscription.py", False),+ ("api_endpoint", "products/subscriptions/backend/presentation/views.py", False),("schedule_config", "posthog/temporal/schedule.py", False),("frontend_code", "frontend/src/test.tsx", False),("rust_code", "rust/some_file.rs", False),@@ -190,7 +190,7 @@ class TestFindPythonDependencies(unittest.TestCase):("utils", "posthog/utils.py", True),("query_runner", "posthog/hogql_queries/query_runner.py", True),# Non-dependencies - should NOT trigger rebuild- ("api_endpoint", "ee/api/subscription.py", False),+ ("api_endpoint", "products/subscriptions/backend/presentation/views.py", False),("schedule_config", "posthog/temporal/schedule.py", False),("admin", "posthog/admin/admins/batch_imports.py", False),("tests", "posthog/test/test_utils.py", False),diff --git a/ee/urls.py b/ee/urls.pyindex d289f111a343..5f26231174e8 100644--- a/ee/urls.py+++ b/ee/urls.py@@ -25,7 +25,7 @@ from ee.api.vercel import vercel_connect, vercel_ssofrom ee.middleware import admin_oauth2_callbackfrom ee.support_sidebar_max.views import MaxChatViewSet-from .api import authentication, billing, conversation, core_memory, organization_billing, project_billing, subscription+from .api import authentication, billing, conversation, core_memory, organization_billing, project_billingfrom .api.scim import views as scim_views@@ -46,16 +46,6 @@ def extend_api_router() -> None:root_router.register(r"integrations", integration.PublicIntegrationViewSet)projects_router.register(r"hooks", hooks.HookViewSet, "project_hooks", ["team_id"])- project_subscriptions_router = projects_router.register(- r"subscriptions", subscription.SubscriptionViewSet, "project_subscriptions", ["team_id"]- )- project_subscriptions_router.register(- r"deliveries",- subscription.SubscriptionDeliveryViewSet,- "project_subscription_deliveries",- ["team_id", "subscription_id"],- )-projects_router.register(r"conversations", conversation.ConversationViewSet, "project_conversations", ["team_id"])projects_router.register(r"core_memory", core_memory.MaxCoreMemoryViewSet, "project_core_memory", ["team_id"])diff --git a/posthog/test/repo_invariants/test_pagination_contract.py b/posthog/test/repo_invariants/test_pagination_contract.pyindex 1a5582ca8d11..8e3afd5c0c95 100644--- a/posthog/test/repo_invariants/test_pagination_contract.py+++ b/posthog/test/repo_invariants/test_pagination_contract.py@@ -31,8 +31,8 @@ EXISTING_CUSTOM_LIST_VIEWSETS = {"products.aeo.backend.presentation.views.AEOPromptViewSet","ee.api.billing.BillingViewset","ee.api.quota_limits.QuotaLimitsViewSet",- "ee.api.subscription.SubscriptionDeliveryViewSet",- "ee.api.subscription.SubscriptionViewSet",+ "products.subscriptions.backend.presentation.views.SubscriptionDeliveryViewSet",+ "products.subscriptions.backend.presentation.views.SubscriptionViewSet","ee.clickhouse.views.experiment_saved_metrics.ExperimentSavedMetricViewSet","ee.clickhouse.views.person.EnterprisePersonViewSet","ee.clickhouse.views.person.LegacyEnterprisePersonViewSet",diff --git a/posthog/test/repo_invariants/test_serializer_timestamp_guard.py b/posthog/test/repo_invariants/test_serializer_timestamp_guard.pyindex 8d81c85ba7bd..5bdd5c5ae667 100644--- a/posthog/test/repo_invariants/test_serializer_timestamp_guard.py+++ b/posthog/test/repo_invariants/test_serializer_timestamp_guard.py@@ -83,10 +83,10 @@ REVIEWED_WRITABLE: dict[str, str] = {"products.cdp.backend.api.hog_function.HogFunctionSerializer.base_updated_at": "Optimistic-concurrency guard: the client echoes the timestamp it loaded, and the view pops it before save","products.managed_migrations.backend.api.batch_imports.BatchImportDateRangeSourceCreateSerializer.start_date": "Client picks the import window; write-only input, never stored on the model","products.managed_migrations.backend.api.batch_imports.BatchImportDateRangeSourceCreateSerializer.end_date": "Client picks the import window; write-only input, never stored on the model",- "ee.api.subscription.SubscriptionSerializer.start_date": "Client sets when delivery starts",- "ee.api.subscription.SubscriptionSerializer.until_date": "Client sets when delivery stops, or null for indefinite",- "ee.api.subscription.SubscriptionWriteSerializer.start_date": "Client sets when delivery starts",- "ee.api.subscription.SubscriptionWriteSerializer.until_date": "Client sets when delivery stops, or null for indefinite",+ "products.subscriptions.backend.presentation.views.SubscriptionSerializer.start_date": "Client sets when delivery starts",+ "products.subscriptions.backend.presentation.views.SubscriptionSerializer.until_date": "Client sets when delivery stops, or null for indefinite",+ "products.subscriptions.backend.presentation.views.SubscriptionWriteSerializer.start_date": "Client sets when delivery starts",+ "products.subscriptions.backend.presentation.views.SubscriptionWriteSerializer.until_date": "Client sets when delivery stops, or null for indefinite","posthog.api.advanced_activity_logs.viewset.ActivityLogFlatExportSerializer.created_at": "TODO: server-owned audit timestamp, make read-only","posthog.api.advanced_activity_logs.viewset.ActivityLogSerializer.created_at": "TODO: server-owned audit timestamp, make read-only","posthog.api.event_definition.EventDefinitionSerializer.created_at": "TODO: server-owned, set when ingestion first sees the event",diff --git a/products/exports/backend/models/subscription.py b/products/exports/backend/models/subscription.pyindex d7a61386cd51..4afc2b30247d 100644--- a/products/exports/backend/models/subscription.py+++ b/products/exports/backend/models/subscription.py@@ -186,7 +186,7 @@ class Subscription(ModelActivityMixin, models.Model):# instead of re-running the planner LLM. Edits that require a fresh plan clear it in save().# Shape is versioned; see report_pipeline._plan_to_freeze.ai_query_plan = models.JSONField(null=True, blank=True, default=None)- # Source of truth for the shape: ee.api.subscription.AIPromptConfigSerializer (writes) and+ # Source of truth for the shape: products.subscriptions.backend.presentation.views.AIPromptConfigSerializer (writes) and# normalize_ai_window below (reads).ai_prompt_config = models.JSONField(default=dict, blank=True)diff --git a/products/feature_flags/backend/management/commands/test/test_delete_feature_flag_usage_insights.py b/products/feature_flags/backend/management/commands/test/test_delete_feature_flag_usage_insights.pyindex b7578185ea04..ca6121823489 100644--- a/products/feature_flags/backend/management/commands/test/test_delete_feature_flag_usage_insights.py+++ b/products/feature_flags/backend/management/commands/test/test_delete_feature_flag_usage_insights.py@@ -27,8 +27,7 @@ from products.dashboards.backend.models.dashboard_tile import DashboardTilefrom products.feature_flags.backend.models.feature_flag import FeatureFlagfrom products.feature_flags.backend.test.usage_dashboard_fixtures import create_usage_dashboardfrom products.product_analytics.backend.facade.models import Insight--from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscription+from products.subscriptions.backend.facade.testing import create_subscriptionclass TestDeleteFeatureFlagUsageInsights(BaseTest):@@ -244,7 +243,7 @@ class TestDeleteFeatureFlagUsageInsights(BaseTest):elif signal == "sharing":SharingConfiguration.objects.create(team=self.team, insight=kept, enabled=True)elif signal in ("subscription", "subscription_paused"):- create_subscription(team=self.team, insight=kept, enabled=signal != "subscription_paused")+ create_subscription(team_id=self.team.id, insight_id=kept.id, enabled=signal != "subscription_paused")elif signal == "alert":AlertConfiguration.objects.create(team=self.team, insight=kept, created_by=self.user, name="a")elif signal == "keep_list":@@ -272,7 +271,7 @@ class TestDeleteFeatureFlagUsageInsights(BaseTest):SharingConfiguration.objects.create(team=self.team, dashboard_id=flag.usage_dashboard_id, enabled=True)else:create_subscription(- team=self.team, dashboard_id=flag.usage_dashboard_id, enabled=signal != "subscribed_paused"+ team_id=self.team.id, dashboard_id=flag.usage_dashboard_id, enabled=signal != "subscribed_paused")self._run()diff --git a/products/isolation_baseline.txt b/products/isolation_baseline.txtindex 515edf12f74e..c8354d8c32fa 100644--- a/products/isolation_baseline.txt+++ b/products/isolation_baseline.txt@@ -67,6 +67,7 @@ revenue_analyticssignalsskillsslack_app+subscriptionssurveystaskstracingdiff --git a/products/model_crossing_uses_baseline.txt b/products/model_crossing_uses_baseline.txtindex 1daef125ff40..d469dbc27a11 100644--- a/products/model_crossing_uses_baseline.txt+++ b/products/model_crossing_uses_baseline.txt@@ -521,8 +521,6 @@ posthog.User web_analytics.WebAnalyticsFilterPreset.last_modified_by reverse-accproduct_analytics.Insight alerts.AlertConfiguration.insight reverse-accessor(alertconfiguration_set) 1product_analytics.Insight dashboards.Dashboard.insights reverse-accessor(dashboards) 1product_analytics.Insight dashboards.DashboardTile.insight reverse-accessor(dashboard_tiles) 1-product_analytics.Insight ee.api.subscription instance-many(filter) 2-product_analytics.Insight ee.api.subscription instance-many(manager) 2product_analytics.Insight ee.hogai.artifacts.handlers.visualization instance-many(filter) 1product_analytics.Insight ee.hogai.artifacts.types in-collection 1product_analytics.Insight ee.hogai.chat_agent.insights.nodes instance-many(order_by) 1@@ -592,6 +590,8 @@ product_analytics.Insight products.pulse.backend.sources.anchored_insights instaproduct_analytics.Insight products.pulse.backend.sources.resource_health instance-many(filter) 2product_analytics.Insight products.reminders.backend.constants in-collection 1product_analytics.Insight products.slack_app.backend.slack_link_unfurl instance-single 1+product_analytics.Insight products.subscriptions.backend.presentation.views instance-many(filter) 2+product_analytics.Insight products.subscriptions.backend.presentation.views instance-many(manager) 2product_analytics.Insight products.subscriptions.backend.temporal.snapshot_activities instance-many(only) 1product_analytics.Insight products.surveys.backend.api.survey instance-single 1product_analytics.Insight surveys.Survey.linked_insight reverse-accessor(surveys_linked_insight) 1diff --git a/products/notebooks/backend/presentation/views/notebook.py b/products/notebooks/backend/presentation/views/notebook.pyindex efd33b05635b..0ad6dbf00bac 100644--- a/products/notebooks/backend/presentation/views/notebook.py+++ b/products/notebooks/backend/presentation/views/notebook.py@@ -749,7 +749,7 @@ class NotebookViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDdef _require_query_access(self) -> None:# SQLV2 runs arbitrary HogQL and returns analytics rows, so notebook access alone is not# enough — a notebook editor whose query access is denied must not read data through it.- # Mirrors ee/api/subscription.py: the query:read scope gates tokens, this gates sessions+ # Mirrors products/subscriptions/backend/presentation/views.py: the query:read scope gates tokens, this gates sessions# (which carry no scopes) and enforces real RBAC for tokens too.if not self._has_query_access():raise PermissionDenied("You need query access to run SQL in a notebook.")diff --git a/products/subscriptions/backend/facade/testing.py b/products/subscriptions/backend/facade/testing.pyindex f123d72fb216..b8992c2d629d 100644--- a/products/subscriptions/backend/facade/testing.py+++ b/products/subscriptions/backend/facade/testing.py@@ -1,10 +1,32 @@"""Test-support facade for subscriptions.-Suites outside this product read what they need to build subscription fixtures from here.+Suites outside this product plant subscription rows and read fixture constants through here+instead of importing the models or the product's own test helpers."""+from datetime import UTC, datetime++from products.exports.backend.models.subscription import Subscriptionfrom products.subscriptions.backend.temporal.ai_subscription.spec_generator import (AI_QUERY_PLAN_VERSION as AI_QUERY_PLAN_VERSION,)-__all__ = ["AI_QUERY_PLAN_VERSION"]+__all__ = ["AI_QUERY_PLAN_VERSION", "create_subscription"]+++def create_subscription(+ *, team_id: int, insight_id: int | None = None, dashboard_id: int | None = None, enabled: bool = True+) -> int:+ """Create a daily email subscription to an insight or a dashboard, and return its id."""+ subscription = Subscription.objects.create(+ team_id=team_id,+ insight_id=insight_id,+ dashboard_id=dashboard_id,+ enabled=enabled,+ target_type=Subscription.SubscriptionTarget.EMAIL,+ target_value="[email protected],[email protected]",+ frequency=Subscription.SubscriptionFrequency.DAILY,+ interval=1,+ start_date=datetime(2022, 1, 1, 9, 0, tzinfo=UTC),+ )+ return subscription.iddiff --git a/ee/tasks/test/subscriptions/__init__.py b/products/subscriptions/backend/presentation/__init__.pysimilarity index 100%rename from ee/tasks/test/subscriptions/__init__.pyrename to products/subscriptions/backend/presentation/__init__.pydiff --git a/ee/api/subscription.py b/products/subscriptions/backend/presentation/views.pysimilarity index 98%rename from ee/api/subscription.pyrename to products/subscriptions/backend/presentation/views.pyindex 047693fe8a47..fca0805ba95e 100644--- a/ee/api/subscription.py+++ b/products/subscriptions/backend/presentation/views.py@@ -1,7 +1,7 @@import uuidimport asynciofrom collections.abc import Callable, Iterable-from typing import Any, ClassVar, Optional+from typing import Any, ClassVar, Optional, castfrom django.conf import settingsfrom django.contrib.postgres.expressions import ArraySubquery@@ -25,10 +25,8 @@ from django.db.models import (Value,)from django.db.models.functions import Cast, Concat-from django.http import HttpRequest, JsonResponsefrom django.shortcuts import get_object_or_404-import jwtimport posthoganalyticsfrom drf_spectacular.utils import (OpenApiParameter,@@ -42,7 +40,10 @@ from rest_framework import exceptions, filters, serializers, status, viewsetsfrom rest_framework.decorators import actionfrom rest_framework.exceptions import ValidationErrorfrom rest_framework.pagination import CursorPagination+from rest_framework.request import Requestfrom rest_framework.response import Response+from rest_framework.throttling import BaseThrottle+from rest_framework.views import APIViewfrom temporalio.exceptions import WorkflowAlreadyStartedErrorfrom posthog.schema import SubscriptionAIContextLimit@@ -58,6 +59,8 @@ from posthog.event_usage import AnalyticsProps, get_request_analytics_propertiesfrom posthog.exceptions import QuotaLimitExceededfrom posthog.exceptions_capture import capture_exceptionfrom posthog.models.integration import Integration, SlackIntegration+from posthog.models.organization import Organization+from posthog.models.user import Userfrom posthog.rate_limit import SubscriptionTestDeliveryThrottlefrom posthog.resource_limits import LimitKey, check_count_limit, get_organization_limitfrom posthog.scopes import APIScopeObject@@ -75,7 +78,6 @@ from products.exports.backend.models.subscription import (Subscription,SubscriptionDelivery,attribute_subscription_saves,- unsubscribe_using_token,)from products.exports.backend.models.subscription_context import SubscriptionContext, context_reffrom products.product_analytics.backend.facade.api import insights_including_soft_deleted_for_team@@ -129,15 +131,15 @@ def _capture_post_write_failure(exc: Exception) -> None:pass-def _summary_quota_cache_key(organization_id) -> str:+def _summary_quota_cache_key(organization_id: uuid.UUID) -> str:return f"subscription:summary_quota:org:{organization_id}"-def _summary_cap_hit_dedupe_key(organization_id) -> str:+def _summary_cap_hit_dedupe_key(organization_id: uuid.UUID) -> str:return f"subscription:summary_cap_hit:org:{organization_id}"-def _count_active_summaries(organization) -> int:+def _count_active_summaries(organization: Organization) -> int:"""Count subscriptions with summary_enabled=True (and not soft-deleted) acrossevery team in this organization. Single source of truth for both the cap-checkin the serializer and the `summary_quota` action endpoint."""@@ -148,7 +150,7 @@ def _count_active_summaries(organization) -> int:).count()-def _invalidate_summary_quota_cache(organization_id) -> None:+def _invalidate_summary_quota_cache(organization_id: uuid.UUID) -> None:cache.delete(_summary_quota_cache_key(organization_id))@@ -216,7 +218,7 @@ def _viewable_queryset(return viewable.filter(Q(id__in=allowed_ids) | Q(created_by=user_access_control.user))-def _ai_create_gate_reason(organization, distinct_id: str) -> Optional[str]:+def _ai_create_gate_reason(organization: Organization, distinct_id: str) -> Optional[str]:if not settings.DEBUG and not is_cloud():return "AI subscriptions are only available in PostHog Cloud."if not organization.is_ai_data_processing_approved:@@ -238,10 +240,10 @@ def _ai_create_gate_reason(organization, distinct_id: str) -> Optional[str]:class DashboardExportInsightsField(serializers.Field):"""Custom field to handle ManyToMany dashboard_export_insights as a list of IDs."""- def to_representation(self, value):+ def to_representation(self, value: Manager) -> list[int]:return [obj.id for obj in value.all()]- def to_internal_value(self, data):+ def to_internal_value(self, data: object) -> list[int]:if not isinstance(data, list):raise serializers.ValidationError("Expected a list of insight IDs.")for item in data:@@ -759,7 +761,7 @@ class SubscriptionWriteSerializer(serializers.ModelSerializer):return validated_contexts- def validate(self, attrs):+ def validate(self, attrs: dict) -> dict:request = self.context.get("request")# Re-run the free-tier cap on create AND on restore (deleted: true → false) —# a soft-deleted row frees its slot, so PATCHing one back to active re-occupies@@ -1032,7 +1034,7 @@ class SubscriptionWriteSerializer(serializers.ModelSerializer):"Increase the limits in Billing settings, or ask an org admin to do so.")- def _validate_summary_enabled_org_limit(self, organization) -> None:+ def _validate_summary_enabled_org_limit(self, organization: Organization) -> None:# Already-on subscriptions stay on for grandfathered orgs already over# the cap; the becoming-active check in validate() ensures we only get# here when the row is transitioning into the active-summary state.@@ -1057,7 +1059,7 @@ class SubscriptionWriteSerializer(serializers.ModelSerializer):return str(request.user.distinct_id)return f"team_{self.context.get('team_id')}"- def _capture_summary_cap_hit(self, organization, active_count: int, limit: int) -> None:+ def _capture_summary_cap_hit(self, organization: Organization, active_count: int, limit: int) -> None:# Rate-limited to one event per org per 10 minutes so a misbehaving# client retrying in a loop doesn't spam the analytics stream. Within# that window the user-visible 402 still fires every time.@@ -1083,7 +1085,7 @@ class SubscriptionWriteSerializer(serializers.ModelSerializer):# Telemetry must never poison the validation path.pass- def _validate_dashboard_export_subscription(self, attrs):+ def _validate_dashboard_export_subscription(self, attrs: dict) -> None:dashboard = attrs.get("dashboard") or (self.instance.dashboard if self.instance else None)if dashboard is None:# Reject dashboard_export_insights on non dashboard subscriptions@@ -1797,7 +1799,7 @@ class SubscriptionViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.M# token least-privileged, and the RBAC check in check_permissions enforces actual query access# for every write — a scope is only a capability flag, not proof of RBAC (personal keys can# carry query:read without it), and session auth has no scopes at all.- def dangerously_get_required_scopes(self, request, view) -> list[str] | None:+ def dangerously_get_required_scopes(self, request: Request, view: APIView) -> list[str] | None:if request.method in ("GET", "HEAD", "OPTIONS"):return Nonescopes = [f"{self.scope_object}:write"]@@ -1805,7 +1807,7 @@ class SubscriptionViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.Mscopes.append("query:read")return scopes- def check_permissions(self, request) -> None:+ def check_permissions(self, request: Request) -> None:super().check_permissions(request)# Enforce query-viewer RBAC for every AI-prompt write, regardless of auth: the query:read# scope above gates tokens but does not prove the owner has query access, and session auth@@ -1817,14 +1819,14 @@ class SubscriptionViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.M):raise exceptions.PermissionDenied("You need query access to create or deliver AI prompt subscriptions.")- def _write_touches_ai_subscription(self, request, view) -> bool:+ def _write_touches_ai_subscription(self, request: Request, view: APIView) -> bool:if request.data.get("prompt"): # create (or a body that sets a prompt)return True# Existing subscription (update / test-delivery): resolve its kind by pk, team-scoped.pk = view.kwargs.get("pk")return bool(pk) and _subscription_is_ai_prompt(pk, self.team_id)- def get_throttles(self):+ def get_throttles(self) -> list[BaseThrottle]:throttles = super().get_throttles()# An update that requests send_test_now enqueues a real email/Slack delivery — the same# blast radius as the test-delivery action — so it shares that team-wide throttle.@@ -1833,7 +1835,7 @@ class SubscriptionViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.Mthrottles.append(SubscriptionTestDeliveryThrottle())return throttles- def safely_get_queryset(self, queryset) -> QuerySet:+ def safely_get_queryset(self, queryset: QuerySet) -> QuerySet:request_params = self.request.GET.dict()if self.action == "list":@@ -1949,7 +1951,7 @@ class SubscriptionViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.Murl_path="summary_quota",required_scopes=["subscription:read"],)- def summary_quota(self, request, **kwargs):+ def summary_quota(self, request: Request, **kwargs) -> Response:organization = self.organizationcache_key = _summary_quota_cache_key(organization.id)cached = cache.get(cache_key)@@ -1987,7 +1989,7 @@ class SubscriptionViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.Mpagination_class=SubscriptionSummaryCursorPagination,filter_backends=[],)- def summaries(self, request, **kwargs):+ def summaries(self, request: Request, **kwargs) -> Response:query = SubscriptionSummariesQuerySerializer(data=request.query_params)query.is_valid(raise_exception=True)if "insight" in query.validated_data:@@ -2059,7 +2061,7 @@ class SubscriptionViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.M# also require query:read (test-delivery runs the AI HogQL pipeline). A static# required_scopes here would short-circuit that check.)- def test_delivery(self, request, **kwargs):+ def test_delivery(self, request: Request, **kwargs) -> Response:subscription = self.get_object()if subscription.deleted:return Response(status=status.HTTP_404_NOT_FOUND)@@ -2104,7 +2106,7 @@ class SubscriptionViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.M)posthoganalytics.capture(- distinct_id=str(request.user.distinct_id),+ distinct_id=str(cast(User, request.user).distinct_id),event="subscription_test_delivery_scheduled",properties={**get_request_analytics_properties(request),@@ -2291,7 +2293,7 @@ class SubscriptionDeliverySerializer(serializers.ModelSerializer):status = snapshot.get(AI_REPORT_QUERY_PLAN_STATUS_KEY)return status if isinstance(status, str) and status in AIQueryPlanStatus.values else None- def to_representation(self, instance):+ def to_representation(self, instance: SubscriptionDelivery) -> dict:data = super().to_representation(instance)# The viewset sets this flag when an AI prompt delivery is read by a caller without query# access; scrub the query-derived report so subscription:read (or a self-granted query:read@@ -2394,16 +2396,3 @@ class SubscriptionDeliveryViewSet(TeamAndOrgViewSetMixin, viewsets.ReadOnlyModel)queryset = queryset.filter(status=status_param)return queryset.filter(_viewable_delivery_filter(self.user_access_control, self.team_id)).distinct()---def unsubscribe(request: HttpRequest):- token = request.GET.get("token")- if not token:- return JsonResponse({"success": False})-- try:- unsubscribe_using_token(token)- except jwt.DecodeError:- return JsonResponse({"success": False})-- return JsonResponse({"success": True})diff --git a/products/subscriptions/backend/routes.py b/products/subscriptions/backend/routes.pynew file mode 100644index 000000000000..15a68955cc52--- /dev/null+++ b/products/subscriptions/backend/routes.py@@ -0,0 +1,23 @@+from posthog.api.routing import RouterRegistry+from posthog.settings import EE_AVAILABLE+++def register_routes(routers: RouterRegistry) -> None:+ # The subscriptions API is part of the enterprise edition, so a non-EE install serves none of these routes.+ if not EE_AVAILABLE:+ return++ from products.subscriptions.backend.presentation.views import ( # noqa: PLC0415 — the views import ee/, which a non-EE install does not ship+ SubscriptionDeliveryViewSet,+ SubscriptionViewSet,+ )++ subscriptions_router = routers.projects.register(+ r"subscriptions", SubscriptionViewSet, "project_subscriptions", ["team_id"]+ )+ subscriptions_router.register(+ r"deliveries",+ SubscriptionDeliveryViewSet,+ "project_subscription_deliveries",+ ["team_id", "subscription_id"],+ )diff --git a/products/subscriptions/backend/temporal/test_delivery_activities.py b/products/subscriptions/backend/temporal/test_delivery_activities.pyindex d6b6fcf70ac8..2fe94ef85268 100644--- a/products/subscriptions/backend/temporal/test_delivery_activities.py+++ b/products/subscriptions/backend/temporal/test_delivery_activities.py@@ -39,8 +39,7 @@ from products.subscriptions.backend.temporal.types import (TrackedSubscriptionInputs,)from products.subscriptions.backend.temporal.workflows import ProcessAISubscriptionWorkflow, ProcessSubscriptionWorkflow--from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscription+from products.subscriptions.backend.tests.subscriptions_test_factory import create_subscriptionpytestmark = [pytest.mark.asyncio, pytest.mark.django_db(transaction=True)]diff --git a/products/subscriptions/backend/temporal/test_webhook_delivery.py b/products/subscriptions/backend/temporal/test_webhook_delivery.pyindex 38278700b959..25bbb4dbc4ba 100644--- a/products/subscriptions/backend/temporal/test_webhook_delivery.py+++ b/products/subscriptions/backend/temporal/test_webhook_delivery.py@@ -19,8 +19,7 @@ from posthog.security.url_validation import PinnedUrlVerdictfrom products.exports.backend.models.subscription import Subscriptionfrom products.subscriptions.backend.temporal.delivery_webhook import _WEBHOOK_SEND_CAPACITY, deliver_teams_webhookfrom products.subscriptions.backend.temporal.types import RecipientResult--from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscription+from products.subscriptions.backend.tests.subscriptions_test_factory import create_subscriptionpytestmark = pytest.mark.asynciodiff --git a/products/subscriptions/backend/tests/logic/test_email_subscriptions.py b/products/subscriptions/backend/tests/logic/test_email_subscriptions.pyindex 3fa881198e2f..eab12d928a8a 100644--- a/products/subscriptions/backend/tests/logic/test_email_subscriptions.py+++ b/products/subscriptions/backend/tests/logic/test_email_subscriptions.py@@ -16,8 +16,7 @@ from products.exports.backend.models.subscription import Subscriptionfrom products.product_analytics.backend.facade.models import Insightfrom products.subscriptions.backend.logic.email_subscriptions import send_email_subscription_reportfrom products.subscriptions.backend.logic.subscription_utils import MAX_INSIGHTS--from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscription+from products.subscriptions.backend.tests.subscriptions_test_factory import create_subscriptiondef mock_ee_email_messages(MockEmailMessage: MagicMock):diff --git a/products/subscriptions/backend/tests/logic/test_slack_subscriptions.py b/products/subscriptions/backend/tests/logic/test_slack_subscriptions.pyindex c3d996cea3a9..a481c55e9531 100644--- a/products/subscriptions/backend/tests/logic/test_slack_subscriptions.py+++ b/products/subscriptions/backend/tests/logic/test_slack_subscriptions.py@@ -29,8 +29,7 @@ from products.subscriptions.backend.logic.slack_subscriptions import (send_slack_subscription_report,)from products.subscriptions.backend.logic.subscription_utils import ASSET_GENERATION_FAILED_MESSAGE--from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscription+from products.subscriptions.backend.tests.subscriptions_test_factory import create_subscriptiondef _make_slack_api_error(error_code: str, **extra_data) -> SlackApiError:diff --git a/products/subscriptions/backend/tests/logic/test_subscriptions_utils.py b/products/subscriptions/backend/tests/logic/test_subscriptions_utils.pyindex d1176bf25270..12dfbaf52bc8 100644--- a/products/subscriptions/backend/tests/logic/test_subscriptions_utils.py+++ b/products/subscriptions/backend/tests/logic/test_subscriptions_utils.py@@ -20,8 +20,7 @@ from products.subscriptions.backend.logic.subscription_utils import (shared_insight_image,subscription_asset_error_message,)--from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscription+from products.subscriptions.backend.tests.subscriptions_test_factory import create_subscription@patch("products.subscriptions.backend.logic.subscription_utils.chain")diff --git a/products/subscriptions/backend/tests/logic/test_teams_subscriptions.py b/products/subscriptions/backend/tests/logic/test_teams_subscriptions.pyindex dd57f246fe0c..9ddd12ed420b 100644--- a/products/subscriptions/backend/tests/logic/test_teams_subscriptions.py+++ b/products/subscriptions/backend/tests/logic/test_teams_subscriptions.py@@ -9,8 +9,7 @@ from products.subscriptions.backend.logic.teams_subscriptions import (TEAMS_CARD_TEXT_BUDGET,build_teams_subscription_card,)--from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscription+from products.subscriptions.backend.tests.subscriptions_test_factory import create_subscriptionVALID_TEAMS_WEBHOOK_URL = ("https://prod-25.westeurope.logic.azure.com:443/workflows/abc123/triggers/manual/paths/invoke?sig=secret"diff --git a/ee/tasks/test/subscriptions/subscriptions_test_factory.py b/products/subscriptions/backend/tests/subscriptions_test_factory.pysimilarity index 100%rename from ee/tasks/test/subscriptions/subscriptions_test_factory.pyrename to products/subscriptions/backend/tests/subscriptions_test_factory.pydiff --git a/products/subscriptions/backend/tests/temporal/test_subscriptions_workflows.py b/products/subscriptions/backend/tests/temporal/test_subscriptions_workflows.pyindex 868aac05ba4b..dfda647f97fc 100644--- a/products/subscriptions/backend/tests/temporal/test_subscriptions_workflows.py+++ b/products/subscriptions/backend/tests/temporal/test_subscriptions_workflows.py@@ -92,8 +92,7 @@ from products.subscriptions.backend.temporal.workflows import (ScheduleAllSubscriptionsWorkflow,_summarize_export_failure_details,)--from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscription+from products.subscriptions.backend.tests.subscriptions_test_factory import create_subscriptionpytestmark = [pytest.mark.asyncio, pytest.mark.django_db(transaction=True)]diff --git a/ee/api/test/test_subscription.py b/products/subscriptions/backend/tests/test_subscription.pysimilarity index 98%rename from ee/api/test/test_subscription.pyrename to products/subscriptions/backend/tests/test_subscription.pyindex d051f5a6611b..3a14a8db9444 100644--- a/ee/api/test/test_subscription.py+++ b/products/subscriptions/backend/tests/test_subscription.py@@ -50,9 +50,9 @@ from products.subscriptions.backend.facade.api import ()from products.subscriptions.backend.facade.contracts import ProcessSubscriptionWorkflowInputs, SubscriptionTriggerTypefrom products.subscriptions.backend.facade.testing import AI_QUERY_PLAN_VERSION+from products.subscriptions.backend.tests.subscriptions_test_factory import create_subscriptionfrom ee.api.test.base import APILicensedTest-from ee.tasks.test.subscriptions.subscriptions_test_factory import create_subscriptionVALID_TEAMS_WEBHOOK_URL = "https://prod-25.westeurope.logic.azure.com:443/workflows/abc/triggers/manual/paths/invoke"GALLERY_ON_PROMPT_ERROR = (@@ -110,7 +110,7 @@ class TestSubscriptionTemporal(APILicensedTest):def setUp(self):super().setUp()- self._sync_connect_patcher = patch("ee.api.subscription.sync_connect")+ self._sync_connect_patcher = patch("products.subscriptions.backend.presentation.views.sync_connect")self.mock_sync = self._sync_connect_patcher.start()self.mock_temporal_client = MagicMock()self.mock_temporal_client.start_workflow = AsyncMock()@@ -236,7 +236,10 @@ class TestSubscriptionTemporal(APILicensedTest):self.mock_temporal_client.start_workflow.reset_mock()if failure == "capture_raises":self.mock_sync.side_effect = RuntimeError("Failed client connect: Connection refused")- capture_patcher = patch("ee.api.subscription.capture_exception", side_effect=RuntimeError("capture down"))+ capture_patcher = patch(+ "products.subscriptions.backend.presentation.views.capture_exception",+ side_effect=RuntimeError("capture down"),+ )capture_patcher.start()self.addCleanup(capture_patcher.stop)elif failure == "start_workflow":@@ -1179,7 +1182,7 @@ class TestSubscriptionTemporal(APILicensedTest):self.organization.save()self._seed_active_summary_subscriptions(existing_active)- with patch("ee.api.subscription.get_organization_limit", return_value=limit):+ with patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=limit):response = self._create_subscription(summary_enabled=True)assert response.status_code == expected_status, response.content@@ -1195,7 +1198,7 @@ class TestSubscriptionTemporal(APILicensedTest):create_response = self._create_subscription(summary_enabled=False)sub_id = create_response.json()["id"]- with patch("ee.api.subscription.get_organization_limit", return_value=5):+ with patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=5):patch_response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{sub_id}",{"summary_enabled": True},@@ -1212,7 +1215,7 @@ class TestSubscriptionTemporal(APILicensedTest):self.organization.save()existing = self._seed_active_summary_subscriptions(7)- with patch("ee.api.subscription.get_organization_limit", return_value=5):+ with patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=5):response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{existing[0].id}",{"title": "renamed while over the cap"},@@ -1241,7 +1244,7 @@ class TestSubscriptionTemporal(APILicensedTest):self.organization.is_ai_data_processing_approved = Trueself.organization.save()- with patch("ee.api.subscription.is_team_limited", return_value=is_limited):+ with patch("products.subscriptions.backend.presentation.views.is_team_limited", return_value=is_limited):response = self._create_subscription(summary_enabled=summary_enabled)assert response.status_code == expected_status, response.content@@ -1254,7 +1257,7 @@ class TestSubscriptionTemporal(APILicensedTest):create_response = self._create_subscription(summary_enabled=False)sub_id = create_response.json()["id"]- with patch("ee.api.subscription.is_team_limited", return_value=True):+ with patch("products.subscriptions.backend.presentation.views.is_team_limited", return_value=True):patch_response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{sub_id}",{"summary_enabled": True},@@ -1270,7 +1273,7 @@ class TestSubscriptionTemporal(APILicensedTest):self.organization.save()existing = self._seed_active_summary_subscriptions(1)- with patch("ee.api.subscription.is_team_limited", return_value=True):+ with patch("products.subscriptions.backend.presentation.views.is_team_limited", return_value=True):response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{existing[0].id}",{"title": "renamed while over budget"},@@ -1298,7 +1301,7 @@ class TestSubscriptionTemporal(APILicensedTest):self.organization.save()self._seed_active_summary_subscriptions(active_count)- with patch("ee.api.subscription.get_organization_limit", return_value=limit):+ with patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=limit):response = self.client.get(f"/api/projects/{self.team.id}/subscriptions/summary_quota")assert response.status_code == status.HTTP_200_OK, response.content@@ -1316,7 +1319,7 @@ class TestSubscriptionTemporal(APILicensedTest):self.organization.save()self._seed_active_summary_subscriptions(2)- with patch("ee.api.subscription.get_organization_limit", return_value=10):+ with patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=10):first = self.client.get(f"/api/projects/{self.team.id}/subscriptions/summary_quota")assert first.status_code == status.HTTP_200_OKassert first.json()["active_count"] == 2@@ -1342,8 +1345,8 @@ class TestSubscriptionTemporal(APILicensedTest):self._seed_active_summary_subscriptions(5)with (- patch("ee.api.subscription.get_organization_limit", return_value=5),- patch("ee.api.subscription.posthoganalytics.capture") as mock_capture,+ patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=5),+ patch("products.subscriptions.backend.presentation.views.posthoganalytics.capture") as mock_capture,):first = self._create_subscription(summary_enabled=True)second = self._create_subscription(summary_enabled=True)@@ -1381,7 +1384,7 @@ class TestSubscriptionTemporal(APILicensedTest):deleted=True,)- with patch("ee.api.subscription.get_organization_limit", return_value=5):+ with patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=5):response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{deleted_summary.id}",{"deleted": False},@@ -1397,7 +1400,7 @@ class TestSubscriptionTemporal(APILicensedTest):self.organization.save()existing = self._seed_active_summary_subscriptions(7)- with patch("ee.api.subscription.get_organization_limit", return_value=5):+ with patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=5):off_response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{existing[0].id}",{"summary_enabled": False},@@ -1451,7 +1454,7 @@ class TestSubscriptionTemporal(APILicensedTest):_seed_for_team(team_two, 2)_seed_for_team(team_three, 1)- with patch("ee.api.subscription.get_organization_limit", return_value=5):+ with patch("products.subscriptions.backend.presentation.views.get_organization_limit", return_value=5):response = self.client.post(f"/api/projects/{team_three.id}/subscriptions",{@@ -1966,7 +1969,7 @@ class TestSubscriptionTemporal(APILicensedTest):stale_date = timezone.now() - timedelta(days=3)Subscription.objects.filter(pk=subscription.pk).update(next_delivery_date=stale_date)- with patch("ee.api.subscription.sync_connect") as temporal_mock:+ with patch("products.subscriptions.backend.presentation.views.sync_connect") as temporal_mock:temporal_mock.return_value.start_workflow = AsyncMock()response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{subscription.id}/",@@ -2125,7 +2128,7 @@ class TestSubscriptionTemporal(APILicensedTest):title="t",enabled=initial_enabled,)- with patch("ee.api.subscription.sync_connect") as temporal_mock:+ with patch("products.subscriptions.backend.presentation.views.sync_connect") as temporal_mock:temporal_mock.return_value.start_workflow = AsyncMock()response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{subscription.id}/",@@ -2155,7 +2158,7 @@ class TestSubscriptionFreeTierLimit(APILicensedTest):def setUp(self):super().setUp()- self._sync_connect_patcher = patch("ee.api.subscription.sync_connect")+ self._sync_connect_patcher = patch("products.subscriptions.backend.presentation.views.sync_connect")self.mock_sync = self._sync_connect_patcher.start()self.mock_temporal_client = MagicMock()self.mock_temporal_client.start_workflow = AsyncMock()@@ -2753,7 +2756,7 @@ class TestSubscriptionDeliveryAPI(APILicensedTest):)assert response.status_code == status.HTTP_404_NOT_FOUND- @patch("ee.api.subscription.SubscriptionDeliveryCursorPagination.page_size", 2)+ @patch("products.subscriptions.backend.presentation.views.SubscriptionDeliveryCursorPagination.page_size", 2)def test_deliveries_list_cursor_pagination(self):self._create_delivery(idempotency_key="page-a")self._create_delivery(idempotency_key="page-b")@@ -2939,9 +2942,9 @@ class TestSubscriptionFreeTierAccess(APILicensedTest):assert response.status_code == status.HTTP_200_OK-@patch("ee.api.subscription.sync_connect")-@patch("ee.api.subscription.posthoganalytics.feature_enabled", return_value=True)-@patch("ee.api.subscription.is_cloud", return_value=True)+@patch("products.subscriptions.backend.presentation.views.sync_connect")+@patch("products.subscriptions.backend.presentation.views.posthoganalytics.feature_enabled", return_value=True)+@patch("products.subscriptions.backend.presentation.views.is_cloud", return_value=True)class TestAISubscriptionAPI(APILicensedTest):def _enable_ai(self):self.organization.is_ai_data_processing_approved = True@@ -3745,7 +3748,7 @@ class TestAISubscriptionAPI(APILicensedTest):# a separate capture, so the content-kind split lives in one metric/dashboard.self._enable_ai()self._mock_temporal(mock_sync)- with patch("ee.api.subscription.slo_operation", wraps=slo_operation) as mock_slo:+ with patch("products.subscriptions.backend.presentation.views.slo_operation", wraps=slo_operation) as mock_slo:response = self.client.post(f"/api/projects/{self.team.id}/subscriptions",self._make_ai_payload(),@@ -4235,7 +4238,7 @@ class TestAISubscriptionAPI(APILicensedTest):class TestSubscriptionObjectAccessControl(APILicensedTest):def setUp(self):super().setUp()- self._sync_connect_patcher = patch("ee.api.subscription.sync_connect")+ self._sync_connect_patcher = patch("products.subscriptions.backend.presentation.views.sync_connect")self.mock_temporal_client = MagicMock(start_workflow=AsyncMock())self._sync_connect_patcher.start().return_value = self.mock_temporal_clientself.addCleanup(self._sync_connect_patcher.stop)@@ -4308,8 +4311,10 @@ class TestSubscriptionObjectAccessControl(APILicensedTest):dashboard = self._dashboard_with_tiles(self.open_insight, self.restricted_insight)with (- patch("ee.api.subscription.is_cloud", return_value=True),- patch("ee.api.subscription.posthoganalytics.feature_enabled", return_value=True),+ patch("products.subscriptions.backend.presentation.views.is_cloud", return_value=True),+ patch(+ "products.subscriptions.backend.presentation.views.posthoganalytics.feature_enabled", return_value=True+ ),):response = self.client.post(f"/api/projects/{self.team.id}/subscriptions",diff --git a/products/subscriptions/package.json b/products/subscriptions/package.jsonindex e0d5894c15ae..80eef67ac82b 100644--- a/products/subscriptions/package.json+++ b/products/subscriptions/package.json@@ -1,8 +1,7 @@{"name": "@posthog/products-subscriptions","scripts": {- "backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short",- "backend:contract-check": "echo 'Contract files unchanged'"+ "backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"},"dependencies": {"@posthog/brand": "catalog:",diff --git a/products/subscriptions/turbo.json b/products/subscriptions/turbo.jsondeleted file mode 100644index 9feb33b42a81..000000000000--- a/products/subscriptions/turbo.json+++ /dev/null@@ -1,19 +0,0 @@-{- "extends": ["//"],- "tasks": {- "backend:contract-check": {- "inputs": [- "backend/facade/**",- "backend/presentation/**",- "backend/routes.py",- "backend/models/**",- "backend/migrations/**",- "backend/temporal/**",- "!backend/temporal/**/test_*.py",- "!backend/temporal/**/test/**"- ],- "outputs": [],- "cache": true- }- }-}diff --git a/pyproject.toml b/pyproject.tomlindex 7401cdf89b27..4bc2065f9a42 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -761,6 +761,15 @@ ignore_imports = ["products.batch_exports.backend.presentation.views.batch_export.exports -> products.batch_exports.backend.temporal.sql.events","products.batch_exports.backend.presentation.views.batch_export.runs -> products.batch_exports.backend.models.batch_export","products.batch_exports.backend.presentation.views.batch_export.runs -> products.batch_exports.backend.service",+ # TODO: subscriptions presentation wave. The viewsets and model serializers moved from ee/+ # with their ORM access: the subscription models (in exports until they move into the+ # product) and the dashboard models behind dashboard and tile selection. Thin them to+ # parse -> facade -> serialize and delete each entry. backend:contract-check stays off+ # until this list is empty.+ "products.subscriptions.backend.presentation.views -> products.dashboards.backend.models.dashboard",+ "products.subscriptions.backend.presentation.views -> products.dashboards.backend.models.dashboard_tile",+ "products.subscriptions.backend.presentation.views -> products.exports.backend.models.subscription",+ "products.subscriptions.backend.presentation.views -> products.exports.backend.models.subscription_context",]# routes.py is the one module core reads to assemble a product's API router, so it is thediff --git a/tach.toml b/tach.tomlindex c028c0256867..0181865e7bf4 100644--- a/tach.toml+++ b/tach.toml@@ -376,6 +376,7 @@ path = "products.subscriptions"depends_on = ["posthog","ee",+ "products.access_control","products.ai_observability","products.annotations","products.dashboards",