Fix every Expo device reporting as a tablet when expo-device is absent - #69
Merged
Conversation
getDeviceInfo()'s Expo branch runs when EITHER expo-device or expo-application is installed, so ExpoDevice can be null inside it. The tablet check was `ExpoDevice?.deviceType === ExpoDevice?.DeviceType?.TABLET` — with ExpoDevice missing that is `undefined === undefined`, which is true, so every such device reported device_type: "tablet". That also flipped the synthesized user agent to iPad/Tablet, so both the structured field and the UA agreed on the wrong answer and nothing downstream could recover it. Visible in production: a cohort of events with os_name="ios", device_manufacturer="Unknown", device_model="Unknown", device_type="tablet" — every field the ExpoDevice-null fallback, and real iPhones shown under Tablet in the device breakdown. Extracted as resolveExpoDeviceType() so the null case is testable, matching the existing exported synthesizeUserAgent() helper. Unknown form factor now resolves to "mobile", the safe default for a React Native app. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Jul 31, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
getDeviceInfo()'s Expo branch is entered when eitherexpo-deviceorexpo-applicationis installed, soExpoDevicecan benullinside it. The tablet check was:With
ExpoDevicemissing that isundefined === undefined→true, so every such device reportsdevice_type: "tablet".It also flips
synthesizeUserAgent()to emit an iPad/Tablet UA, so the structured field and the user agent agree on the wrong answer and nothing downstream can recover the real form factor.Evidence
Visible in production
raw_events: a cohort withos_name: "ios",device_manufacturer: "Unknown",device_model: "Unknown",device_type: "tablet"— every value theExpoDevice-null fallback. Real iPhones are showing under Tablet in the dashboard's device breakdown.The fix
Extracted as an exported
resolveExpoDeviceType()so the null case is testable, matching the existing exportedsynthesizeUserAgent()helper. An unknown form factor now resolves to"mobile"— the safe default for a React Native app.8 new unit tests cover: both args absent, either arm absent, real tablet, phone,
DeviceType.UNKNOWN(0, which must not be treated as missing), desktop/TV, andnullvsundefined.Full suite: 239 passing.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.