Repository navigation
feat(catalog): load similar and discover rows from v2 - #380
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
Quick104 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Code review summaryReviewed head: 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:
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 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 ( |
019a408 to
9faf9fd
Compare
55e2710 to
049486b
Compare
The "More Like This" rails and the Discover tab still read
/api/v1/recommendations. The similar route returned scored IDs only, so
each rail then fetched item detail for every ID: up to twelve extra
requests per detail page. Discover decoded v1 `rows`/`label`.
SiloAPI now calls the existing v2 client reads. Similar cards come from
GET /api/v2/recommendations/similar/{item_id} as full cards in ranked
order, so both rails drop the per-item detail fan-out and map cards
directly; the facade refuses cards whose owner changed mid-read.
Discover reads GET /api/v2/recommendations/discover and maps each row's
`title` into the same ResolvedSection ids as before. The v1-only
DiscoverResponse, DiscoverRow, ScoredItemsResponse and ScoredItemRef
models are deleted.
Stack-PR: W5-K
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The similar-cards doc comment and PR text said the facade throws `requestIdentityChanged` when the profile switches mid-read. The owner fence inside `APIv2Client.similarCards` rejects that read first with `authorityChanged`; the facade guard only catches a switch during decoding. The regression test caught any error, so it could not tell the two apart. The doc comment now names both checks, and the test asserts `HTTPError.authorityChanged`. Stack-PR: W5-K Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
9faf9fd to
2a2aa0c
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Problem
The "More Like This" rails on iOS and tvOS and the Discover tab still read
/api/v1/recommendations. The v1 similar route returned only scored item IDs, so each rail then requested item detail for every ID: up to 12 extra requests per detail page (tvOS sent them three at a time). Discover decoded the v1rows/labelbody.Solution
SiloAPI.recommendationsSimilar(contentId:limit:)now callsAPIv2Client.similarCards, which sendsGET /api/v2/recommendations/similar/{item_id}?limit=. The item ID is percent-encoded, the limit must be 1...50, and the call runs under the owner fence. The server returns full cards in ranked order. If the acting owner changes while the request is in flight, the fence rejects the read withauthorityChanged. The facade checks again after decoding and throwsrequestIdentityChangedif the owner changed in that window.PhoneSimilarRailandTVSimilarRailmap those cards straight toSimilarPosterItem(card:). The per-item detail fan-out and its reordering are gone. tvOS keeps its delayed start and its rail cache.SiloAPI.recommendationsDiscover()now callsAPIv2Client.discover(GET /api/v2/recommendations/discover). It maps each row'stitleinto the samediscover_<index>_<type>ResolvedSectionIDs, soStartupContentPrefetcherand the Discover screens are unchanged.DiscoverResponse,DiscoverRow,ScoredItemsResponseandScoredItemRef.Both operations are
profile_scopedGETs, so no failure-outcome table applies. Failures reach the caller as typed errors and never become empty results. The rails still hide on any failure, and the Discover prefetch reports the reason (decode_failed,invalid_profile, and so on).Validation
RecommendationsAPITests,LibraryDetailScopeTestsandHomeSectionsAPITests.RecommendationsAPITestscover:limitandX-Profile-Id, returning cards in server orderHTTPError.authorityChangedafter a profile switch mid-readtitleto the existing section IDsscripts/ci/check-no-api-v1.shpassed.Risks and follow-ups
contracts/api/v2/openapi.jsonat84ed9e596(listSimilar,getDiscover).APIv2Client.swift; this PR did not move them into a per-domain file.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 32 of 50 in the Apple API v2 stack. Base:
apiv2-stack/31-home-sections-v2. Merge in order from the bottom of the stack. The plan and full index are in PR 01.🤖 Generated with Claude Code