Previous behaviour fired send(event) then flipFromEvent(event)
back-to-back. send is a fire-and-forget Promise; if the POST was
rejected (bundle mismatch, token revoked, validation, network), the
session was still flipped to crashed/errored. Result: Release Health
showed '1 crash' but the Issues tab was empty because no event was
ever persisted.
Fix:
- send/doSend now return Promise<boolean> (true on HTTP 2xx).
- New sendThenFlip() chains the flip behind an .ok check.
- The 3 auto-capture paths (setGlobalHandler, Hermes rejection
tracker, wrapTimers) all use sendThenFlip.
- captureException/captureMessage stay fire-and-forget without flip
(Sentry parity — manual captures don't affect session health).
Side benefits:
- The console.warn 'event rejected (permanent)' is unchanged, so
devs still see bundle/token misconfigs in TestFlight.
- Phantom 'crashed' sessions can no longer accumulate while the
underlying root cause goes unnoticed.