Skip to content

feat(lists): page favorites and watchlist from v2 - #385

Merged
Quick104 merged 2 commits into
mainfrom
apiv2-stack/37-favorites-watchlist-lists-v2
Sep 23, 2026
Merged

Quick104 merged 2 commits into
mainfrom
apiv2-stack/37-favorites-watchlist-lists-v2

Conversation

@Quick104

Copy link
Copy Markdown
Contributor

Problem

The Favorites and Watchlist screens (iOS, tvOS, macOS) loaded their list with one GET /api/v1/favorites or GET /api/v1/watchlist call at offset=0&limit=100. Any saved title after the 100th never appeared. Both calls were also among the last v1 personal-data reads.

Solution

  • SiloAPI.favorites() and SiloAPI.watchlist() now read the whole list from GET /api/v2/favorites and GET /api/v2/watchlist (listFavorites / listWatchlist). They use the existing APIv2Client.personalList / nextPersonalListPage cursor client with 200 items per page and the image-size preference.
  • The new APIv2Client+PersonalLists.swift pages until has_more is false. Every page sends the first page's X-Profile-Id and goes through the existing owner fence. A profile switch mid-read throws instead of returning the old profile's list.
  • The read stops after 100 pages (invariant I10) and throws the new APIv2Error.incompletePersonalList rather than showing a truncated list as complete. A repeated or missing cursor still throws invalidPersonalListContinuation.
  • The screens drop the offset: 0, limit: 100 call. They still filter by media type locally and cache the result under the same ResponseCache keys.
  • Deleted SiloAPI.favorites(offset:limit:) and SiloAPI.watchlist(offset:limit:) (rows 60, 61), and the withImageSize helper they were the last callers of.

This uses the standalone routes, which the Apple client already had. Android reads these lists through /api/v2/catalog?source=favorites|watchlist, which also returns a total and supports sorting. Apple needs neither, because its screens load the full list and filter it locally.

Validation

  • iOS, tvOS and macOS builds passed.
  • Focused tests passed: PersonalListsAPITests on iOS and tvOS, and CatalogPagingAPITests on iOS.
  • The new PersonalListsAPITests use APIv2TestStub. They cover:
    • a 201-item favorites read across three pages, one of them empty, checking the path, cursor chain, limit=200, no offset, and X-Profile-Id on every request
    • the watchlist route
    • a read that runs past the 100-page budget and fails instead of truncating
    • a repeated cursor
    • a profile switch during the read, which discards the list
  • scripts/ci/check-no-api-v1.sh passed.
  • The final stack passed the full suites (iOS 1981 tests and tvOS 1792 tests, 0 failures), the macOS build and the v1 path guard. Every branch in the stack, this one included, builds on its own.

Risks and follow-ups

  • The whole list loads before the screen updates. At 200 items a page, a list of a few thousand titles takes a handful of requests. The budget caps a read at 20,000 items.
  • If a refresh fails while a cached list is on screen, the screens keep the cached list and hide the error, as they did before.
  • A server invalid_cursor mid-read (for example after an access-policy change) surfaces as an error. It does not restart from page 1 the way catalog grids do. The keyset cursor survives adds and removes, so this should be rare.
  • Not checked by hand on a device or simulator; the evidence is the tests and builds above.

AI disclosure

Code and description written by Claude Opus 5.5 (claude-opus-5-5) agents in Claude Code (T3 Code), orchestrated by a Claude Code workflow.


Part 37 of 50 in the Apple API v2 stack. Base: apiv2-stack/36-people-v2. Merge in order from the bottom of the stack. The plan and full index are in PR 01.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 360ee5c7-3097-41ab-8ec1-b74e91a513fc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick104 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T13:22:54.034167Z 8af5c19 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Quick104

Copy link
Copy Markdown
Contributor Author

Code review summary

Reviewed head: 9dc91f45 (apiv2-stack/37-favorites-watchlist-lists-v2).

Process: an adversarial review of this PR's diff with each candidate finding independently verified before any fix, a simplify pass for medium and larger PRs, and a whole-stack review across contract conformance, authority and failure handling, data integrity, user-visible behavior and cross-PR integration.

Verified findings, all fixed on this branch:

  • whole-stack review: SiloAPI.withImageSize has had no callers since PR 37

Validation: this branch builds on its own for iOS, tvOS and macOS, and its focused tests passed. The completed stack passed the full iOS suite (1981 tests) and tvOS suite (1792 tests) with 0 failures, the macOS build and the v1 path guard. The final stack was also exercised on iOS and tvOS simulators against a v1/v2 bridge server: sign-in (password and QR), restore, browse, search, detail, favorites and watchlist, playback (direct play, transcode, subtitles, stop), audiobooks, downloads with offline playback, settings, requests, profiles, push registration and diagnostics. Server logs showed no /api/v1 request from the new builds except the retained health probe.

Remaining: no open verified findings. Merge in stack order.

Mergeability: 8/10 — conditional. The approach holds up and every verified finding is fixed. Conditions: this PR's CI must pass (it was pending at review time), and the owner still plans a physical-device check of the completed stack.

Review by Claude Opus 5.5 (claude-opus-5-5) agents in Claude Code (T3 Code).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9dc91f4587

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

var items = result.value.items
for pageNumber in 1...100 {
guard let continuation = result.continuation else {
return CatalogResponse(items: items, total: items.count, totalExact: true, hasMore: false)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Recheck list ownership before returning it

When the active profile changes after the final personalListPage finishes its withOwnerFence check but while that page is being decoded or assembled, result.continuation can be nil and this returns the previous profile's items without consulting auth again. loadFavorites and loadWatchlist then cache that response under process-wide keys, so a late completion after the profile-switch cache clear can repopulate the cache and expose profile A's saved titles to profile B. Revalidate the captured owner immediately before publishing the complete response, including after the last page.

Useful? React with 👍 / 👎.

@Quick104
Quick104 force-pushed the apiv2-stack/37-favorites-watchlist-lists-v2 branch from 9dc91f4 to 8af5c19 Compare September 23, 2026 13:19
@Quick104
Quick104 force-pushed the apiv2-stack/36-people-v2 branch 2 times, most recently from 8335d86 to 9d378b3 Compare September 23, 2026 13:43
Base automatically changed from apiv2-stack/36-people-v2 to main September 23, 2026 13:43
Quick104 and others added 2 commits September 23, 2026 09:43
The Favorites and Watchlist screens read GET /api/v1/favorites and
/api/v1/watchlist once with offset 0 and limit 100, so anything past the
100th saved title never appeared.

SiloAPI.favorites() and watchlist() now read the whole list from
/api/v2/favorites and /api/v2/watchlist with the existing cursor client,
200 items a page, every page under the first page's owner. The read is
bounded at 100 pages and throws incompletePersonalList past that instead
of showing a cut-off list as complete. The v1 methods are deleted.

Stack-PR: W5-N
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Favorites and watchlist were its last callers; they now pass
imageSizeQuery["image_size"] to personalListItems like every other v2
call site.

Stack-PR: W5-N
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Quick104
Quick104 force-pushed the apiv2-stack/37-favorites-watchlist-lists-v2 branch from 8af5c19 to 0c0a415 Compare September 23, 2026 13:43
@Quick104
Quick104 merged commit 905ba74 into main Sep 23, 2026
2 checks passed
@Quick104
Quick104 deleted the apiv2-stack/37-favorites-watchlist-lists-v2 branch September 23, 2026 13:43
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

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