Skip to content

: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.

chore(subscriptions): deterministic activity-log ordering in tests (#73558)

Raúl Negrón-Otero7f9370ec025b
diff --git a/posthog/models/test/test_subscription_activity_log.py b/posthog/models/test/test_subscription_activity_log.py
index f1591faafdbd..b11fac5816aa 100644
--- a/posthog/models/test/test_subscription_activity_log.py
+++ b/posthog/models/test/test_subscription_activity_log.py
@@ -32,7 +32,9 @@ class TestSubscriptionActivityLog(BaseTest):
return Subscription.objects.create(**params)
def _subscription_logs(self):
- return ActivityLog.objects.filter(scope="Subscription").order_by("created_at")
+ # Every row shares one created_at under freeze_time, leaving order undefined. The UUIDT
+ # id's per-millisecond series counter increments per insert, so id tie-breaks in insertion order.
+ return ActivityLog.objects.filter(scope="Subscription").order_by("created_at", "id")
@parameterized.expand(
[