Repository navigation
fix(app): open the chat when an iOS chat-answer push is tapped - #22286
Conversation
Omi's chat answers reach iOS as an APNS alert whose data carries push_type=chat_answer and navigate_to=/chat/omi. Since 618efee the tap router (NotificationUtil.routeFromFcmData) returns null for every typed push except capture_recovery, so tapping an answer opened the app but never the chat, undoing the BasedHardware#5126 deep link. Android was not affected because its local BigText notification drops push_type from the tap payload. Route a chat_answer push to its navigate_to when that names a chat (/chat/...). Unknown push types, and a chat_answer that points anywhere else, still route nowhere. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
left a comment
There was a problem hiding this comment.
The production change here is correct and nicely scoped - approved.
- app/lib/services/notifications.dart: the new
chat_answerbranch restores the #5126 deep link while keeping the typed-allowlist property from #18858 -navigate_tois honored only forpush_type=chat_answerand only within/chat/, so a typed push still cannot be steered to an arbitrary screen. I verified the sender contract: the only backend senders (send_client_displayed_notification[_async], called fromutils/chat.py) always setnavigate_to=f'/chat/{app_id}', so the prefix gate covers every real payload. Thecapture_recoveryrule and the untyped legacy fallback are untouched, and Android's local BigText rebuild (nopush_typein the tap payload) keeps routing via the fallback exactly as before. - app/test/unit/notification_fcm_navigate_to_test.dart: good coverage - the positive route, the spoof/mismatch cases (
/settings/device,/conversation/..., empty, missing), and an end-to-endhandleFcmDataTapwidget test throughHomeNavigation. - .github/failure-classes/FC-push-tap-router-drops-sent-push-type.json: validates against
scripts/failure-class, and the canonical prevention matches what the tests now assert. - app/changelog/unreleased/20261019-chat-answer-notification-tap.json:
platforms: ["ios"]matches the mobile changelog schema.
Security: this re-opens navigate_to routing only for the chat_answer type and confines it to the /chat/ prefix - the spoof-steering concern that motivated #18858 stays closed for every other route.
USER IMPACT: on iOS, tapping an Omi answer notification opens that chat again (since #18858 it only opened the app); Android behavior is unchanged.
Nothing blocking from my side. Nice failure-class write-up - the Android-masks-iOS asymmetry in violated_contract is exactly the kind of context that prevents a repeat.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
kodjima33
left a comment
There was a problem hiding this comment.
Mobile bug fix (iOS chat-answer push deep link), root cause stated, test added, CI green. Confidence 5/5.
What changed and why
Fixes #22285
Omi's chat answers reach iOS as an APNS alert. The FCM data carries
push_type=chat_answerandnavigate_to=/chat/omi(send_client_displayed_notification(_async)inbackend/utils/notifications.py,_chat_message_notificationinbackend/utils/chat.py). A tap goes throughonMessageOpenedApp/getInitialMessagetoNotificationUtil.handleFcmDataTapand thenrouteFromFcmData.Since 618efee (#18858),
routeFromFcmDatareturns null for every non-emptypush_typeexceptcapture_recoverywithrepair_device. So tapping an answer opens the app on whatever screen it was on and never opens the chat, which undoes the #5126 deep link on iOS. Android is not affected because its local BigText notification rebuilds the tap payload with onlynavigate_toandmessage_id.routeFromFcmDatanow recogniseschat_answerand returns itsnavigate_towhen that is a chat route (/chat/...). Unknown push types still route nowhere, achat_answerthat points anywhere else routes nowhere, and the capture-recovery rule is unchanged.Product invariants affected
none
How it was verified
origin/main(f26307c):push_type='chat_answer'next tonavigate_to='/chat/{app_id}'.content-available, so iOS shows it as a normal alert. A tap reacheshandleFcmDataTapwithpush_typestill inmessage.data, androuteFromFcmDatareturned null for it.git show 618efeee6dshows that before this commit the tap usednavigateToFromFcmData, which does not checkpush_type./chat/<id>still opens the chat (case 'chat'inhome_deep_links.dart) and that the Android paths are unchanged (ChatAnswerNotificationHandler.handleleavespush_typeout of the local payload).dart format --line-length 120on the changed Dart files made no changes.ci:fullruns the new tests and the full app suite. I wrote the new tests to fail without the fix:routeFromFcmDatareturns null for the chat-answer payload, andhandleFcmDataTapreturns false with nothing opened.Tests
app/test/unit/notification_fcm_navigate_to_test.dart:a chat_answer push opens the chat it names: the payload the backend sends routes to/chat/omi.a chat_answer push without a chat route routes nowhere: anavigate_toof/settings/device,/conversation/abc, an empty string, or none at all returns null.a chat_answer tap opens its chat in the mounted Home (#5126):handleFcmDataTapwith the same payload returns true, and the registered Home opener receives/chat/omi.The existing capture-recovery and unknown-push-type tests are unchanged.
UI evidence
UI-Evidence: none -- this fixes where a notification tap leads, with no layout change, and no simulator or device is available here; the unit and widget tests above cover the routing.
Failure class (fixes)
Failure-Class: new
Failure-class transition narrative
New class
FC-push-tap-router-drops-sent-push-type.push_typemust keep a route for every type a backend sender sets.routeFromFcmDatadroppedchat_answer, which the backend has sent since fix(app,backend): BigText chat-answer notifications + chat deep-link #13173.app/test/unit/notification_fcm_navigate_to_test.dartdrivesrouteFromFcmDataandhandleFcmDataTapwith each sender's payload and asserts where the tap goes.routeFromFcmDataonorigin/mainbefore this change.evidence_prsis empty because this PR is the first instance.🤖 Generated with Claude Code