Skip to content

Split Expo push batches across mixed projects on PUSH_TOO_MANY_EXPERIENCE_IDS - #8542

Open
lanjak wants to merge 1 commit into
get-bb:mainfrom
lanjak:lanjak/fix-7578-handle-expo-push-too-many-experience-id-thr_7rkpvvs57j
Open

lanjak wants to merge 1 commit into
get-bb:mainfrom
lanjak:lanjak/fix-7578-handle-expo-push-too-many-experience-id-thr_7rkpvvs57j

Conversation

@lanjak

@lanjak lanjak commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

createPushSender (sender.ts#L651) batched all registered mobile subscriptions into 100-message requests to https://exp.host/--/api/v2/push/send regardless of Expo project. When devices from different Expo projects (for example stable and nightly builds) were registered together, Expo rejected the entire batch with PUSH_TOO_MANY_EXPERIENCE_IDS and dropped notifications for every device in the batch. Investigation report: https://get-bb.github.io/reports/issues/7578.html

What changed

  • plugins/push-notifications/sender.ts:
    • Added details: z.unknown().optional() to expoPushErrorSchema.
    • On PUSH_TOO_MANY_EXPERIENCE_IDS for a multi-device batch, splitBatchByExperience splits deliveries by Expo's errors[].details map (experienceId -> token[], with any unassigned tokens in a remainder group) or falls back to single-token batches when details does not split the batch; single-token rejections stop without retrying.
    • Cached learned token -> experienceId mappings in experienceIdsByToken (cleared on DeviceNotRegistered) and grouped both deliver and dismissThread via batchesFor(deliveries) so single-project setups stay one HTTP request while mixed-project sends avoid extra round-trips on subsequent pushes.
  • Docs: none updated; PLUGIN_OVERVIEW.md does not describe Expo batch splitting internals.

No wire change, no KV schema change, and no mobile re-registration required.

How you verified

Base commit: origin/main 4d7a9af609.

Case Before (origin/main) After (d823875043)
Mixed-project batch returns PUSH_TOO_MANY_EXPERIENCE_IDS with details Whole batch fails; 0 notifications delivered Splits by experienceId, delivers all, pre-groups subsequent sends
PUSH_TOO_MANY_EXPERIENCE_IDS without details Whole batch fails Falls back to single-token sends and delivers all
Single-project batch 1 HTTP request per 100 devices 1 HTTP request per 100 devices (unchanged)
Per-ticket DeviceNotRegistered after split / single-token rejection n/a Subscription + cache entry removed; single-token rejection does not loop

Tests added in plugins/push-notifications/server.test.ts (3 new tests failed before the fix; 43/43 pass after).

CI parity command:
pnpm exec turbo run typecheck test lint lint:type-aware --filter=bb-plugin-push-notifications --continue

  • typecheck, lint, lint:type-aware: passed (0 errors, 0 warnings).
  • test: server.test.ts (43/43) and notification-text.test.ts (1/1) passed (app.test.tsx / client.test.ts hit local Node 26 window.localStorage shadowing).

Fixes #7578

AGENT GENERATED

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.

Mobile pushes fail when registered devices use different Expo projects

1 participant