feat: Checkpoint Requests#153
Open
stevensJourney wants to merge 36 commits into
Open
Conversation
…fore updating local targets
…request mode configurable
stevensJourney
marked this pull request as ready for review
July 9, 2026 14:50
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.
Overview
This is the Swift SDK implementation of the Request Checkpoint proposal: https://github.com/orgs/powersync-ja/discussions/324
Related to:
This adds a new
requestCheckpointmethod which returns aCheckpointRequest. TheCheckpointRequestinstance exposes awaitForSyncmethod which resolves once the requested checkpoint has been synced and applied locally.The SDK is updated to cater for the Rust core and PowerSync service changes.
ConnectOptionsnow has acheckpointMode, and checkpoint requests are enabled by connecting withcheckpointMode: .requests(). In request mode the sync client posts checkpoint requests to the service, tracks the latest applied checkpoint request ID from core sync status, retries unapplied requests with a delay, and cancels pending waits when the sync client disconnects or closes.For backends that process uploads asynchronously, this also adds
CustomCheckpointRequestConnector. A connector can implement this to handle checkpoint requests itself and return the effective checkpoint request ID accepted by the backend.These APIs are documented as alpha and may change in future releases.
Demo
The
PowerSyncExamplehas been updated to include a pull-to-refresh action which shows a loading spinner until a checkpoint request has been resolved.In order to showcase the functionality a bit better, a new Admin page has been added to the demo which conveys the SyncStatus. In the demo below, we go offline, create 50k todos which will be synced, then connect and await a checkpoint request. We can see the download progress reach 100%, but the data is only available after the checkpoint has been applied locally. The checkpoint request correctly keeps the operation in a loading state until the data is actually available.
request-checkpoint.mp4
There is also a small SwiftPM command-line demo under
Demos/CustomCheckpointDemowhich shows a custom checkpoint request connector against the Node.js todo backend.Testing
I added coverage for creating and waiting on checkpoint requests, timeout/error behavior, unsupported service responses, reconnects, seeded/reseeded checkpoint request state, retry timing, disconnect cancellation, custom checkpoint request connectors, upload integration, and the mock HTTP client hook used by these tests.
AI disclosure: This work was assisted by Codex. I manually guided and reviewed the changes.