Skip to content

feat(playback): adopt platform-neutral protocol v3 - #131

Merged
Quick104 merged 11 commits into
mainfrom
codex/playback-v3-neutral-apple
Aug 10, 2026
Merged

Quick104 merged 11 commits into
mainfrom
codex/playback-v3-neutral-apple

Conversation

@Quick104

@Quick104 Quick104 commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Part of Silo-Server/silo-server#135

The Apple player still implemented the platform-shaped playback-v3 draft and hard-coded old attempt tokens in contract tests. That left iOS, tvOS, and macOS without an exact executable binding to the server-owned neutral contract used by the web and Android clients.

Approach

  • Adopt neutral v3 capability evidence, server delivery plans, opaque attempt-key echoing, output context, route events, terminal decisions, and intent/seek/failure replans.
  • Update the playback bridge, plan adapter, player model, quality selection, and subtitle AI handoff to preserve server-selected tracks and lifecycle ownership.
  • Remove the old client plan-attempt hash shim and cross-check decision/replan/route identities rather than hard-coding a token implementation.
  • Vendor all nine canonical fixtures from server PR #567, pin the exact server SHA, and exercise the typed planner/replan/protocol matrix including HDR/DV, TrueHD, ASS/PGS/DVD, restart, recovery, capacity, and route-limit cases.
  • Assert that intent and seek-reanchor requests omit failure, while real recovery requests carry a classification.

Coordinated release train:

Risks and follow-up

  • Requires the coordinated server contract; there is intentionally no compatibility window for the removed draft-v3 fields.
  • The server is the one-way authority for attempt identities and golden wire vectors.
  • No physical-device or signed-in runtime playback was exercised in this closeout; coverage is simulator tests plus platform build/compile checks.

Testing

  • Focused Playback V3, conformance, media-fixture, font-fetch, and decode-capability suite: 59/59 passed on an iPhone 17 Pro simulator.
  • Post-review focused rerun covering font-cache LRU recency plus the AVPlayer codec invariant: 4/4 passed.
  • tvOS simulator build/compile: passed.
  • macOS arm64 compile: passed.
  • All nine vendored JSON fixtures are byte-identical to server PR feat(browse): add Release Date library sort #567 at ce2f3e6df084f52c62595db8e3011f55c3a925ef.
  • git diff --check: passed.

Review closeout (a1eb44b)

  • Answered and resolved all 18 review threads that were open before the closeout push.
  • Refuted and resolved the post-push MPEG-2 thread with source/test evidence, and strengthened the top-level LRU recency test in the follow-up commit.
  • Restricted HLS and audiobook capability evidence to routes their actual AVPlayer executors can run.
  • Preserved authoritative V3 sidecar selection across HLS replans and stopped rejected allocated sessions.
  • Added supported sessionless terminal-start telemetry, feature-aware source-duration fallback, a shared server-scoped capability gate, and bounded font-bundle streaming/LRU caching.
  • Synced the vendored corpus to the current server PR head and addressed the top-level sentinel-name and duration reviews.

AI Disclosure

  • Tool(s): OpenAI Codex; Claude Code
  • Model(s): gpt-5; gpt-5.6-sol; claude-fable-5 (server-side xhigh review attempt produced no result)
  • Involvement: AI-assisted
  • Adversarial review: Independent Standards and Spec passes plus a fresh thread audit found stale fixtures, executor-inaccurate claims, subtitle restoration drift, session cleanup gaps, unbounded font bundles, and unknown-duration fallback. The actionable contract/runtime findings were fixed and revalidated at the pushed head.

Summary by CodeRabbit

  • New Features

    • Playback now uses the latest protocol for improved session setup, recovery, device capabilities, and stream selection.
    • Added server-provided quality options with resolution and bitrate details.
    • Subtitle preferences persist across playback actions, including seeking and recovery.
    • Added support for embedded, external, downloaded, and font-enhanced subtitles.
  • Bug Fixes

    • Improved playback recovery and session renewal during network changes.
    • Enhanced HDR, Dolby Vision, audio, and video capability handling.
    • Improved subtitle indexing, timeline handling, and video-only playback support.

Issue #134 remediation

  • Advertise the bare audio containers Apple can safely direct-play (mp3, m4a, m4b, aac, flac, wav) in both the flat V3 snapshot and original_http delivery.
  • Preserve the scanner's canonical M4A/M4B match through the existing mp4 claim.
  • Renew a missing playback session during V3 seek/replan instead of tearing playback down.
  • Keep Ogg off the flat claim because current Apple runtimes accept Ogg/Opus but reject Ogg/Vorbis, and V3 cannot yet express that codec/container pairing safely.

Fixes #134

Recover the exact six-file uncommitted worktree state from dev-builder so the interrupted platform-neutral playback v3 port can continue in an isolated local Codex worktree. This is an intentionally incomplete local checkpoint, not a finished implementation.
@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Playback Protocol V3 now drives iOS playback negotiation, session adoption, renewal, replanning, quality selection, subtitle handling, capability reporting, and conformance testing. Loopback playback supports video-only sessions and expanded audio container claims.

Changes

Playback Protocol V3

Layer / File(s) Summary
V3 contracts and Apple plan adaptation
iosApp/iosApp/Screens/Player/ProtocolV3/*, iosApp/iosApp/Screens/Player/ApplePlaybackQuality.swift
Neutral V3 models define delivery classes, capability evidence, attempt keys, output contexts, subtitle inventories, and server qualities. Apple capability reporting and plan adaptation use these contracts.
V3 startup and session renewal
iosApp/iosApp/Screens/Audio/*, iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
Playback startup requires V3 capability support and a valid profile. The bridge resolves track intent, retries with stable attempt IDs, adopts compatible plans, renews direct sessions, and reports output contexts.
Player intent, renewal, and replanning
iosApp/iosApp/Screens/Player/PlayerViewModel.swift, iosApp/iosApp/Screens/Player/Subtitles/*, iosApp/iosApp/Networking/Models.swift
Player state preserves V3 subtitle and quality intent across recovery, renewal, quality changes, seek reanchors, subtitle handoff, and automatic subtitle updates. Sidecar subtitles can load font bundles.
Playback execution and route handling
iosApp/iosApp/Screens/Player/PlaybackExecutionPlan.swift, iosApp/iosApp/Screens/Player/ApplePlaybackRoutePlanner.swift, iosApp/iosApp/Screens/Player/AVPlayerRoute/*, iosApp/iosApp/Screens/Player/PlaybackCoordinator.swift, iosApp/iosApp/Screens/Player/CoreMedia/*, iosApp/iosApp/Screens/Player/PlayerView.swift
Loopback sessions support absent audio, preserve route state, guard timeline anchors, reuse compatible engines, and use the active player model. Display-mode polling uses bounded millisecond delays.
Fixture contracts and conformance validation
iosApp/Tests/Fixtures/PlaybackV3/*, iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift, iosApp/Tests/PlaybackProtocolV3Tests.swift, iosApp/project.yml, iosApp/Tests/DetailVersionSelectionTests.swift, iosApp/Tests/PlaybackMediaFixtureTests.swift
Vendored JSON fixtures and XCTest coverage validate V3 requests, responses, replans, route events, errors, subtitle inventories, attempt keys, quality handling, recovery, audio track versions, and video-only Dolby Vision loopback playback.
Apple decode capability support
iosApp/iosApp/Shared/AppleDecodeCapabilities.swift, iosApp/Tests/AppleDecodeCapabilitiesTests.swift
Apple capability data separates video and audio containers, advertises direct-play audio formats, excludes Ogg, and validates the advertised container claims.

Estimated code review effort: 5 (Critical) | ~90+ minutes

Sequence Diagram(s)

sequenceDiagram
  participant PlayerViewModel
  participant PlaybackSessionBridge
  participant PlaybackProtocolV3
  participant ApplePlaybackV3PlanAdapter
  PlayerViewModel->>PlaybackSessionBridge: startSession with subtitle intent and preferences
  PlaybackSessionBridge->>PlaybackProtocolV3: send capability-rich start request
  PlaybackProtocolV3-->>PlaybackSessionBridge: return playable plan and server qualities
  PlaybackSessionBridge->>ApplePlaybackV3PlanAdapter: adapt the V3 plan
  ApplePlaybackV3PlanAdapter-->>PlayerViewModel: return prepared playback and subtitle inventory
  PlayerViewModel->>PlaybackSessionBridge: request quality, subtitle, or seek replan
  PlaybackSessionBridge->>PlaybackProtocolV3: send operation-specific replan
  PlaybackProtocolV3-->>PlayerViewModel: return replacement plan and output context
Loading

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes broad protocol, subtitle, quality, fixture, lifecycle, and routing changes beyond issue #134's container and renewal objectives. Split unrelated Protocol V3 adoption, subtitle, quality, fixture, and lifecycle changes into separate pull requests, or link issues that define those objectives.
Docstring Coverage ⚠️ Warning Docstring coverage is 19.19% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds safe bare-audio containers and implements stale-session renewal for missing V3 sessions, satisfying issue #134.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the primary change: adopting the platform-neutral Playback Protocol V3.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/playback-v3-neutral-apple

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

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code review — 10 confirmed findings

Review method: 8 independent finder angles over the full diff, candidates deduped, then each survivor adversarially verified against the PR-head code and the pinned server commit (63247a36) in the sibling silo-server checkout. Everything below is CONFIRMED (not speculative), ranked most severe first.


1. Intent replans are sent as failure_recovery — track/quality switches terminally kill playback

iosApp/iosApp/Screens/Player/PlayerViewModel.swift:1610

attemptProtocolV3Replan defaults operation: String = "failure_recovery". The bridge only consults the new replanOperation(forClassification:) mapper when operation is nil — which never happens, since the ViewModel always passes the non-nil default. All four intent call sites (quality 4354, audio 5388, subtitle 5415/5439) omit operation, so:

  • isIntent == false → a fabricated failure block is attached to a deliberate user action;
  • invalidatesIntent == false → attemptedPlanKeys accumulate and attemptCount increments (on main, these reset via the classification list).

Concretely: switching audio A→B→A returns the original plan whose plan_attempt_key is already in attemptedPlanKeys → replan_loop_detected terminal → finalizeTerminalPlaybackError kills playback on a plain track toggle. Independently, the 8th track/quality switch in one sitting trips the attemptCount < 8 guard → attempt_limit_reached. The new testIntentReplansCarryNoFailureAndUseNeutralOperations only exercises the static mapper, never this wiring.

Fix: default the ViewModel parameter to nil (matching the bridge) or pass the mapped operation explicitly.

2. Audiobook/music playback is broken: audio player still posts the legacy start body

iosApp/iosApp/Screens/Audio/AudioPlayerViewModel.swift:244

AudioPlayerViewModel.startSession still POSTs a legacy StartPlaybackRequest (no protocol_version field) to /api/v1/playback/start. At the pinned server commit, HandleStartPlayback rejects any body whose protocol_version is not 3 with HTTP 426 (LegacyUpgradeErrorV3), and there is no legacy sibling route. Every audiobook/music start fails on both iOS and tvOS against the coordinated server.

Migration nuance: the client's disableProgressPersistence: true (sent for audiobooks so file-local positions don't clobber the book-level resume point kept via /sync/progress) has no client-supplied v3 equivalent. The server derives it only for multipart files (PresentationPartTotal > 1); the single-file audiobook case regresses under a naive port — this needs server-side coordination.

3. macOS: all-false HDR claim makes the server terminally refuse every HDR title

iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift:250

The macOS branch now reports hdr10/hdr10Plus/hlg = false, no DV profiles (was true/true/true + DV 8 on main). The pinned server gives output HDR evidence precedence, and with no HDR claim, no DV route, and no tone-map recipe installed, planVideoTranscodeV3 terminates with hdr_transcode_unsupported for every non-SDR source (plan_v3.go:601, mirrored by the server's own test). Net: macOS goes from direct-playing HDR titles to a hard terminal error on all of them — unmentioned in the PR.

The comment's premise ("macOS does not expose AVPlayer.availableHDRModes") is true but incomplete: AVPlayer.eligibleForHDRPlayback (macOS 10.15+) and NSScreen EDR headroom exist for exactly this attestation. Also note availableHDRModes is deprecated as of iOS/tvOS 26 — the project's minimum — so eligibleForHDRPlayback would serve all three platforms uniformly.

4. System-caption subtitle policy (#122/#124) is disabled for all online playback

iosApp/iosApp/Screens/Player/PlayerViewModel.swift:3321

adoptProtocolV3RenewalIntent unconditionally sets hasExplicitSubtitleChoice = true, prefsForCurrentItem = nil, prefsResolvedForCurrentItem = true — immediately after beginFreshLoad computed the system-caption snapshot (3489–3493), and before the player opens. Since v3 is now the only online path, the guards at 7540 (applyAutoSubtitlePreferencesIfNeeded), 7570 (reapplySystemSubtitlePolicy), 1222 (caption-change observer), and 7417 (forced-sidecar auto-select) become unreachable for every server-backed playback.

The plan being deferred to can't compensate: initialProtocolV3SubtitleIntent builds its resolver inputs from watchDetail.effectiveSubtitle* only and never passes additionalPreferredLanguages / forcedOnly / preferAccessibilityTracks / disableWhenNoLanguageMatch — exactly the fields systemCaptionPrefsSnapshot() populates. SubtitleMode has no system case, so there is no server-side escape hatch. A user with "match system captions" + SDH/language prefs gets no track selected, and mid-playback caption-setting changes are ignored.

5. Seek-reanchor replans carry a failure block the vendored contract forbids

iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift:940

failure: is only nil'd for isIntent (track/quality change). A seek reanchor therefore ships failure: {classification: "seek_reanchor", …} — not a failure-taxonomy member — while all nine vendored replan vectors including seek_reanchor omit failure, PlaybackProtocolV3ConformanceFixtureTests.swift:101 asserts "track, quality, and seek-reanchor intent vectors must omit failure", and the PR description claims the same. The live client violates the contract its own tests vendored, on every out-of-window seek.

Fix: omit failure when operation == seekReanchor too.

6. Embedded-source sidecar inventory items produce duplicate subtitle rows and a double-apply

iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift:94 (+ PlayerViewModel.swift:1033)

playbackSession now emits a SubtitleUrl for every inventory item with delivery == "sidecar", including source == "embedded" ones (the PR's own decision_response.json shape: combined_index 1/2). subtitleUrlsForCurrentRoute only filters when activeRouteUsesEmbeddedAVPlayerSubtitleExtraction is true — false for .playerCoreDirect, the route original_http resolves to. PlayerCore enumerates the container's subtitle streams and appendSidecarTracks appends the same tracks as sidecar rows (no overlap check; the codec-ranked sort doesn't even keep the twins adjacent) → each embedded track appears twice in the menu.

Relatedly, adoptingProtocolV3Intent sets both pendingSubtitleFfIndex and pendingSidecarSubtitleTrackId for such items (the guards aren't mutually exclusive), and neither consumer clears the other's pending state: the embedded decoder is selected via applyTrackList, then torn down and replaced by the sidecar fetch — subtitle flicker plus a redundant network fetch on every V3 adopt/renewal.

Fix: give an embedded-sidecar item one identity per route — filter sidecar URLs on routes that enumerate container streams, or pick exactly one of ffIndex/sidecarTrackId in adoptingProtocolV3Intent.

7. AI-subtitle handoff and provider subtitle search break on media with zero subtitle tracks

iosApp/iosApp/Screens/Player/PlayerViewModel.swift:5662

The new guard … !inventory.isEmpty else { return nil } turns a correct baseTrackCount == 0 into a nil context. The pinned server always encodes a no-subtitle file's inventory as [] (never null, per subtitle_inventory_v3.go), and transcription is routed precisely when no text subtitle source exists — so the most common transcription input now soft-fails at handoff ("Translation finished but the track couldn't be added.") until the session restarts. The same nil context breaks downloadSearchedSubtitle on no-subtitle files. The old code (max(index) ?? -1) + 1 == 0) handled this correctly.

Fix: drop the !inventory.isEmpty clause; an empty inventory legitimately yields baseTrackCount = 0.

8. PlaybackV3AvailableQuality.height is non-optional — the canonical audio-only vector cannot decode

iosApp/iosApp/Screens/Player/ProtocolV3/PlaybackProtocolV3Models.swift:395

The vendored corpus's audio_only_original planner scenario omits height from available_qualities. Production decodes with synthesized Codable + convertFromSnakeCase, so that plan's entire decision response throws keyNotFound — and the conformance test hides it by mirroring the field as height: Int? in its own private struct (PlaybackProtocolV3ConformanceFixtureTests.swift:240). Latent today only because of finding 2; the moment audio migrates to v3 (or a server omits height on any rung), start throws instead of playing. Same class of gap the PR itself guarded for source.durationSeconds.

Fix: make height optional, and have the conformance test decode the production model rather than a lenient mirror.

9. Deleted 404/405 catch: old servers now surface a raw HTTP error instead of the upgrade message

iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift:583

A pre-v3 server has no /api/v1/playback/capability route, so the probe throws HTTPError.http(404, …) out of stageProtocolV3Start before the guard protocolV3Available == true that produces the new "Update the server to continue." terminal is ever reached. The exact population the message was written for sees "HTTP 404" instead — and protocolV3Available stays nil, so every start re-probes.

Fix: restore the 404/405 catch, set protocolV3Available = false, and let the existing guard throw the friendly terminal failure.

10. adoptSession is dead code — diagnostics reports lose playback session IDs

iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift:287

All three callers were deleted with the legacy paths; adoptProtocolV3Start assigns sessionId/currentSession directly. RecentSessionTracker.shared.record(sessionID:) (its only production call site is inside the dead function) and the "playback session adopted" breadcrumb never run, so every manual and crash/abnormal-exit diagnostics report now ships an empty playbackSessionIDs — playback bugs can no longer be correlated to server sessions. Secondary: the new renewDirectSession dropped the consecutiveProgressFailures = 0 / emittedOrphanedSessionWarning = false resets, so the orphaned-session escalation stays latched across a successful silent renewal until the next good progress tick.

Fix: fold the tracker/breadcrumb side effects into adoptProtocolV3Start and delete adoptSession.


Below the cut (verified, lower tier — happy to detail)

Cleanup-grade items that lost to the correctness findings above: route-event telemetry POSTs are awaited serially on the seek/replan critical path (2–3 extra RTTs per seek); the capability snapshot hand-rolls decode limits and silently drops the shared AppleDecodeCapabilities vocabulary (MPEG-2 claim diverges on device; the sim-only test can't see it); the four-delivery string allowlist is duplicated across ~7 sites while the new DeliveryClass constants go unused; restartCurrentTranscodeHLSForSeek is now unreachable-as-success for seeks (its guard bails on the only condition that reaches it) and logs a misleading warning; the "adopt prepared plan" state block is copy-pasted at four sites with divergent field subsets; server quality labels outside the local catalog are silently normalized to auto and dropped from the in-player menu; and the new Tests/Fixtures/PlaybackV3 set relies on XcodeGen inference instead of the explicit buildPhase declarations the SettingsContract precedent uses.


Review ran at high effort: 8 finder angles × up to 6 candidates, deduped, 1-vote adversarial verification per survivor; all 10 reported findings are CONFIRMED.

🤖 Generated with Claude Code

@Quick104

Quick104 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the full Quick104 correctness review at Apple head 3706d5a while keeping this PR draft.

Resolved findings:

  • Intent call sites now reach typed track_change / quality_change replans; seek reanchor also omits synthetic failure data.
  • Audio and audiobook playback now use neutral V3 with client-owned durable progress and an explicit file-local start position.
  • macOS attests the live HDR output chain without inventing HDR10+ or Dolby Vision support.
  • Automatic system-caption policy is included at initial planning and remains automatic across renewal; policy changes replan through the server.
  • Embedded-origin sidecars retain one authoritative identity instead of duplicating the embedded selector.
  • Empty subtitle inventories remain valid for AI subtitle handoff.
  • Audio-only quality height is optional in the production decoder; unknown server quality IDs remain usable.
  • Capability 404/405 and missing neutral_playback_v3_contract_v1 produce the friendly server-upgrade terminal.
  • Every V3 start/replan adopts the session through the diagnostics/reset path.
  • Correctness-relevant lower-tier items were also closed: route telemetry no longer blocks replans, MPEG-2 software capability is attested, delivery constants are centralized, obsolete seek-restart wiring is removed, and PlaybackV3 fixture resources are explicit.

Contract parity:

  • All nine JSON fixtures match silo-server 30ddc0d09255816e44cd9874ff79a785d8a6fd8e byte-for-byte.
  • SOURCE is pinned to that exact SHA.
  • Typed conformance assertions cover draft_v3_426, client progress ownership with explicit start position, and the neutral contract token.

Validation:

  • PlaybackProtocolV3 plus conformance fixtures: 25/25 passed.
  • AppleDecode, AudiobookProgress, DetailVersionSelection, SubtitleAutoResolver, and SystemCaptionAppearance: 90/90 passed.
  • iOS app compiled through both test gates.
  • SiloTV tvOS simulator build passed.
  • SiloMac macOS build passed.
  • git diff --check and exact nine-fixture parity passed.

The only emitted warnings were existing actor-isolation, lock, deprecation, alignment, and AppIntents warnings outside this patch.

@Quick104
Quick104 marked this pull request as ready for review August 9, 2026 05:53

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift (1)

134-165: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Progressive and HLS deliveries advertise a codec that AVPlayer cannot decode.

videoCodecs is now videoDecode.map(\.codec) (Line 40), and videoDecodeAttestation() appends AppleDecodeCapabilities.mpeg2VideoCodec with decoderName: "FFmpeg" on device (Lines 217-228). The same list is then reported for all three delivery classes.

MPEG-2 is decodable only through the bundled FFmpeg loopback executor, which is exposed on originalHTTP (apple_local_loopback, apple_playercore). The progressive and hls classes expose AVPlayer only. If the server selects server_remux_progressive or a remux HLS route with copied MPEG-2 video, the AVPlayer route cannot decode it and playback fails.

Report the FFmpeg-only codec on the originalHTTP class only.

🐛 Proposed fix to scope the software-decoded codec to the loopback delivery
         let videoDecode = videoDecodeAttestation()
         let videoCodecs = videoDecode.map(\.codec)
         let hardwareVideoCodecs = videoDecode.filter(\.hardware).map(\.codec)
+        // AVPlayer-only deliveries cannot use the bundled FFmpeg software path.
+        let avPlayerVideoCodecs = videoDecode.filter(\.hardware).map(\.codec)
             PlaybackProtocolV3.DeliveryClass.progressive: PlaybackV3DeliveryCapability(
                 ...
                 containers: ["mp4", "mov", "m4v"],
-                videoCodecs: videoCodecs,
+                videoCodecs: avPlayerVideoCodecs,
             PlaybackProtocolV3.DeliveryClass.hls: PlaybackV3DeliveryCapability(
                 ...
                 containers: ["hls", "mpegts", "fmp4", "mp4"],
-                videoCodecs: videoCodecs,
+                videoCodecs: avPlayerVideoCodecs,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift`
around lines 134 - 165, Restrict the software-decoded MPEG-2 codec to the
originalHTTP capability, which exposes the FFmpeg loopback executor. In the
delivery capability definitions, keep the full videoCodecs list for originalHTTP
but filter out AppleDecodeCapabilities.mpeg2VideoCodec for the progressive and
hls classes, preserving their AVPlayer-compatible codec advertisements.
🧹 Nitpick comments (3)
iosApp/Tests/PlaybackProtocolV3Tests.swift (1)

624-665: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Gate the simulator-specific capability assertions.

The test name states simulator expectations, but the body never checks the environment. snapshot() derives codecsVideo from videoDecodeAttestation() and hdr from the live output snapshot. On a physical device the codec list includes HEVC and hdr can be true, so lines 644-645 and line 651 fail. Add an explicit simulator guard so a device test run reports "skipped" instead of a false failure.

♻️ Proposed guard
     func testSimulatorCapabilitiesAreNeutralAttestedAndOutputScoped() throws {
+        try XCTSkipUnless(
+            AppleDecodeCapabilities.isSimulator,
+            "Attested codec and HDR values are device-specific; this vector pins the simulator profile."
+        )
         let snapshot = ApplePlaybackV3Capabilities.snapshot()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/Tests/PlaybackProtocolV3Tests.swift` around lines 624 - 665, Add an
explicit simulator-only guard at the start of
testSimulatorCapabilitiesAreNeutralAttestedAndOutputScoped, using the test
environment’s existing simulator detection and reporting the test as skipped
when running on a physical device. Keep the current capability assertions
unchanged for simulator runs.
iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift (1)

153-168: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicated fixture-loading helpers in both Playback V3 test suites. Both suites define an identical snake-case JSONDecoder, fixtureURL(named:), and decodeFixture(_:named:). One shared helper keeps the bundle lookup and the decoding strategy in a single place.

  • iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift#L153-L168: remove the local decoder, fixtureURL(named:), and decodeFixture(_:named:) and call the shared helper.
  • iosApp/Tests/PlaybackProtocolV3Tests.swift#L829-L851: remove the same three members and keep only the suite-specific encoder, fixtureObject(named:), fixtureArray(named:), and encodedObject(_:).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift` around lines
153 - 168, Consolidate the duplicated fixture-loading helpers by removing
decoder, fixtureURL(named:), and decodeFixture(_:named:) from
iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift lines 153-168 and
iosApp/Tests/PlaybackProtocolV3Tests.swift lines 829-851, then update both
suites to use the shared helper; retain only encoder, fixtureObject(named:),
fixtureArray(named:), and encodedObject(_:) in PlaybackProtocolV3Tests.swift.
iosApp/iosApp/Screens/Audio/AudioPlayerViewModel.swift (1)

16-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Share the V3 capability gate with PlaybackSessionBridge.

This block duplicates PlaybackSessionBridge.stageProtocolV3Start (Lines 617-637 of iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift), including the cached flag, the 404/405 handling, and the server_upgrade_required message. The two caches are independent, so the app probes /api/v1/playback/capability once per view model instead of once per server.

Extract one shared, actor-isolated capability gate and call it from both sites. That removes the duplicated terminal message and the second probe.

Also applies to: 244-262

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/iosApp/Screens/Audio/AudioPlayerViewModel.swift` at line 16, Replace
the separate protocolV3Available cache and duplicated capability-check logic in
AudioPlayerViewModel and PlaybackSessionBridge.stageProtocolV3Start with one
shared actor-isolated V3 capability gate. Centralize the capability probe,
cached result, 404/405 handling, and server_upgrade_required terminal message,
then have both call sites reuse that gate so each server is probed only once.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@iosApp/iosApp/Screens/Player/PlayerViewModel.swift`:
- Around line 7700-7720: Update replanAutomaticProtocolV3SubtitleSelection to
return true only when attemptProtocolV3Replan admits and starts the replan; when
protocolV3ReplanTask is already active or currentWatchDetail is unavailable,
return false before mutating selectedSubtitleId or the preferred subtitle index
so applyAutoSubtitle can execute its local fallback.
- Around line 5060-5069: Update the playback preparation flow around
adoptProtocolV3RenewalIntent so selectedSubtitleSnapshot is only restored to
pendingSidecarSubtitleTrackId when protocolV3.plan.subtitle.mode is "render";
preserve the V3 plan’s burn_in and off modes without re-enabling a sidecar, and
add a regression test covering this restoration path.

In `@iosApp/Tests/Fixtures/PlaybackV3/SOURCE`:
- Line 6: Update the regeneration instruction in the SOURCE fixture to
explicitly run XcodeGen from the iosApp working directory, using the established
`cd iosApp && xcodegen generate` command after refreshing the files.

---

Outside diff comments:
In `@iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift`:
- Around line 134-165: Restrict the software-decoded MPEG-2 codec to the
originalHTTP capability, which exposes the FFmpeg loopback executor. In the
delivery capability definitions, keep the full videoCodecs list for originalHTTP
but filter out AppleDecodeCapabilities.mpeg2VideoCodec for the progressive and
hls classes, preserving their AVPlayer-compatible codec advertisements.

---

Nitpick comments:
In `@iosApp/iosApp/Screens/Audio/AudioPlayerViewModel.swift`:
- Line 16: Replace the separate protocolV3Available cache and duplicated
capability-check logic in AudioPlayerViewModel and
PlaybackSessionBridge.stageProtocolV3Start with one shared actor-isolated V3
capability gate. Centralize the capability probe, cached result, 404/405
handling, and server_upgrade_required terminal message, then have both call
sites reuse that gate so each server is probed only once.

In `@iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift`:
- Around line 153-168: Consolidate the duplicated fixture-loading helpers by
removing decoder, fixtureURL(named:), and decodeFixture(_:named:) from
iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift lines 153-168 and
iosApp/Tests/PlaybackProtocolV3Tests.swift lines 829-851, then update both
suites to use the shared helper; retain only encoder, fixtureObject(named:),
fixtureArray(named:), and encodedObject(_:) in PlaybackProtocolV3Tests.swift.

In `@iosApp/Tests/PlaybackProtocolV3Tests.swift`:
- Around line 624-665: Add an explicit simulator-only guard at the start of
testSimulatorCapabilitiesAreNeutralAttestedAndOutputScoped, using the test
environment’s existing simulator detection and reporting the test as skipped
when running on a physical device. Keep the current capability assertions
unchanged for simulator runs.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f609d7a6-885e-4b9f-b034-c6548c657615

📥 Commits

Reviewing files that changed from the base of the PR and between f33e674 and 3706d5a.

📒 Files selected for processing (23)
  • iosApp/Tests/DetailVersionSelectionTests.swift
  • iosApp/Tests/Fixtures/PlaybackV3/SOURCE
  • iosApp/Tests/Fixtures/PlaybackV3/attempt_keys.json
  • iosApp/Tests/Fixtures/PlaybackV3/capability_response.json
  • iosApp/Tests/Fixtures/PlaybackV3/conformance_matrix.json
  • iosApp/Tests/Fixtures/PlaybackV3/decision_response.json
  • iosApp/Tests/Fixtures/PlaybackV3/error_response.json
  • iosApp/Tests/Fixtures/PlaybackV3/replan_request.json
  • iosApp/Tests/Fixtures/PlaybackV3/route_event.json
  • iosApp/Tests/Fixtures/PlaybackV3/start_request.json
  • iosApp/Tests/Fixtures/PlaybackV3/subtitle_inventory.json
  • iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/iosApp/Screens/Audio/AudioPlayerViewModel.swift
  • iosApp/iosApp/Screens/Audio/AudiobookPlaybackContext.swift
  • iosApp/iosApp/Screens/Player/ApplePlaybackQuality.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/PlaybackProtocolV3Models.swift
  • iosApp/iosApp/Screens/Player/Subtitles/SubtitleAIController.swift
  • iosApp/project.yml

Comment thread iosApp/Tests/Fixtures/PlaybackV3/SOURCE Resolved

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3706d5a100

ℹ️ 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".

@Quick104

Quick104 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed #134 at b36267f.

What changed:

  • Split the Apple container vocabulary into video and bare-audio lists, then carried the combined list into the flat V3 capability and original_http delivery.
  • Added the safe direct-play audio set: mp3, m4a, m4b, aac, flac, and wav. The server scanner currently normalizes M4A/M4B to mp4, which remains advertised.
  • Kept ogg out intentionally: iOS 26.4 and tvOS 26.4 AVFoundation probes played Ogg/Opus but rejected Ogg/Vorbis. Because V3 currently sends flat codec and container lists rather than compatible pairs, claiming ogg while also claiming vorbis would authorize an invalid original route.
  • Routed playback_session_not_found from V3 replans/seek reanchors into stale-session renewal rather than terminal teardown.

Validation:

  • AppleDecodeCapabilitiesTests + PlaybackProtocolV3Tests: 31/31 passed on iPhone 17 Pro, iOS 26.4 simulator.
  • SiloTV: tvOS 26.4 simulator build passed.
  • SiloMac: macOS build passed.
  • Runtime AVFoundation probes covered MP3, raw AAC, FLAC, WAV, M4A, Ogg/Opus, and Ogg/Vorbis on iOS/tvOS simulators; the safe claim reflects those results.
  • git diff --check: passed.

Existing warnings were unchanged diagnostics, SwiftUI deprecation, lock-result, and linker-alignment warnings outside this patch.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b36267f44e

ℹ️ 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".

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
iosApp/iosApp/Screens/Player/PlaybackExecutionPlan.swift (1)

116-132: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider renaming the none sentinel to avoid shadowing Optional.none.

SelectedAudio.none collides with Optional.none wherever the contextual type is SelectedAudio?. Every current assignment site declares a non-optional let selectedAudio: LoopbackSessionSpec.SelectedAudio, so resolution is unambiguous today.

The hazard is in comparisons. XCTAssertEqual(plan.loopbackSession?.selectedAudio, .none) compares against nil instead of the sentinel and passes when loopbackSession is nil. PlaybackMediaFixtureTests.testAppleLoopbackRouteSupportsVideoOnlyDolbyVision avoids this only because it spells out LoopbackSessionSpec.SelectedAudio.none.

A name such as absent removes the ambiguity.

♻️ Proposed rename
-        static let none = SelectedAudio(
+        static let absent = SelectedAudio(
             trackIndex: -1,
             ffIndex: nil,
             sourceCodec: nil,
             sourceChannelCount: nil,
             sourceChannelLayout: nil,
             outputMode: .copy,
             preservesAtmos: false
         )

Update the assignment sites in ApplePlaybackRoutePlanner.swift (Line 403), PlayerViewModel.swift (Line 7205), and the assertion in PlaybackMediaFixtureTests.swift.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/iosApp/Screens/Player/PlaybackExecutionPlan.swift` around lines 116 -
132, Rename the `SelectedAudio.none` sentinel to `SelectedAudio.absent` to avoid
ambiguity with `Optional.none`. Update its declaration and all references,
including assignment sites in `ApplePlaybackRoutePlanner` and `PlayerViewModel`,
plus the assertion in `PlaybackMediaFixtureTests`, preserving the sentinel’s
existing semantics.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@iosApp/iosApp/Screens/Player/PlayerViewModel.swift`:
- Around line 5316-5322: Update the restoration logic around
armAdoptedProtocolV3TrackIntent to use protocolV3SidecarRestoreIntent, matching
attemptProtocolV3Replan and requiring the snapshot subtitle index to match
plan.selectedTracks.subtitle?.index before assigning
pendingSidecarSubtitleTrackId. If protocolV3RestoredSidecarTrackId becomes
unused, remove that helper and its associated test.

In `@iosApp/iosApp/Screens/Player/Subtitles/SidecarSubtitleFetcher.swift`:
- Around line 109-144: Update fetchFontBundle to reject oversized font-bundle
responses before buffering or decoding, using a defined maximum size and
validating Content-Length when available; enforce the same limit during body
retrieval or stream the response if necessary. Bound fontBundleCache with a
total byte limit and eviction policy, tracking each attachment bundle’s decoded
size and removing entries as needed so cached bundles cannot grow without limit.

---

Nitpick comments:
In `@iosApp/iosApp/Screens/Player/PlaybackExecutionPlan.swift`:
- Around line 116-132: Rename the `SelectedAudio.none` sentinel to
`SelectedAudio.absent` to avoid ambiguity with `Optional.none`. Update its
declaration and all references, including assignment sites in
`ApplePlaybackRoutePlanner` and `PlayerViewModel`, plus the assertion in
`PlaybackMediaFixtureTests`, preserving the sentinel’s existing semantics.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 025c2278-c7e1-48b7-8cb9-f1efe1b87b21

📥 Commits

Reviewing files that changed from the base of the PR and between b36267f and e4c28de.

📒 Files selected for processing (16)
  • iosApp/Tests/Fixtures/PlaybackV3/SOURCE
  • iosApp/Tests/PlaybackMediaFixtureTests.swift
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/iosApp/Networking/Models.swift
  • iosApp/iosApp/Screens/Audio/AudioPlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/AVPlayerRoute/AVPlayerBackend.swift
  • iosApp/iosApp/Screens/Player/ApplePlaybackQuality.swift
  • iosApp/iosApp/Screens/Player/ApplePlaybackRoutePlanner.swift
  • iosApp/iosApp/Screens/Player/PlaybackExecutionPlan.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/iosApp/Screens/Player/PlayerView.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift
  • iosApp/iosApp/Screens/Player/Subtitles/SidecarSubtitleFetcher.swift
  • iosApp/iosApp/Screens/Player/Subtitles/SubtitleSession.swift
🚧 Files skipped from review as they are similar to previous changes (6)
  • iosApp/Tests/Fixtures/PlaybackV3/SOURCE
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift
  • iosApp/iosApp/Screens/Player/ApplePlaybackQuality.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/Tests/PlaybackProtocolV3Tests.swift

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4c28de98d

ℹ️ 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".

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

durationSeconds: plan.source.durationSeconds ?? selectedVersion.duration,

P2 Badge Preserve an explicitly unknown source duration

When a server advertises plan_source_duration_v1 but returns duration_seconds: null because the effective source duration is unknown, this fallback substitutes the catalog version's potentially stale duration. PlayerViewModel then treats that guess as authoritative for the displayed timeline and seek clamping, which can prevent access to content beyond the stale endpoint or report completion prematurely. Pass the negotiated server features into this conversion and use the catalog fallback only when the server lacks the duration feature.

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Quick104

Copy link
Copy Markdown
Contributor Author

Review closeout — caaec2e

Addressed the actionable review findings and pushed the fixes:

  • made progressive/HLS and audiobook capability evidence match their actual AVPlayer executors;
  • preserved the replacement plan's selected sidecar across HLS replans;
  • stopped allocated sessions when Apple rejects a plan before publication;
  • added sessionless terminal-start route telemetry and feature-aware unknown source duration;
  • shared the capability gate by active server and bounded font-bundle streaming/cache memory;
  • renamed SelectedAudio.none to .absent, consolidated fixture decoding, and synced all nine vectors to server PR feat(browse): add Release Date library sort #567 at ce2f3e6.

I also replied to and resolved all 18 threads that were open before this push. The top-level CodeRabbit sentinel suggestion and Codex unknown-duration review are covered by this commit as well.

Validation at the pushed source:

  • iOS focused suite: 59 passed, 0 failed;
  • exact-final font-fetch rerun: 3 passed, 0 failed;
  • tvOS simulator build/compile: passed;
  • macOS arm64 compile: passed;
  • all nine fixtures: byte-identical to the server head;
  • git diff --check: passed.

No physical-device or signed-in playback run was performed in this closeout.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
iosApp/Tests/SidecarSubtitleFetcherTests.swift (1)

70-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exercise cache recency before asserting LRU eviction.

Each bundle decodes to two bytes, and the cache limit is two bytes. The second insertion must evict the first entry regardless of markFontBundleRecentlyUsed(_:). A regression in recency tracking will still pass this test.

Use a four-byte cache with three URLs. Fetch the first URL again before inserting the third URL. Then verify that the second URL is evicted and the first URL remains cached.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/Tests/SidecarSubtitleFetcherTests.swift` around lines 70 - 99, Update
testFontBundleCacheEvictsLeastRecentlyUsedEntryByDecodedBytes to use a four-byte
cache and add a third URL. Fetch the first URL, then the second, fetch the first
again to refresh recency, and insert the third; assert the second URL is
requested twice while the first remains at two requests, confirming true LRU
eviction.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift`:
- Around line 170-172: Update the HLS capability construction in the ProtocolV3
Apple playback path to advertise only codecs supported by AVPlayer. Derive the
value from AppleDecodeCapabilities.videoCodecs while excluding
AppleDecodeCapabilities.mpeg2VideoCodec, leaving the broader codec list
unchanged for PlayerCore-only delivery.

---

Nitpick comments:
In `@iosApp/Tests/SidecarSubtitleFetcherTests.swift`:
- Around line 70-99: Update
testFontBundleCacheEvictsLeastRecentlyUsedEntryByDecodedBytes to use a four-byte
cache and add a third URL. Fetch the first URL, then the second, fetch the first
again to refresh recency, and insert the third; assert the second URL is
requested twice while the first remains at two requests, confirming true LRU
eviction.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb3b041e-990f-4911-90d7-993b51d338d4

📥 Commits

Reviewing files that changed from the base of the PR and between 9870cd4 and caaec2e.

📒 Files selected for processing (18)
  • iosApp/Tests/Fixtures/PlaybackV3/SOURCE
  • iosApp/Tests/Fixtures/PlaybackV3/capability_response.json
  • iosApp/Tests/Fixtures/PlaybackV3/conformance_matrix.json
  • iosApp/Tests/Fixtures/PlaybackV3/decision_response.json
  • iosApp/Tests/PlaybackMediaFixtureTests.swift
  • iosApp/Tests/PlaybackProtocolV3ConformanceFixtureTests.swift
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/Tests/PlaybackV3FixtureTestSupport.swift
  • iosApp/Tests/SidecarSubtitleFetcherTests.swift
  • iosApp/iosApp/Screens/Audio/AudioPlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ApplePlaybackRoutePlanner.swift
  • iosApp/iosApp/Screens/Player/PlaybackCoordinator.swift
  • iosApp/iosApp/Screens/Player/PlaybackExecutionPlan.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift
  • iosApp/iosApp/Screens/Player/Subtitles/SidecarSubtitleFetcher.swift
🚧 Files skipped from review as they are similar to previous changes (11)
  • iosApp/Tests/Fixtures/PlaybackV3/SOURCE
  • iosApp/Tests/PlaybackMediaFixtureTests.swift
  • iosApp/Tests/Fixtures/PlaybackV3/decision_response.json
  • iosApp/Tests/Fixtures/PlaybackV3/capability_response.json
  • iosApp/iosApp/Screens/Audio/AudioPlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ApplePlaybackRoutePlanner.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/iosApp/Screens/Player/PlaybackCoordinator.swift

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Quick104

Copy link
Copy Markdown
Contributor Author

Post-review follow-up — a1eb44b

The completed CodeRabbit pass added one inline finding and one top-level test nit:

  • The inline MPEG-2 claim was refuted: AppleDecodeCapabilities.videoCodecs is the AVPlayer-safe list and never contains mpeg2video; only the separate PlayerCore attestation does. I clarified the nearby comment, linked the existing invariant test, replied, and resolved the thread.
  • The LRU nit was valid. The cache test now uses three URLs and a four-byte budget, refreshes the first entry's recency, forces eviction with the third, and proves the second—not the first—was fetched again.

Focused follow-up run: 4 passed, 0 failed.

@Quick104
Quick104 merged commit 779c692 into main Aug 10, 2026
1 check passed
@Quick104
Quick104 deleted the codex/playback-v3-neutral-apple branch August 10, 2026 22:14
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.

Audiobooks fall back to server remux: bare audio containers missing from v3 capability snapshot

1 participant