Repository navigation
feat(diagnostics): read diagnostics capabilities from v2 - #396
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: none. 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 ( |
022c1a8 to
e8860c8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8860c8c4f
ℹ️ 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".
| let status = try await siloAPI.apiV2Client.diagnosticsCapabilities() | ||
| let user = try await siloAPI.currentUser() |
There was a problem hiding this comment.
Bind both diagnostics reads to one account owner
When credentials are replaced on the same registered server between these two awaits, each v2 request can succeed under a different owner: capabilities come from account A, while currentUser() returns account B. The final guard checks only the unchanged server ID and that some token exists, so A's account-scoped allowed value and limits are persisted under B's diagnostics binding and may enable capture despite B being denied. Capture one request owner before both reads and verify/reuse it for both responses.
Useful? React with 👍 / 👎.
576679a to
5452dc7
Compare
Self-hosted diagnostics still read upload availability and limits from GET /api/v1/diagnostics/status through a plain HTTPClient call with no owner fence. The coordinator now reads GET /api/v2/diagnostics/capabilities through the shared APIv2Client, bound to the owner captured before the request. The v2 document is projected onto the existing DiagnosticsStatusResponse, so persisted last-known snapshots still decode. Uploads count as available only when allowed is true and state is available; not_configured maps to storage unavailable and every other state to disabled. A v2 5xx still lets a persistent capture fall back to the last-known snapshot, other answers fail closed, and a v1-only server hides the diagnostics screen as the old 404 did. The v1 method and v1 test routes are gone. Stack-PR: W5-W1 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
e8860c8 to
d529fa5
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Self-hosted diagnostics now read upload availability and limits from
GET /api/v2/diagnostics/capabilities, bound to the request owner.Problem
Self-hosted diagnostics read upload availability and limits from
GET /api/v1/diagnostics/status(inventory row 121). The call went straight throughHTTPClientwith no owner fence, and it is one of the last v1 reads in the diagnostics path.Solution
APIv2Client.diagnosticsCapabilities()inNetworking/APIv2/APIv2Client+Diagnostics.swift. It readsGET /api/v2/diagnostics/capabilities(getDiagnosticsCapabilities) throughrequestGet, which binds the read to the owner captured before the request, sends the account scope, and requires a 200.APIv2DiagnosticsCapabilitieswire model inAPIv2DiagnosticsModels.swift. It projects onto the existingDiagnosticsStatusResponse, so the coordinator, prompt policy and persisted last-known snapshots are unchanged and older snapshots still decode..availableonly whenallowedis true andstate == "available".not_configuredmaps to storage unavailable, which is how the server reports missing storage. Every other state maps to disabled. The free-formstatusstring is not read.DiagnosticsCoordinator.refreshStatuscalls the method throughsiloAPI.apiV2Client, so tests that inject aSiloAPIalso cover the v2 read.isTransientCaptureFallbackFailurerecognizesAPIv2Error: a 5xx problem or status still lets a persistent capture fall back to the last-known snapshot. Every other v2 answer fails closed, includingserverUpdateRequired.APIv2Error.serverUpdateRequired, a v1-only server. This replaces the old plain-404 check, which only the v1 route could trigger.DiagnosticsAPI.getDiagnosticsStatus()and the v1 status routes and fixtures in the tests.Android reads the same operation (
DiagnosticsApi.ktgetStatus).Validation
#if os(iOS) || os(tvOS), so the macOS build does not exercise it.DiagnosticsCapabilitiesV2Tests(new),HostedDiagnosticsAPITests,DiagnosticsContractTests,DiagnosticsChunkedUploadTests,DiagnosticsReviewFixesTestsandDiagnosticsViewModelTests.allowed:false,disabled,not_configuredandunsupportedupload_chunk_bytes: 0means no chunked uploadserverUpdateRequiredscripts/ci/check-no-api-v1.shpasses.Risks and follow-ups
If-None-Matchconditional read is not used. Each refresh does a full read, as before.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 48 of 50 in the Apple API v2 stack. Base:
apiv2-stack/47-notification-sync-v2. Merge in order from the bottom of the stack. The plan and full index are in PR 01.🤖 Generated with Claude Code