: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(data-warehouse): remove WAREHOUSE_SOURCE_WEBHOOKS feature flag (#60941)
Tom Owers154d80817d58
diff --git a/.agents/skills/implementing-warehouse-sources/SKILL.md b/.agents/skills/implementing-warehouse-sources/SKILL.mdindex 9475eaf86ed3..f83f770b678c 100644--- a/.agents/skills/implementing-warehouse-sources/SKILL.md+++ b/.agents/skills/implementing-warehouse-sources/SKILL.md@@ -458,7 +458,7 @@ After changing source fields, re-run `pnpm run generate:source-configs` and `pnp- Incremental sync misbehaving: wrong field name/type or wrong sort assumptions.- Endless retries for bad credentials: missing `get_non_retryable_errors`.- Resumable state never saved: forgot to call `save_state` after yielding a batch; or saved before yield and a crash causes data loss.-- Webhook rows not landing: feature flag `warehouse-source-webhooks` disabled, or schema `is_webhook=False`, or `initial_sync_complete=False`.+- Webhook rows not landing: schema `is_webhook=False`, or `initial_sync_complete=False`.- Dependent resource path `KeyError`: pre-format static path placeholders (see Fan-out).- Silent truncation risk: page caps hit without logs/metrics.- Drift from refactors: unused function params/helpers left behind after endpoint behavior changes.diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex fd4307e4155a..4107f46d9733 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -494,7 +494,6 @@ export const FEATURE_FLAGS = {USER_INTERVIEWS: 'user-interviews', // owner: @Twixes @jurajmajerikUX_REMOVE_SIDEPANEL: 'ux-remove-sidepanel', // owner: #team-surveysVISUAL_REVIEW: 'visual-review', // owner: #team-devex- WAREHOUSE_SOURCE_WEBHOOKS: 'warehouse-source-webhooks', // owner: #team-warehouse-sources @Gilbert09WEB_ANALYTICS_BOT_ANALYSIS: 'web-analytics-bot-analysis', // owner: @lricoy #team-web-analyticsWEB_ANALYTICS_CONVERSION_GOAL_PREAGG: 'web-analytics-conversion-goal-preagg', // owner: @lricoy #team-web-analyticsWEB_ANALYTICS_DRAG_TO_ZOOM: 'web-analytics-drag-to-zoom', // owner: @jordanm-posthog #team-web-analyticsdiff --git a/posthog/temporal/data_imports/sources/common/test/test_webhook_s3.py b/posthog/temporal/data_imports/sources/common/test/test_webhook_s3.pyindex a5088725f83a..316473eecbe1 100644--- a/posthog/temporal/data_imports/sources/common/test/test_webhook_s3.py+++ b/posthog/temporal/data_imports/sources/common/test/test_webhook_s3.py@@ -110,12 +110,6 @@ class TestWebhookSourceManager:assert result.num_rows == 1assert result.column("event").to_pylist() == ["click"]- async def test_webhook_enabled_returns_false_when_flag_disabled(self):- manager = _make_manager()-- with patch.object(manager, "_is_webhook_feature_flag_enabled", return_value=False):- assert await manager.webhook_enabled() is False-@parameterized.expand([("no_hog_function", False, True, True, False, False),@@ -149,12 +143,9 @@ class TestWebhookSourceManager:return AsyncMock(return_value=mock_schema)return AsyncMock(return_value=has_webhook_function)- with (- patch.object(manager, "_is_webhook_feature_flag_enabled", return_value=True),- patch(- "posthog.temporal.data_imports.sources.common.webhook_s3.database_sync_to_async_pool",- side_effect=mock_db_sync_to_async,- ),+ with patch(+ "posthog.temporal.data_imports.sources.common.webhook_s3.database_sync_to_async_pool",+ side_effect=mock_db_sync_to_async,):assert await manager.webhook_enabled() is expected@@ -345,70 +336,6 @@ class TestWebhookSourceManager:assert tables == []- async def test_feature_flag_returns_false_when_team_not_found(self):- from posthog.models import Team-- manager = _make_manager(team_id=999)-- with patch(- "posthog.temporal.data_imports.sources.common.webhook_s3.database_sync_to_async_pool",- return_value=AsyncMock(side_effect=Team.DoesNotExist),- ):- result = await manager._is_webhook_feature_flag_enabled()-- assert result is False-- async def test_feature_flag_returns_false_on_analytics_exception(self):- manager = _make_manager()- mock_team = MagicMock()- mock_team.uuid = uuid.uuid4()- mock_team.organization_id = uuid.uuid4()- mock_team.id = 1-- call_count = 0-- async def mock_side_effect(*args, **kwargs):- nonlocal call_count- call_count += 1- if call_count == 1:- return mock_team- raise Exception("PostHog analytics error")-- with (- patch(- "posthog.temporal.data_imports.sources.common.webhook_s3.database_sync_to_async_pool",- return_value=mock_side_effect,- ),- patch("posthog.temporal.data_imports.sources.common.webhook_s3.capture_exception"),- ):- result = await manager._is_webhook_feature_flag_enabled()-- assert result is False-- async def test_feature_flag_returns_true_when_enabled(self):- manager = _make_manager()- mock_team = MagicMock()- mock_team.uuid = uuid.uuid4()- mock_team.organization_id = uuid.uuid4()- mock_team.id = 1-- call_count = 0-- async def mock_side_effect(*args, **kwargs):- nonlocal call_count- call_count += 1- if call_count == 1:- return mock_team- return True-- with patch(- "posthog.temporal.data_imports.sources.common.webhook_s3.database_sync_to_async_pool",- return_value=mock_side_effect,- ):- result = await manager._is_webhook_feature_flag_enabled()-- assert result is True-# -- Integration tests using MinIO --diff --git a/posthog/temporal/data_imports/sources/common/webhook_s3.py b/posthog/temporal/data_imports/sources/common/webhook_s3.pyindex 757cb61c65e3..f3b46b7fa4a8 100644--- a/posthog/temporal/data_imports/sources/common/webhook_s3.py+++ b/posthog/temporal/data_imports/sources/common/webhook_s3.py@@ -9,48 +9,14 @@ import orjsonimport pyarrow as paimport pyarrow.compute as pcimport pyarrow.parquet as pq-import posthoganalyticsfrom structlog.types import FilteringBoundLogger-from posthog.exceptions_capture import capture_exceptionfrom posthog.sync import database_sync_to_async_poolfrom posthog.temporal.data_imports.pipelines.pipeline.typings import SourceInputsfrom posthog.temporal.data_imports.pipelines.pipeline.utils import table_from_py_listfrom products.data_warehouse.backend.s3 import aget_s3_client-WAREHOUSE_WEBHOOK_FLAG = "warehouse-source-webhooks"---def is_webhook_feature_flag_enabled(team_id: int) -> bool:- from posthog.models import Team-- try:- team = Team.objects.only("uuid", "organization_id").get(id=team_id)- except Team.DoesNotExist:- return False-- try:- enabled = posthoganalytics.feature_enabled(- WAREHOUSE_WEBHOOK_FLAG,- str(team.uuid),- groups={- "organization": str(team.organization_id),- "project": str(team.id),- },- group_properties={- "organization": {"id": str(team.organization_id)},- "project": {"id": str(team.id)},- },- only_evaluate_locally=False,- send_feature_flag_events=False,- )-- return bool(enabled)- except Exception as e:- capture_exception(e)- return False-class WebhookSourceManager:_inputs: SourceInputs@@ -70,11 +36,6 @@ class WebhookSourceManager:from products.cdp.backend.models.hog_functions.hog_function import HogFunctionfrom products.warehouse_sources.backend.models.external_data_schema import ExternalDataSchema- flag_enabled = await self._is_webhook_feature_flag_enabled()-- if not flag_enabled:- return False-schema = await database_sync_to_async_pool(ExternalDataSchema.objects.get)(id=self._inputs.schema_id, team_id=self._inputs.team_id)@@ -215,39 +176,3 @@ class WebhookSourceManager:def _transform_webhook_table(self, table: pa.Table) -> pa.Table:rows = [orjson.loads(str(s)) for s in table.column("payload_json").to_pylist()]return table_from_py_list(rows)-- async def _is_webhook_feature_flag_enabled(self) -> bool:- from posthog.models import Team-- try:- team = await database_sync_to_async_pool(Team.objects.only("uuid", "organization_id").get)(- id=self._inputs.team_id- )- except Team.DoesNotExist:- return False-- try:- enabled = await database_sync_to_async_pool(posthoganalytics.feature_enabled)(- WAREHOUSE_WEBHOOK_FLAG,- str(team.uuid),- groups={- "organization": str(team.organization_id),- "project": str(team.id),- },- group_properties={- "organization": {"id": str(team.organization_id)},- "project": {"id": str(team.id)},- },- only_evaluate_locally=False,- send_feature_flag_events=False,- )-- if enabled:- await self._logger.adebug(- f"Feature flag '{WAREHOUSE_WEBHOOK_FLAG}' is enabled for team {self._inputs.team_id}"- )-- return bool(enabled)- except Exception as e:- capture_exception(e)- return Falsediff --git a/posthog/temporal/data_imports/sources/revenuecat/source.py b/posthog/temporal/data_imports/sources/revenuecat/source.pyindex 2d7b18268da6..2ca5b1f19fcf 100644--- a/posthog/temporal/data_imports/sources/revenuecat/source.py+++ b/posthog/temporal/data_imports/sources/revenuecat/source.py@@ -26,10 +26,7 @@ from posthog.temporal.data_imports.sources.common.base import (from posthog.temporal.data_imports.sources.common.registry import SourceRegistryfrom posthog.temporal.data_imports.sources.common.resumable import ResumableSourceManagerfrom posthog.temporal.data_imports.sources.common.schema import SourceSchema-from posthog.temporal.data_imports.sources.common.webhook_s3 import (- WebhookSourceManager,- is_webhook_feature_flag_enabled,-)+from posthog.temporal.data_imports.sources.common.webhook_s3 import WebhookSourceManagerfrom posthog.temporal.data_imports.sources.generated_configs import RevenueCatSourceConfigfrom posthog.temporal.data_imports.sources.revenuecat import revenuecat as api_clientfrom posthog.temporal.data_imports.sources.revenuecat.constants import (@@ -212,7 +209,6 @@ class RevenueCatSource(names: list[str] | None = None,force_refresh: bool = False,) -> list[SourceSchema]:- webhook_supported = is_webhook_feature_flag_enabled(team_id)# `events` is webhook-only — the v2 API doesn't expose a historical# backfill endpoint for webhook events, so the only way to populate# this table is via realtime webhook deliveries.@@ -221,7 +217,7 @@ class RevenueCatSource(name=name,supports_incremental=False,supports_append=False,- supports_webhooks=webhook_supported,+ supports_webhooks=True,incremental_fields=[],)for name in REVENUECAT_WEBHOOK_SCHEMA_NAMESdiff --git a/posthog/temporal/data_imports/sources/revenuecat/tests/test_revenuecat_source.py b/posthog/temporal/data_imports/sources/revenuecat/tests/test_revenuecat_source.pyindex 93167b9962f6..76e0a43e83fc 100644--- a/posthog/temporal/data_imports/sources/revenuecat/tests/test_revenuecat_source.py+++ b/posthog/temporal/data_imports/sources/revenuecat/tests/test_revenuecat_source.py@@ -78,9 +78,7 @@ class TestRevenueCatSourceWebhookResourceMap:class TestRevenueCatSourceGetSchemas:- @patch("posthog.temporal.data_imports.sources.revenuecat.source.is_webhook_feature_flag_enabled")- def test_includes_both_webhook_and_api_schemas(self, mock_flag):- mock_flag.return_value = True+ def test_includes_both_webhook_and_api_schemas(self):source = RevenueCatSource()schemas = source.get_schemas(_config(), team_id=1)@@ -91,9 +89,7 @@ class TestRevenueCatSourceGetSchemas:for name in REVENUECAT_API_SCHEMA_NAMES:assert name in names, f"missing api schema: {name}"- @patch("posthog.temporal.data_imports.sources.revenuecat.source.is_webhook_feature_flag_enabled")- def test_only_events_schema_supports_webhooks(self, mock_flag):- mock_flag.return_value = True+ def test_only_events_schema_supports_webhooks(self):source = RevenueCatSource()schemas = source.get_schemas(_config(), team_id=1)@@ -101,23 +97,7 @@ class TestRevenueCatSourceGetSchemas:webhook_supported = {s.name for s in schemas if s.supports_webhooks}assert webhook_supported == set(REVENUECAT_WEBHOOK_SCHEMA_NAMES)- @patch("posthog.temporal.data_imports.sources.revenuecat.source.is_webhook_feature_flag_enabled")- def test_webhook_feature_flag_off_disables_webhook_support(self, mock_flag):- # When the warehouse-source-webhooks feature flag is disabled for the team,- # the events schema is still listed but can't actually receive webhook- # data. Reflect that in supports_webhooks so the frontend wizard hides- # the webhook UI.- mock_flag.return_value = False- source = RevenueCatSource()-- schemas = source.get_schemas(_config(), team_id=1)-- webhook_supported = {s.name for s in schemas if s.supports_webhooks}- assert webhook_supported == set()-- @patch("posthog.temporal.data_imports.sources.revenuecat.source.is_webhook_feature_flag_enabled")- def test_filters_by_names_argument(self, mock_flag):- mock_flag.return_value = True+ def test_filters_by_names_argument(self):source = RevenueCatSource()schemas = source.get_schemas(_config(), team_id=1, names=["customers", "events"])diff --git a/posthog/temporal/data_imports/sources/stripe/source.py b/posthog/temporal/data_imports/sources/stripe/source.pyindex e5a12e17ee87..6d87122d0dfa 100644--- a/posthog/temporal/data_imports/sources/stripe/source.py+++ b/posthog/temporal/data_imports/sources/stripe/source.py@@ -1,9 +1,6 @@from typing import TYPE_CHECKING, Optional, cast-from posthog.temporal.data_imports.sources.common.webhook_s3 import (- WebhookSourceManager,- is_webhook_feature_flag_enabled,-)+from posthog.temporal.data_imports.sources.common.webhook_s3 import WebhookSourceManagerif TYPE_CHECKING:from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC@@ -275,8 +272,7 @@ If automatic creation failed due to a permissions error and you're using a restrSourceSchema(name=endpoint,supports_incremental=False,- supports_webhooks=is_webhook_feature_flag_enabled(team_id)- and STRIPE_APPEND_ONLY_INCREMENTAL_FIELDS.get(endpoint, None) is not None,+ supports_webhooks=STRIPE_APPEND_ONLY_INCREMENTAL_FIELDS.get(endpoint, None) is not None,# nested resources are only full refresh and are not in STRIPE_APPEND_ONLY_INCREMENTAL_FIELDSsupports_append=STRIPE_APPEND_ONLY_INCREMENTAL_FIELDS.get(endpoint, None) is not None,incremental_fields=STRIPE_APPEND_ONLY_INCREMENTAL_FIELDS.get(endpoint, []),diff --git a/posthog/temporal/tests/data_imports/test_end_to_end.py b/posthog/temporal/tests/data_imports/test_end_to_end.pyindex 35f7dbc30168..66b75300327a 100644--- a/posthog/temporal/tests/data_imports/test_end_to_end.py+++ b/posthog/temporal/tests/data_imports/test_end_to_end.py@@ -63,7 +63,6 @@ from posthog.temporal.data_imports.row_tracking import get_rowsfrom posthog.temporal.data_imports.settings import ACTIVITIESfrom posthog.temporal.data_imports.sources.common.registry import SourceRegistryfrom posthog.temporal.data_imports.sources.common.rest_source.rest_client import RESTClient as PostHogRESTClient-from posthog.temporal.data_imports.sources.common.webhook_s3 import WebhookSourceManagerfrom posthog.temporal.data_imports.sources.stripe.constants import (BALANCE_TRANSACTION_RESOURCE_NAME as STRIPE_BALANCE_TRANSACTION_RESOURCE_NAME,CHARGE_RESOURCE_NAME as STRIPE_CHARGE_RESOURCE_NAME,@@ -3691,11 +3690,8 @@ async def test_stripe_webhook_s3_charges(team, stripe_charge, mock_stripe_clientfiles = await minio_client.list_objects_v2(Bucket=BUCKET_NAME, Prefix=webhook_prefix)assert len(files.get("Contents", [])) == 1- # Run the pipeline again with webhook feature flag enabled- with (- mock.patch.object(WebhookSourceManager, "_is_webhook_feature_flag_enabled", new=AsyncMock(return_value=True)),- mock.patch.object(DeltaTableHelper, "compact_table"),- ):+ # Run the pipeline again to ingest the webhook parquet+ with mock.patch.object(DeltaTableHelper, "compact_table"):workflow_id = str(uuid.uuid4())await _execute_run(workflow_id, inputs, stripe_charge["data"])@@ -3885,11 +3881,8 @@ async def test_stripe_webhook_consumer_e2e(team, stripe_charge, mock_stripe_clie# Verify offsets were committedconsumer._consumer.commit.assert_called_once_with(asynchronous=False)- # 6. Run the import pipeline with webhook feature flag enabled to ingest the parquet- with (- mock.patch.object(WebhookSourceManager, "_is_webhook_feature_flag_enabled", new=AsyncMock(return_value=True)),- mock.patch.object(DeltaTableHelper, "compact_table"),- ):+ # 6. Run the import pipeline to ingest the parquet+ with mock.patch.object(DeltaTableHelper, "compact_table"):workflow_id = str(uuid.uuid4())await _execute_run(workflow_id, inputs, stripe_charge["data"])diff --git a/products/data_warehouse/backend/api/test/test_external_data_schema.py b/products/data_warehouse/backend/api/test/test_external_data_schema.pyindex cb1a63a894d1..a57599253258 100644--- a/products/data_warehouse/backend/api/test/test_external_data_schema.py+++ b/products/data_warehouse/backend/api/test/test_external_data_schema.py@@ -105,7 +105,7 @@ class TestExternalDataSchema(APIBaseTest):"append_available": True,"cdc_available": None,"full_refresh_available": True,- "supports_webhooks": False,+ "supports_webhooks": True,"available_columns": [],"detected_primary_keys": None,}@@ -492,6 +492,12 @@ class TestExternalDataSchema(APIBaseTest):table=table,)+ mock_hog_fn_result = WebhookHogFunctionCreateResult(+ hog_function=mock.MagicMock(),+ webhook_url="https://test.com/webhook",+ hog_function_created=False,+ )+with (mock.patch("products.data_warehouse.backend.api.external_data_schema.trigger_external_data_workflow"@@ -500,6 +506,10 @@ class TestExternalDataSchema(APIBaseTest):"products.data_warehouse.backend.api.external_data_schema.external_data_workflow_exists",return_value=True,),+ mock.patch(+ "products.data_warehouse.backend.api.external_data_schema.get_or_create_webhook_hog_function",+ return_value=mock_hog_fn_result,+ ),):response = self.client.patch(f"/api/environments/{self.team.pk}/external_data_schemas/{schema.id}",diff --git a/products/data_warehouse/backend/api/test/test_external_data_source.py b/products/data_warehouse/backend/api/test/test_external_data_source.pyindex f1e76a23436f..204f29a20f31 100644--- a/products/data_warehouse/backend/api/test/test_external_data_source.py+++ b/products/data_warehouse/backend/api/test/test_external_data_source.py@@ -5704,9 +5704,8 @@ class TestCreateWebhook(APIBaseTest):category=[],)- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_create_webhook_success(self, mock_create_webhook, _mock_flag):+ def test_create_webhook_success(self, mock_create_webhook):mock_create_webhook.return_value = self._webhook_result()from posthog.temporal.data_imports.sources.stripe.constants import RESOURCE_TO_STRIPE_OBJECT_TYPE@@ -5736,8 +5735,7 @@ class TestCreateWebhook(APIBaseTest):assert hog_function.inputs["source_id"]["value"] == str(source.pk)- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_create_webhook_no_job_inputs(self, _mock_flag):+ def test_create_webhook_no_job_inputs(self):source = ExternalDataSource.objects.create(team_id=self.team.pk,source_id=str(uuid.uuid4()),@@ -5755,9 +5753,8 @@ class TestCreateWebhook(APIBaseTest):assert response.status_code == status.HTTP_400_BAD_REQUESTassert response.json()["message"] == "Source has no configuration"- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_create_webhook_external_creation_fails(self, mock_create_webhook, _mock_flag):+ def test_create_webhook_external_creation_fails(self, mock_create_webhook):mock_create_webhook.return_value = self._webhook_result(success=False, error="Permission denied")from products.cdp.backend.models.hog_functions.hog_function import HogFunction@@ -5777,10 +5774,9 @@ class TestCreateWebhook(APIBaseTest):assert HogFunction.objects.filter(team=self.team, type="warehouse_source_webhook").exists()- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")@override_settings(CLOUD_DEPLOYMENT="US")- def test_create_webhook_url_uses_cloud_deployment(self, mock_create_webhook, _mock_flag):+ def test_create_webhook_url_uses_cloud_deployment(self, mock_create_webhook):mock_create_webhook.return_value = self._webhook_result()self._create_hog_function_template()source = self._create_stripe_source()@@ -5793,10 +5789,9 @@ class TestCreateWebhook(APIBaseTest):assert response.status_code == status.HTTP_200_OKassert response.json()["webhook_url"].startswith("https://webhooks.us.posthog.com")- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")@override_settings(CLOUD_DEPLOYMENT=None, SITE_URL="https://my.posthog.instance")- def test_create_webhook_url_uses_site_url_for_self_hosted(self, mock_create_webhook, _mock_flag):+ def test_create_webhook_url_uses_site_url_for_self_hosted(self, mock_create_webhook):mock_create_webhook.return_value = self._webhook_result()self._create_hog_function_template()source = self._create_stripe_source()@@ -5809,9 +5804,8 @@ class TestCreateWebhook(APIBaseTest):assert response.status_code == status.HTTP_200_OKassert response.json()["webhook_url"].startswith("https://my.posthog.instance")- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_create_webhook_merges_schemas_on_update(self, mock_create_webhook, _mock_flag):+ def test_create_webhook_merges_schemas_on_update(self, mock_create_webhook):mock_create_webhook.return_value = self._webhook_result()from posthog.temporal.data_imports.sources.stripe.constants import RESOURCE_TO_STRIPE_OBJECT_TYPE@@ -5847,8 +5841,7 @@ class TestCreateWebhook(APIBaseTest):assert charge_object_type in schema_mappingassert customer_object_type in schema_mapping- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_create_webhook_template_not_in_db(self, _mock_flag):+ def test_create_webhook_template_not_in_db(self):source = self._create_stripe_source()self._create_webhook_schema(source, STRIPE_CUSTOMER_RESOURCE_NAME)@@ -5859,9 +5852,8 @@ class TestCreateWebhook(APIBaseTest):assert response.status_code == status.HTTP_400_BAD_REQUESTassert "sync_hog_function_templates" in response.json()["message"]- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_create_webhook_saves_extra_inputs(self, mock_create_webhook, _mock_flag):+ def test_create_webhook_saves_extra_inputs(self, mock_create_webhook):from products.cdp.backend.models.hog_functions.hog_function import HogFunctionmock_create_webhook.return_value = self._webhook_result(extra_inputs={"signing_secret": "whsec_test123"})@@ -5882,10 +5874,9 @@ class TestCreateWebhook(APIBaseTest):assert hog_function.encrypted_inputs is not Noneassert hog_function.encrypted_inputs["signing_secret"]["value"] == "whsec_test123"- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.webhook_inputs_updated")@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_update_webhook_inputs(self, mock_create_webhook, mock_inputs_updated, _mock_flag):+ def test_update_webhook_inputs(self, mock_create_webhook, mock_inputs_updated):from products.cdp.backend.models.hog_functions.hog_function import HogFunctionmock_create_webhook.return_value = self._webhook_result()@@ -5920,12 +5911,9 @@ class TestCreateWebhook(APIBaseTest):assert call_args.args[2] == self.team.pkassert call_args.args[3] == {"signing_secret": "whsec_manual123"}- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.webhook_inputs_updated")@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_update_webhook_inputs_propagates_failure_from_source(- self, mock_create_webhook, mock_inputs_updated, _mock_flag- ):+ def test_update_webhook_inputs_propagates_failure_from_source(self, mock_create_webhook, mock_inputs_updated):# If the source's webhook_inputs_updated reports failure (e.g. Customer.io# rejects the request to enable the webhook), surface that to the caller as# a 400 instead of returning 200 + success=true while the webhook stays@@ -5949,9 +5937,8 @@ class TestCreateWebhook(APIBaseTest):assert body["success"] is Falseassert "Customer.io rejected" in body["error"]- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.webhook_inputs_updated")- def test_update_webhook_inputs_requires_job_inputs(self, mock_inputs_updated, _mock_flag):+ def test_update_webhook_inputs_requires_job_inputs(self, mock_inputs_updated):# Sources persisted without job_inputs can't be parsed into a config, so# we should bail out with a 400 before saving anything to the HogFunction.source = self._create_stripe_source(job_inputs={})@@ -5967,9 +5954,8 @@ class TestCreateWebhook(APIBaseTest):assert response.json()["message"] == "Source has no configuration"mock_inputs_updated.assert_not_called()- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.webhook_inputs_updated")- def test_update_webhook_inputs_rejects_invalid_keys(self, mock_inputs_updated, _mock_flag):+ def test_update_webhook_inputs_rejects_invalid_keys(self, mock_inputs_updated):source = self._create_stripe_source()self._create_webhook_schema(source, STRIPE_CUSTOMER_RESOURCE_NAME)@@ -5983,9 +5969,8 @@ class TestCreateWebhook(APIBaseTest):assert "Invalid input keys" in response.json()["message"]mock_inputs_updated.assert_not_called()- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.webhook_inputs_updated")- def test_update_webhook_inputs_no_hog_function(self, mock_inputs_updated, _mock_flag):+ def test_update_webhook_inputs_no_hog_function(self, mock_inputs_updated):source = self._create_stripe_source()self._create_webhook_schema(source, STRIPE_CUSTOMER_RESOURCE_NAME)@@ -5999,9 +5984,8 @@ class TestCreateWebhook(APIBaseTest):assert "No webhook function found" in response.json()["message"]mock_inputs_updated.assert_not_called()- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_update_webhook_inputs_rejects_blanked_required_field(self, mock_create_webhook, _mock_flag):+ def test_update_webhook_inputs_rejects_blanked_required_field(self, mock_create_webhook):mock_create_webhook.return_value = self._webhook_result()self._create_hog_function_template()source = self._create_stripe_source()@@ -6017,11 +6001,8 @@ class TestCreateWebhook(APIBaseTest):assert response.status_code == status.HTTP_400_BAD_REQUESTassert "signing_secret" in response.json()["message"]- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_update_webhook_inputs_partial_update_preserves_other_required_fields(- self, mock_create_webhook, _mock_flag- ):+ def test_update_webhook_inputs_partial_update_preserves_other_required_fields(self, mock_create_webhook):from posthog.schema import SourceFieldInputConfig, SourceFieldInputConfigTypefrom products.cdp.backend.models.hog_functions.hog_function import HogFunction@@ -6091,8 +6072,7 @@ class TestCreateWebhook(APIBaseTest):assert response.status_code == status.HTTP_400_BAD_REQUESTassert "does not support webhooks" in response.json()["message"]- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_update_webhook_inputs_rejects_empty_payload(self, _mock_flag):+ def test_update_webhook_inputs_rejects_empty_payload(self):source = self._create_stripe_source()response = self.client.post(@@ -6104,11 +6084,10 @@ class TestCreateWebhook(APIBaseTest):assert response.status_code == status.HTTP_400_BAD_REQUESTassert "No inputs provided" in response.json()["message"]- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.webhook_inputs_updated")@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")def test_update_webhook_inputs_rotates_secret_without_webhook_schemas(- self, mock_create_webhook, mock_inputs_updated, _mock_flag+ self, mock_create_webhook, mock_inputs_updated):# Regression for Zendesk 57818: the signing secret is a source-level credential# stored on the HogFunction inputs, not per-schema. A source can legitimately@@ -6142,9 +6121,8 @@ class TestCreateWebhook(APIBaseTest):assert hog_function.encrypted_inputs["signing_secret"]["value"] == "whsec_rotated"mock_inputs_updated.assert_called_once()- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.create_webhook")- def test_create_webhook_maps_all_webhook_schemas(self, mock_create_webhook, _mock_flag):+ def test_create_webhook_maps_all_webhook_schemas(self, mock_create_webhook):"""Regression: creating a source with multiple webhook tables then hitting thecreate_webhook endpoint must populate schema_mapping for every webhook schema.Webhook schemas have sync_type='webhook' (not 'incremental')."""@@ -6530,8 +6508,7 @@ class TestWebhookInfo(APIBaseTest):},)- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_webhook_info_non_webhook_source(self, _mock_flag):+ def test_webhook_info_non_webhook_source(self):source = self._create_postgres_source()response = self.client.get(f"/api/environments/{self.team.pk}/external_data_sources/{source.pk}/webhook_info/")@@ -6540,8 +6517,7 @@ class TestWebhookInfo(APIBaseTest):data = response.json()assert data["supports_webhooks"] is False- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_webhook_info_no_hog_function(self, _mock_flag):+ def test_webhook_info_no_hog_function(self):source = self._create_stripe_source()response = self.client.get(f"/api/environments/{self.team.pk}/external_data_sources/{source.pk}/webhook_info/")@@ -6551,9 +6527,8 @@ class TestWebhookInfo(APIBaseTest):assert data["supports_webhooks"] is Trueassert data["exists"] is False- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.get_external_webhook_info")- def test_webhook_info_with_hog_function(self, mock_get_info, _mock_flag):+ def test_webhook_info_with_hog_function(self, mock_get_info):from posthog.temporal.data_imports.sources.common.base import ExternalWebhookInfomock_get_info.return_value = ExternalWebhookInfo(@@ -6581,9 +6556,8 @@ class TestWebhookInfo(APIBaseTest):assert data["external_status"]["status"] == "enabled"assert data["external_status"]["enabled_events"] == ["charge.created", "charge.updated"]- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.get_external_webhook_info")- def test_webhook_info_external_not_found(self, mock_get_info, _mock_flag):+ def test_webhook_info_external_not_found(self, mock_get_info):from posthog.temporal.data_imports.sources.common.base import ExternalWebhookInfomock_get_info.return_value = ExternalWebhookInfo(exists=False)@@ -6598,9 +6572,8 @@ class TestWebhookInfo(APIBaseTest):assert data["exists"] is Trueassert data["external_status"]["exists"] is False- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.get_external_webhook_info")- def test_webhook_info_external_error(self, mock_get_info, _mock_flag):+ def test_webhook_info_external_error(self, mock_get_info):from posthog.temporal.data_imports.sources.common.base import ExternalWebhookInfomock_get_info.return_value = ExternalWebhookInfo(@@ -6618,8 +6591,7 @@ class TestWebhookInfo(APIBaseTest):assert data["exists"] is Trueassert data["external_status"]["error"] is not None- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_webhook_info_source_returns_none(self, _mock_flag):+ def test_webhook_info_source_returns_none(self):"""When a source doesn't implement get_external_webhook_info, external_status should be null."""source = self._create_stripe_source()self._create_hog_function(source)@@ -6637,11 +6609,10 @@ class TestWebhookInfo(APIBaseTest):assert data["exists"] is Trueassert data["external_status"] is None- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.get_external_webhook_info", return_value=None)- def test_webhook_info_masks_set_secret_input(self, _mock_info, _mock_flag):+ def test_webhook_info_masks_set_secret_input(self, _mock_info):from products.cdp.backend.models.hog_functions.hog_function import HogFunctionsource = self._create_stripe_source()@@ -6664,11 +6635,10 @@ class TestWebhookInfo(APIBaseTest):data = response.json()assert data["inputs"] == {"signing_secret": {"secret": True}}- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.get_external_webhook_info", return_value=None)- def test_webhook_info_omits_unset_inputs(self, _mock_info, _mock_flag):+ def test_webhook_info_omits_unset_inputs(self, _mock_info):source = self._create_stripe_source()self._create_hog_function(source)@@ -6739,9 +6709,8 @@ class TestDeleteWebhook(APIBaseTest):should_sync=True,)- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.delete_webhook")- def test_delete_webhook_success(self, mock_delete_webhook, _mock_flag):+ def test_delete_webhook_success(self, mock_delete_webhook):from posthog.temporal.data_imports.sources.common.base import WebhookDeletionResultmock_delete_webhook.return_value = WebhookDeletionResult(success=True)@@ -6764,8 +6733,7 @@ class TestDeleteWebhook(APIBaseTest):assert hog_function.deleted is Trueassert hog_function.enabled is False- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_delete_webhook_blocked_by_webhook_schemas(self, _mock_flag):+ def test_delete_webhook_blocked_by_webhook_schemas(self):source = self._create_stripe_source()self._create_webhook_schema(source, "Customers")self._create_hog_function(source)@@ -6778,9 +6746,8 @@ class TestDeleteWebhook(APIBaseTest):assert "webhook sync" in response.json()["message"]assert "Customers" in response.json()["message"]- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.delete_webhook")- def test_delete_webhook_external_fails_still_deletes_hog_function(self, mock_delete_webhook, _mock_flag):+ def test_delete_webhook_external_fails_still_deletes_hog_function(self, mock_delete_webhook):from posthog.temporal.data_imports.sources.common.base import WebhookDeletionResultmock_delete_webhook.return_value = WebhookDeletionResult(success=False, error="Permission denied")@@ -6803,8 +6770,7 @@ class TestDeleteWebhook(APIBaseTest):assert hog_function.deleted is Trueassert hog_function.enabled is False- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_delete_webhook_no_hog_function(self, _mock_flag):+ def test_delete_webhook_no_hog_function(self):source = self._create_stripe_source()response = self.client.post(@@ -6816,8 +6782,7 @@ class TestDeleteWebhook(APIBaseTest):assert data["success"] is Trueassert data["external_deleted"] is False- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_delete_webhook_non_webhook_source(self, _mock_flag):+ def test_delete_webhook_non_webhook_source(self):source = ExternalDataSource.objects.create(team_id=self.team.pk,source_id=str(uuid.uuid4()),@@ -6835,8 +6800,7 @@ class TestDeleteWebhook(APIBaseTest):assert response.status_code == status.HTTP_400_BAD_REQUESTassert "does not support webhooks" in response.json()["message"]- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)- def test_delete_webhook_no_job_inputs_still_cleans_up_hog_function(self, _mock_flag):+ def test_delete_webhook_no_job_inputs_still_cleans_up_hog_function(self):source = self._create_stripe_source(job_inputs={})hog_function = self._create_hog_function(source)@@ -6855,9 +6819,8 @@ class TestDeleteWebhook(APIBaseTest):class TestDestroySourceCleansUpWebhook(APIBaseTest):- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.delete_webhook")- def test_destroy_source_deletes_webhook_and_hog_function(self, mock_delete_webhook, _mock_flag):+ def test_destroy_source_deletes_webhook_and_hog_function(self, mock_delete_webhook):from posthog.temporal.data_imports.sources.common.base import WebhookDeletionResultfrom products.cdp.backend.models.hog_functions.hog_function import HogFunction@@ -6895,15 +6858,12 @@ class TestDestroySourceCleansUpWebhook(APIBaseTest):assert hog_function.enabled is Falsemock_delete_webhook.assert_called_once()- @patch("posthog.temporal.data_imports.sources.stripe.source.is_webhook_feature_flag_enabled", return_value=True)@patch("products.data_warehouse.backend.api.external_data_source.capture_exception")@patch("posthog.temporal.data_imports.sources.stripe.source.StripeSource.delete_webhook",side_effect=Exception("Stripe API error"),)- def test_destroy_source_continues_if_webhook_cleanup_fails(- self, _mock_delete_webhook, mock_capture_exception, _mock_flag- ):+ def test_destroy_source_continues_if_webhook_cleanup_fails(self, _mock_delete_webhook, mock_capture_exception):from products.cdp.backend.models.hog_functions.hog_function import HogFunctionsource = ExternalDataSource.objects.create(diff --git a/products/data_warehouse/frontend/scenes/SourceScene/SourceScene.tsx b/products/data_warehouse/frontend/scenes/SourceScene/SourceScene.tsxindex 593a7abe6362..937d68283d59 100644--- a/products/data_warehouse/frontend/scenes/SourceScene/SourceScene.tsx+++ b/products/data_warehouse/frontend/scenes/SourceScene/SourceScene.tsx@@ -222,7 +222,7 @@ function ManagedSourceTabs({useAttachedLogic(settingsLogic, attachTo)const showSyncsTab = shouldShowManagedSourceSyncsTab(source)- const showWebhookTab = !!featureFlags[FEATURE_FLAGS.WAREHOUSE_SOURCE_WEBHOOKS] && !!source?.supports_webhooks+ const showWebhookTab = !!source?.supports_webhooksconst showMetricsTab = !!featureFlags[FEATURE_FLAGS.DWH_SOURCE_METRICS]useEffect(() => {