Repository navigation
fix(connection): explain v1-only servers instead of reporting them unreachable - #355
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: f348ff014e
ℹ️ 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 APIv2Error.problem(let problem) where Self.isClientUpgradeRequired(problem): | ||
| self = .app |
There was a problem hiding this comment.
Preserve the HTTP status when classifying v2 upgrade problems
When a /api/v2 response has a non-410 HTTP status but its JSON body contains status: 410 and the client_upgrade_required type, APIv2Client.mapErrors discards the transport status and this branch incorrectly tells the user to update Silo. This bypasses the outer-status check applied to HTTPError and can misclassify an inconsistent server or proxy response; retain the HTTP status in APIv2Error.problem or only classify the problem as an upgrade when the actual response status is 410.
Useful? React with 👍 / 👎.
5dded52 to
3938db4
Compare
f348ff0 to
5dc5b35
Compare
3938db4 to
1b2df9c
Compare
…reachable A v1-only server, or a server that no longer accepts this app version, surfaced as "Could not reach a Silo server" on server add, "We can't verify this server" on cold launch, and a generic "Something went wrong" on error screens. APIv2Client also dropped the legacy 404 body, so a v2 route answered by a v1-only server became a plain HTTP 404. Add one UpdateRequirement classification (server update or app update) that both request layers map to: APIv2Error.serverUpdateRequired, a legacy 404 on any /api/v2 route (now mapped in APIv2Client.mapErrors), and HTTP 410 with the client_upgrade_required problem type from either layer. Server add, the restored-session validator and its recovery screen, ErrorState and ErrorView, and the HTTPError/APIv2Error descriptions (used by sign-in) now show the existing server-update copy or "Update Silo to keep using this server." A 410 never triggers a refresh or clears tokens. Stack-PR: F5 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…tombstone envelope The new UpdateRequirement tests added six /api/v1 path literals, which F2's v1-path guard rejects once this PR sits on top of it. Classification also accepted only a problem document on a 410, while the server's API contract describes the v1 retirement tombstone as the v1-shaped client_upgrade_required error, so that answer would still read as an unreachable or unrecognized server. The HTTPClient-layer tests now request a neutral path and assert exact requested paths instead of checking for a v1 prefix. A 410 whose body is the v1 error envelope with error client_upgrade_required now classifies as an app update, covered by a table row and a wire test. Stack-PR: F5 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
5dc5b35 to
28244ca
Compare
Problem
When the server and the app are on incompatible versions, the app blames the connection instead of saying what to update:
APIv2Error.serverUpdateRequiredhad no status, soErrorState.isTransientwas true).APIv2Client.mapErrorsdropped the body of a non-problem 404. A v1-only server's legacy listener answering a v2 route (404 page not found) becameAPIv2Error.httpStatus(404), which reads the same as any other 404.This gets worse as each later PR in the stack moves a call to
/api/v2. On a v1-only server, every moved call fails this way.Solution
This implements owner decision D7 (reduced): it reuses the existing copy and adds no new pill or banner UI.
UpdateRequirement(Networking/UpdateRequirement.swift) with two cases:.server: the server is v1-only. The message is the existing "This server needs to be updated before this version of Silo can use it." It moved here fromAPIv2Error..app: the server no longer accepts this app version. The message is "Update Silo to keep using this server."APIv2Error.serverUpdateRequiredmaps to.server. The probe verdict (ConnectionMonitor.isServerUpdateRequired) reaches it through the existinggate().APIv2Client.mapErrorsnow maps a 404 whose body is exactly the legacy listener's body (APIv2Probe.isLegacyNotFound, match unchanged) toAPIv2Error.serverUpdateRequired. This mapping is safe only on/api/v2paths.client_upgrade_requiredmaps to.app, whether it arrives asHTTPError.httpor asAPIv2Error.problem. On theHTTPErrorlayer, a 410 carrying the v1 error envelope{"error":"client_upgrade_required",...}also maps to.app, because the server's API contract describes the v1 tombstone that way.playback_session_ended, expired device login), is not an update prompt.ServerSetupViewModel): if any candidate URL shows a version mismatch, the update message replaces "Could not reach a Silo server". The view model now takes its server check as an injectable closure; production still callsAuthService.checkServer.RestoredSessionValidator): a classified error returns the new recovery reasons.serverRecovery(.serverUpdateRequired)/.serverRecovery(.appUpdateRequired)instead of.serverNotRecognizedor.indeterminate.RestoredServerRecoveryViewshows "Server update required" / "Update Silo" with the update message and the existing "saved sign-in information has not been removed" line.ErrorStatecarriesupdateRequirementand uses the update message. It is neitherisNotFoundnorisTransient, so Home shows it rather than auto-retrying.ErrorViewshows the headline "Update required".localizedDescriptionusers:HTTPError.errorDescriptionandAPIv2Error.errorDescriptionreturn the app-update message for the 410 problem.Validation
StubURLProtocol:APIv2Client.setupStatusagainst a legacy404 page not found, a problem+json 410, and an HTML 404.HTTPClient-layer 410 with a problem document or the v1 error envelope, checked throughlocalizedDescriptionandErrorState.HTTPClientGET and on v2account/me: no refresh request is sent, and both tokens are kept.ServerSetupViewModeltable: a v1-only server on every candidate, a v1-only server behind one scheme, a 410 through each layer, a legacy 404 on theHTTPClientlayer, a proxy 404, and no server answering.RestoredSessionValidatortable: real v2 setup orHTTPClientrequests against a legacy 404 and a problem+json 410, plus a 410 from the account probe. Each case keeps the access token and skips the account probe after a setup failure./api/v1literals, which the v1 path guard rejected. TheHTTPClient-layer cases now use a neutral/probepath, and the v2 no-fallback check asserts the exact requested paths. A new classification row and wire test cover the v1-envelope 410. After these fixes, UpdateRequirementTests, RestoredSessionValidatorTests and PlaybackProtocolV3ConformanceFixtureTests passed on iOS and tvOS (25 tests each, 0 failures), and the iOS, tvOS and macOS builds passed.scripts/ci/check-no-api-v1.sh: ok.Risks and follow-ups
auth/meare still v1 calls. The new messages appear once W1-B moves those calls to v2, or when a server answers with the 410 problem. Server version 84ed9e596 definesclient_upgrade_requiredbut does not send it yet.client_upgrade_requirederror", so the classifier accepts both on a 410.ItemDetailViewModelkeeps cached content and hides the error).ContentView.swift:2772as a deep link that swallows errors withtry?. That line is the iPad neighbour-detail prefetch, where ignoring the error is intended. The play deep link (routePlayDeepLink) falls through to the player, which shows its own error. Neither was changed.SettingsAPIError.serverUpgradeRequired(the v1 settings fallback) is separate and belongs to W1-C.QRLoginViewModelprefixes errors with "Couldn't start sign-in." The update message now follows that prefix. W5-B owns the QR flow.RestoredSessionValidator.swiftandContentView.swift. This PR does not changeContentView.swift.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 7 of 50 in the Apple API v2 stack. Base:
apiv2-stack/06-delete-unused-media-fixtures. Merge in order from the bottom of the stack. The plan and full index are in PR 01.🤖 Generated with Claude Code