Fix Kobo Sync Download Loop and Pagination Bugs#3584
Open
leahjessie wants to merge 1 commit intojaneczku:masterfrom
Open
Fix Kobo Sync Download Loop and Pagination Bugs#3584leahjessie wants to merge 1 commit intojaneczku:masterfrom
leahjessie wants to merge 1 commit intojaneczku:masterfrom
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.
Fix Kobo Sync Download Loop and Pagination Bugs
Summary
This PR fixes Kobo sync issues that caused repeated downloads, missed re-syncs, and pagination loops.
It builds on PR #3352 and resolves additional cursor, filtering, and continuation bugs.
Key Fixes
Sync cursor separation
books_last_modifiedfor content changestags_last_modifiedfor shelf membership changes (BookShelf.date_added)Timestamp normalization
Books.last_modifiedby stripping+00:00before token comparison.Resync filtering logic
db.Books.id.notin_(KoboSyncedBooks)filter, which blocked legitimate re-syncs when book content changed.date_added > tags_last_modifiedlast_modified > books_last_modifieddistinct()for multi-shelf deduplication.Pagination correctness
cont_sync = bool(book_count)withcont_sync = bool(book_count > SYNC_ITEM_LIMIT).books_last_idtiebreaker for identicallast_modifiedtimestamps.last_modified > token.books_last_modifiedid > token.books_last_id1-2-0(backward compatible; missingbooks_last_iddefaults to-1).KEPUB sync reliability
last_modifiedafter successful KEPUB/EPUB conversion so converted books are picked up.Files Touched
cps/kobo.pycps/services/SyncToken.pycps/shelf.pycps/tasks/convert.pyTesting
Targeted integration pytests are available in my fork:
Many of these tests fail on current
master; all pass onref-pr/kobo-sync-tests.Coverage includes:
Local validation: In addition to the pytest coverage above, I've repeatedly run Kobo sync on my local Calibre-Web environment (including shelf-only flows) and observed no repeat-download loop, correct modified-book re-sync, and stable pagination.
Expected Behavior After This PR
SYNC_ITEM_LIMITitems remain.last_modifiedtimestamps paginate without repeat loops.