Rescue APNs client errors instead of failing todo batches

What does this MR do and why?

Hardens Gitlab::MobilePush::ApnsClient#push so it never raises: connection build and delivery errors are tracked via Gitlab::ErrorTracking and reported as :failed (the outcome SendTodoNotificationsService already counts and logs).

Previously, configured? only checked that the three APNs settings are present — it never touched the filesystem. If mobile_push.apns.auth_key_path pointed to a missing, unreadable, or invalid .p8 file, apnotic raised at connection build (Cert file not found: …) inside Todos::PushNotificationWorker, failing and retrying the batch job on every todo creation for as long as the misconfiguration persisted — a permanent Sidekiq failure/error-tracking storm from a config typo, with no push delivered anyway.

With this change a misconfigured instance degrades to mobile_push_notifications_total{result="failed"} counts plus one tracked exception (grouped by Sentry), and todo batches complete normally.

Raised by @WarheadsSE while reviewing the Omnibus settings counterpart: omnibus-gitlab!9676 (comment 3688250767)

Distribution counterparts that catch the misconfiguration at configuration time (this MR is the runtime backstop):

References

How to set up and validate locally

  1. Configure mobile_push.apns in config/gitlab.yml with auth_key_path pointing at a path that does not exist.
  2. Enable the flags and create a todo (or run Notifications::MobilePush::SendTodoNotificationsService.new([todo.id]).execute from a console for a user with a device subscription).
  3. Before: the worker raises RuntimeError (Cert file not found: …) and retries. After: the service returns normally with apns_results: { "failed" => 1 } and the exception appears in log/exceptions_json.log.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading