fix: update push onchain notif detection#9407
Open
zelkibuilds wants to merge 4 commits into
Open
Conversation
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.
Explanation
After the v4 Notification API migration (#9384),
isOnChainRawNotificationstill used legacy heuristics (idandpayload.datamust be defined). v4 on-chain push payloads are discriminated bynotification_type === 'wallet_activity', so the old check could reject valid notifications and web push handling inpush-utils.tswould bail out early.This PR updates
isOnChainRawNotificationto delegate to the existingisOnChainNotificationtype guard, which uses the v4notification_typediscriminator. The function now narrows toOnChainNotification(the unprocessed v4 shape) instead ofOnChainRawNotification(the normalised shape with atypefield added bytoRawAPINotification). That matches the push flow: discriminate first, then normalise viatoRawAPINotification.No other packages were changed. No dependency upgrades.
Changelog entry:
References
NotificationServicesPushController/web/push-utils.tsChecklist
Note
Low Risk
Single-function detection fix in notification-services-controller with no auth or data-model changes; main caveat is the type guard now narrows to
OnChainNotificationinstead ofOnChainRawNotification.Overview
Fixes web push dropping valid on-chain payloads after the v4 Notification API migration by updating
isOnChainRawNotificationto use the v4 discriminator instead of legacy shape checks.The guard no longer requires
idandpayload.datato be defined; it delegates toisOnChainNotification(notification_type === 'wallet_activity'). The narrowed type is nowOnChainNotification(unprocessed v4 API shape), matching the push path inpush-utils.ts: discriminate first, thentoRawAPINotification.Changelog updated under Fixed for this package.
Reviewed by Cursor Bugbot for commit 77c4b5b. Bugbot is set up for automated code reviews on this repo. Configure here.