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.

fix(test): widen data_interval_start in backfill_earliest_persons to eliminate flake (#72980)

mendral-app[bot]a12f6a851b1b
diff --git a/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_workflow.py b/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_workflow.py
index 51e686be2a8b..917a82bddfa3 100644
--- a/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_workflow.py
+++ b/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_workflow.py
@@ -258,9 +258,9 @@ async def test_bigquery_export_workflow_without_events(
@pytest.mark.parametrize(
"data_interval_start",
- # This is set to 24 hours before the `data_interval_end` to ensure that the data created is outside the batch
- # interval.
- [TEST_TIME - dt.timedelta(hours=24)],
+ # Use 72 hours so that with 10 randomly sampled persons the probability of none landing
+ # more than 12 hours before the end is negligible ((12/72)^10 ≈ 1 in 60 million).
+ [TEST_TIME - dt.timedelta(hours=72)],
indirect=True,
)
@pytest.mark.parametrize("interval", ["hour"], indirect=True)
diff --git a/products/batch_exports/backend/tests/temporal/destinations/postgres/test_workflow.py b/products/batch_exports/backend/tests/temporal/destinations/postgres/test_workflow.py
index b1519921b4db..58960bc80940 100644
--- a/products/batch_exports/backend/tests/temporal/destinations/postgres/test_workflow.py
+++ b/products/batch_exports/backend/tests/temporal/destinations/postgres/test_workflow.py
@@ -308,9 +308,10 @@ async def test_postgres_export_workflow_without_events(
@pytest.mark.parametrize(
"data_interval_start",
- # This is set to 24 hours before the `data_interval_end` to ensure that the data created is outside the batch
- # interval.
- [dt.datetime.now(tz=dt.UTC).replace(hour=0, minute=0, second=0, microsecond=0) - dt.timedelta(hours=24)],
+ # This is set to 72 hours before the `data_interval_end` to ensure that the data created is outside the batch
+ # interval. We use 72 hours (instead of 24) so that with 10 randomly sampled persons the probability of none
+ # landing more than 12 hours before the end is negligible ((12/72)^10 ≈ 1 in 60 million).
+ [dt.datetime.now(tz=dt.UTC).replace(hour=0, minute=0, second=0, microsecond=0) - dt.timedelta(hours=72)],
indirect=True,
)
@pytest.mark.parametrize("interval", ["hour"], indirect=True)
diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_minio_bucket.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_minio_bucket.py
index 75dbf201c358..2ab54f6bfc61 100644
--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_minio_bucket.py
+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_minio_bucket.py
@@ -146,12 +146,13 @@ async def test_s3_export_workflow_with_minio_bucket_with_exclude_events(
@pytest.mark.parametrize(
"data_interval_start",
- [dt.datetime.now(tz=dt.UTC).replace(hour=0, minute=0, second=0, microsecond=0) - dt.timedelta(hours=24)],
+ # Use 72 hours so that with 10 randomly sampled persons the probability of none landing
+ # more than 12 hours before the end is negligible ((12/72)^10 ≈ 1 in 60 million).
+ [dt.datetime.now(tz=dt.UTC).replace(hour=0, minute=0, second=0, microsecond=0) - dt.timedelta(hours=72)],
indirect=True,
)
@pytest.mark.parametrize("interval", ["hour"], indirect=True)
@pytest.mark.parametrize("model", [BatchExportModel(name="persons", schema=None)])
async def test_s3_export_workflow_backfill_earliest_persons_with_minio_bucket(
clickhouse_client,
minio_client,
diff --git a/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_workflow_e2e.py b/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_workflow_e2e.py
index aa159824a7e1..b69c3846ba8c 100644
--- a/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_workflow_e2e.py
+++ b/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_workflow_e2e.py
@@ -231,9 +231,9 @@ async def test_snowflake_export_workflow_with_many_files(
@pytest.mark.parametrize(
"data_interval_start",
- # This is set to 24 hours before the `data_interval_end` to ensure that the data created is outside the batch
- # interval.
- [TEST_TIME - dt.timedelta(hours=24)],
+ # Use 72 hours so that with 10 randomly sampled persons the probability of none landing
+ # more than 12 hours before the end is negligible ((12/72)^10 ≈ 1 in 60 million).
+ [TEST_TIME - dt.timedelta(hours=72)],
indirect=True,
)
@pytest.mark.parametrize("interval", ["hour"], indirect=True)