Skip to content

Register Live Activity push-to-start error code 40182, add LiveActivity push stats#349

Merged
JoaoDiasAbly merged 2 commits into
mainfrom
AIT-989/liveactivity-error-codes-and-stats
Jul 10, 2026
Merged

Register Live Activity push-to-start error code 40182, add LiveActivity push stats#349
JoaoDiasAbly merged 2 commits into
mainfrom
AIT-989/liveactivity-error-codes-and-stats

Conversation

@JoaoDiasAbly

@JoaoDiasAbly JoaoDiasAbly commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

ably-common side of LiveActivity production readiness (ADR-157, follow-up): registers the one LiveActivity error code still missing from the error registry, and adds the customer stats for Live Activity broadcasts and per-outcome notification delivery. Unblocks ably/realtime#8527, which bumps its ably-common submodule once this merges.

Restructured after #348 ("Error code documentation registry"): codes are now registered as errors/codes/<code>.md files and protocol/errors.json is generated from them. Of the six codes this PR originally set out to add, #344 had already registered 103004–103007 and #348 registered 103008 — leaving only 40182.

Error code

  • errors/codes/40182.md (new) — apns_token_authentication_required_for_push_to_start. Push-to-start of a Live Activity requires the app's APNs credentials to use token-based authentication. realtime#8527 rejects non-compliant apps with 40182 at /start request time and uses it for the push-worker transport skip (both previously fell under location's 40180).
  • errors/codes/40180.md — scoped back to location notifications only, since realtime#8527 moves the live-activity case onto 40182: summary narrowed, and identifier/title renamed to apns_token_authentication_required_for_location / "APNs token authentication required for location notification" so the pair reads symmetrically (per review). There's a brief window between the two merges where production still emits 40180 for live-activity skips; realtime#8527 closes it.
  • protocol/errors.json — regenerated via npm run generate:errors (not hand-edited).

Stats schema

Adds push.apnsBroadcasts to json-schemas/src/app-stats.json and json-schemas/src/account-stats.json, alongside push.directPublishes. Each broadcast is a single request to Apple that Apple fans out to every subscribed device (Ably has no per-device visibility), so the counter tracks issuance, not deliveries, and includes the final broadcast sent by an end request.

Also adds the ten per-outcome entries push.notifications.{delivered,refused.retriable,refused.final,skipped,all}.apnsLiveActivity to both schemas, mirroring the apnsLocation wording and placement. These are emitted by the push-worker's apnsLiveActivity stats block in ably/realtime#8527, which counts the expected no-push-to-start-token drops as skips.

Additive fields only — no versions.json bump, following 50412f0 ("Add missing objects stats").

Related

  • AIT-989 — error-code registration
  • AIT-990 — stats counters
  • AIT-804 — 40182 push-to-start precondition
  • ably/realtime#8527 — realtime side (merge this PR first, then the submodule bump lands there)

🤖 Generated with Claude Code

@JoaoDiasAbly JoaoDiasAbly requested a review from lmars July 7, 2026 14:18
@JoaoDiasAbly JoaoDiasAbly changed the title Register LiveActivity error codes 40182 and 103008, add push.apnsBroadcasts stat Register LiveActivity error codes 40182 and 103008, add LiveActivity push stats Jul 7, 2026
@JoaoDiasAbly JoaoDiasAbly force-pushed the AIT-989/liveactivity-error-codes-and-stats branch from cdda81e to e6166de Compare July 7, 2026 20:01
@lmars

lmars commented Jul 9, 2026

Copy link
Copy Markdown
Member

@JoaoDiasAbly we recently updated how error codes are maintained in this repo, so if these new codes are still needed, they need to be registered by creating a Markdown file in the errors/codes directory.

@JoaoDiasAbly JoaoDiasAbly force-pushed the AIT-989/liveactivity-error-codes-and-stats branch from e6166de to 77083de Compare July 10, 2026 09:56
@JoaoDiasAbly JoaoDiasAbly changed the title Register LiveActivity error codes 40182 and 103008, add LiveActivity push stats Register Live Activity push-to-start error code 40182, add LiveActivity push stats Jul 10, 2026
Comment thread errors/codes/40180.md
identifier: apns_token_authentication_required
title: APNs token authentication required
summary: A location or live-activity notification was not sent because these require the app's APNs credentials to use token-based authentication, but the app is not configured that way.
summary: A location notification was not sent because location notifications require the app's APNs credentials to use token-based authentication, but the app is not configured that way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this one is now just about location push, I think we should make the two errors a bit more symmetrical, so here:

apns_token_authentication_required_for_location
"APNs token authentication required for location notification"

and below:

apns_token_authentication_required_push_to_start
"APNs token authentication required for push-to-start Live Activities notification"

JoaoDiasAbly and others added 2 commits July 10, 2026 14:59
Push-to-start of a Live Activity requires the app's APNs credentials
to use token-based authentication; ably/realtime#8527 rejects
non-compliant apps at request time with 40182 (AIT-804, AIT-989)
rather than reusing the location-specific 40180.

Adds errors/codes/40182.md per the registry process introduced in
#348, scopes 40180 back to location notifications only (realtime#8527
moves the live-activity case onto 40182), and regenerates
protocol/errors.json. Per review, the pair is named symmetrically:
apns_token_authentication_required_for_location and
apns_token_authentication_required_for_push_to_start, with titles to
match.

103008, which this branch previously registered by hand, already
landed in #348's registry, so it no longer appears here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two additive fields for LiveActivity observability (AIT-990), added to
both the app and account stats schemas:

- push.apnsBroadcasts: APNs Live Activity broadcasts issued. Each
  broadcast is a single request to Apple that Apple fans out to every
  device subscribed to the broadcast channel (no per-device
  visibility), so it counts issuance, not deliveries, and includes
  the final broadcast sent by an end request.
- push.notifications.{delivered,refused.retriable,refused.final,
  skipped,all}.apnsLiveActivity: per-outcome delivery counters
  mirroring the apnsLocation wording and placement. Emitted by the
  realtime push-worker's apnsLiveActivity stats block
  (ably/realtime#8527), which counts the expected
  no-push-to-start-token drops as skips.

No versions.json bump, following 50412f0 ("Add missing objects stats").

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@JoaoDiasAbly JoaoDiasAbly force-pushed the AIT-989/liveactivity-error-codes-and-stats branch from 77083de to c7b8c01 Compare July 10, 2026 14:02
@JoaoDiasAbly JoaoDiasAbly merged commit 812062a into main Jul 10, 2026
2 checks passed
@JoaoDiasAbly JoaoDiasAbly deleted the AIT-989/liveactivity-error-codes-and-stats branch July 10, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants