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(adobe_commerce): keep admin token retry noise out of error tracking (#87932)

Tom Owerscb368d8699cd
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/adobe_commerce.py b/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/adobe_commerce.py
index 3367726f8cc6..c3b0fab742dd 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/adobe_commerce.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/adobe_commerce.py
@@ -72,6 +72,10 @@ HOST_NOT_ALLOWED_ERROR = "Adobe Commerce store URL is not allowed"
INCOMPLETE_CREDENTIALS_ERROR = "Adobe Commerce credentials are incomplete"
HTTPS_REQUIRED_ERROR = "Adobe Commerce store URL must use HTTPS"
PAGINATION_LIMIT_ERROR = "Adobe Commerce pagination did not terminate"
+# Reached only after the tracked session's own transport-level retries for 429/5xx are exhausted
+# (see `_mint`), so this is self-recovering — matched by `AdobeCommerceSource.get_retryable_errors`
+# to keep it out of error tracking. The status code is left out of the constant since it varies.
+ADMIN_TOKEN_RETRYABLE_ERROR = "Adobe Commerce admin token request failed (retryable)"
# A store code is a Magento code: letters, digits and underscores, starting with a letter.
_STORE_CODE_RE = re.compile(r"^[a-zA-Z][a-zA-Z0-9_]*$")
@@ -369,9 +373,7 @@ class AdobeCommerceTokenManager:
try:
if response.status_code == 429 or response.status_code >= 500:
- raise AdobeCommerceRetryableError(
- f"Adobe Commerce admin token request failed (retryable): status={response.status_code}"
- )
+ raise AdobeCommerceRetryableError(f"{ADMIN_TOKEN_RETRYABLE_ERROR}: status={response.status_code}")
# A 3xx is not an error status, so refuse it explicitly rather than following it to a
# potentially internal Location.
if response.is_redirect or response.is_permanent_redirect:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/source.py
index 8d83f2f6db3e..d1f596e642d4 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/source.py
@@ -12,6 +12,7 @@ from posthog.schema import (
)
from products.warehouse_sources.backend.temporal.data_imports.sources.adobe_commerce.adobe_commerce import (
+ ADMIN_TOKEN_RETRYABLE_ERROR,
HOST_NOT_ALLOWED_ERROR,
HTTPS_REQUIRED_ERROR,
INCOMPLETE_CREDENTIALS_ERROR,
@@ -168,6 +169,12 @@ class AdobeCommerceSource(ResumableSource[AdobeCommerceSourceConfig, AdobeCommer
PAGINATION_LIMIT_ERROR: "Adobe Commerce kept returning pages without signalling the end of the collection. This usually means the store's REST API is misconfigured — check the store URL and store code.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # The admin token exchange already retries 429/5xx at the transport level (the tracked
+ # session); this is only raised once that budget is exhausted, and re-minting later
+ # recovers on its own. Keep it out of error tracking rather than paging it as a bug.
+ return {ADMIN_TOKEN_RETRYABLE_ERROR}
+
def get_canonical_descriptions(self) -> CanonicalDescriptions:
from products.warehouse_sources.backend.temporal.data_imports.sources.adobe_commerce.canonical_descriptions import ( # noqa: PLC0415
CANONICAL_DESCRIPTIONS,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/tests/test_adobe_commerce_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/tests/test_adobe_commerce_source.py
index 202f64300273..81ef98b61b98 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/tests/test_adobe_commerce_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/adobe_commerce/tests/test_adobe_commerce_source.py
@@ -109,6 +109,17 @@ class TestAdobeCommerceSource:
def test_non_retryable_errors_ignore_transient(self, _name: str, unrelated_error: str) -> None:
assert not any(key in unrelated_error for key in self.source.get_non_retryable_errors())
+ @parameterized.expand(
+ [
+ ("server_error", "Adobe Commerce admin token request failed (retryable): status=500"),
+ ("rate_limited", "Adobe Commerce admin token request failed (retryable): status=429"),
+ ]
+ )
+ def test_retryable_errors_match_admin_token_failures(self, _name: str, observed_error: str) -> None:
+ # The admin token exchange only raises this once its own transport-level retries for
+ # 429/5xx are exhausted, so it's self-recovering — it must stay out of error tracking.
+ assert any(key in observed_error for key in self.source.get_retryable_errors())
+
@mock.patch(f"{_MODULE}.adobe_commerce_source")
def test_source_for_pipeline_plumbs_incremental_inputs(self, mock_source: mock.MagicMock) -> None:
inputs = mock.MagicMock()