Repository navigation
feat(home): load home sections and dismissals from v2 - #379
Conversation
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.
|
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 |
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 ( |
e5911fe to
55e2710
Compare
2e3a00b to
b8e695f
Compare
Home rows and the Continue Watching and Next Up dismissals still went to
/api/v1/home/sections and /api/v1/home/dismissals/{surface}/{id}, even
though APIv2Client already implemented both v2 operations.
SiloAPI now reads Home through GET /api/v2/home/sections with the captured
request owner and dismisses cards through PUT
/api/v2/home/dismissals/{surface}/{item_id}, which must answer 204. The
startup prefetcher and the player's on-deck lookup check that the read
still belongs to the active profile before caching or showing it. A v2
profile_verification_required problem still sends the user back to profile
selection, and prefetch diagnostics bucket v2 errors by status. The v1
dismissal bodies and the v1 home test read are gone, and the in-memory
Home cache key is versioned.
Stack-PR: W5-G
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
APIv2Client turns every non-2xx response into APIv2Error.problem or .httpStatus, but ErrorState only read a status from HTTPError and APIError. A v2 401 or 404 on Home therefore had no status: it counted as transient, was retried as a network blip, and ErrorView showed "Something went wrong" with only Try Again instead of "Session expired" or "Not found". ErrorState now takes the status from both APIv2Error cases, including for update-required problems. 401, 403 and 404 use the same copy as the v1 path; other problems keep the server's detail text. Stack-PR: W5-G Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The v2 Home read decodes its 200 body outside mapErrors, so a malformed body throws a bare DecodingError. prefetchFailureReason only knew HTTPError.decodingFailed and APIv2Error, and reported it as "other", which dropped the stable decode_failed token the v1 read produced. prefetchFailureReason now classifies any DecodingError as decode_failed. Stack-PR: W5-G Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
55e2710 to
049486b
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Problem
Home still loaded its rows from
GET /api/v1/home/sections. Dismissing a Continue Watching or Next Up card still sentPUT /api/v1/home/dismissals/{surface}/{id}.APIv2Clientalready hadhomeSectionsanddismissHomeItem, but only tests called them (inventory rows 47, 48 and 49).Solution
SiloAPI.homeSections()captures the request owner and callsAPIv2Client.homeSections(GET /api/v2/home/sections,X-Profile-Id,image_sizeas before). It returnsAPIv2HomeSectionsRead, so callers get the rows together with the owner they were fetched for.StartupContentPrefetcher.fetchHomeSectionsand the player's on-deck lookup confirm that the owner still matches the active session (SiloAPI.isCurrentOwner, backed byTokenStore.currentOrdinaryRequestAuth(matchingIdentityOf:)) before they cache or show the rows. The prefetcher's generation checks still run.dismissContinueWatchingItemanddismissNextUpItemcallAPIv2Client.dismissHomeItem(PUT /api/v2/home/dismissals/{surface}/{item_id}). The body is{"progress_updated_at": …}forcontinue_watchingand{"series_id": …}fornext_up. Only a 204 counts as success. The private v1 bodiesHomeDismissalBodyandNextUpDismissalBodyare deleted.StartupContentPrefetcher.indicatesInvalidProfilenow recognizes the v2profile_verification_requiredproblem, so a locked profile without a valid token still returns the user to profile selection when Home loads.prefetchFailureReasongroups v2 errors by status, as it does for v1 errors, and adds aserver_update_requiredtoken. A malformed 200 body, which the v2 read throws as a bareDecodingError, is still reported asdecode_failed.ErrorStatenow reads the status fromAPIv2Error.problemand.httpStatus. Without this, a v2 401 or 404 on Home had no status, was retried as a transient failure, and showed "Something went wrong" instead of "Session expired" with Sign In Again, or "Not found". 401, 403 and 404 use the same copy as v1; other problems show the server's detail text.ErrorStateis shared, so every screen that shows v2 errors gets the same fix.CacheKey.homeSectionsis nowhome:sections:v2.ArtworkURLTestsno longer reads/api/v1/home/sections.Failure outcomes for the dismissal write (
dismissHomeItem,x-silo-retry-safety: natural_idempotent)actionError.Validation
HomeSectionsAPITests,HomeSectionsMutationTests,ArtworkURLTests,InvalidProfileRecoveryTests,ErrorStateTests,UpdateRequirementTestsandRequestErrorCopyTests.HomeSectionsAPITestsrun through theSiloAPIfacade onStubURLProtocol. They cover:X-Profile-Idheaderprofile_verification_requiredproblem surfaces as an invalid profile and is not treated as an empty Homedecode_failedErrorStateTestscheck that a v2 401 problem is an auth failure and not transient, that a v2 404 (plain status or problem) is "Not found", that a v2 5xx stays transient with the server's detail, and that a v2 upgrade problem keeps its 410 status.scripts/ci/check-no-api-v1.shpassed. Fence and owner-check references iniosApp/iosAppwent from 100 to 101.Risks and follow-ups
not_found, so a Home 404 does not trigger profile recovery. At the pinned server commit, v1 also sentnot_found(notprofile_not_found), so this matches today's behavior.ResponseCachekey. The persisted row order and visibility preferences (*.homeSections.v1inHomeSectionPreferences) keep their key. v1 and v2 use the same server home service and section IDs, so users keep their saved row layout.DiagnosticsPathTemplateTestsandHTTPClientDiagnosticsClassificationTestsstill contain/api/v1/home/...strings. They send no requests, and Z1 owns their final allowlist.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 31 of 50 in the Apple API v2 stack. Base:
apiv2-stack/30-control-socket-v2. Merge in order from the bottom of the stack. The plan and full index are in PR 01.🤖 Generated with Claude Code