Repository navigation
feat(people): load people and refresh metadata through v2 - #384
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 ( |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55e59cbc39
ℹ️ 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".
| case .incompleteCatalogRead: return true | ||
| default: return false | ||
| } | ||
| return (200..<300).contains(status) || status == 429 || ((500...599).contains(status) && status != 503) |
There was a problem hiding this comment.
Keep polling after transient 503 responses
A 503 service_unavailable from the refresh POST is a transient failure, but this condition returns false for every 503, despite the method's stated policy of polling after transient server errors. In runMetadataAutoRefresh, that immediately ends the poll and marks the incomplete person as exhausted, so metadata potentially queued by the initial person read will not appear until the page is recreated. Distinguish the specific capability_not_configured problem identifier from other 503 responses, and keep polling for generic or undecodable 503s.
Useful? React with 👍 / 👎.
278db7f to
fb0a56c
Compare
55e59cb to
8335d86
Compare
fb0a56c to
26bbdbb
Compare
The person page still read people from /api/v1/people/{id} and queued
metadata refreshes through /api/v1/people/{id}/refresh, and it carried
person IDs as Int even though v2 sends them as opaque strings.
Load the person through GET /api/v2/catalog/people/{id} and queue the
refresh through POST /api/v2/catalog/people/{id}/refresh, both under the
captured owner with X-Profile-Id and the percent-encoded ID. Person IDs
are now strings from the cast list through the route to the credits
query, so cast taps no longer depend on Int parsing. The refresh is
non_retryable: it is dispatched once, a definite failure ends the page's
refresh poll, and a lost answer is observed by re-reading the person
without dispatching again. The v1 methods, PersonRefreshQueuedResponse
and the unused ownerless catalogPerson(id:) are deleted.
Stack-PR: W5-J
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A rejected refresh POST ended the person page's poll at once. Viewing a person already queues a provider refresh when one is due, so a 429 from the per-user refresh limit, or a transient server error, left a refresh running that the page never showed. The 401 regression test was also vacuous: its fixture stored no refresh token, so it passed even without the non_retryable path exclusion. The poll now keeps running without dispatching again after a 429, a 5xx other than 503, or a malformed receipt. It still stops when the read cannot queue a refresh either: 404, 503, a refused credential, request or client, or a v1-only server. The 401 test now seeds a refreshable session and asserts no token refresh, no second POST and an unchanged access token. Stack-PR: W5-J Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
8335d86 to
9d378b3
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Problem
The person page still used v1. It read the person from
GET /api/v1/people/{id}and queued metadata refreshes throughPOST /api/v1/people/{id}/refresh(inventory rows 56 and 57). It also stored person IDs asInt. The v2 contract declares person IDs as opaque strings, so the client should not assume integers. Today's server still issues integer IDs, so no taps are lost now; this change is forward compatibility.Solution
SiloAPI.person(id:)now readsGET /api/v2/catalog/people/{id}(getPerson).SiloAPI.refreshPerson(id:)now callsPOST /api/v2/catalog/people/{id}/refresh(refreshPerson). Both capture the ordinary request owner, sendX-Profile-Id, percent-encode the ID throughcatalogPathSegment, and run insidewithOwnerFence.APIv2Client.catalogPerson(id:auth:)requires exactly 200 and rejects a body for a different person.APIv2Client.refreshPerson(id:auth:)requires exactly 202 with{"status":"queued","person_id":<id>}and returns nothing.Person.id,Route.personDetail(personId:),APIv2CatalogQuery.personCredits(personId:)andPersonDetailViewModelnow useString. The iOS and tvOS item detail screens pass the castperson_iddirectly instead of parsing it withInt(...).SiloAPIperson methods,PersonRefreshQueuedResponse, and the unused ownerlessAPIv2Client.catalogPerson(id:)(F17).x-silo-retry-safetyforrefreshPersonisnon_retryable.HTTPClient.shouldAttemptRefreshalready excluded this path, so a 401 is never replayed under a refreshed bearer. A regression test with a refreshable session covers this.Failure outcomes for the person refresh (
refreshPerson,non_retryable)The page queues the refresh on its own, at most once per person, when bio, photo or birth date is missing.
capability_not_configured, 400/401/403/410/422, v1-only server, owner changed before dispatch)Validation
CatalogV2Tests,PersonMetadataRefreshPolicyTestsandCatalogPagingAPITests, plusDetailDismissalNavigationTestson iOS (the class is excluded fromSiloTVTestsinproject.yml).CatalogV2Testscases cover:X-Profile-Idheader, and noprefetchquery parametershouldAttemptRefreshexclusion is removed)PersonMetadataRefreshPolicyTestscheck which rejected refreshes keep the read-only poll running (429, 5xx other than 503, malformed receipts) and which end it (404, 503, 400/401/403/410/422, v1-only server).scripts/ci/check-no-api-v1.shpassed.Risks and follow-ups
PersonDetailViewModelhas no unit test because it callsSiloAPI.shareddirectly. The wire layer and the keep-polling classification are covered.GETreads. Per the contract, a plain read also queues a provider refresh when one is due. The server decides when that is, so the poll does not sendprefetch=true.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 36 of 50 in the Apple API v2 stack. Base:
apiv2-stack/35-library-sections-v2. Merge in order from the bottom of the stack. The plan and full index are in PR 01.🤖 Generated with Claude Code