fix(mobile): stop crashing on launch before the shell snapshot arrives - #11537
Conversation
Build 56 still died on every cold open. The device's expo-error.log names it: "TypeError: Cannot read property 'defaultModelSelection' of null" in NewTaskFlowProvider. resolveProjectSettings reads the project aggregate's legacy fields when projectSettingsFolded is false, and the mobile flow passes its selected project through as-is, which is null until the shell snapshot lands. tsc did not catch it: apps/mobile extends Expo's tsconfig without noUncheckedIndexedAccess, so `projects[0] ?? null` types as non-null there. Accept null in resolveProjectSettings and treat it like an absent project. Co-Authored-By: Claude Code <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped mobile crash fix that handles the already-observed null project state without changing valid project-settings resolution or product defaults. It includes focused regression coverage and has no deployment, schema, security, billing, or static-analysis implications. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: 9 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour. 📝 WalkthroughWalkthrough
ChangesProject settings resolution
Priority: ➖ Normal Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The nullable project path is covered by regression testing, with no remaining merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Build 1.1.1 (56) still crashed on every cold open even with #11486 in it. TestFlight strips the JS error, but expo-updates writes it to the app container (
Library/Application Support/expo-error.log), pulled off the device withdevicectl:resolveProjectSettings(added in #11176) reads the project aggregate's legacydefaultModelSelection/defaultThreadEnvModewhileprojectSettingsFoldedis false. The mobile new-task flow (#10639) passes itsselectedProjectstraight through, and that isnulluntil the shell snapshot arrives — so the very first render ofNewTaskFlowProviderthrows, RN reports a fatal, and expo-updates'ErrorRecoveryaborts the process ~1 s after launch. That is the same native trace as thetoReversedcrash, which is why it looked unfixed.tscnever flagged it:apps/mobile/tsconfig.jsonextends Expo's base, not the repo'stsconfig.base.json, sonoUncheckedIndexedAccessis off there andprojectsForEnvironment[0] ?? nulltypes as non-null.Fix: accept
nullfor theprojectargument and treat it like an absent project.Verification
vp test run packages/shared/src/projectSettings.test.ts— new case fails onmainwith the exact production error and passes here:tsc --noEmitclean forpackages/sharedandapps/mobile. Not a visual change.Claude Fable 5 via Claude Code.
Summary by CodeRabbit