Skip to content

refactor(api): share one APIv2Client from SiloAPI - #350

Merged
Quick104 merged 1 commit into
mainfrom
apiv2-stack/02-share-apiv2-client
Sep 23, 2026
Merged

Quick104 merged 1 commit into
mainfrom
apiv2-stack/02-share-apiv2-client

Conversation

@Quick104

Copy link
Copy Markdown
Contributor

Problem

SiloAPI built a new APIv2Client(http:tokenStore:) inline for each of its four v2 detail reads (itemDetail, seasons, episodes, watchDetail). Code outside the actor had no shared v2 client to use, so each upcoming v2 migration would add more inline constructions.

Solution

  • Add one stored apiV2Client on SiloAPI, built in init from the same injected HTTPClient and TokenStore. It uses the same name as open PR feat(player): support all marker occurrences #343.
  • Declare it nonisolated let (APIv2Client is a Sendable struct), so callers outside the actor can use SiloAPI.shared.apiV2Client directly.
  • Route the four detail reads through it.

Behavior does not change. The client is a stateless value over the same transport and token store, and its isUpdateRequired check still runs on each call. This PR owns no inventory rows.

Validation

All runs used the stack build helper on this branch:

  • build ios, build tvos, build macos: PASS.
  • test ios SiloTests/LibraryDetailScopeTests SiloTests/ArtworkURLTests: PASS, 18 tests. LibraryDetailScopeTests sends the facade's detail reads through a StubURLProtocol-backed HTTPClient, which confirms the shared client uses the injected transport.
  • test tvos SiloTVTests/LibraryDetailScopeTests SiloTVTests/ArtworkURLTests: PASS, 18 tests.

No new test was added. The change moves code without changing behavior, and the existing facade tests already cover it.

  • Final stack: with all 50 PRs applied, the full iOS suite (1981 tests) and tvOS suite (1792 tests) passed with 0 failures, the macOS build passed, and the v1 path guard passed. Every branch in the stack, this one included, builds on its own.

Risks and follow-ups

  • Open PR feat(player): support all marker occurrences #343 adds a property with the same name to SiloAPI.swift. Whichever PR lands second gets a trivial conflict: keep one declaration.
  • Later PRs in the stack should call SiloAPI.shared.apiV2Client (or the injected facade's apiV2Client) instead of building APIv2Client at call sites.

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 2 of 50 in the Apple API v2 stack. Base: apiv2-stack/01-pin-contract-fixtures. Merge in order from the bottom of the stack. The plan and full index are in PR 01.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3b70bbb6-5d0a-4d78-b9bf-fec12a7a2bb7

📥 Commits

Reviewing files that changed from the base of the PR and between 647aa2e and 93cff73.

📒 Files selected for processing (1)
  • iosApp/iosApp/Networking/SiloAPI.swift

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick104 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T13:30:40.388937Z 93cff73 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Quick104

Copy link
Copy Markdown
Contributor Author

Code review summary

Reviewed head: 055dcd08 (apiv2-stack/02-share-apiv2-client).

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 /api/v1 request from the new builds except the retained health probe.

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 (claude-opus-5-5) agents in Claude Code (T3 Code).

@Quick104
Quick104 force-pushed the apiv2-stack/01-pin-contract-fixtures branch from 590c404 to e60b329 Compare September 23, 2026 13:19
@Quick104
Quick104 force-pushed the apiv2-stack/02-share-apiv2-client branch from 055dcd0 to 21dff02 Compare September 23, 2026 13:19
Base automatically changed from apiv2-stack/01-pin-contract-fixtures to main September 23, 2026 13:28
SiloAPI built a fresh APIv2Client inline for each of its four v2 detail
reads, and code outside the actor had no shared client to call. Later v2
migrations would have kept adding more inline constructions.

Store one apiV2Client on SiloAPI, built from the same injected HTTPClient
and TokenStore, and route the four reads through it. The property is a
nonisolated let so non-actor callers can use SiloAPI.shared.apiV2Client
without an actor hop. No behavior change.

Stack-PR: F1

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Quick104
Quick104 force-pushed the apiv2-stack/02-share-apiv2-client branch 2 times, most recently from 21dff02 to 93cff73 Compare September 23, 2026 13:28
@Quick104
Quick104 merged commit b3b90a1 into main Sep 23, 2026
2 checks passed
@Quick104
Quick104 deleted the apiv2-stack/02-share-apiv2-client branch September 23, 2026 13:28
@Quick104 Quick104 mentioned this pull request Nov 26, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant