Skip to content

Preserve GCM provider errors and skip terminal retries - #45

Open
thomasgregg wants to merge 1 commit into
sdb9696:mainfrom
thomasgregg:codex/registration-errors
Open

thomasgregg wants to merge 1 commit into
sdb9696:mainfrom
thomasgregg:codex/registration-errors

Conversation

@thomasgregg

Copy link
Copy Markdown

Summary

  • Add public FcmRegistrationError details for provider-side registration failures.
  • Mark PHONE_REGISTRATION_ERROR as non-retryable for the current identity.
  • Preserve bounded retries for transient provider errors and raise their typed error after exhaustion.
  • Avoid sleeping after the final request.

Why

gcm_register() currently repeats PHONE_REGISTRATION_ERROR four times with the same Android ID, security token, and GCM app ID. Because none of the identity inputs change, these requests cannot recover from a deterministic identity rejection. The provider code is then collapsed into a generic registration failure, so callers cannot choose an appropriate recovery policy.

FcmRegistrationError remains a RuntimeError, while adding stable stage, code, and retryable attributes. This lets downstream callers use long backoff for terminal identity errors without parsing log strings. The exception message contains only the stage and provider code, not credentials.

This improves the behavior and diagnostics discussed in #32; it intentionally does not claim to fix the undocumented provider-side reason for the rejection.

Tests

  • Terminal PHONE_REGISTRATION_ERROR produces one request, no sleep, and a typed non-retryable error.
  • Transient SERVICE_NOT_AVAILABLE still makes four attempts, sleeps only between attempts, and retains the typed provider details.
  • Full suite: 15 passed.
  • Ruff format/lint, mypy, and git diff --check pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant