Skip to content

sync: page up next until an empty page - #358

Merged
mfederowicz merged 1 commit into
mainfrom
sync-up-next-paging
Nov 18, 2026
Merged

mfederowicz merged 1 commit into
mainfrom
sync-up-next-paging

Conversation

@mfederowicz

Copy link
Copy Markdown
Owner

Trakt documented that GET sync/progress/up_next and up_next_nitro send placeholder X-Pagination-Item-Count / X-Pagination-Page-Count values; clients should request pages until one comes back empty (trakt/trakt-api 5bb9376). HavePages stops on the page count, so a placeholder that claims the last page could leave shows out of the export.

  • handlers/sync_handler.go: fetchSyncProgressUntilEmpty pages until an empty page, an unpaginated response or pages_limit; used by sync -a get_up_next and get_up_next_nitro. get_watched_progress keeps HavePages.
  • Tests: TestSyncUpNextPagesUntilEmpty (page count that always claims the last page, pages_limit cap, empty first page) fails without the fix; the count-based paging test now runs on watched progress.
  • Docs: docs/sync.md, CHANGELOG.md (Fixed).

Checked live by the maintainer on 2026-11-18: per_page=100 -> 3 requests, per_page=10 -> 19 requests (18 pages + the empty one), 177 shows each, same set, no duplicates, for both actions. Note: Trakt orders the last 61 shows (ties in the sort) differently per page size; the CLI keeps the order it gets.

AI: Claude Code wrote the changes, tests and the live-check scripts; reviewed by the maintainer.

@mfederowicz
mfederowicz merged commit b50997a into main Nov 18, 2026
6 checks passed
@mfederowicz
mfederowicz deleted the sync-up-next-paging branch November 19, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant