: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(monday): retry 404s from the fixed GraphQL endpoint (#75850)
Tom Owerse1d9e2564740
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/monday/monday.py b/products/warehouse_sources/backend/temporal/data_imports/sources/monday/monday.pyindex 71647072f159..736908ebd40e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/monday/monday.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/monday/monday.py@@ -137,7 +137,11 @@ def _execute(timeout=REQUEST_TIMEOUT_SECONDS,)- if response.status_code == 429 or response.status_code >= 500:+ # MONDAY_API_URL is a fixed constant, never derived from customer input, so a 404 on it can't+ # mean "this resource doesn't exist" — it's the edge/gateway dropping the request before it+ # reaches the GraphQL engine (monday.com's own docs don't list 404 as a GraphQL response code).+ # Treat it like the other transport-layer blips (429/5xx) instead of failing the sync outright.+ if response.status_code in (404, 429) or response.status_code >= 500:raise MondayRetryableError(f"monday.com API error (retryable): status={response.status_code}")if not response.ok:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/monday/tests/test_monday.py b/products/warehouse_sources/backend/temporal/data_imports/sources/monday/tests/test_monday.pyindex 38e8b8b12dde..1c54a1e27504 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/monday/tests/test_monday.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/monday/tests/test_monday.py@@ -95,6 +95,20 @@ class TestGetRowsPaged:with pytest.raises(MondayRetryableError):list(get_rows("token", "users", mock.MagicMock()))+ @mock.patch("time.sleep")+ @mock.patch(f"{_MODULE}.make_tracked_session")+ def test_404_status_is_retried_then_succeeds(self, mock_session, _mock_sleep):+ not_found = mock.MagicMock(status_code=404, ok=False)+ mock_session.return_value.post.side_effect = [+ not_found,+ _response({"users": [{"id": "1"}]}),+ ]++ batches = list(get_rows("token", "users", mock.MagicMock()))++ assert batches == [[{"id": "1"}]]+ assert mock_session.return_value.post.call_count == 2+@mock.patch(f"{_MODULE}.make_tracked_session")def test_requests_carry_token_and_api_version(self, mock_session):mock_session.return_value.post.return_value = _response({"users": []})