fix: paginate mobile delta sync - #5
Open
djbclark wants to merge 1 commit into
Open
Conversation
6 tasks
djbclark
marked this pull request as ready for review
July 31, 2026 13:23
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.
Why this is useful
The mobile app should eventually reflect every server-side change, even after it has been offline or a large import or recategorization updates many records. Previously, delta sync requested only one bounded result set and then advanced its sync cursor. If more rows had changed than fit in that response, the remaining changes could be skipped permanently, leaving the mobile library incomplete or stale without an obvious error.
This change makes the client fetch every page before advancing its cursor. Stable ordering prevents rows with identical timestamps from being skipped or duplicated across page boundaries, and a failed page now fails the sync instead of being mistaken for successful completion.
Summary
has_moremetadata to the backend delta-sync endpoint.updated_at, shortcodeordering so rows with the same timestamp remain stable across pages.Verification
PYTHONPATH=backend <project-python> -m unittest backend.tests.test_sync_pagination -v— passed.npx tsc --noEmitinsuperbrain-app— passed.main; the regression test covers deterministic paging across equal timestamps.Roadmap FYI
The broader plan for small SuperBrain contributions that do not depend on YouTube approving enhanced YouTube Data API access, including increased quota, is tracked in djbclark/superbrain#3. These contributions may support YouTube-related workflows, but OAuth subscription discovery, YouTube playlist management and backfill, and other approval-dependent API work are explicitly excluded from this PR and held back.