: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
fix(data-warehouse): partition Stripe Discount on start not created (#71836)
posthog[bot]cdc0e277c2b1
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/settings.pyindex bdd2ddf2d01a..24c2720ffc7e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/settings.py@@ -178,4 +178,15 @@ APPEND_ONLY_INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {"field_type": IncrementalFieldType.Integer,}],+ # Discount objects expose `start`/`end`, not `created`. Without this entry the partition key+ # falls back to "created" (stripe_source), which Discount rows lack, so a KeyError kills the+ # sync as soon as real customer.discount.* webhook events arrive.+ DISCOUNT_RESOURCE_NAME: [+ {+ "label": "start",+ "type": IncrementalFieldType.DateTime,+ "field": "start",+ "field_type": IncrementalFieldType.Integer,+ }+ ],}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.pyindex 96a190ea7c56..bc2c37aedda5 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py@@ -582,6 +582,14 @@ class TestWebhookOnlyResponseWiring:assert response.webhook_only is Falsemanager.webhook_enabled.assert_awaited_once_with(webhook_only=False)+ def test_discount_partitions_on_start_not_created(self) -> None:+ # Discount objects carry `start`/`end`, not `created`. If the incremental-field entry is+ # dropped the partition key falls back to "created" and the Delta partitioner KeyErrors on+ # the first real customer.discount.* webhook event, failing the whole sync.+ manager = self._make_manager(enabled=True)+ response = self._source(DISCOUNT_RESOURCE_NAME, manager)+ assert response.partition_keys == ["start"]+class TestSchemaWebhookCapability:def setup_method(self):