: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(temporal): share the digest fan-out helpers from posthog/temporal/common (#103981)
Thiago Salvatore43a3e65ea41a
diff --git a/products/web_analytics/backend/temporal/digest_common.py b/posthog/temporal/common/digest.pysimilarity index 100%rename from products/web_analytics/backend/temporal/digest_common.pyrename to posthog/temporal/common/digest.pydiff --git a/products/web_analytics/backend/temporal/digest_notification/activities.py b/products/web_analytics/backend/temporal/digest_notification/activities.pyindex ba2448673774..fe672e4440c9 100644--- a/products/web_analytics/backend/temporal/digest_notification/activities.py+++ b/products/web_analytics/backend/temporal/digest_notification/activities.py@@ -17,6 +17,7 @@ from posthog.models.organization import Organization, OrganizationMembershipfrom posthog.models.user import Userfrom posthog.ph_client import ph_scoped_capturefrom posthog.sync import database_sync_to_async+from posthog.temporal.common.digest import OrgBatchPageResult, paginate_index, paginate_keysetfrom posthog.temporal.common.heartbeat import Heartbeaterfrom posthog.user_permissions import UserPermissions@@ -28,7 +29,6 @@ from products.notifications.backend.facade.api import (create_notification,)from products.web_analytics.backend import weekly_digest-from products.web_analytics.backend.temporal.digest_common import OrgBatchPageResult, paginate_index, paginate_keysetfrom products.web_analytics.backend.temporal.digest_notification.types import (DigestBatchInput,DigestBatchResult,diff --git a/products/web_analytics/backend/temporal/digest_notification/types.py b/products/web_analytics/backend/temporal/digest_notification/types.pyindex f47599758a45..2071d11bf1ba 100644--- a/products/web_analytics/backend/temporal/digest_notification/types.py+++ b/products/web_analytics/backend/temporal/digest_notification/types.py@@ -1,7 +1,7 @@import dataclassesfrom enum import StrEnum-from products.web_analytics.backend.temporal.digest_common import DigestBatchTotals+from posthog.temporal.common.digest import DigestBatchTotalsclass NotificationDigestOutcome(StrEnum):diff --git a/products/web_analytics/backend/temporal/digest_notification/workflows.py b/products/web_analytics/backend/temporal/digest_notification/workflows.pyindex 71ed9e00b2b9..0b6030ea9b57 100644--- a/products/web_analytics/backend/temporal/digest_notification/workflows.py+++ b/products/web_analytics/backend/temporal/digest_notification/workflows.py@@ -9,7 +9,8 @@ from temporalio.exceptions import ApplicationErrorfrom posthog.temporal.common.base import PostHogWorkflowwith workflow.unsafe.imports_passed_through():- from products.web_analytics.backend.temporal.digest_common import ACTIVITY_RETRY_POLICY+ from posthog.temporal.common.digest import ACTIVITY_RETRY_POLICY+from products.web_analytics.backend.temporal.digest_notification.activities import (get_org_batch_page,run_wa_digest_notification_batch,diff --git a/products/web_analytics/backend/temporal/weekly_digest/activities.py b/products/web_analytics/backend/temporal/weekly_digest/activities.pyindex 0663e624ea95..cb1dd40c8e17 100644--- a/products/web_analytics/backend/temporal/weekly_digest/activities.py+++ b/products/web_analytics/backend/temporal/weekly_digest/activities.py@@ -24,12 +24,12 @@ from posthog.models.organization import Organization, OrganizationMembershipfrom posthog.models.user import Userfrom posthog.sync import database_sync_to_asyncfrom posthog.tasks.email import NotificationSetting, should_send_notification+from posthog.temporal.common.digest import OrgBatchPageResult, paginate_index, paginate_keysetfrom posthog.temporal.common.heartbeat import Heartbeaterfrom posthog.user_permissions import UserPermissionsfrom products.web_analytics.backend import weekly_digestfrom products.web_analytics.backend.recap import recap_url_for_team-from products.web_analytics.backend.temporal.digest_common import OrgBatchPageResult, paginate_index, paginate_keysetfrom products.web_analytics.backend.temporal.weekly_digest.types import (WA_DIGEST_EMAIL_UNAVAILABLE_TYPE,DigestBatchInput,diff --git a/products/web_analytics/backend/temporal/weekly_digest/types.py b/products/web_analytics/backend/temporal/weekly_digest/types.pyindex b2d56027758c..d673decab9e3 100644--- a/products/web_analytics/backend/temporal/weekly_digest/types.py+++ b/products/web_analytics/backend/temporal/weekly_digest/types.py@@ -1,7 +1,7 @@import dataclassesfrom enum import StrEnum-from products.web_analytics.backend.temporal.digest_common import DigestBatchTotals+from posthog.temporal.common.digest import DigestBatchTotalsclass DigestOutcome(StrEnum):diff --git a/products/web_analytics/backend/temporal/weekly_digest/workflows.py b/products/web_analytics/backend/temporal/weekly_digest/workflows.pyindex 9a66df2875c6..b9d6f506eecc 100644--- a/products/web_analytics/backend/temporal/weekly_digest/workflows.py+++ b/products/web_analytics/backend/temporal/weekly_digest/workflows.py@@ -9,7 +9,8 @@ from temporalio.exceptions import ApplicationErrorfrom posthog.temporal.common.base import PostHogWorkflowwith workflow.unsafe.imports_passed_through():- from products.web_analytics.backend.temporal.digest_common import ACTIVITY_RETRY_POLICY+ from posthog.temporal.common.digest import ACTIVITY_RETRY_POLICY+from products.web_analytics.backend.temporal.weekly_digest.activities import (get_org_batch_page,push_wa_digest_metrics_activity,diff --git a/products/web_analytics/backend/test/test_digest_notification_workflows.py b/products/web_analytics/backend/test/test_digest_notification_workflows.pyindex df6689c3d741..b8400dc62d0e 100644--- a/products/web_analytics/backend/test/test_digest_notification_workflows.py+++ b/products/web_analytics/backend/test/test_digest_notification_workflows.py@@ -9,7 +9,8 @@ from temporalio import activityfrom temporalio.testing import WorkflowEnvironmentfrom temporalio.worker import Worker-from products.web_analytics.backend.temporal.digest_common import OrgBatchPageResult+from posthog.temporal.common.digest import OrgBatchPageResult+from products.web_analytics.backend.temporal.digest_notification.types import (WA_DIGEST_NOTIF_THRESHOLD_EXCEEDED_TYPE,DigestBatchInput,diff --git a/products/web_analytics/backend/test/test_weekly_digest_workflows.py b/products/web_analytics/backend/test/test_weekly_digest_workflows.pyindex 2871e3c9a78b..37feb825a912 100644--- a/products/web_analytics/backend/test/test_weekly_digest_workflows.py+++ b/products/web_analytics/backend/test/test_weekly_digest_workflows.py@@ -9,7 +9,8 @@ from temporalio import activityfrom temporalio.testing import WorkflowEnvironmentfrom temporalio.worker import Worker-from products.web_analytics.backend.temporal.digest_common import OrgBatchPageResult+from posthog.temporal.common.digest import OrgBatchPageResult+from products.web_analytics.backend.temporal.weekly_digest.types import (WA_DIGEST_THRESHOLD_EXCEEDED_TYPE,DigestBatchInput,