feat(host-api): scheduled push notifications (RFC 0019)#170
Merged
johnthecat merged 10 commits intoMay 14, 2026
Merged
Conversation
4a41cf5 to
2e36d6b
Compare
kalininilya
approved these changes
May 13, 2026
8dc050c to
3800d91
Compare
3938ce7 to
1634946
Compare
Implements the JS SDK side of paritytech/truapi RFC 0019 (scheduled push
notifications with idempotent cancellation).
BREAKING CHANGE: `host_push_notification` wire format changes — request gains
`scheduled_at: Option<u64>` (ms UTC), response becomes
`Result<NotificationId, PushNotificationError>` with `ScheduleLimitReached`
and `Unknown { reason }` variants. The prior wire format is replaced rather
than versioned alongside; hosts and products must upgrade together.
Protocol changes (v0.8 of host-api-protocol.md):
- `host_push_notification` carries the new `PushNotification` struct
- new `host_push_notification_cancel(NotificationId) -> Result<(), GenericErr>`
- both methods gated by `DevicePermission::Notifications`
SDK changes:
- host-api: `PushNotification`, `NotificationId`, `PushNotificationError`
- host-container: new `handlePushNotificationCancel`; existing
`handlePushNotification` returns `NotificationId` and rejects with
`PushNotificationError`
- host-api-wrapper: `createNotificationManager()` exposing
`.push({ text, deeplink?, scheduledAt? })` and `.cancel(id)`
Host-side persistence, OS-scheduler integration, and the platform-wide
queue cap remain host-application concerns; the SDK only transports
the typed error.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fe71f2a to
1c2e9d3
Compare
johnthecat
approved these changes
May 14, 2026
33ea295
into
feat/create-transaction-refinement
5 checks passed
johnthecat
added a commit
that referenced
this pull request
May 15, 2026
Co-authored-by: Sergey Zhuravlev <zhuravlev1337@gmail.com>
7 tasks
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.
Summary
Implements the JS SDK side of paritytech/truapi RFC 0019 / truapi#66: scheduled push notifications with idempotent cancellation.
Breaking change (per senior-dev review): the prior wire format is replaced rather than versioned alongside. Hosts and products must upgrade together at v0.8.
host_push_notificationrequest gainsscheduled_at: Option<u64>(ms UTC); response changes fromResult<(), GenericErr>toResult<NotificationId, PushNotificationError>(withScheduleLimitReachedandUnknown { reason }).host_push_notification_cancel(NotificationId) -> Result<(), GenericErr>— host MUST treat unknown/already-fired ids asOk(())per RFC §5.DevicePermission::Notifications(no new permission variant).host-api-wrappersurface:createNotificationManager(...).push({ text, deeplink?, scheduledAt? }) → Promise<NotificationId>and.cancel(id).Host-side persistence, OS-scheduler integration, and the platform-wide 64-slot queue cap remain host-application concerns; the SDK only transports the typed error.
Test plan
npm run buildnpm run lintnpm test— 449 tests across 44 files pass (11 innotification.spec.ts)scheduledAt: bigint;ScheduleLimitReached;Unknown { reason }roundtrip; permission denial for both push and cancel; cancel happy path; arbitrary-id passthrough;GenericErrorpropagation🤖 Generated with Claude Code