: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(alerts): rename temporal identities to alerts-platform (#104405)
posthog[bot]30c57c00325c
diff --git a/docs/internal/alerts-product-temporal.md b/docs/internal/alerts-platform-temporal.mdsimilarity index 78%rename from docs/internal/alerts-product-temporal.mdrename to docs/internal/alerts-platform-temporal.mdindex d2cadf00427b..27fee4c0cb0b 100644--- a/docs/internal/alerts-product-temporal.md+++ b/docs/internal/alerts-platform-temporal.md@@ -2,23 +2,23 @@The Alerts product registers three queues through `products/alerts/backend/facade/temporal.py` and the shared `start_temporal_worker` command:-| Setting in `posthog/settings/temporal.py` | Queue | Workflow |-| ------------------------------------------------ | ------------------------------------------------ | ---------------------------- |-| `ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE` | `alerts-product-shared-orchestration-task-queue` | `alerts-product-orchestrate` |-| `ALERTS_PRODUCT_EVALUATION_TASK_QUEUE` | `alerts-product-evaluation-task-queue` | `alerts-product-evaluate` |-| `ALERTS_PRODUCT_DELIVERY_TASK_QUEUE` | `alerts-product-delivery-task-queue` | `alerts-product-deliver` |+| Setting in `posthog/settings/temporal.py` | Queue | Workflow |+| ------------------------------------------------- | ------------------------------------------------- | ----------------------------- |+| `ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE` | `alerts-platform-shared-orchestration-task-queue` | `alerts-platform-orchestrate` |+| `ALERTS_PLATFORM_EVALUATION_TASK_QUEUE` | `alerts-platform-evaluation-task-queue` | `alerts-platform-evaluate` |+| `ALERTS_PLATFORM_DELIVERY_TASK_QUEUE` | `alerts-platform-delivery-task-queue` | `alerts-platform-deliver` |These queue names are hardcoded and stay separate even with `DEBUG=True`.Shared orchestration registers the orchestration workflow, the source dispatcher and a synthetic demand-discovery activity.-The evaluation queue registers the evaluation workflow (`alerts-product-evaluate`), each bound source evaluation, and the probe activity.+The evaluation queue registers the evaluation workflow (`alerts-platform-evaluate`), each bound source evaluation, and the probe activity.Each schedule tick starts orchestration, which discovers demand once and then pages source dispatchers until the demand is exhausted or its dispatch budget is spent.Each dispatcher starts one evaluation child for its source. Evaluation runs the probe and starts its independent delivery child on the delivery queue.Start one worker for each queue:```bash-python manage.py start_temporal_worker --task-queue alerts-product-shared-orchestration-task-queue --metrics-port 8104-python manage.py start_temporal_worker --task-queue alerts-product-evaluation-task-queue --metrics-port 8102-python manage.py start_temporal_worker --task-queue alerts-product-delivery-task-queue --metrics-port 8103+python manage.py start_temporal_worker --task-queue alerts-platform-shared-orchestration-task-queue --metrics-port 8104+python manage.py start_temporal_worker --task-queue alerts-platform-evaluation-task-queue --metrics-port 8102+python manage.py start_temporal_worker --task-queue alerts-platform-delivery-task-queue --metrics-port 8103```Give every worker its own `--metrics-port`.@@ -28,12 +28,12 @@ See [Temporal development guidance](../../posthog/temporal/README.md) for worker## Dev schedule-`python manage.py schedule_temporal_workflows` creates or updates `alerts-product-check-due-schedule`+`python manage.py schedule_temporal_workflows` creates or updates `alerts-platform-check-due-schedule`only when `CLOUD_DEPLOYMENT=DEV`. The normal deployment migration step runs this command.Registration does nothing in production, local development, or other environments, even with `DEBUG=True`.It does not delete schedules created manually in those environments.-The schedule starts `alerts-product-orchestrate` with `{}` on the orchestration queue every minute (UTC).+The schedule starts `alerts-platform-orchestrate` with `{}` on the orchestration queue every minute (UTC).There is no routing flag: the flow is tick → orchestration → evaluation → delivery.It uses SKIP overlap, a one-minute catchup window, a 50-second workflow execution timeout,and one workflow attempt. Creation does not trigger an immediate run; the next minute starts it.@@ -48,22 +48,44 @@ Enable production only in a separate rollout after dev verification.### Shared orchestration rollout and rollback-The deployment identity is `temporal-worker-alerts-product-shared-orchestration`.+The deployment identity is `temporal-worker-alerts-platform-shared-orchestration`.It uses the shared `posthog-cloud` image built by `container-images-cd.yml`, not a separate image build or repository.Worker deployment configuration lives outside this repository. Deploying this code must be coordinated with starting the orchestration worker.-Schedule reconciliation now routes directly to orchestration; merging the code alone does not start a worker process.-If the dev schedule does not exist yet, start all three workers before the first reconciliation: new schedules start unpaused.--1. Pause the existing dev schedule before deployment so migration-time reconciliation cannot send ticks to a worker that is not ready.-2. Deploy the code and start the orchestration worker with the command above.- Verify it polls `alerts-product-shared-orchestration-task-queue`, and that evaluation and delivery workers remain available.-3. Run `python manage.py schedule_temporal_workflows` and verify the action starts `alerts-product-orchestrate` on the orchestration queue.- Existing pause state is preserved. Resume only after all three workers are ready, then verify the complete workflow chain.--To stop future starts, pause the schedule. Keep all three workers running until orchestration, evaluation, and delivery work drains.-For rollback, restore the previous schedule action (the evaluation workflow started directly on the evaluation queue, named `alerts-product-check-due` before the rename below) after draining, then roll back the code.-Do not reconcile with the new code after restoring the old action: reconciliation would route back to orchestration.-Pausing or changing the schedule does not move or stop queued or running workflows.+The three deployments in `PostHog/charts` must pass the matching `alerts-platform-*` queue names.+The worker command rejects an unregistered queue with `ValueError` at startup.+An old image with a new queue, or a new image with an old queue, cannot start.+Treat each worker's image and queue configuration as one deployment change; merging two PRs close together does not make their deployments atomic.+Schedule reconciliation routes directly to orchestration; merging the code alone does not start a worker process.++1. Hold automatic promotions and syncs for all three worker deployments before either the code or chart queue changes deploys.+ Record the current image, queue configuration, and schedule action for rollback.+2. Pause `alerts-product-check-due-schedule` if it exists, and stop manual starts and delivery-preview requests during the cutover.+ Before migration-time reconciliation runs with the new code, create `alerts-platform-check-due-schedule` in Temporal with its state explicitly paused.+ Use the action and policy from [Dev schedule](#dev-schedule). If the new schedule already exists, pause it instead.+ Pause state is preserved only for the same schedule ID; pausing the old ID does not pause a newly created schedule.+3. Keep the old images polling all three `alerts-product-*` queues until queued and running orchestration, source-dispatch, evaluation, and delivery work drains.+ Verify this in Temporal rather than waiting a fixed interval. Delivery can outlive its parent, and manual runs can have different timeouts.+4. Build the image containing the renamed worker registrations. Render each worker deployment with that image and its matching `alerts-platform-*` queue before allowing its promotion or sync.+ Do not restart a worker with only half of this change. Keep both schedules paused while the three deployments roll out.+ Verify all three workers start successfully and poll their configured queues, including `alerts-platform-shared-orchestration-task-queue`.+5. Run `python manage.py schedule_temporal_workflows` with the new code and verify the new schedule remains paused.+ Its action must start `alerts-platform-orchestrate` on the orchestration queue.+ Resume the new schedule only after all three workers are ready. Verify the Postgres probe result and delivery completion separately.+6. After the complete workflow chain succeeds, delete the paused `alerts-product-check-due-schedule` by hand and release the deployment holds.+ Reconciliation never deletes the old ID. Allow manual starts and delivery-preview requests again only with callers running the matching code.++For rollback:++1. Pause the new schedule and stop manual starts and delivery-preview requests. Keep the current workers running until all queued and running work drains.+2. Hold worker promotions and syncs. Restore each previous image together with its `alerts-product-*` queue configuration, then verify all three workers are ready.+3. Restore the recorded schedule configuration using the previous code. Immediately before this rename, its action starts `alerts-product-orchestrate` on `alerts-product-shared-orchestration-task-queue`.+ Do not restore the older `alerts-product-check-due` action unless the selected rollback image actually registers it.+ If the old schedule was deleted, reconcile it only after the old workers are ready, because creation starts it unpaused.+4. Resume the old schedule if it is paused, verify the probe and delivery complete, then delete the paused new schedule and release the deployment holds.+ Restore manual starts and delivery-preview requests with callers running the previous code.++Do not reconcile with the new code after rollback: it would recreate the new schedule unpaused.+Pausing or changing a schedule does not move or stop queued or running workflows.### Manual local runs@@ -73,9 +95,9 @@ The `execute_temporal_workflow` and `start_temporal_workflow` commands do not kn```bashdocker exec posthog-temporal-admin-tools-1 \temporal workflow start --address temporal:7233 --namespace default \- --task-queue alerts-product-shared-orchestration-task-queue \- --type alerts-product-orchestrate \- --workflow-id "alerts-product-orchestrate-manual-$(date +%Y%m%d%H%M%S)" \+ --task-queue alerts-platform-shared-orchestration-task-queue \+ --type alerts-platform-orchestrate \+ --workflow-id "alerts-platform-orchestrate-manual-$(date +%Y%m%d%H%M%S)" \--execution-timeout 50s \--input '{}'```@@ -83,7 +105,7 @@ docker exec posthog-temporal-admin-tools-1 \The empty `--input '{}'` becomes an `OrchestrateInputs` with every field defaulted.Watch orchestration, its source dispatcher children, their evaluation children, and the delivery great-grandchildren in the Temporal UI at <http://localhost:8081>.-Evaluation and delivery accept an empty `AlertsProductInputs` dataclass; orchestration accepts `OrchestrateInputs` with all fields defaulted.+Evaluation and delivery accept an empty `AlertsPlatformInputs` dataclass; orchestration accepts `OrchestrateInputs` with all fields defaulted.Orchestration pages source dispatchers, which start evaluation children with a 75-second execution timeout and one workflow attempt.Evaluation child IDs carry the tick ID, source and page, so each tick starts distinct evaluations.Evaluation runs a Postgres connectivity probe; delivery runs an empty activity with no I/O.@@ -97,16 +119,17 @@ Real notification delivery guarantees remain undecided.## Names-The evaluation workflow is `alerts-product-evaluate` (class `AlertsProductEvaluateWorkflow`), the probe activity is `alerts_product_probe_postgres_activity`, and the schedule is registered by `create_alerts_product_tick_schedule`.+The evaluation workflow is `alerts-platform-evaluate` (class `AlertsPlatformEvaluateWorkflow`), the probe activity is `alerts_platform_probe_postgres_activity`, and the schedule is registered by `create_alerts_platform_tick_schedule`.These replace `alerts-product-check-due`, `alerts_product_check_due_activity` and `create_alerts_product_check_due_schedule`: discovery finds what is due and dispatchers hand it out, so this workflow only evaluates.A workflow type rename breaks runs of the old type that are in flight at deploy time: no worker knows the old name, so they fail. Dev evaluations live under their execution timeout, and production is off.-The schedule ID stays `alerts-product-check-due-schedule`. Registration does not delete schedules, so a new ID would leave two schedules until someone deleted the old one by hand.+The schedule ID is `alerts-platform-check-due-schedule`, renamed from `alerts-product-check-due-schedule`.+Registration never deletes a schedule, so the rollout above deletes the old ID by hand.## Tick loop and source dispatchers-One tick is one `alerts-product-orchestrate` execution. It takes an `OrchestrateInputs`; the schedule passes `{}` and every field defaults.+One tick is one `alerts-platform-orchestrate` execution. It takes an `OrchestrateInputs`; the schedule passes `{}` and every field defaults.The first run records the tick cutoff (the scheduled start time, or the workflow start time for manual runs) and a deadline 45 seconds after the run started.-Discovery runs once per tick. The loop then starts one `alerts-product-source-dispatch` child per source with demand, ID `{tick_id}-{source}-p{page}`, on the orchestration queue.+Discovery runs once per tick. The loop then starts one `alerts-platform-source-dispatch` child per source with demand, ID `{tick_id}-{source}-p{page}`, on the orchestration queue.Dispatchers are part of the tick: the orchestrator awaits each dispatcher's report and keeps the default `TERMINATE` close policy on that edge.They run on the tick's own fleet because the tick awaits them. On the evaluation queue, an evaluation fleet with no free slotsleaves the dispatcher unpicked, and the tick waits on a report that cannot arrive. A dispatcher starts no activities,@@ -118,7 +141,7 @@ The hard stop is the run's own execution timeout when it has one, and the budgetThe orchestrator passes a dispatcher every remaining ID for its source. The dispatcher decides how much to take and returns the rest.Today it takes everything: no adapter has said yet how many alerts one evaluation can hold, so nothing remains and a tick is one page.The limit that will matter is the evaluation workflow's own history, which depends on the adapter's query shape; it arrives with the first real adapter.-It starts one `alerts-product-evaluate` child, ID `{dispatcher_id}-eval`, with `ParentClosePolicy.ABANDON`, a 75-second execution timeout (`SOURCE_EVALUATION_TIMEOUT`) and one attempt.+It starts one `alerts-platform-evaluate` child, ID `{dispatcher_id}-eval`, with `ParentClosePolicy.ABANDON`, a 75-second execution timeout (`SOURCE_EVALUATION_TIMEOUT`) and one attempt.The timeout has to hold every attempt a source's activities allow, because an attempt cut off here is a batch that decided something and recorded nothing.Evaluations are abandoned rather than awaited, so it does not have to fit inside the tick.It waits for the child to start, never for it to finish, then returns the dispatched count and the remaining IDs.@@ -142,7 +165,7 @@ The previous `workflow.patched` gate around discovery is gone: the loop cannot r## Synthetic demand discovery-The first orchestration activity, `alerts_product_discover_demand_activity`, accepts a timezone-aware ISO-8601 cutoff.+The first orchestration activity, `alerts_platform_discover_demand_activity`, accepts a timezone-aware ISO-8601 cutoff.Scheduled runs use `TemporalScheduledStartTime`; manual runs use the workflow start time.Activity retries retain the same cutoff rather than reading the activity's clock.The activity returns an `AlertDemand` containing configuration IDs grouped by the shared `SourceKind` enum (`logs` and `insight`).@@ -182,7 +205,7 @@ than within one.`products/alerts/backend/temporal/sources.py` maps a `SourceKind` to the workflow name that evaluates it.A source in that map gets its own workflow started by name, carrying one batch key and the tick cutoff.-A source absent from it keeps the noop `alerts-product-evaluate` path, which receives no key.+A source absent from it keeps the noop `alerts-platform-evaluate` path, which receives no key.The alerts product imports nothing from a source: the binding holds a name, and `test_every_source_evaluation_binding_names_a_registered_workflow` fails if that name is not registered on the evaluation queue.`logs` is bound to `logs-alert-evaluate`, which is the first real source evaluation.@@ -196,7 +219,7 @@ It writes its own state and never the logs product's rows.The production `logs-alerting-task-queue` fleet evaluates these same alerts every minute against `LogsAlertConfiguration`,so a write to those rows, a `LogsAlertEvent` row or a Kafka message here would transition an alert twice and notify a person twice for one breach.State transitions land on `PlatformAlert` and schedule advancement on `PlatformAlertConfiguration`, which the logs fleet never reads.-Delivery stops at `alerts-product-deliver-preview`, which records what would have been sent and contacts no destination.+Delivery stops at `alerts-platform-deliver-preview`, which records what would have been sent and contacts no destination.The lifecycle decision comes from `products/alerts/backend/facade/lifecycle.py` configured with `LOGS_ALERT_POLICY`,which is the shared machine the logs product's own state machine is a thin adapter over.@@ -213,7 +236,7 @@ can have been disabled, snoozed or broken since.It is a sync `def`, so Temporal runs it on the worker's own activity executor and the thread it blocks is a slot Temporal is accounting for.An async activity handing the work to its own thread pool releases its slot the moment the activity times out, while the thread stays on a query Temporal can no longer see.Being sync also means Django's connection recycling is the activity's own job, which `@close_db_connections` does for it.-The workflow then calls `alerts_product_record_outcomes`, the platform's own activity, which persists the batch.+The workflow then calls `alerts_platform_record_outcomes`, the platform's own activity, which persists the batch.Order matters more than the split does: Temporal holds the deliveries the batch decided on before any writecan advance a schedule past them, so an attempt lost between the two costs its queries and nothing else.A source starts the write by name rather than importing it, so the products stay apart.@@ -296,7 +319,7 @@ The transaction commits on success and rolls back on failure, so the timeout doeConnection acquisition, SQL, and force-close cleanup run in the same executor thread, outside the default thread-sensitive executor.`close_db_connections` closes initialized connections without a cleanup health-check query after failure.-Django `OperationalError` and `InterfaceError` become a sanitized `AlertsProductPostgresProbeFailure` activity failure.+Django `OperationalError` and `InterfaceError` become a sanitized `AlertsPlatformPostgresProbeFailure` activity failure.Evaluation starts delivery after that failure or an activity start-to-close/schedule-to-close timeout.Cancellation and unrelated errors propagate without starting delivery.This handoff requires the parent and its worker to remain available; termination before child startup is not covered.@@ -321,7 +344,7 @@ Worker registration does not deploy workers. The dev schedule sets the orchestra## Activity logs-The evaluation and delivery queues use an activity-only interceptor that emits `alerts_product_activity_started` and `alerts_product_activity_finished` through the shared write-only logger.+The evaluation and delivery queues use an activity-only interceptor that emits `alerts_platform_activity_started` and `alerts_platform_activity_finished` through the shared write-only logger.Discovery has SDK metrics and traces but does not use this logging interceptor.The shared logger's async methods keep log processing and writes off the activity event loop.Each retry emits its own start and finish events.@@ -345,7 +368,7 @@ The shared worker exposes these SDK histograms with `task_queue` labels:Both histograms use milliseconds and the SDK's default buckets.Prometheus exposes their `_bucket`, `_sum`, and `_count` series.-Native metrics retain the `temporal_` prefix. The `alerts_product_` convention applies only to custom metrics if those are added later.+Native metrics retain the `temporal_` prefix. The `alerts_platform_` prefix is the convention for the platform's own custom metrics.Do not add workflow or run IDs as metric labels.A worker killed before completion cannot emit a finish log or execution sample.@@ -366,4 +389,4 @@ Retries have separate activity attempt spans.Tests verify local logging, queue-labelled SDK metrics, and trace relationships without an application database or an external collector.Charts rollout must separately configure all three deployments and verify Prometheus scraping and delivery to the tracing collector.This change does not configure deployments, dashboards, alert rules, or SLO emission.-The `alerts-product` SLO area remains reserved without changes to shared SLO handling or workflow inputs.+The `alerts-platform` SLO area remains reserved without changes to shared SLO handling or workflow inputs.diff --git a/posthog/management/commands/start_temporal_worker.py b/posthog/management/commands/start_temporal_worker.pyindex 28882f15bd48..85ffec91c861 100644--- a/posthog/management/commands/start_temporal_worker.py+++ b/posthog/management/commands/start_temporal_worker.py@@ -152,12 +152,12 @@ from posthog.temporal.weekly_digest import ()from products.alerts.backend.facade.temporal import (- DELIVERY_ACTIVITIES as ALERTS_PRODUCT_DELIVERY_ACTIVITIES,- DELIVERY_WORKFLOWS as ALERTS_PRODUCT_DELIVERY_WORKFLOWS,- EVALUATION_ACTIVITIES as ALERTS_PRODUCT_EVALUATION_ACTIVITIES,- EVALUATION_WORKFLOWS as ALERTS_PRODUCT_EVALUATION_WORKFLOWS,- SHARED_ORCHESTRATION_ACTIVITIES as ALERTS_PRODUCT_SHARED_ORCHESTRATION_ACTIVITIES,- SHARED_ORCHESTRATION_WORKFLOWS as ALERTS_PRODUCT_SHARED_ORCHESTRATION_WORKFLOWS,+ DELIVERY_ACTIVITIES as ALERTS_PLATFORM_DELIVERY_ACTIVITIES,+ DELIVERY_WORKFLOWS as ALERTS_PLATFORM_DELIVERY_WORKFLOWS,+ EVALUATION_ACTIVITIES as ALERTS_PLATFORM_EVALUATION_ACTIVITIES,+ EVALUATION_WORKFLOWS as ALERTS_PLATFORM_EVALUATION_WORKFLOWS,+ SHARED_ORCHESTRATION_ACTIVITIES as ALERTS_PLATFORM_SHARED_ORCHESTRATION_ACTIVITIES,+ SHARED_ORCHESTRATION_WORKFLOWS as ALERTS_PLATFORM_SHARED_ORCHESTRATION_WORKFLOWS,)from products.batch_exports.backend.temporal import (ACTIVITIES as BATCH_EXPORTS_ACTIVITIES,@@ -566,19 +566,19 @@ _task_queue_specs = [STAMPHOG_ACTIVITIES,),(- settings.ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE,- ALERTS_PRODUCT_SHARED_ORCHESTRATION_WORKFLOWS,- ALERTS_PRODUCT_SHARED_ORCHESTRATION_ACTIVITIES,+ settings.ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE,+ ALERTS_PLATFORM_SHARED_ORCHESTRATION_WORKFLOWS,+ ALERTS_PLATFORM_SHARED_ORCHESTRATION_ACTIVITIES,),(- settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,- ALERTS_PRODUCT_EVALUATION_WORKFLOWS + LOGS_SOURCE_EVALUATION_WORKFLOWS,- ALERTS_PRODUCT_EVALUATION_ACTIVITIES + LOGS_SOURCE_EVALUATION_ACTIVITIES,+ settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,+ ALERTS_PLATFORM_EVALUATION_WORKFLOWS + LOGS_SOURCE_EVALUATION_WORKFLOWS,+ ALERTS_PLATFORM_EVALUATION_ACTIVITIES + LOGS_SOURCE_EVALUATION_ACTIVITIES,),(- settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE,- ALERTS_PRODUCT_DELIVERY_WORKFLOWS,- ALERTS_PRODUCT_DELIVERY_ACTIVITIES,+ settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE,+ ALERTS_PLATFORM_DELIVERY_WORKFLOWS,+ ALERTS_PLATFORM_DELIVERY_ACTIVITIES,),]diff --git a/posthog/management/commands/test/test_start_temporal_worker.py b/posthog/management/commands/test/test_start_temporal_worker.pyindex 8c145cdb1ce6..58e726989834 100644--- a/posthog/management/commands/test/test_start_temporal_worker.py+++ b/posthog/management/commands/test/test_start_temporal_worker.py@@ -38,12 +38,12 @@ class _NotADataSyncWorkflow:[(settings.WIZARD_TASK_QUEUE, WIZARD_WORKFLOWS, WIZARD_ACTIVITIES),(- "alerts-product-shared-orchestration-task-queue",+ "alerts-platform-shared-orchestration-task-queue",SHARED_ORCHESTRATION_WORKFLOWS,SHARED_ORCHESTRATION_ACTIVITIES,),- ("alerts-product-evaluation-task-queue", EVALUATION_WORKFLOWS, EVALUATION_ACTIVITIES),- ("alerts-product-delivery-task-queue", DELIVERY_WORKFLOWS, DELIVERY_ACTIVITIES),+ ("alerts-platform-evaluation-task-queue", EVALUATION_WORKFLOWS, EVALUATION_ACTIVITIES),+ ("alerts-platform-delivery-task-queue", DELIVERY_WORKFLOWS, DELIVERY_ACTIVITIES),],)def test_queue_registers_workflows_and_activities(@@ -53,7 +53,7 @@ def test_queue_registers_workflows_and_activities(assert set(expected_workflows) <= WORKFLOWS_DICT[task_queue]assert expected_activitiesassert set(expected_activities) <= ACTIVITIES_DICT[task_queue]- if task_queue == settings.ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE:+ if task_queue == settings.ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE:assert WORKFLOWS_DICT[task_queue] == set(expected_workflows)assert ACTIVITIES_DICT[task_queue] == set(expected_activities)diff --git a/posthog/settings/temporal.py b/posthog/settings/temporal.pyindex 444ddc2a6c96..79bb426e9f06 100644--- a/posthog/settings/temporal.py+++ b/posthog/settings/temporal.py@@ -270,9 +270,9 @@ BILLING_TASK_QUEUE = _set_temporal_task_queue("billing-task-queue")VIDEO_EXPORT_TASK_QUEUE = _set_temporal_task_queue("video-export-task-queue")ANALYTICS_PLATFORM_TASK_QUEUE = _set_temporal_task_queue("analytics-platform-task-queue")# Keep the smoke fleets separate in local development as well as deployed environments.-ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE = "alerts-product-shared-orchestration-task-queue"-ALERTS_PRODUCT_EVALUATION_TASK_QUEUE = "alerts-product-evaluation-task-queue"-ALERTS_PRODUCT_DELIVERY_TASK_QUEUE = "alerts-product-delivery-task-queue"+ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE = "alerts-platform-shared-orchestration-task-queue"+ALERTS_PLATFORM_EVALUATION_TASK_QUEUE = "alerts-platform-evaluation-task-queue"+ALERTS_PLATFORM_DELIVERY_TASK_QUEUE = "alerts-platform-delivery-task-queue"SESSION_REPLAY_TASK_QUEUE = _set_temporal_task_queue("session-replay-task-queue")REPLAY_VISION_TASK_QUEUE = _set_temporal_task_queue("replay-vision-task-queue")# The XGBoost-based session surfacing scoring sweep runs on the session-replaydiff --git a/posthog/temporal/common/worker.py b/posthog/temporal/common/worker.pyindex 198e73267be6..b3d71597bca9 100644--- a/posthog/temporal/common/worker.py+++ b/posthog/temporal/common/worker.py@@ -61,7 +61,7 @@ from posthog.temporal.usage_report.metrics import (from products.alerts.backend.facade.temporal import (ALERTS_PLATFORM_LATENCY_HISTOGRAM_BUCKETS,ALERTS_PLATFORM_LATENCY_HISTOGRAM_METRICS,- AlertsProductTelemetryInterceptor,+ AlertsPlatformTelemetryInterceptor,)from products.batch_exports.backend.temporal.metrics import BatchExportsMetricsInterceptorfrom products.experiments.backend.temporal.recalculation_metrics import (@@ -178,7 +178,7 @@ ALL_INTERCEPTOR_CLASSES = [LivenessInterceptor,PostHogClientInterceptor,SloInterceptor,- AlertsProductTelemetryInterceptor,+ AlertsPlatformTelemetryInterceptor,BatchExportsMetricsInterceptor,DeleteRecordingsMetricsInterceptor,SurfacingScoringMetricsInterceptor,diff --git a/posthog/temporal/schedule.py b/posthog/temporal/schedule.pyindex d33f8c109515..306b1f180628 100644--- a/posthog/temporal/schedule.py+++ b/posthog/temporal/schedule.py@@ -78,7 +78,7 @@ from posthog.temporal.warehouse_sources_queue_partition_management.schedule impo)from posthog.temporal.weekly_digest.types import WeeklyDigestInput-from products.alerts.backend.facade.temporal import create_alerts_product_tick_schedule+from products.alerts.backend.facade.temporal import create_alerts_platform_tick_schedulefrom products.billing_alerts.backend.temporal.schedule import create_schedule_due_billing_alert_checks_schedulefrom products.business_knowledge.backend.temporal.schedule import (create_business_knowledge_learning_coordinator_schedule,@@ -941,7 +941,7 @@ schedules = [create_error_tracking_weekly_digest_schedule,create_wa_weekly_digest_schedule,create_wa_digest_notification_schedule,- create_alerts_product_tick_schedule,+ create_alerts_platform_tick_schedule,create_logs_alert_check_schedule,create_logs_volume_tick_schedule,create_schedule_due_alert_checks_schedule,diff --git a/products/alerts/backend/facade/contracts.py b/products/alerts/backend/facade/contracts.pyindex 859aa9326931..ff288df52b3d 100644--- a/products/alerts/backend/facade/contracts.py+++ b/products/alerts/backend/facade/contracts.py@@ -188,7 +188,7 @@ class SourceBatchEvaluation:# The platform's write, which a source's evaluation workflow starts by name. One definition,# because a rename that misses a source breaks it at runtime and nothing else would catch it.-RECORD_OUTCOMES_ACTIVITY: Final[str] = "alerts_product_record_outcomes"+RECORD_OUTCOMES_ACTIVITY: Final[str] = "alerts_platform_record_outcomes"@frozendiff --git a/products/alerts/backend/facade/temporal.py b/products/alerts/backend/facade/temporal.pyindex 26ea7cb57e91..42cf5045f5ee 100644--- a/products/alerts/backend/facade/temporal.py+++ b/products/alerts/backend/facade/temporal.py@@ -2,8 +2,8 @@ from products.alerts.backend.temporal.metrics import (ALERTS_PLATFORM_LATENCY_HISTOGRAM_BUCKETS,ALERTS_PLATFORM_LATENCY_HISTOGRAM_METRICS,)-from products.alerts.backend.temporal.schedule import create_alerts_product_tick_schedule-from products.alerts.backend.temporal.telemetry import AlertsProductTelemetryInterceptor+from products.alerts.backend.temporal.schedule import create_alerts_platform_tick_schedule+from products.alerts.backend.temporal.telemetry import AlertsPlatformTelemetryInterceptorfrom products.alerts.backend.temporal.workflows import (DELIVERY_ACTIVITIES,DELIVERY_WORKFLOWS,@@ -24,6 +24,6 @@ __all__ = ["SHARED_ORCHESTRATION_ACTIVITIES","SHARED_ORCHESTRATION_WORKFLOWS","SOURCE_EVALUATION_TIMEOUT",- "AlertsProductTelemetryInterceptor",- "create_alerts_product_tick_schedule",+ "AlertsPlatformTelemetryInterceptor",+ "create_alerts_platform_tick_schedule",]diff --git a/products/alerts/backend/temporal/outcomes.py b/products/alerts/backend/temporal/outcomes.pyindex 326d64125f0b..75e27a2e6165 100644--- a/products/alerts/backend/temporal/outcomes.py+++ b/products/alerts/backend/temporal/outcomes.py@@ -18,7 +18,7 @@ from products.alerts.backend.temporal.metrics import increment_outcomes_recorded@activity.defn(name=RECORD_OUTCOMES_ACTIVITY)-async def alerts_product_record_outcomes_activity(inputs: SourceOutcomeInputs) -> int:+async def alerts_platform_record_outcomes_activity(inputs: SourceOutcomeInputs) -> int:"""Records one batch's decisions. Returns how many reached the tables."""# Imported in the activity body, not at module scope: a Django model import trips Temporal's# workflow sandbox, and the worker registration that reaches this module runs through one.diff --git a/products/alerts/backend/temporal/schedule.py b/products/alerts/backend/temporal/schedule.pyindex e07f1d30f621..58fce1957193 100644--- a/products/alerts/backend/temporal/schedule.py+++ b/products/alerts/backend/temporal/schedule.py@@ -11,19 +11,19 @@ from posthog.temporal.common.schedule import a_create_schedule, a_schedule_existif TYPE_CHECKING:from temporalio.client import Client-SCHEDULE_ID = "alerts-product-check-due-schedule"+SCHEDULE_ID = "alerts-platform-check-due-schedule"-async def create_alerts_product_tick_schedule(client: "Client") -> None:+async def create_alerts_platform_tick_schedule(client: "Client") -> None:if settings.CLOUD_DEPLOYMENT != "DEV":returnschedule = Schedule(action=ScheduleActionStartWorkflow(- "alerts-product-orchestrate",+ "alerts-platform-orchestrate",{},id=SCHEDULE_ID,- task_queue=settings.ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE,execution_timeout=dt.timedelta(seconds=50),retry_policy=RetryPolicy(maximum_attempts=1),),diff --git a/products/alerts/backend/temporal/telemetry.py b/products/alerts/backend/temporal/telemetry.pyindex 122632fb585c..09ed5cda6926 100644--- a/products/alerts/backend/temporal/telemetry.py+++ b/products/alerts/backend/temporal/telemetry.py@@ -44,20 +44,20 @@ async def _log_activity_event(pass-class AlertsProductTelemetryInterceptor(Interceptor):- task_queue = (settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE, settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE)+class AlertsPlatformTelemetryInterceptor(Interceptor):+ task_queue = (settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE, settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE)def intercept_activity(self, next: ActivityInboundInterceptor) -> ActivityInboundInterceptor:- return _AlertsProductActivityInterceptor(next)+ return _AlertsPlatformActivityInterceptor(next)-class _AlertsProductActivityInterceptor(ActivityInboundInterceptor):+class _AlertsPlatformActivityInterceptor(ActivityInboundInterceptor):async def execute_activity(self, input: ExecuteActivityInput) -> object:started_at = _monotonic_time()outcome = "success"exception_type = Nonetry:- await _log_activity_event("alerts_product_activity_started")+ await _log_activity_event("alerts_platform_activity_started")return await super().execute_activity(input)except (asyncio.CancelledError, CancelledError):outcome = "cancellation"@@ -69,7 +69,7 @@ class _AlertsProductActivityInterceptor(ActivityInboundInterceptor):finally:try:await _log_activity_event(- "alerts_product_activity_finished",+ "alerts_platform_activity_finished",started_at=started_at,outcome=outcome,exception_type=exception_type,diff --git a/products/alerts/backend/temporal/workflows.py b/products/alerts/backend/temporal/workflows.pyindex ed89b387246f..309726a7c6d9 100644--- a/products/alerts/backend/temporal/workflows.py+++ b/products/alerts/backend/temporal/workflows.py@@ -19,7 +19,7 @@ from posthog.temporal.common.base import PostHogWorkflowfrom posthog.temporal.common.logger import get_write_only_loggerfrom products.alerts.backend.temporal.metrics import increment_deliveries_previewed, safe_record-from products.alerts.backend.temporal.outcomes import alerts_product_record_outcomes_activity+from products.alerts.backend.temporal.outcomes import alerts_platform_record_outcomes_activityfrom products.alerts.backend.temporal.sources import SOURCE_EVALUATION_WORKFLOWSLOGGER = get_write_only_logger(__name__)@@ -47,7 +47,7 @@ with workflow.unsafe.imports_passed_through():from products.alerts.backend.temporal.postgres import check_postgres_connection-POSTGRES_PROBE_FAILURE = "AlertsProductPostgresProbeFailure"+POSTGRES_PROBE_FAILURE = "AlertsPlatformPostgresProbeFailure"# A tick stops starting pages once this much of its minute is spent. The schedule's 50-second# execution timeout is the backstop, and it spans continued runs.@@ -70,17 +70,17 @@ SOURCE_EVALUATION_TIMEOUT = dt.timedelta(seconds=75)@frozen-class AlertsProductInputs:+class AlertsPlatformInputs:pass@activity.defn-async def alerts_product_discover_demand_activity(inputs: DemandDiscoveryInputs) -> AlertDemand:+async def alerts_platform_discover_demand_activity(inputs: DemandDiscoveryInputs) -> AlertDemand:return await database_sync_to_async_pool(discover_demand)(inputs.cutoff)@activity.defn-async def alerts_product_probe_postgres_activity() -> None:+async def alerts_platform_probe_postgres_activity() -> None:try:await sync_to_async(check_postgres_connection, thread_sensitive=False)()except (OperationalError, InterfaceError):@@ -88,15 +88,15 @@ async def alerts_product_probe_postgres_activity() -> None:@activity.defn-async def alerts_product_deliver_activity() -> None:+async def alerts_platform_deliver_activity() -> None:pass@activity.defn-async def alerts_product_deliver_preview_activity(preview: AlertDeliveryPreview) -> None:+async def alerts_platform_deliver_preview_activity(preview: AlertDeliveryPreview) -> None:"""Records what delivery would have sent. The PoC contacts no destination."""await LOGGER.ainfo(- "alerts_product_delivery_preview",+ "alerts_platform_delivery_preview",source=preview.source.value,alert_id=preview.alert_id,alert_name=preview.alert_name,@@ -110,14 +110,14 @@ async def alerts_product_deliver_preview_activity(preview: AlertDeliveryPreview)safe_record(increment_deliveries_previewed, preview.source.value)[email protected](name="alerts-product-deliver-preview")-class AlertsProductDeliverPreviewWorkflow(PostHogWorkflow):[email protected](name="alerts-platform-deliver-preview")+class AlertsPlatformDeliverPreviewWorkflow(PostHogWorkflow):inputs_cls = AlertDeliveryPreview@workflow.runasync def run(self, inputs: AlertDeliveryPreview) -> None:await workflow.execute_activity(- alerts_product_deliver_preview_activity,+ alerts_platform_deliver_preview_activity,inputs,start_to_close_timeout=dt.timedelta(seconds=10),schedule_to_close_timeout=dt.timedelta(seconds=30),@@ -125,30 +125,30 @@ class AlertsProductDeliverPreviewWorkflow(PostHogWorkflow):)[email protected](name="alerts-product-deliver")-class AlertsProductDeliverWorkflow(PostHogWorkflow):- inputs_cls = AlertsProductInputs[email protected](name="alerts-platform-deliver")+class AlertsPlatformDeliverWorkflow(PostHogWorkflow):+ inputs_cls = AlertsPlatformInputs@workflow.run- async def run(self, inputs: AlertsProductInputs) -> None:+ async def run(self, inputs: AlertsPlatformInputs) -> None:await workflow.execute_activity(- alerts_product_deliver_activity,+ alerts_platform_deliver_activity,start_to_close_timeout=dt.timedelta(seconds=10),schedule_to_close_timeout=dt.timedelta(seconds=30),retry_policy=RetryPolicy(maximum_attempts=3),)[email protected](name="alerts-product-evaluate")-class AlertsProductEvaluateWorkflow(PostHogWorkflow):- inputs_cls = AlertsProductInputs[email protected](name="alerts-platform-evaluate")+class AlertsPlatformEvaluateWorkflow(PostHogWorkflow):+ inputs_cls = AlertsPlatformInputs@workflow.run- async def run(self, inputs: AlertsProductInputs) -> None:+ async def run(self, inputs: AlertsPlatformInputs) -> None:try:await workflow.execute_activity(- alerts_product_probe_postgres_activity,- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ alerts_platform_probe_postgres_activity,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,start_to_close_timeout=dt.timedelta(seconds=10),schedule_to_close_timeout=dt.timedelta(seconds=30),retry_policy=RetryPolicy(maximum_attempts=1),@@ -165,17 +165,17 @@ class AlertsProductEvaluateWorkflow(PostHogWorkflow):raise# Delivery must outlive the tick, so wait for start confirmation without awaiting the handle.await workflow.start_child_workflow(- AlertsProductDeliverWorkflow.run,+ AlertsPlatformDeliverWorkflow.run,inputs,- id=f"alerts-product-deliver-{workflow.info().run_id}",- task_queue=settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE,+ id=f"alerts-platform-deliver-{workflow.info().run_id}",+ task_queue=settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE,parent_close_policy=workflow.ParentClosePolicy.ABANDON,execution_timeout=dt.timedelta(minutes=1),)[email protected](name="alerts-product-source-dispatch")-class AlertsProductSourceDispatchWorkflow(PostHogWorkflow):[email protected](name="alerts-platform-source-dispatch")+class AlertsPlatformSourceDispatchWorkflow(PostHogWorkflow):"""One run per source per page. Receives all of the source's remaining demand, starts oneevaluation child per batch key up to `MAX_EVALUATIONS_PER_DISPATCH`, and reports the keys itdid not take so a later page picks them up.@@ -200,10 +200,10 @@ class AlertsProductSourceDispatchWorkflow(PostHogWorkflow):if source_workflow is None:# No adapter yet. The key is not passed to the noop, and the probe path stays as is.await workflow.start_child_workflow(- AlertsProductEvaluateWorkflow.run,- AlertsProductInputs(),+ AlertsPlatformEvaluateWorkflow.run,+ AlertsPlatformInputs(),id=evaluation_workflow_id,- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,parent_close_policy=workflow.ParentClosePolicy.ABANDON,execution_timeout=SOURCE_EVALUATION_TIMEOUT,retry_policy=RetryPolicy(maximum_attempts=1),@@ -213,7 +213,7 @@ class AlertsProductSourceDispatchWorkflow(PostHogWorkflow):source_workflow,SourceEvaluationInputs(source=inputs.source, cutoff=inputs.cutoff, batch_key=key),id=evaluation_workflow_id,- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,parent_close_policy=workflow.ParentClosePolicy.ABANDON,execution_timeout=SOURCE_EVALUATION_TIMEOUT,retry_policy=RetryPolicy(maximum_attempts=1),@@ -243,8 +243,8 @@ def _should_continue_as_new() -> bool:return workflow.info().is_continue_as_new_suggested()[email protected](name="alerts-product-orchestrate")-class AlertsProductOrchestrateWorkflow(PostHogWorkflow):[email protected](name="alerts-platform-orchestrate")+class AlertsPlatformOrchestrateWorkflow(PostHogWorkflow):"""One minute tick. Discovers demand once, then pages source dispatchers until the demand isexhausted or the dispatch budget is spent. Dispatchers are part of the tick: they keep thedefault TERMINATE close policy and their reports are awaited. Evaluation is never awaited.@@ -275,7 +275,7 @@ class AlertsProductOrchestrateWorkflow(PostHogWorkflow):if inputs.demand is None:discovered = await workflow.execute_activity(- alerts_product_discover_demand_activity,+ alerts_platform_discover_demand_activity,DemandDiscoveryInputs(cutoff=inputs.cutoff),start_to_close_timeout=dt.timedelta(seconds=5),schedule_to_close_timeout=dt.timedelta(seconds=10),@@ -306,7 +306,7 @@ class AlertsProductOrchestrateWorkflow(PostHogWorkflow):paged = sorted(demand.items())handles = [await workflow.start_child_workflow(- AlertsProductSourceDispatchWorkflow.run,+ AlertsPlatformSourceDispatchWorkflow.run,SourceDispatchInputs(tick_id=info.workflow_id,source=source,@@ -317,7 +317,7 @@ class AlertsProductOrchestrateWorkflow(PostHogWorkflow):id=f"{info.workflow_id}-{source.value}-p{page}",# The tick awaits these, so they run on its own fleet. An evaluation fleet with# no free slots would otherwise leave the dispatcher unpicked and stall the tick.- task_queue=settings.ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE,execution_timeout=page_timeout,retry_policy=RetryPolicy(maximum_attempts=1),)@@ -369,17 +369,17 @@ class AlertsProductOrchestrateWorkflow(PostHogWorkflow):SHARED_ORCHESTRATION_WORKFLOWS: list[type[PostHogWorkflow]] = [- AlertsProductOrchestrateWorkflow,- AlertsProductSourceDispatchWorkflow,+ AlertsPlatformOrchestrateWorkflow,+ AlertsPlatformSourceDispatchWorkflow,]-SHARED_ORCHESTRATION_ACTIVITIES: list[Callable[..., object]] = [alerts_product_discover_demand_activity]-EVALUATION_WORKFLOWS: list[type[PostHogWorkflow]] = [AlertsProductEvaluateWorkflow]+SHARED_ORCHESTRATION_ACTIVITIES: list[Callable[..., object]] = [alerts_platform_discover_demand_activity]+EVALUATION_WORKFLOWS: list[type[PostHogWorkflow]] = [AlertsPlatformEvaluateWorkflow]EVALUATION_ACTIVITIES: list[Callable[..., object]] = [- alerts_product_probe_postgres_activity,- alerts_product_record_outcomes_activity,+ alerts_platform_probe_postgres_activity,+ alerts_platform_record_outcomes_activity,]-DELIVERY_WORKFLOWS: list[type[PostHogWorkflow]] = [AlertsProductDeliverWorkflow, AlertsProductDeliverPreviewWorkflow]+DELIVERY_WORKFLOWS: list[type[PostHogWorkflow]] = [AlertsPlatformDeliverWorkflow, AlertsPlatformDeliverPreviewWorkflow]DELIVERY_ACTIVITIES: list[Callable[..., object]] = [- alerts_product_deliver_activity,- alerts_product_deliver_preview_activity,+ alerts_platform_deliver_activity,+ alerts_platform_deliver_preview_activity,]diff --git a/products/alerts/backend/tests/test_temporal_dispatch.py b/products/alerts/backend/tests/test_temporal_dispatch.pyindex 84aecc02d7ba..da136559c12f 100644--- a/products/alerts/backend/tests/test_temporal_dispatch.py+++ b/products/alerts/backend/tests/test_temporal_dispatch.py@@ -48,10 +48,10 @@ from products.alerts.backend.facade.temporal import (from products.alerts.backend.temporal import postgres, workflowsfrom products.alerts.backend.temporal.sources import SOURCE_EVALUATION_WORKFLOWSfrom products.alerts.backend.temporal.workflows import (- AlertsProductEvaluateWorkflow,- AlertsProductInputs,- AlertsProductOrchestrateWorkflow,- AlertsProductSourceDispatchWorkflow,+ AlertsPlatformEvaluateWorkflow,+ AlertsPlatformInputs,+ AlertsPlatformOrchestrateWorkflow,+ AlertsPlatformSourceDispatchWorkflow,)_team_id = 0@@ -74,11 +74,11 @@ def scenario_team() -> None:_team_id += 1-ORCHESTRATION_QUEUE = settings.ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE-EVALUATION_QUEUE = settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE+ORCHESTRATION_QUEUE = settings.ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE+EVALUATION_QUEUE = settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE[email protected](name="alerts-product-source-dispatch")[email protected](name="alerts-platform-source-dispatch")class PagingDispatcher:"""Stands in for the real dispatcher: takes one ID per run, reports the rest. Same child edge."""@@ -89,8 +89,8 @@ class PagingDispatcher:)evaluation_workflow_id = f"{workflow.info().workflow_id}-eval"await workflow.start_child_workflow(- AlertsProductEvaluateWorkflow.run,- AlertsProductInputs(),+ AlertsPlatformEvaluateWorkflow.run,+ AlertsPlatformInputs(),id=evaluation_workflow_id,task_queue=EVALUATION_QUEUE,parent_close_policy=workflow.ParentClosePolicy.ABANDON,@@ -104,7 +104,7 @@ class PagingDispatcher:)[email protected](name="alerts-product-source-dispatch")[email protected](name="alerts-platform-source-dispatch")class BrokenLogsDispatcher:"""Registered under the real dispatcher's name. Fails for logs, dispatches for every othersource, the way a broken source adapter would."""@@ -167,7 +167,7 @@ GateActivity = Callable[[list[str]], Awaitable[None]]def demand_activity(demand: dict[SourceKind, list[AlertBatchKey]], omitted: dict[SourceKind, int] | None = None) -> DiscoverActivity:- @activity.defn(name="alerts_product_discover_demand_activity")+ @activity.defn(name="alerts_platform_discover_demand_activity")async def discover(inputs: DemandDiscoveryInputs) -> AlertDemand:return AlertDemand(batch_keys_by_source=demand, omitted_by_source=omitted or {})@@ -190,7 +190,7 @@ def workers(name, so it takes its place on the fleet the tick dispatches to."""runner = UnsandboxedWorkflowRunner()orchestration_workflows: list[type] = (- [AlertsProductOrchestrateWorkflow, dispatcher] if dispatcher else list(SHARED_ORCHESTRATION_WORKFLOWS)+ [AlertsPlatformOrchestrateWorkflow, dispatcher] if dispatcher else list(SHARED_ORCHESTRATION_WORKFLOWS))return (Worker(@@ -216,7 +216,7 @@ def events_of(history: WorkflowHistory, event_type: int) -> list[HistoryEvent]:async def run_tick(client: Client, tick_id: str) -> OrchestrateResult:return await client.execute_workflow(- AlertsProductOrchestrateWorkflow.run,+ AlertsPlatformOrchestrateWorkflow.run,OrchestrateInputs(),id=tick_id,task_queue=ORCHESTRATION_QUEUE,@@ -230,7 +230,7 @@ async def test_real_dispatcher_takes_everything_and_abandons_one_evaluation(enviorchestration_worker, evaluation_worker = workers(client)async with orchestration_worker, evaluation_worker:report: SourceDispatchReport = await client.execute_workflow(- AlertsProductSourceDispatchWorkflow.run,+ AlertsPlatformSourceDispatchWorkflow.run,SourceDispatchInputs(tick_id="tick",source=SourceKind.LOGS,@@ -259,7 +259,7 @@ async def test_real_dispatcher_takes_everything_and_abandons_one_evaluation(envi# One evaluation per key the dispatcher took, each named by the key it holds.assert len(initiated) == 3child = initiated[0].start_child_workflow_execution_initiated_event_attributes- assert child.workflow_type.name == "alerts-product-evaluate"+ assert child.workflow_type.name == "alerts-platform-evaluate"assert child.parent_close_policy == ParentClosePolicy.PARENT_CLOSE_POLICY_ABANDONassert child.workflow_execution_timeout.ToTimedelta() == workflows.SOURCE_EVALUATION_TIMEOUT# One task per child start, plus the one that completed the run. A dispatcher that awaited an@@ -282,7 +282,7 @@ async def test_a_key_whose_evaluation_still_runs_is_skipped_without_losing_the_pblocker = await client.start_workflow(BlockingEvaluation.run, id=held_id, task_queue=EVALUATION_QUEUE)try:report: SourceDispatchReport = await client.execute_workflow(- AlertsProductSourceDispatchWorkflow.run,+ AlertsPlatformSourceDispatchWorkflow.run,SourceDispatchInputs(tick_id="tick",source=SourceKind.LOGS,@@ -363,7 +363,7 @@ async def test_tick_pages_until_demand_is_exhausted(environment: WorkflowEnviron).replay_workflow(history)scheduled = events_of(history, EventType.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED)assert [event.activity_task_scheduled_event_attributes.activity_type.name for event in scheduled] == [- "alerts_product_discover_demand_activity"+ "alerts_platform_discover_demand_activity"]started = events_of(history, EventType.EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_STARTED)children = {@@ -373,10 +373,10 @@ async def test_tick_pages_until_demand_is_exhausted(environment: WorkflowEnvironfor event in started}assert children == {- f"{tick_id}-insight-p0": "alerts-product-source-dispatch",- f"{tick_id}-logs-p0": "alerts-product-source-dispatch",- f"{tick_id}-logs-p1": "alerts-product-source-dispatch",- f"{tick_id}-logs-p2": "alerts-product-source-dispatch",+ f"{tick_id}-insight-p0": "alerts-platform-source-dispatch",+ f"{tick_id}-logs-p0": "alerts-platform-source-dispatch",+ f"{tick_id}-logs-p1": "alerts-platform-source-dispatch",+ f"{tick_id}-logs-p2": "alerts-platform-source-dispatch",}for event in events_of(history, EventType.EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED):attributes = event.start_child_workflow_execution_initiated_event_attributes@@ -457,7 +457,7 @@ async def test_overrunning_dispatcher_times_out_before_the_tick_hard_stop()async with orchestration, evaluation:handle = await client.start_workflow(- AlertsProductOrchestrateWorkflow.run,+ AlertsPlatformOrchestrateWorkflow.run,OrchestrateInputs(),id=tick_id,task_queue=ORCHESTRATION_QUEUE,diff --git a/products/alerts/backend/tests/test_temporal_postgres.py b/products/alerts/backend/tests/test_temporal_postgres.pyindex 30836ec4a7ef..fa821892782e 100644--- a/products/alerts/backend/tests/test_temporal_postgres.py+++ b/products/alerts/backend/tests/test_temporal_postgres.py@@ -18,7 +18,7 @@ from temporalio.exceptions import ApplicationError, CancelledErrorfrom temporalio.testing import ActivityEnvironmentfrom products.alerts.backend.temporal import postgres-from products.alerts.backend.temporal.workflows import POSTGRES_PROBE_FAILURE, alerts_product_probe_postgres_activity+from products.alerts.backend.temporal.workflows import POSTGRES_PROBE_FAILURE, alerts_platform_probe_postgres_activityif TYPE_CHECKING:from pytest_django.fixtures import Settings@@ -62,11 +62,11 @@ async def test_probe_uses_database_thread_and_sanitizes_only_expected_errors():environment = ActivityEnvironment()if error is None:- await environment.run(alerts_product_probe_postgres_activity)+ await environment.run(alerts_platform_probe_postgres_activity)cursor.fetchone.assert_called_once_with()elif isinstance(error, (OperationalError, InterfaceError)):with pytest.raises(ApplicationError) as caught:- await environment.run(alerts_product_probe_postgres_activity)+ await environment.run(alerts_platform_probe_postgres_activity)assert caught.value.type == POSTGRES_PROBE_FAILUREfailure = Failure()DefaultFailureConverter().to_failure(caught.value, DefaultPayloadConverter(), failure)@@ -74,7 +74,7 @@ async def test_probe_uses_database_thread_and_sanitizes_only_expected_errors(assert "sensitive" not in str(failure)else:with pytest.raises(type(error)) as caught_unrelated:- await environment.run(alerts_product_probe_postgres_activity)+ await environment.run(alerts_platform_probe_postgres_activity)assert caught_unrelated.value is errorcursor.execute.assert_called_once_with("SELECT 1")@@ -114,10 +114,10 @@ async def test_probe_cancellation_and_concurrent_activity_cleanup(settings: Settpatch.object(postgres, "execute_with_timeout", execute_with_timeout),patch("django.db.connections.all", return_value=[connection]),):- task = asyncio.create_task(ActivityEnvironment().run(alerts_product_probe_postgres_activity))+ task = asyncio.create_task(ActivityEnvironment().run(alerts_platform_probe_postgres_activity))try:await asyncio.wait_for(entered.wait(), timeout=5)- await asyncio.wait_for(ActivityEnvironment().run(alerts_product_probe_postgres_activity), timeout=5)+ await asyncio.wait_for(ActivityEnvironment().run(alerts_platform_probe_postgres_activity), timeout=5)task.cancel()with pytest.raises(asyncio.CancelledError):await taskdiff --git a/products/alerts/backend/tests/test_temporal_schedule.py b/products/alerts/backend/tests/test_temporal_schedule.pyindex a4f79bc46ba6..1acd1b93f553 100644--- a/products/alerts/backend/tests/test_temporal_schedule.py+++ b/products/alerts/backend/tests/test_temporal_schedule.py@@ -7,7 +7,7 @@ from django.test import override_settingsfrom temporalio.client import Client, ScheduleActionStartWorkflow, ScheduleOverlapPolicy, ScheduleState-from products.alerts.backend.temporal.schedule import SCHEDULE_ID, create_alerts_product_tick_schedule+from products.alerts.backend.temporal.schedule import SCHEDULE_ID, create_alerts_platform_tick_scheduleMODULE = "products.alerts.backend.temporal.schedule"@@ -22,7 +22,7 @@ async def test_schedule_does_not_access_temporal_outside_dev(deployment: str | Npatch(f"{MODULE}.a_create_schedule") as create,patch(f"{MODULE}.a_update_schedule") as update,):- await create_alerts_product_tick_schedule(client)+ await create_alerts_platform_tick_schedule(client)exists.assert_not_awaited()create.assert_not_awaited()update.assert_not_awaited()@@ -40,13 +40,13 @@ async def test_dev_schedule_creates_or_updates_with_bounded_policy(already_existwith (override_settings(CLOUD_DEPLOYMENT="DEV",- ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE="orchestration-test-queue",+ ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE="orchestration-test-queue",),patch(f"{MODULE}.a_schedule_exists", return_value=already_exists) as exists,patch(f"{MODULE}.a_create_schedule") as create,patch(f"{MODULE}.a_update_schedule") as update,):- await create_alerts_product_tick_schedule(client)+ await create_alerts_platform_tick_schedule(client)exists.assert_awaited_once_with(client, SCHEDULE_ID)called = update if already_exists else create@@ -59,7 +59,7 @@ async def test_dev_schedule_creates_or_updates_with_bounded_policy(already_existschedule = called.await_args.args[2]action = schedule.actionassert isinstance(action, ScheduleActionStartWorkflow)- assert action.workflow == "alerts-product-orchestrate"+ assert action.workflow == "alerts-platform-orchestrate"assert list(action.args) == [{}]assert action.id == SCHEDULE_IDassert action.task_queue == "orchestration-test-queue"diff --git a/products/alerts/backend/tests/test_temporal_telemetry.py b/products/alerts/backend/tests/test_temporal_telemetry.pyindex 12164e61c36c..b8e8f75294cb 100644--- a/products/alerts/backend/tests/test_temporal_telemetry.py+++ b/products/alerts/backend/tests/test_temporal_telemetry.py@@ -19,7 +19,7 @@ from temporalio.worker import ActivityInboundInterceptor, ExecuteActivityInputfrom posthog.temporal.common.interceptor import is_task_queue_supportedfrom posthog.temporal.common.worker import ALL_INTERCEPTOR_CLASSES-from products.alerts.backend.facade.temporal import AlertsProductTelemetryInterceptor+from products.alerts.backend.facade.temporal import AlertsPlatformTelemetryInterceptorfrom products.alerts.backend.temporal import telemetry@@ -38,7 +38,7 @@ async def test_activity_attempt_logs(error, outcome, level, tracing_enabled, actdownstream = Mock(spec=ActivityInboundInterceptor)result = object()downstream.execute_activity = AsyncMock(return_value=result, side_effect=error)- interceptor = AlertsProductTelemetryInterceptor().intercept_activity(downstream)+ interceptor = AlertsPlatformTelemetryInterceptor().intercept_activity(downstream)activity_input = ExecuteActivityInput(fn=downstream.execute_activity,args=["sensitive activity input"],@@ -64,11 +64,11 @@ async def test_activity_attempt_logs(error, outcome, level, tracing_enabled, actassert len(activity_logs) == 4for attempt, duration_ms in ((1, 125.0), (2, 500.0)):start, finish = activity_logs[(attempt - 1) * 2 : attempt * 2]- assert start["event"] == "alerts_product_activity_started"+ assert start["event"] == "alerts_platform_activity_started"assert start["log_level"] == "info"assert "duration_ms" not in startassert "outcome" not in start- assert finish["event"] == "alerts_product_activity_finished"+ assert finish["event"] == "alerts_platform_activity_finished"assert finish["log_level"] == levelassert finish["outcome"] == outcomeassert finish["duration_ms"] == duration_ms@@ -106,7 +106,7 @@ async def test_telemetry_failure_preserves_activity_outcome(error, failure_pointdownstream = Mock(spec=ActivityInboundInterceptor)result = object()downstream.execute_activity = AsyncMock(return_value=result, side_effect=error)- interceptor = AlertsProductTelemetryInterceptor().intercept_activity(downstream)+ interceptor = AlertsPlatformTelemetryInterceptor().intercept_activity(downstream)activity_input = ExecuteActivityInput(fn=downstream.execute_activity, args=[], executor=None, headers={})telemetry_error = RuntimeError("telemetry unavailable")if failure_point in ("start", "finish"):@@ -133,7 +133,7 @@ async def test_logging_does_not_block_activity_loop(phase: str, activity_logs: ldownstream = Mock(spec=ActivityInboundInterceptor)result = object()downstream.execute_activity = AsyncMock(return_value=result)- interceptor = AlertsProductTelemetryInterceptor().intercept_activity(downstream)+ interceptor = AlertsPlatformTelemetryInterceptor().intercept_activity(downstream)activity_input = ExecuteActivityInput(fn=downstream.execute_activity, args=[], executor=None, headers={})loop = asyncio.get_running_loop()log_started = asyncio.Event()@@ -141,7 +141,7 @@ async def test_logging_does_not_block_activity_loop(phase: str, activity_logs: lreleased: list[bool] = []def block_log(_logger: WrappedLogger, _method_name: str, entry: EventDict) -> EventDict:- if entry["event"] == f"alerts_product_activity_{phase}":+ if entry["event"] == f"alerts_platform_activity_{phase}":loop.call_soon_threadsafe(log_started.set)released.append(release_log.wait(timeout=10))return entry@@ -165,12 +165,12 @@ async def test_cancellation_during_logging_preserves_activity_outcome(downstream = Mock(spec=ActivityInboundInterceptor)result = object()downstream.execute_activity = AsyncMock(return_value=result, side_effect=error)- interceptor = AlertsProductTelemetryInterceptor().intercept_activity(downstream)+ interceptor = AlertsPlatformTelemetryInterceptor().intercept_activity(downstream)activity_input = ExecuteActivityInput(fn=downstream.execute_activity, args=[], executor=None, headers={})log_started = asyncio.Event()async def wait_for_cancellation(event: str, **fields: object) -> None:- if event == f"alerts_product_activity_{phase}":+ if event == f"alerts_platform_activity_{phase}":log_started.set()await asyncio.Event().wait()@@ -200,8 +200,8 @@ async def test_cancellation_during_logging_preserves_activity_outcome(@pytest.mark.parametrize("task_queue,supported",[- (settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE, True),- (settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE, True),+ (settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE, True),+ (settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE, True),(settings.LOGS_ALERTING_TASK_QUEUE, False),("unrelated-task-queue", False),],@@ -210,6 +210,6 @@ def test_telemetry_registration(task_queue, supported):registered = [interceptorfor interceptor in ALL_INTERCEPTOR_CLASSES- if interceptor is AlertsProductTelemetryInterceptor and is_task_queue_supported(task_queue, interceptor)+ if interceptor is AlertsPlatformTelemetryInterceptor and is_task_queue_supported(task_queue, interceptor)]- assert registered == ([AlertsProductTelemetryInterceptor] if supported else [])+ assert registered == ([AlertsPlatformTelemetryInterceptor] if supported else [])diff --git a/products/alerts/backend/tests/test_temporal_workflows.py b/products/alerts/backend/tests/test_temporal_workflows.pyindex ae8d643737f1..38e67ef991d5 100644--- a/products/alerts/backend/tests/test_temporal_workflows.py+++ b/products/alerts/backend/tests/test_temporal_workflows.py@@ -50,24 +50,24 @@ from products.alerts.backend.facade.temporal import (EVALUATION_WORKFLOWS,SHARED_ORCHESTRATION_ACTIVITIES,SHARED_ORCHESTRATION_WORKFLOWS,- AlertsProductTelemetryInterceptor,+ AlertsPlatformTelemetryInterceptor,)from products.alerts.backend.logic import demandfrom products.alerts.backend.models import PlatformAlertConfigurationfrom products.alerts.backend.temporal import postgresfrom products.alerts.backend.temporal.workflows import (- AlertsProductEvaluateWorkflow,- AlertsProductInputs,- AlertsProductOrchestrateWorkflow,- alerts_product_discover_demand_activity,+ AlertsPlatformEvaluateWorkflow,+ AlertsPlatformInputs,+ AlertsPlatformOrchestrateWorkflow,+ alerts_platform_discover_demand_activity,)[email protected](name="test-alerts-product-close-after-child-start")[email protected](name="test-alerts-platform-close-after-child-start")class CloseAfterChildStartWorkflow:@workflow.runasync def run(self, close_mode: str) -> None:- await AlertsProductEvaluateWorkflow().run(AlertsProductInputs())+ await AlertsPlatformEvaluateWorkflow().run(AlertsPlatformInputs())await workflow.execute_activity("test_confirm_child_start", start_to_close_timeout=dt.timedelta(seconds=5))if close_mode == "failed":raise ApplicationError("Test parent failure", non_retryable=True)@@ -119,7 +119,7 @@ async def test_each_tick_starts_independent_delivery(span_exporter.clear()sdk_metrics.retrieve_updates()- @activity.defn(name="alerts_product_deliver_activity")+ @activity.defn(name="alerts_platform_deliver_activity")async def retry_delivery() -> None:if activity.info().attempt == 1:raise ApplicationError("sensitive retry exception")@@ -127,26 +127,26 @@ async def test_each_tick_starts_independent_delivery(async with (Worker(client,- task_queue=settings.ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE,workflows=SHARED_ORCHESTRATION_WORKFLOWS,activities=SHARED_ORCHESTRATION_ACTIVITIES,workflow_runner=UnsandboxedWorkflowRunner(),),Worker(client,- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,workflows=EVALUATION_WORKFLOWS,activities=EVALUATION_ACTIVITIES,- interceptors=[AlertsProductTelemetryInterceptor()],+ interceptors=[AlertsPlatformTelemetryInterceptor()],workflow_runner=UnsandboxedWorkflowRunner(),),):for _ in range(2):parent = await client.start_workflow(- "alerts-product-evaluate",- AlertsProductInputs(),+ "alerts-platform-evaluate",+ AlertsPlatformInputs(),id=workflow_id,- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,execution_timeout=dt.timedelta(seconds=10),)assert await parent.result() is None@@ -158,7 +158,7 @@ async def test_each_tick_starts_independent_delivery(if event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED]assert len(scheduled) == 1- assert scheduled[0].task_queue.name == settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE+ assert scheduled[0].task_queue.name == settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUEassert scheduled[0].retry_policy.maximum_attempts == 1failure_count = sum(event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_FAILED for event in history.events@@ -174,10 +174,10 @@ async def test_each_tick_starts_independent_delivery(child_id = children[0].workflow_execution.workflow_idassert evaluation_run_id is not Noneassert evaluation_run_id in child_id- assert children[0].workflow_type.name == "alerts-product-deliver"+ assert children[0].workflow_type.name == "alerts-platform-deliver"child_ids.add(child_id)child_description = await client.get_workflow_handle(child_id).describe()- assert child_description.task_queue == settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE+ assert child_description.task_queue == settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUEassert child_description.status == WorkflowExecutionStatus.RUNNINGassert len(child_ids) == 2@@ -185,10 +185,10 @@ async def test_each_tick_starts_independent_delivery(assert "sensitive" not in caplog.textasync with Worker(client,- task_queue=settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE,workflows=DELIVERY_WORKFLOWS,activities=[retry_delivery],- interceptors=[AlertsProductTelemetryInterceptor()],+ interceptors=[AlertsPlatformTelemetryInterceptor()],workflow_runner=UnsandboxedWorkflowRunner(),):for child_id in child_ids:@@ -201,15 +201,15 @@ async def test_each_tick_starts_independent_delivery(if event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED]assert len(scheduled) == 1- assert scheduled[0].task_queue.name == settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE+ assert scheduled[0].task_queue.name == settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUEassert scheduled[0].retry_policy.maximum_attempts == 3updates = sdk_metrics.retrieve_updates()for metric_name in ("temporal_activity_schedule_to_start_latency", "temporal_activity_execution_latency"):for task_queue, expected_attempts in (- (settings.ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE, 0),- (settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE, 2),- (settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE, 4),+ (settings.ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE, 0),+ (settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE, 2),+ (settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE, 4),):samples = [update@@ -226,13 +226,13 @@ async def test_each_tick_starts_independent_delivery(activity_spans = [span for span in spans if span.name.startswith("RunActivity:")]assert len(workflow_spans) == 4assert len(activity_spans) == 6- for delivery in (span for span in workflow_spans if span.name == "RunWorkflow:alerts-product-deliver"):+ for delivery in (span for span in workflow_spans if span.name == "RunWorkflow:alerts-platform-deliver"):assert delivery.parent is not Nonechild_start = spans_by_id[delivery.parent.span_id]assert child_start.parent is not Noneevaluation = spans_by_id[child_start.parent.span_id]- assert child_start.name == "StartChildWorkflow:alerts-product-deliver"- assert evaluation.name == "RunWorkflow:alerts-product-evaluate"+ assert child_start.name == "StartChildWorkflow:alerts-platform-deliver"+ assert evaluation.name == "RunWorkflow:alerts-platform-evaluate"assert delivery.context.trace_id == child_start.context.trace_id == evaluation.context.trace_idassert evaluation.end_time is not None and delivery.start_time is not Noneassert evaluation.end_time <= delivery.start_time@@ -252,16 +252,16 @@ async def test_each_tick_starts_independent_delivery(if entry.get("span_id") == trace.format_span_id(attempt_span.context.span_id)]assert [entry["event"] for entry in entries] == [- "alerts_product_activity_started",- "alerts_product_activity_finished",+ "alerts_platform_activity_started",+ "alerts_platform_activity_finished",]assert all(entry["trace_id"] == trace.format_trace_id(attempt_span.context.trace_id) for entry in entries)assert entries[0]["attempt"] == entries[1]["attempt"]assert entries[1]["outcome"] == ("failure"if (- (attempt_span.name == "RunActivity:alerts_product_deliver_activity" and entries[1]["attempt"] == 1)- or (attempt_span.name == "RunActivity:alerts_product_probe_postgres_activity" and database_error)+ (attempt_span.name == "RunActivity:alerts_platform_deliver_activity" and entries[1]["attempt"] == 1)+ or (attempt_span.name == "RunActivity:alerts_platform_probe_postgres_activity" and database_error))else "success")@@ -284,7 +284,7 @@ async def test_delivery_survives_parent_closure(async with Worker(client,- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,workflows=[CloseAfterChildStartWorkflow],activities=[*EVALUATION_ACTIVITIES, confirm_child_start],workflow_runner=UnsandboxedWorkflowRunner(),@@ -293,11 +293,11 @@ async def test_delivery_survives_parent_closure(CloseAfterChildStartWorkflow.run,close_mode,id=str(uuid.uuid4()),- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,execution_timeout=dt.timedelta(seconds=10),)await asyncio.wait_for(child_started.wait(), timeout=10)- child_id = f"alerts-product-deliver-{parent.first_execution_run_id}"+ child_id = f"alerts-platform-deliver-{parent.first_execution_run_id}"if close_mode == "terminated":await parent.terminate()@@ -309,7 +309,7 @@ async def test_delivery_survives_parent_closure(assert (await child.describe()).status == WorkflowExecutionStatus.RUNNINGasync with Worker(client,- task_queue=settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE,workflows=DELIVERY_WORKFLOWS,activities=DELIVERY_ACTIVITIES,workflow_runner=UnsandboxedWorkflowRunner(),@@ -325,7 +325,7 @@ async def test_probe_timeout_still_starts_independent_delivery(activity_started = asyncio.Event()release_activity = asyncio.Event()- @activity.defn(name="alerts_product_probe_postgres_activity")+ @activity.defn(name="alerts_platform_probe_postgres_activity")async def blocked_probe() -> None:activity_started.set()await release_activity.wait()@@ -333,15 +333,15 @@ async def test_probe_timeout_still_starts_independent_delivery(client = environment.clientasync with Worker(client,- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,workflows=EVALUATION_WORKFLOWS,workflow_runner=UnsandboxedWorkflowRunner(),):parent = await client.start_workflow(- AlertsProductEvaluateWorkflow.run,- AlertsProductInputs(),+ AlertsPlatformEvaluateWorkflow.run,+ AlertsPlatformInputs(),id=str(uuid.uuid4()),- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,execution_timeout=dt.timedelta(seconds=50),)async with asyncio.timeout(10):@@ -355,7 +355,7 @@ async def test_probe_timeout_still_starts_independent_delivery(await environment.sleep(25)async with Worker(client,- task_queue=settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,activities=[blocked_probe],):try:@@ -371,7 +371,7 @@ async def test_probe_timeout_still_starts_independent_delivery(]assert len(timeouts) == 1assert timeouts[0].failure.timeout_failure_info.timeout_type == int(timeout_type)- child = client.get_workflow_handle(f"alerts-product-deliver-{parent.first_execution_run_id}")+ child = client.get_workflow_handle(f"alerts-platform-deliver-{parent.first_execution_run_id}")assert (await child.describe()).status == WorkflowExecutionStatus.RUNNINGobservation = "Postgres probe timed out; database outcome unknown; delivery is continuing"@@ -380,7 +380,7 @@ async def test_probe_timeout_still_starts_independent_delivery(assert caplog.text.count(observation) == 1async with Worker(client,- task_queue=settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE,workflows=DELIVERY_WORKFLOWS,activities=DELIVERY_ACTIVITIES,workflow_runner=UnsandboxedWorkflowRunner(),@@ -403,7 +403,7 @@ async def test_probe_unrelated_activity_failures_do_not_start_delivery(cause: Exscheduled_event_id=1,started_event_id=2,identity="test-worker",- activity_type="alerts_product_probe_postgres_activity",+ activity_type="alerts_platform_probe_postgres_activity",activity_id="1",retry_state=None,)@@ -413,7 +413,7 @@ async def test_probe_unrelated_activity_failures_do_not_start_delivery(cause: Expatch.object(workflow, "start_child_workflow", AsyncMock()) as start_delivery,pytest.raises(ActivityError) as caught,):- await AlertsProductEvaluateWorkflow().run(AlertsProductInputs())+ await AlertsPlatformEvaluateWorkflow().run(AlertsPlatformInputs())assert caught.value is errorstart_delivery.assert_not_awaited()@@ -424,7 +424,7 @@ async def test_probe_workflow_cancellation_does_not_start_delivery() -> None:patch.object(workflow, "start_child_workflow", AsyncMock()) as start_delivery,pytest.raises(asyncio.CancelledError),):- await AlertsProductEvaluateWorkflow().run(AlertsProductInputs())+ await AlertsPlatformEvaluateWorkflow().run(AlertsPlatformInputs())start_delivery.assert_not_awaited()@@ -495,7 +495,7 @@ class TestDemandDiscovery(APIBaseTest):async def test_discovery_runs_off_the_event_loop(self) -> None:# The activity is async and discovery reads Postgres, so calling it inline raises# SynchronousOnlyOperation and takes the whole tick down. No mock catches that.- result = await alerts_product_discover_demand_activity(DemandDiscoveryInputs(cutoff=self.tick.isoformat()))+ result = await alerts_platform_discover_demand_activity(DemandDiscoveryInputs(cutoff=self.tick.isoformat()))assert result.batch_keys_by_source == {}@@ -528,7 +528,7 @@ async def test_discovery_uses_scheduled_cutoff_or_manual_start(scheduled: bool)) as discover,patch.object(workflow, "start_child_workflow", AsyncMock()) as dispatch,):- result = await AlertsProductOrchestrateWorkflow().run(OrchestrateInputs())+ result = await AlertsPlatformOrchestrateWorkflow().run(OrchestrateInputs())assert discover.await_args is not Noneassert discover.await_args.args[1] == DemandDiscoveryInputs(cutoff=(tick_time if scheduled else actual_start).isoformat()@@ -540,12 +540,12 @@ async def test_discovery_uses_scheduled_cutoff_or_manual_start(scheduled: bool)def test_the_dispatcher_is_registered_on_the_fleet_the_tick_starts_it_on() -> None:from posthog.management.commands.start_temporal_worker import WORKFLOWS_DICT- from products.alerts.backend.temporal.workflows import AlertsProductSourceDispatchWorkflow+ from products.alerts.backend.temporal.workflows import AlertsPlatformSourceDispatchWorkflow# The tick awaits its dispatchers. One registered on a fleet the tick does not dispatch to# leaves every page queued until it times out, and fails the tick with it.- registered = WORKFLOWS_DICT[settings.ALERTS_PRODUCT_SHARED_ORCHESTRATION_TASK_QUEUE]- assert AlertsProductSourceDispatchWorkflow in registered+ registered = WORKFLOWS_DICT[settings.ALERTS_PLATFORM_SHARED_ORCHESTRATION_TASK_QUEUE]+ assert AlertsPlatformSourceDispatchWorkflow in registereddef test_every_source_evaluation_binding_names_a_registered_workflow() -> None:@@ -557,7 +557,7 @@ def test_every_source_evaluation_binding_names_a_registered_workflow() -> None:definitions = (temporalio.workflow._Definition.from_class(registered_workflow)- for registered_workflow in WORKFLOWS_DICT[settings.ALERTS_PRODUCT_EVALUATION_TASK_QUEUE]+ for registered_workflow in WORKFLOWS_DICT[settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE])registered = {definition.name for definition in definitions if definition is not None}# A binding naming a workflow no evaluation worker registers leaves every dispatch fordiff --git a/products/logs/backend/temporal/alert_evaluate.py b/products/logs/backend/temporal/alert_evaluate.pyindex dc1cd6edba01..1a2a9dabb8f6 100644--- a/products/logs/backend/temporal/alert_evaluate.py+++ b/products/logs/backend/temporal/alert_evaluate.py@@ -101,10 +101,10 @@ class LogsAlertEvaluateWorkflow(PostHogWorkflow):results = await asyncio.gather(*(workflow.start_child_workflow(- "alerts-product-deliver-preview",+ "alerts-platform-deliver-preview",preview,id=f"alerts-deliver-preview-{preview.evaluation_key}",- task_queue=settings.ALERTS_PRODUCT_DELIVERY_TASK_QUEUE,+ task_queue=settings.ALERTS_PLATFORM_DELIVERY_TASK_QUEUE,parent_close_policy=workflow.ParentClosePolicy.ABANDON,execution_timeout=dt.timedelta(minutes=1),)