Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ def get_non_retryable_errors(self) -> dict[str, str | None]:
SHOPIFY_GRAPHQL_UNAUTHORIZED_ERROR_MATCH: SHOPIFY_GRAPHQL_UNAUTHORIZED_ERROR_MESSAGE,
}

def get_retryable_errors(self) -> set[str]:
# These are the messages `ShopifyRetryableError` carries once `_make_paginated_shopify_
# request`'s `execute` exhausts its own tenacity retries (5 attempts, exponential backoff
# honoring Shopify's throttle refill time — retried alongside transient `ConnectionError`/
# `Timeout`) and re-raises. Surviving all 5 attempts means the rate limit or upstream blip
# is still live, but Temporal retries the whole activity and it's self-recovering, so keep
# it out of error tracking as noise.
return {
"Shopify: rate limit exceeded",
"Shopify: internal error",
"Shopify: connection broken while reading response",
}

@property
def get_source_config(self) -> SourceConfig:
return SourceConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,22 @@ def test_transient_http_errors_stay_retryable(status_code, reason):
assert not any(pattern in error_message for pattern in patterns), (
f"transient error '{error_message}' should remain retryable"
)


@pytest.mark.parametrize(
"error_message",
[
"Shopify: rate limit exceeded...",
"Shopify: internal error from request 500 Internal Server Error",
'Shopify: internal errors in payload [{"message": "internal error", "extensions": {"code": "internal_server_error"}}]',
"Shopify: connection broken while reading response: Connection broken: IncompleteRead(0 bytes read)",
],
)
def test_exhausted_internal_retries_are_classified_as_retryable(error_message):
# These messages only reach `_handle_import_error` after `_make_paginated_shopify_request`'s
# own tenacity retries (5 attempts) are exhausted, so they should be logged as a warning
# and left for Temporal's activity retry rather than reported to error tracking as noise.
patterns = ShopifySource().get_retryable_errors()
assert any(pattern in error_message for pattern in patterns), (
f"exhausted-retry error '{error_message}' should be classified as retryable"
)
Loading