Repository navigation
Client playback UX redesign: detail, Remote Control, now-playing shelf - #12
Conversation
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
FileVersion gained an optional `edition` field (it had none); PlaybackEditions groups versions by it, defaulting unlabeled versions to "Standard". Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…lector row Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…cks change Fixes a bug where changing Audio/Subtitles (without changing Version) on series/season dropped the selection because the play route fell back to .player without track indices. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…row) Co-Authored-By: Claude Opus 4.8 <[email protected]>
- Add edition, audio, and subtitle formatting for detail screens - Carry selected tracks into phone and tvOS playback - Decode server edition and preferred audio metadata
Native "now-playing" redesign of the iOS cast/remote UI (artwork-forward screen, consolidated control row, searching-state picker). iOS view layer only — wire protocol and tvOS receiver unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Task-by-task plan: split SiloCastViews.swift into focused files, add a client-side artwork resolver, native now-playing remote, searching-state picker, restyled control-mode button. iOS view layer only. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…controls) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…out SiloCastViews
Lands the previously-uncommitted cast feature as a baseline: shared SiloCastProtocol/Session, iOS SiloCastController/Browser/UI, tvOS TVCastReceiver/standby, and the Home/Detail/Player/TabView integration. Includes the improvement plan in docs/superpowers/plans/. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…order Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…e-advertise Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…e into controller Co-Authored-By: Claude Opus 4.8 <[email protected]>
…lume row, next-episode Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
fix(tvos): refine Skyline home navigation and rows
Plan 001 of the iOS 26 Liquid Glass migration. Lets the iOS path adopt glass/tab-bar/scroll-edge APIs unconditionally; macOS stays 15.0 (shared views keep their macOS 26 fallback via the centralized helper). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Plan 002. One design-system primitive (DesignSystem/SiloGlass.swift) owns the iOS-unconditional / macOS-26-guarded glass decision; migrates the two drifted glass sites (HomeView header, macOS VersionGlassCard), the now-playing .card chrome, and the AuroraGlassPanel base onto it. iOS + macOS builds green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…n-scroll) Plan 003. iOS TabView migrates to the value-based Tab API (tvOS stays text-only .tabItem, since value-based Tab requires an icon there); deletes the dead iOS-18 now-playing fallback; the cast/audio mini-bars condense in the .inline tabViewBottomAccessory placement; tab bar minimizes on scroll. iOS + tvOS builds green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…nEffect Plan 004. Applies .backgroundExtensionEffect() to the phone detail backdrop image and drops the hard .clipped() so artwork bleeds under the status bar and screen edges; keeps the soft bottom fade for the editorial-column seam. Badges/overlays stay composited at the original frame. iOS build green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Plan 005. Adds a continuumScrollEdgeEffect() helper (no-op on tvOS) and adopts .scrollEdgeEffectStyle(.soft) on Home/Libraries-Recommended/Calendar, retiring the hand-rolled scroll-offset gradient scrims (and the now-dead onScrollOffsetChange plumbing). Routes the top-bar buttons and Browse/Calendar filter pills through .siloGlass. iOS + tvOS builds green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Plan 006. A single @namespace in MainTabView is shared via a \.zoomNamespace EnvironmentValues key to MediaCard/EpisodeThumbCard (matchedTransitionSource) and used at the item-detail destination (navigationTransition(.zoom)). The zoomTransitionSource helper no-ops on a nil namespace (tvOS/macOS/unset), so nil-contentId cards still push normally. Namespace never touches Route or router.path. iOS + tvOS builds green; additive only. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…guards macOS now matches iOS/tvOS at the 26 minimum, so iOS-26 APIs in shared files (siloGlass, continuumScrollEdgeEffect, backgroundExtensionEffect) no longer need macOS availability fallbacks — simplified to unconditional. Also fixes the macOS build of plan 003's tabViewBottomAccessoryPlacement read in AudioMiniPlayerView, which is valid at macOS 26. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Plan 007. Center transport + top-bar buttons become .buttonStyle(.glass)/ .glassProminent inside GlassEffectContainer clusters; intro-skip buttons go glass; the buffering chip and PlayerNoticeOverlay route through .siloGlass. Explicit white glyph foregrounds kept for bright-frame contrast. iOS + macOS builds green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Plan 008. Removes the opaque Color.black.opacity(0.85) backgrounds on the iOS path of PlayerSettingsSheet and ChapterSheet so the native iOS-26 glass sheet shows (tvOS keeps its opaque panels). TrackSelectionSheet's iOS path already had no forced background. Full system glass; .presentationDetents unchanged. iOS + macOS builds green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Plan 009. Adds siloPrimaryButton/siloSecondaryButton/siloTextButton view extensions that route to .glassProminent/.glass on iOS+macOS and keep the focus-reactive Continuum styles on tvOS; migrates 11 iOS-reachable call sites. Promotes the byte-identical GhostChipButtonStyle into one shared definition in ContinuumButtonStyles.swift. AuroraPrimaryButtonStyle kept. iOS+tvOS+macOS green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Plan 010. Drops the scroll-content-background-hidden + opaque page background + 6 per-section listRowBackground overrides so the native iOS-26 grouped-list glass shows. All navigation rows were already NavigationLinks; the switch- profile (action) and Server (router push) rows stay Buttons with chevrons. NOTE: brand-black-vs-glass is a visual decision left PENDING REVIEW with an inline revert comment. iOS + macOS builds green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Plan 011. Upgrades the four state-keyed symbol toggles (favorite heart, watchlist bookmark, the detail circle action, audio play/pause) from the flat iOS-17 .symbolEffect(.replace) to .replace.magic(fallback: .replace) so shared glyph parts animate. DownloadButton's progress ring kept (arrow.down.circle has no variable-draw layers). iOS + tvOS + macOS green. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…cast, and detail Player/CoreMedia: - audio-track selection: PlayerCore now exposes the audio-relative ordinal as srcId so the native route matches the loopback/server (0:a:%d) convention instead of picking the wrong track by container stream index - decode recovery: serialize the recovery state machine under decodeRecoveryLock (decide-under-lock, act-after-unlock; never held across the blocking flush); a rebuild now supersedes a pending burst resync - AudioOutput: guard userVolume/userMuted with stateLock; setVolume clears mute - volume/mute now persist across backend swaps (quality switch / loopback fallback) via canonical VM state re-applied on every install AVPlayer HLS loopback: - retired segments drop from the manifest (sliding window) so a backward seek re-anchors instead of fetching a .gone segment and 410ing; also fixes the O(n^2) retirement rescan and adds a bounded capacity-wait escape Cast: - RemotePlaybackClock: hold optimistic seeks, smooth backward interpolation, clamp paused position to duration; isPlaying(asOf:) is now injectable - SiloCastSession: route send() through the same FIFO as enqueue() - de-dup double-launch; heartbeat liveness resets only on .pong (half-open) Detail/UI: - unique per-card zoom-transition source id (fixes duplicate-item collisions) - siloPrimaryButton honors isLoading on iOS; ChapterSheet pinned to dark - subtitle "On" label + tvOS edition fallback parity - tvOS season-keyed focus so Play re-focuses on in-place season switch - fix SubtitleTrack.externalPath CodingKey (never decoded under convertFromSnakeCase, collapsing external-sub ids to "-1|") Cleanup/tests: - remove dead PhoneVersionFormatting / PhoneVersionSheet / pill buttons; route formatHMS/formatCountdown through PlayerTimeFormatter - wire a SiloTests unit-test target; convert standalone tests to XCTest; fix the optimistic-clock test and add -8969 H.264 coverage Builds: iOS, tvOS, macOS all green; SiloTests 46/46 pass. Co-Authored-By: Claude Opus 4.8 <[email protected]>
… into ios26 glass migration + code-review fixes
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5feb2e43b7
ℹ️ 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 .hello(let hello): | ||
| guard let serverId = hello.serverId, !serverId.isEmpty, | ||
| let activeServerId = ServerRegistry.shared.activeServerId, | ||
| serverId == activeServerId else { | ||
| sendError(code: "server_mismatch", | ||
| message: "This Apple TV is connected to a different Silo server.") | ||
| closeActiveSession(sendClose: true) | ||
| return | ||
| } | ||
| isAuthorized = true |
There was a problem hiding this comment.
Require real authentication before authorizing controls
Any device on the same network can become authorized by echoing the server ID from the Bonjour TXT record (TVCastReceiver.swift:49-54); that identifier is publicly advertised, and every installation also uses the same hard-coded TLS PSK in SiloCastSession.swift. An unauthenticated LAN peer can therefore pass this check and issue launch, seek, stop, and track-selection commands. Require a per-account or paired-device credential before setting isAuthorized.
Useful? React with 👍 / 👎.
| case .ready: | ||
| Task { await self.beginLoops() } |
There was a problem hiding this comment.
Start the connection loops only once
When an NWConnection recovers from a transient .waiting state, its state handler can report .ready again, causing beginLoops() to create another receive chain and another consumer of the outbound AsyncStream. The two drain tasks can then perform concurrent writes and violate the FIFO ordering that SiloCastSession promises. Guard the ready transition so the receive and drain loops are started only once per session.
Useful? React with 👍 / 👎.
| Button { | ||
| controller.togglePlayPauseOptimistic() |
There was a problem hiding this comment.
Keep the mini-bar controls as sibling buttons
The play/pause button is nested inside the button whose action opens the full remote. Nested SwiftUI buttons do not provide independent control semantics, so tapping or activating play/pause can also trigger the containing button or produce an incorrect accessibility hierarchy. Structure this like AudioMiniPlayerView, with separate sibling buttons for opening the remote and controlling playback.
Useful? React with 👍 / 👎.
| func send(_ message: SiloCastMessage) async throws { | ||
| guard isOpen else { throw SessionError.closed } | ||
| try await withCheckedThrowingContinuation { (cont: CheckedContinuation<Void, Error>) in | ||
| outboundContinuation.yield(OutboundItem(message: message, completion: cont)) | ||
| } |
There was a problem hiding this comment.
Resume queued sends when setup fails before ready
When TCP/TLS setup fails before the connection ever reaches .ready, no drain task has been started, so finishing outboundContinuation in teardown leaves the checked continuation queued here permanently unresumed. Both controller and receiver await their initial hello through send, causing connection attempts to hang indefinitely instead of reporting the failure. Start a drain before setup or explicitly fail buffered send completions during teardown.
Useful? React with 👍 / 👎.
| if nextUpEpisode != nil, let effectiveNextUpVersion { | ||
| PhonePlaybackSelectorRow( | ||
| versions: nextUpVersions, | ||
| currentVersion: effectiveNextUpVersion, |
There was a problem hiding this comment.
Preserve episode-file fallback selectors
When the next-up watch-detail request fails or returns no versions but nextUpEpisode.files contains multiple playable files, effectiveNextUpVersion is nil and this removes the version selector entirely. The previous implementation explicitly built fallback rows from EpisodeFile, and the playback path still supports those file IDs, so users now lose the ability to choose an available version during that recoverable metadata failure. Preserve the episode-file fallback in the new selector model; the same regression exists in the season and tvOS next-up views.
Useful? React with 👍 / 👎.
| self.isReconnecting = false | ||
| self.errorMessage = reason | ||
| self.clearSession() |
There was a problem hiding this comment.
Keep the final reconnect error visible
After all reconnect attempts fail, the error is assigned and then clearSession() immediately sets isShowingRemoteControl to false and removes the active-session shelf, leaving no UI that can display errorMessage. A user watching the reconnect screen therefore gets abruptly returned to the app with no explanation. Preserve an error presentation state, or clear the session without dismissing the remote until the user acknowledges the failure.
Useful? React with 👍 / 👎.
| func setOptimisticPlaying(_ playing: Bool, asOf now: Date = Date()) { | ||
| optimisticPlaying = playing | ||
| optimisticPlayingDate = now | ||
| // Re-anchor so interpolation reflects the new direction immediately. | ||
| anchorTime = displayTime(asOf: now) | ||
| anchorDate = now |
There was a problem hiding this comment.
Capture the playhead before changing optimistic state
When resuming after the TV has been paused for a while, this sets the optimistic state to playing before reading displayTime, so interpolation includes the entire paused interval since anchorDate and can jump the remote playhead all the way to the duration limit until the next TV snapshot arrives. Pausing similarly re-anchors to the previous snapshot rather than the current interpolated position. Capture displayTime(asOf:) before assigning optimisticPlaying, then apply that captured value as the new anchor.
Useful? React with 👍 / 👎.
| listener.stateUpdateHandler = { state in | ||
| if case .failed(let error) = state { | ||
| Self.logger.error("cast listener failed: \(String(describing: error), privacy: .public)") | ||
| } |
There was a problem hiding this comment.
Recover the cast listener after a terminal failure
If the NWListener enters .failed because of a transient local-network or Bonjour error, this handler only logs it and leaves the failed listener stored in self.listener. Remote Control then remains undiscoverable for the rest of the authenticated view's lifetime, and a later start for the same server returns early because listener != nil. Clear and recreate the listener, with bounded retry/backoff, when the failed state is reported.
Useful? React with 👍 / 👎.
|
|
||
| do { | ||
| let detail = try await ContinuumAPI.shared.itemDetail(contentId: contentId) | ||
| try Task.checkCancellation() | ||
| apply(detail, contentId: contentId) | ||
| } catch { | ||
| // Degrade silently: the remote simply shows the flat background. |
There was a problem hiding this comment.
Clear stale artwork when resolving a new item
When playback changes to a new content ID whose detail request fails, the resolver leaves the previous item's posterURL, backdropURL, and resolvedContentId intact because the error path does nothing. The remote and mini-bar can therefore display the prior movie or episode's artwork indefinitely while showing the new title. Clear the old URLs when beginning a different content ID, or at least clear them when that resolution attempt fails.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 11
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
iosApp/iosApp/tvOS/Screens/Detail/TVSeasonDetailView.swift (1)
195-206:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse shared auto-version selection for next-up version resolution.
At Line 195, falling back to
versions.firstcan disagree with playback’s actual auto-pick (best-ranked version), so the selector row can display version/audio/subtitle metadata for the wrong file.Suggested fix
- private var effectiveNextUpVersion: FileVersion? { - let versions = nextUpPlaybackDetail?.versions ?? [] - if let selectedNextUpFileId, - let selected = versions.first(where: { $0.fileId == selectedNextUpFileId }) { - return selected - } - if let lastFileId = nextUpPlaybackDetail?.userData?.lastFileId, - let lastVersion = versions.first(where: { $0.fileId == lastFileId }) { - return lastVersion - } - return versions.first - } + private var effectiveNextUpVersion: FileVersion? { + DetailVersionSelection.displayVersion( + versions: nextUpVersions, + selectedFileId: selectedNextUpFileId, + lastFileId: nextUpPlaybackDetail?.userData?.lastFileId + ) + }🤖 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/tvOS/Screens/Detail/TVSeasonDetailView.swift` around lines 195 - 206, The effectiveNextUpVersion computed property uses versions.first as a fallback when no selected or last version is found, but this does not match the actual best-ranked version selection logic used by the playback system. Replace the return versions.first statement with a call to a shared auto-version selection method or function that matches what the playback system uses to determine the best-ranked version, ensuring the selector displays metadata consistent with what will actually be played.iosApp/iosApp/tvOS/Navigation/TVTopMenuBar.swift (1)
410-436:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDon’t capture Menu when no handler can run.
At Line 414, capture is enabled for
isFocusedAwayFromHomeeven whenonExitisnil. In that state, Lines 426-428 executeonExit?()(no-op), so the recognizer consumes Menu and nothing happens.Suggested fix
private var shouldCaptureExitPress: Bool { - !isFocusSuppressed - && focusedItem != nil - && !panelHasFocus - && (openPanel != nil || isFocusedAwayFromHome || onExit != nil) + guard !isFocusSuppressed, focusedItem != nil, !panelHasFocus else { return false } + if openPanel != nil || onExit != nil { return true } + // Only capture for local "re-pin to Home tab" behavior. + return selectedRoot == .home && isFocusedAwayFromHome } private func handleExitPress() { if openPanel != nil { onDwell(nil) return } - if isFocusedAwayFromHome { - if selectedRoot == .home { - focusedItem = .root(.home) - isMenuFocused = true - } else { - onExit?() - } - return - } + if isFocusedAwayFromHome, selectedRoot == .home { + focusedItem = .root(.home) + isMenuFocused = true + return + } onExit?() }🤖 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/tvOS/Navigation/TVTopMenuBar.swift` around lines 410 - 436, The `shouldCaptureExitPress` computed property captures the Menu button when `isFocusedAwayFromHome` is true, but this can occur when `onExit` is nil, causing the menu press to be consumed without any meaningful action (the `onExit?.()` call at line 426-428 becomes a no-op). Modify the capture condition to ensure that when `isFocusedAwayFromHome` is true, the Menu is only captured if we can perform a meaningful action: either `selectedRoot == .home` (which allows refocusing in `handleExitPress`) or `onExit` is not nil. Update the logic in the compound condition at line 414 to restrict capture in this scenario.
🟡 Minor comments (12)
docs/superpowers/plans/2026-06-15-tvos-detail-redesign.md-31-33 (1)
31-33:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd a language identifier to this fenced code block.
Line 31 opens a fenced block without a language, which triggers MD040 in markdownlint.
Suggested fix
-``` +```text Co-Authored-By: Claude Opus 4.8 <[email protected]></details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.In
@docs/superpowers/plans/2026-06-15-tvos-detail-redesign.mdaround lines 31 -
33, The fenced code block in the file does not have a language identifier
specified after the opening triple backticks, which violates the MD040
markdownlint rule. Add a language identifier such as "text" immediately after
the opening triple backticks on line 31 to resolve this linting error and make
the code block compliant with markdownlint standards.</details> <!-- cr-comment:v1:2c7887118fd5402c24d8cc4b --> _Source: Linters/SAST tools_ </blockquote></details> <details> <summary>iosApp/iosApp/Screens/Detail/DetailPlaybackFormatting.swift-22-29 (1)</summary><blockquote> `22-29`: _⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Avoid labeling a concrete version as `"Auto"` when metadata is sparse.** At Line 28, a non-`nil` version with missing resolution/HDR currently returns `"Auto"`, which collides with the real auto-selection state and can mislabel explicit selections. <details> <summary>Proposed fix</summary> ```diff static func versionShortLabel(_ version: FileVersion?) -> String { guard let version else { return "Auto" } let tokens = [ nonEmpty(version.resolution)?.uppercased(), version.hdr == true ? "HDR" : nil, ].compactMap { $0 } - return tokens.isEmpty ? "Auto" : tokens.joined(separator: " · ") + if !tokens.isEmpty { + return tokens.joined(separator: " · ") + } + if let fileName = normalizedFileName(version.fileName) { + return fileName + } + return "Version \(version.fileId)" }🤖 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/Detail/DetailPlaybackFormatting.swift` around lines 22 - 29, The versionShortLabel function currently returns "Auto" both when version is nil (true auto-selection) and when version is non-nil but has no resolution or HDR metadata (sparse concrete version), creating ambiguity. Fix this by providing a different fallback label when the tokens array is empty for a non-nil version, such as "Unknown" or another identifier, to distinguish explicit versions with sparse metadata from actual auto-selection. Only return "Auto" when the input version parameter itself is nil.iosApp/iosApp/Screens/Detail/DetailPlaybackFormatting.swift-234-254 (1)
234-254:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAlign codec alias normalization with player-side canonicalization.
The alias mapping here misses several tokens used by player normalization (e.g.,
hvc1/hev1,avc1,h.264,h.265,mp4a,ec3,mlp/mlpa), which can produce inconsistent labels between detail UI and playback surfaces.Proposed fix
static func normalizedVideoCodec(_ codec: String?) -> String? { guard let codec = codec?.lowercased(), !codec.isEmpty else { return nil } - if codec.contains("hevc") || codec.contains("h265") { return "HEVC" } + if ["hevc", "h265", "h.265", "hvc1", "hev1"].contains(where: codec.contains) { return "HEVC" } if codec.contains("av1") { return "AV1" } - if codec.contains("avc") || codec.contains("h264") { return "H.264" } + if ["avc", "avc1", "h264", "h.264"].contains(where: codec.contains) { return "H.264" } return codec.uppercased() } static func normalizedAudioCodec(_ codec: String?) -> String? { guard let codec = codec?.lowercased(), !codec.isEmpty else { return nil } - if codec.contains("eac3") || codec.contains("e-ac-3") || codec.contains("ec-3") { + if ["eac3", "e-ac-3", "ec-3", "ec3"].contains(where: codec.contains) { return "EAC3" } if codec.contains("ac3") || codec.contains("ac-3") { return "AC3" } - if codec.contains("aac") { return "AAC" } + if codec.contains("aac") || codec.contains("mp4a") { return "AAC" } if codec.contains("mp3") { return "MP3" } - if codec.contains("truehd") { return "TrueHD" } + if ["truehd", "true-hd", "dolbytruehd", "mlp", "mlpa"].contains(where: codec.contains) { return "TrueHD" } if codec.contains("dts") { return "DTS" } if codec.contains("flac") { return "FLAC" } return codec.uppercased() }🤖 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/Detail/DetailPlaybackFormatting.swift` around lines 234 - 254, The normalizedVideoCodec and normalizedAudioCodec functions are missing several codec token aliases used by the player-side canonicalization logic, causing codec label inconsistencies between the detail UI and playback surfaces. Add additional contains checks in both functions to handle the missing video codec variants (hvc1, hev1, avc1, h.264, h.265) and audio codec variants (mp4a, ec3, mlp, mlpa) by inserting them into the appropriate conditional statements before the final fallback return statement.iosApp/iosApp/tvOS/Screens/Detail/TVMovieDetailView.swift-81-94 (1)
81-94:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMissing
preferredQualityIdparameter indisplayVersioncall.The
DetailVersionSelection.displayVersioncall at lines 83-87 omits thepreferredQualityIdparameter, unlike other usages in this PR (e.g.,MovieDetailContent,SeasonDetailContent,TVItemDetailView) that passPlayerSettings.shared.preferredQuality. This inconsistency could cause different default version selection behavior on this screen.Suggested fix
TVPlaybackSelectorRow( versions: availableVersions, currentVersion: DetailVersionSelection.displayVersion( versions: availableVersions, selectedFileId: selectedVersionFileId, - lastFileId: detail.userData?.lastFileId + lastFileId: detail.userData?.lastFileId, + preferredQualityId: PlayerSettings.shared.preferredQuality ), selectedVersionFileId: selectedVersionFileId,🤖 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/tvOS/Screens/Detail/TVMovieDetailView.swift` around lines 81 - 94, The DetailVersionSelection.displayVersion call within the TVPlaybackSelectorRow initialization is missing the preferredQualityId parameter that should be passed for consistent version selection behavior. Add the preferredQualityId parameter to the displayVersion function call and pass PlayerSettings.shared.preferredQuality as its value, matching the pattern used in other similar screens like MovieDetailContent and SeasonDetailContent.iosApp/iosApp/Components/MediaRow.swift-83-89 (1)
83-89:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid double-firing
onItemFocusfor one focus request.At Line 88,
onItemFocus?(firstItem)is invoked immediately after Line 87 setsfocusedItemId, but Lines 74-78 already emitonItemFocusonfocusedItemIdchanges. This causes duplicate callbacks for a single request whenever focus actually changes.Suggested fix
private func applyFocusRequest(_ request: Int) { guard request > 0, request != lastAppliedFocusRequest, let firstItem = items.first else { return } lastAppliedFocusRequest = request - focusedItemId = firstItem.contentId - onItemFocus?(firstItem) + if focusedItemId != firstItem.contentId { + focusedItemId = firstItem.contentId + } else { + // Keep explicit reporting when focus is already on first item. + onItemFocus?(firstItem) + } }🤖 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/Components/MediaRow.swift` around lines 83 - 89, The onItemFocus callback is being fired twice for a single focus request: once explicitly in the applyFocusRequest method and once through the property observer on focusedItemId that fires between lines 74-78. Remove the explicit onItemFocus?(firstItem) call from the applyFocusRequest method since setting focusedItemId will automatically trigger the existing property observer that already handles invoking the onItemFocus callback.iosApp/iosApp/Cast/iOS/SiloCastBrowser.swift-31-45 (1)
31-45:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIgnore stale
NWBrowsercallbacks afterstop()/restart to prevent list repopulation glitches.A canceled browser can still deliver a late result callback; current code unconditionally overwrites
found, which can resurface stale targets afterstop().Suggested guard
- browser.browseResultsChangedHandler = { [weak self] results, _ in + browser.browseResultsChangedHandler = { [weak self, weak browser] results, _ in Task { `@MainActor` in guard let self else { return } + guard let browser, self.browser === browser else { return } let activeServerId = ServerRegistry.shared.activeServerId self.found = results .compactMap { Self.makeTarget($0) }Also applies to: 48-52
🤖 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/Cast/iOS/SiloCastBrowser.swift` around lines 31 - 45, The browseResultsChangedHandler can receive late callbacks even after the browser has been stopped, causing stale targets to overwrite the found list. Add a guard condition within the browseResultsChangedHandler closure to verify that the browser is still running or active before updating self.found with the results. This prevents stale callbacks from a stopped or restarted browser from populating the list with outdated targets. Check the browser's running state or track its active status to conditionally proceed with updating self.found only when the browser is actually active.docs/superpowers/plans/2026-06-16-ios-tvos-cast-remote-improvements.md-1137-1138 (1)
1137-1138:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDo not instruct committing
iosApp/Silo.xcodeprojin the plan.This step conflicts with the project’s generated-Xcode workflow and will create churn/merge noise for generated artifacts.
Suggested docs fix
-git add iosApp/iosApp/Cast/iOS/SiloCastMiniBar.swift iosApp/iosApp/ContentView.swift iosApp/project.yml iosApp/Silo.xcodeproj +git add iosApp/iosApp/Cast/iOS/SiloCastMiniBar.swift iosApp/iosApp/ContentView.swift iosApp/project.ymlAs per coding guidelines, "Generated Xcode structure must be controlled by
iosApp/project.ymland regenerated withxcodegen generateafter target or source layout changes" and "updateproject.ymlinstead of hand-editing generated.xcodeprojfiles."🤖 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 `@docs/superpowers/plans/2026-06-16-ios-tvos-cast-remote-improvements.md` around lines 1137 - 1138, The git commit instruction in the plan includes the generated Xcode project file iosApp/Silo.xcodeproj which should not be committed. Remove iosApp/Silo.xcodeproj from the git add command, keeping only the source files SiloCastMiniBar.swift, ContentView.swift, and project.yml. If any Xcode project structure changes are needed, update iosApp/project.yml instead and document running xcodegen generate to regenerate the .xcodeproj file.Source: Coding guidelines
iosApp/iosApp/Screens/Detail/ItemDetailView.swift-267-269 (1)
267-269:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUse the same resume-position sanitization in the series path.
Line 267 currently uses raw
positionSeconds, while the season/movie flows useplayableResumePosition(...). This can resume from near-end timestamps and produce incorrect playback start behavior.🎯 Suggested fix
- let resumePosition = startFromBeginning - ? nil - : viewModel.episodes.first(where: { $0.contentId == id })?.userData?.positionSeconds + let episode = viewModel.episodes.first(where: { $0.contentId == id }) + let resumePosition = startFromBeginning + ? nil + : playableResumePosition( + position: episode?.userData?.positionSeconds, + duration: episode?.userData?.durationSeconds + )🤖 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/Detail/ItemDetailView.swift` around lines 267 - 269, The resume position logic in the series path is inconsistent with the season/movie flows. In the code where resumePosition is assigned (lines 267-269), replace the direct access to userData?.positionSeconds with the playableResumePosition(...) function that is used in the season/movie flows. This ensures that all resume position values are properly sanitized and validated before being used for playback, preventing incorrect behavior from near-end timestamps.docs/superpowers/specs/2026-06-16-now-playing-shelf-design.md-60-66 (1)
60-66:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd a language identifier to the fenced code block.
This snippet triggers markdownlint MD040 (
fenced-code-language), which can break docs lint in CI.Suggested patch
-``` +```swift if `#available`(iOS 26, *) { content.tabViewBottomAccessory { NowPlayingShelf(...) } // when active } else { content.safeAreaInset(edge: .bottom, spacing: 0) { NowPlayingShelf(...) } }</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.In
@docs/superpowers/specs/2026-06-16-now-playing-shelf-design.mdaround lines
60 - 66, The fenced code block containing the#available(iOS 26, *) check is
missing a language identifier, which violates markdownlint rule MD040. Add
"swift" immediately after the opening triple backticks () to specify the code block language, so it readsswift instead of just ```.</details> <!-- cr-comment:v1:3088c043bfb14df1c0ea85bd --> _Source: Linters/SAST tools_ </blockquote></details> <details> <summary>iosApp/iosApp/Cast/iOS/SiloCastArtwork.swift-14-34 (1)</summary><blockquote> `14-34`: _⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Clear stale artwork when resolving a new `contentId` fails.** On API error, previous artwork can remain visible even though this path intends to fall back to a flat background. <details> <summary>Suggested patch</summary> ```diff func resolve(contentId: String?) async { guard let contentId, !contentId.isEmpty else { posterURL = nil backdropURL = nil resolvedContentId = nil return } guard contentId != resolvedContentId else { return } + // Prevent showing stale artwork while resolving a new item. + posterURL = nil + backdropURL = nil if let cached: ItemDetail = ResponseCache.shared.get(CacheKey.itemDetail(contentId)) { apply(cached, contentId: contentId) return } do { let detail = try await ContinuumAPI.shared.itemDetail(contentId: contentId) try Task.checkCancellation() apply(detail, contentId: contentId) } catch { // Degrade silently: the remote simply shows the flat background. + posterURL = nil + backdropURL = nil } } ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary> ``` 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/Cast/iOS/SiloCastArtwork.swift` around lines 14 - 34, When the API call to fetch item details fails in the resolve method, the previous artwork (posterURL and backdropURL) remains visible instead of being cleared to show the flat background. In the catch block that handles the error from ContinuumAPI.shared.itemDetail, add code to clear posterURL, backdropURL, and resolvedContentId to nil, ensuring stale artwork is not displayed when the API request fails. ``` </details> <!-- cr-comment:v1:5cd343bec4d66320a969ca5b --> </blockquote></details> <details> <summary>iosApp/Tests/SiloCastTests.swift-4-6 (1)</summary><blockquote> `4-6`: _⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Remove the outdated “no test target wired” note.** Lines 4-6 now conflict with `iosApp/project.yml`, which adds and wires `SiloTests`; keeping this comment will mislead future contributors. <details> <summary>🤖 Prompt for AI Agents</summary> ``` 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/SiloCastTests.swift` around lines 4 - 6, The NOTE comment block at lines 4-6 in SiloCastTests.swift is now outdated and contradicts the current project configuration. Since iosApp/project.yml has already added and wired the SiloTests target, this comment will mislead future contributors. Remove the entire three-line comment block that starts with "NOTE: This project has no unit-test target wired into project.yml yet". ``` </details> <!-- cr-comment:v1:540ef147fcf1f0879322828d --> </blockquote></details> <details> <summary>iosApp/iosApp/Cast/iOS/SiloCastTargetPickerView.swift-65-72 (1)</summary><blockquote> `65-72`: _⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_ **Only dismiss after a successful connect/cast.** Line 71 dismisses the picker unconditionally, so failed attempts still close the sheet and force users to reopen it before retrying. <details> <summary>Proposed fix</summary> ```diff Button { Task { + let didSucceed: Bool if let request { await controller.cast(to: target, request: request) + didSucceed = controller.hasActiveSession } else { - await controller.connect(to: target) + didSucceed = await controller.connect(to: target) } - dismiss() + if didSucceed { + dismiss() + } } } label: { ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary> ``` 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/Cast/iOS/SiloCastTargetPickerView.swift` around lines 65 - 72, The dismiss() call in the Task block is being executed unconditionally regardless of whether the cast or connect operation succeeds. Modify the code so that dismiss() is only called after a successful operation. Check the return value or result of the await controller.cast(to:request:) and await controller.connect(to:) calls, and only invoke dismiss() if those operations complete successfully, ensuring that failed connection or cast attempts keep the picker open so users can retry without reopening the sheet. ``` </details> <!-- cr-comment:v1:f2d0f1e8c6de8c7b228ad6c0 --> </blockquote></details> </blockquote></details> <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>iosApp/iosApp/Cast/SiloCastProtocol.swift (1)</summary><blockquote> `229-250`: _⚡ Quick win_ **Protocol version is not validated during decoding.** The encoder writes `SiloCastProtocol.version` to the `"v"` key, but the decoder ignores it. If a future protocol revision changes the wire format, the receiver will attempt to decode incompatible payloads without any version guard. Consider validating the version during decode and throwing or logging when it doesn't match `SiloCastProtocol.version`. <details> <summary>🛡️ Proposed validation</summary> ```diff init(from decoder: Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) + let wireVersion = try c.decodeIfPresent(Int.self, forKey: .v) ?? 1 + guard wireVersion == SiloCastProtocol.version else { + throw DecodingError.dataCorruptedError( + forKey: .v, + in: c, + debugDescription: "Unsupported protocol version \(wireVersion); expected \(SiloCastProtocol.version)" + ) + } let kind = try c.decode(Kind.self, forKey: .type) ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary> ``` 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/Cast/SiloCastProtocol.swift` around lines 229 - 250, In the init(from decoder: Decoder) method of the SiloCastProtocol type, add version validation after decoding the Kind. Decode the version value from the keyed container using the appropriate CodingKey for the "v" key, then compare it against SiloCastProtocol.version. If the versions do not match, throw a DecodingError to prevent decoding incompatible payloads from future protocol revisions. This validation should occur before the switch statement that handles different message kinds. ``` </details> <!-- cr-comment:v1:95a172d9d899b02f2e2e0b7c --> </blockquote></details> </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary>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@docs/superpowers/plans/2026-06-16-ios-tvos-cast-remote-improvements.md:
- Around line 15-17: The Cast-channel security approach in the plan has an
authorization boundary gap that poses a release risk: the static TLS-PSK with
only serverId-based gating allows any LAN device running the app to control a TV
on the same server, which is insufficient for a released product. Revise the
"Cast-channel security (#12)" bullet point to either include proper per-device
authorization (such as pairing-key exchange) as a pre-release requirement in
this phase, or explicitly document this as a known security limitation that
blocks release until Phase G completes the threat model and implements per-pair
authentication. Ensure the plan clearly states what authorization work is
required before the remote-control feature can be shipped to users.In
@docs/superpowers/plans/2026-06-16-now-playing-shelf.md:
- Line 418: Remove the plaintext credentials (admin / water1234) from line 418
in the now-playing-shelf.md documentation file. Keep the technical instructions
about finding the bundle ID using grep and PRODUCT_BUNDLE_IDENTIFIER, but
replace the exposed username/password pair with a reference directing readers to
securely obtain credentials from the SiloTV simulator-debugging memory instead
of including them inline in the versioned documentation.In
@docs/tvos-player/cast-remote.md:
- Around line 83-97: The cast control authentication is currently
unauthenticated due to the static pre-shared key in
SiloCastSession.tlsParameters(), allowing any LAN device to control any TV.
Implement proof-of-possession authentication by deriving a per-pair secret from
the companion-pairing trust mechanism (_silopair) and bind it into the cast
handshake, then gate both the.launchand.controloperations to only allow
authenticated/authorized sessions. Alternatively, hard-disable the cast remote
control feature outside of trusted/internal builds until the proper
authentication mechanism is implemented. Update the documentation to reflect
whichever approach is taken.In
@iosApp/iosApp/Cast/iOS/SiloCastMiniBar.swift:
- Around line 18-41: The outer Button wrapping the HStack contains a nested
Button for play/pause, which breaks gesture handling and accessibility
semantics. Replace the outer Button structure by removing the Button wrapper and
instead apply .onTapGesture to the HStack container to call
controller.showRemoteControl(), keeping the inner play/pause Button unchanged.
Then add .accessibilityAddTraits(.isButton) to the HStack to preserve
accessibility semantics and ensure both the outer remote control action and
inner play/pause button are properly exposed to VoiceOver.In
@iosApp/iosApp/Screens/Player/CoreMedia/PlayerCore.swift:
- Around line 1841-1843: The audioOutput.prepare() method resets the mixer
volume to 1.0, and while applyUserGain() is correctly called after the prepare()
call in the reloadAudioOutput() path (lines 1841-1843), there is another
invocation of audioOutput.prepare(audioFormat:) around line 3467 that also needs
the same user gain restoration. Locate the audioOutput.prepare(audioFormat:)
call near line 3467 (which handles new loads or audio-track switches) and add an
audioOutput.applyUserGain() call immediately after it to ensure user volume and
mute settings are preserved across all prepare paths.- Around line 3588-3592: When a rebuild supersedes the pending decode burst
resync, thependingDecodeBurstResyncflag is dropped in the conditionalif doRebuild { pendingDecodeBurstResync = false }block. However, this prevents
performDecodeBurstResync()from ever executing, which means the
isRecoveringDecodeBurstflag is never cleared. This causes the branch at Line
4203 to continue swallowing future-12909failures indefinitely. In addition
to droppingpendingDecodeBurstResync, also clear theisRecoveringDecodeBurst
flag in the sameif doRebuildconditional block to ensure the burst-recovery
state is properly cleaned up when the resync is skipped due to a rebuild.- Around line 4047-4048: The createDecompressionSession() call failure is only
being logged with a print statement but not actually handled, causing playback
to freeze silently when decoder rebuild fails. After the
createDecompressionSession() call assigns its result to ok, add a check for when
ok is false and invoke an appropriate error handler (such as onError callback)
to signal the failure and allow the player to take corrective action, rather
than only printing the status and continuing execution.- Around line 4176-4184: In the
.reportUnsupportedcase handler, the values
lastLoadHeadersandlastLoadStartTimeare being accessed inside the
DispatchQueue.main.async closure, which means they can be mutated by a new
load() call before the callback executes, resulting in mixed source context
being passed to onUnsupportedStream. Snapshot these values immediately when
handling the.reportUnsupportedcase (before the async dispatch) so the
callback receives the correct context for the actual failed load operation, not
values from a subsequent load.- Around line 409-421: The decode-recovery state group is now protected by the
decodeRecoveryLockas documented in the comment, but the reset operations at
lines 1177-1186 and lines 4747-4748 are still modifying the recovery state
members (consecutiveDecodeFailures, hasReportedDecodeFailure,
isRebuildingDecoder, decoderRebuildPending, decodeBurstRecoveryAttempts,
framesDecodedSinceRecovery, pendingDecodeBurstResync, isRecoveringDecodeBurst)
without holding this lock. Wrap the reset operations at both locations with the
decodeRecoveryLockusing the same locking pattern to prevent race conditions
where VT callbacks might interfere with these state resets during teardown or
dispose operations.In
@iosApp/iosApp/Screens/Player/PlayerViewModel.swift:
- Line 5448: In the PlayerViewModel.swift file, the assignment of liveContentId
on line 5448 currently prioritizes the optional contentId from lastLoadRequest
over the contentId method argument, which can result in stale item IDs being
used. Reverse the precedence by swapping the order of the nil-coalescing
operation so that the contentId argument is checked first, and only fall back to
lastLoadRequest?.contentId if the argument is unavailable. This ensures the
receiver-provided contentId is always preferred, maintaining the proper receiver
to state contract.In
@iosApp/scripts/strip-ffmpeg-framework-signatures.sh:
- Around line 1-30: The strip-ffmpeg-framework-signatures.sh script contains
valid logic for removing code signatures from FFmpeg frameworks during the iOS
build process, but it is not currently integrated into the Xcode build system.
Wire this script into the build process by adding it as a build phase in
iosApp/project.yml, following the same pattern used for the
prepare-macos-ffmpeg-frameworks.sh script. This will ensure the script executes
automatically during the iOS app build and the signature stripping logic is
actually invoked.
Outside diff comments:
In@iosApp/iosApp/tvOS/Navigation/TVTopMenuBar.swift:
- Around line 410-436: The
shouldCaptureExitPresscomputed property captures
the Menu button whenisFocusedAwayFromHomeis true, but this can occur when
onExitis nil, causing the menu press to be consumed without any meaningful
action (theonExit?.()call at line 426-428 becomes a no-op). Modify the
capture condition to ensure that whenisFocusedAwayFromHomeis true, the Menu
is only captured if we can perform a meaningful action: eitherselectedRoot == .home(which allows refocusing inhandleExitPress) oronExitis not nil.
Update the logic in the compound condition at line 414 to restrict capture in
this scenario.In
@iosApp/iosApp/tvOS/Screens/Detail/TVSeasonDetailView.swift:
- Around line 195-206: The effectiveNextUpVersion computed property uses
versions.first as a fallback when no selected or last version is found, but this
does not match the actual best-ranked version selection logic used by the
playback system. Replace the return versions.first statement with a call to a
shared auto-version selection method or function that matches what the playback
system uses to determine the best-ranked version, ensuring the selector displays
metadata consistent with what will actually be played.
Minor comments:
In@docs/superpowers/plans/2026-06-15-tvos-detail-redesign.md:
- Around line 31-33: The fenced code block in the file does not have a language
identifier specified after the opening triple backticks, which violates the
MD040 markdownlint rule. Add a language identifier such as "text" immediately
after the opening triple backticks on line 31 to resolve this linting error and
make the code block compliant with markdownlint standards.In
@docs/superpowers/plans/2026-06-16-ios-tvos-cast-remote-improvements.md:
- Around line 1137-1138: The git commit instruction in the plan includes the
generated Xcode project file iosApp/Silo.xcodeproj which should not be
committed. Remove iosApp/Silo.xcodeproj from the git add command, keeping only
the source files SiloCastMiniBar.swift, ContentView.swift, and project.yml. If
any Xcode project structure changes are needed, update iosApp/project.yml
instead and document running xcodegen generate to regenerate the .xcodeproj
file.In
@docs/superpowers/specs/2026-06-16-now-playing-shelf-design.md:
- Around line 60-66: The fenced code block containing the
#available(iOS 26, *)
check is missing a language identifier, which violates markdownlint rule MD040.
Add "swift" immediately after the opening triple backticks () to specify the code block language, so it readsswift instead of just ```.In
@iosApp/iosApp/Cast/iOS/SiloCastArtwork.swift:
- Around line 14-34: When the API call to fetch item details fails in the
resolve method, the previous artwork (posterURL and backdropURL) remains visible
instead of being cleared to show the flat background. In the catch block that
handles the error from ContinuumAPI.shared.itemDetail, add code to clear
posterURL, backdropURL, and resolvedContentId to nil, ensuring stale artwork is
not displayed when the API request fails.In
@iosApp/iosApp/Cast/iOS/SiloCastBrowser.swift:
- Around line 31-45: The browseResultsChangedHandler can receive late callbacks
even after the browser has been stopped, causing stale targets to overwrite the
found list. Add a guard condition within the browseResultsChangedHandler closure
to verify that the browser is still running or active before updating self.found
with the results. This prevents stale callbacks from a stopped or restarted
browser from populating the list with outdated targets. Check the browser's
running state or track its active status to conditionally proceed with updating
self.found only when the browser is actually active.In
@iosApp/iosApp/Cast/iOS/SiloCastTargetPickerView.swift:
- Around line 65-72: The dismiss() call in the Task block is being executed
unconditionally regardless of whether the cast or connect operation succeeds.
Modify the code so that dismiss() is only called after a successful operation.
Check the return value or result of the await controller.cast(to:request:) and
await controller.connect(to:) calls, and only invoke dismiss() if those
operations complete successfully, ensuring that failed connection or cast
attempts keep the picker open so users can retry without reopening the sheet.In
@iosApp/iosApp/Components/MediaRow.swift:
- Around line 83-89: The onItemFocus callback is being fired twice for a single
focus request: once explicitly in the applyFocusRequest method and once through
the property observer on focusedItemId that fires between lines 74-78. Remove
the explicit onItemFocus?(firstItem) call from the applyFocusRequest method
since setting focusedItemId will automatically trigger the existing property
observer that already handles invoking the onItemFocus callback.In
@iosApp/iosApp/Screens/Detail/DetailPlaybackFormatting.swift:
- Around line 22-29: The versionShortLabel function currently returns "Auto"
both when version is nil (true auto-selection) and when version is non-nil but
has no resolution or HDR metadata (sparse concrete version), creating ambiguity.
Fix this by providing a different fallback label when the tokens array is empty
for a non-nil version, such as "Unknown" or another identifier, to distinguish
explicit versions with sparse metadata from actual auto-selection. Only return
"Auto" when the input version parameter itself is nil.- Around line 234-254: The normalizedVideoCodec and normalizedAudioCodec
functions are missing several codec token aliases used by the player-side
canonicalization logic, causing codec label inconsistencies between the detail
UI and playback surfaces. Add additional contains checks in both functions to
handle the missing video codec variants (hvc1, hev1, avc1, h.264, h.265) and
audio codec variants (mp4a, ec3, mlp, mlpa) by inserting them into the
appropriate conditional statements before the final fallback return statement.In
@iosApp/iosApp/Screens/Detail/ItemDetailView.swift:
- Around line 267-269: The resume position logic in the series path is
inconsistent with the season/movie flows. In the code where resumePosition is
assigned (lines 267-269), replace the direct access to userData?.positionSeconds
with the playableResumePosition(...) function that is used in the season/movie
flows. This ensures that all resume position values are properly sanitized and
validated before being used for playback, preventing incorrect behavior from
near-end timestamps.In
@iosApp/iosApp/tvOS/Screens/Detail/TVMovieDetailView.swift:
- Around line 81-94: The DetailVersionSelection.displayVersion call within the
TVPlaybackSelectorRow initialization is missing the preferredQualityId parameter
that should be passed for consistent version selection behavior. Add the
preferredQualityId parameter to the displayVersion function call and pass
PlayerSettings.shared.preferredQuality as its value, matching the pattern used
in other similar screens like MovieDetailContent and SeasonDetailContent.In
@iosApp/Tests/SiloCastTests.swift:
- Around line 4-6: The NOTE comment block at lines 4-6 in SiloCastTests.swift is
now outdated and contradicts the current project configuration. Since
iosApp/project.yml has already added and wired the SiloTests target, this
comment will mislead future contributors. Remove the entire three-line comment
block that starts with "NOTE: This project has no unit-test target wired into
project.yml yet".
Nitpick comments:
In@iosApp/iosApp/Cast/SiloCastProtocol.swift:
- Around line 229-250: In the init(from decoder: Decoder) method of the
SiloCastProtocol type, add version validation after decoding the Kind. Decode
the version value from the keyed container using the appropriate CodingKey for
the "v" key, then compare it against SiloCastProtocol.version. If the versions
do not match, throw a DecodingError to prevent decoding incompatible payloads
from future protocol revisions. This validation should occur before the switch
statement that handles different message kinds.</details> <details> <summary>🪄 Autofix (Beta)</summary> Fix all unresolved CodeRabbit comments on this PR: - [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended) - [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes </details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Organization UI **Review profile**: CHILL **Plan**: Pro Plus **Run ID**: `a3afa339-3023-4dab-9041-3ba710b2a831` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 4b36780eeb34abfcda021d8448d7058b1745f307 and 5feb2e43b7fb0a5c20184b2703ec11e51775b1bf. </details> <details> <summary>📒 Files selected for processing (103)</summary> * `docs/superpowers/plans/2026-06-15-tvos-detail-redesign.md` * `docs/superpowers/plans/2026-06-16-cast-ui-redesign.md` * `docs/superpowers/plans/2026-06-16-ios-tvos-cast-remote-improvements.md` * `docs/superpowers/plans/2026-06-16-now-playing-shelf.md` * `docs/superpowers/specs/2026-06-16-cast-ui-redesign-design.md` * `docs/superpowers/specs/2026-06-16-now-playing-shelf-design.md` * `docs/tvos-player/cast-remote.md` * `iosApp/Tests/CompanionDismissalKeyTests.swift` * `iosApp/Tests/DVSegmentStoreTests.swift` * `iosApp/Tests/DecodeFailureRecoveryPolicyTests.swift` * `iosApp/Tests/DetailVersionSelectionTests.swift` * `iosApp/Tests/LocalHLSPlaylistPolicyTests.swift` * `iosApp/Tests/LocalHLSRequestLogPolicyTests.swift` * `iosApp/Tests/PairingFrameTests.swift` * `iosApp/Tests/PairingProtocolTests.swift` * `iosApp/Tests/SiloCastTests.swift` * `iosApp/iosApp/Cast/SiloCastProtocol.swift` * `iosApp/iosApp/Cast/SiloCastSession.swift` * `iosApp/iosApp/Cast/iOS/NowPlayingBarStyle.swift` * `iosApp/iosApp/Cast/iOS/NowPlayingShelf.swift` * `iosApp/iosApp/Cast/iOS/RemotePlaybackClock.swift` * `iosApp/iosApp/Cast/iOS/SiloCastArtwork.swift` * `iosApp/iosApp/Cast/iOS/SiloCastBrowser.swift` * `iosApp/iosApp/Cast/iOS/SiloCastControlModeButton.swift` * `iosApp/iosApp/Cast/iOS/SiloCastController.swift` * `iosApp/iosApp/Cast/iOS/SiloCastMiniBar.swift` * `iosApp/iosApp/Cast/iOS/SiloCastRemoteControlView.swift` * `iosApp/iosApp/Cast/iOS/SiloCastTargetPickerView.swift` * `iosApp/iosApp/Cast/tvOS/TVCastReceiver.swift` * `iosApp/iosApp/Cast/tvOS/TVCastStandbyState.swift` * `iosApp/iosApp/Cast/tvOS/TVCastStandbyView.swift` * `iosApp/iosApp/Components/EpisodeThumbCard.swift` * `iosApp/iosApp/Components/ErrorView.swift` * `iosApp/iosApp/Components/FavoriteButton.swift` * `iosApp/iosApp/Components/MediaCard.swift` * `iosApp/iosApp/Components/MediaRow.swift` * `iosApp/iosApp/Components/StartupSplashView.swift` * `iosApp/iosApp/Components/TabTopBarActions.swift` * `iosApp/iosApp/Components/WatchlistButton.swift` * `iosApp/iosApp/ContentView.swift` * `iosApp/iosApp/DesignSystem/Aurora/AuroraStyle.swift` * `iosApp/iosApp/DesignSystem/SiloGlass.swift` * `iosApp/iosApp/Extensions/ViewExtensions.swift` * `iosApp/iosApp/Info.plist` * `iosApp/iosApp/Navigation/AppRouter.swift` * `iosApp/iosApp/Networking/Models.swift` * `iosApp/iosApp/Screens/Audio/AudioFullPlayerView.swift` * `iosApp/iosApp/Screens/Audio/AudioMiniPlayerView.swift` * `iosApp/iosApp/Screens/Browse/BrowseView.swift` * `iosApp/iosApp/Screens/Browse/LibrariesTabView.swift` * `iosApp/iosApp/Screens/Calendar/CalendarFilterBar.swift` * `iosApp/iosApp/Screens/Calendar/CalendarView.swift` * `iosApp/iosApp/Screens/Collections/CollectionsView.swift` * `iosApp/iosApp/Screens/Detail/AudiobookDetailContent.swift` * `iosApp/iosApp/Screens/Detail/DetailPlaybackFormatting.swift` * `iosApp/iosApp/Screens/Detail/ItemDetailView.swift` * `iosApp/iosApp/Screens/Detail/MovieDetailContent.swift` * `iosApp/iosApp/Screens/Detail/Phone/PhoneDetailActions.swift` * `iosApp/iosApp/Screens/Detail/Phone/PhoneDetailHero.swift` * `iosApp/iosApp/Screens/Detail/Phone/PhonePlaybackSelectorRow.swift` * `iosApp/iosApp/Screens/Detail/Phone/PhoneVersionFormatting.swift` * `iosApp/iosApp/Screens/Detail/Phone/PhoneVersionSheet.swift` * `iosApp/iosApp/Screens/Detail/PlaybackEditions.swift` * `iosApp/iosApp/Screens/Detail/SeasonDetailContent.swift` * `iosApp/iosApp/Screens/Detail/SeriesDetailContent.swift` * `iosApp/iosApp/Screens/Home/HomeView.swift` * `iosApp/iosApp/Screens/Home/HomeViewModel.swift` * `iosApp/iosApp/Screens/Home/SectionRow.swift` * `iosApp/iosApp/Screens/Player/AVPlayerRoute/AVPlayerBackend.swift` * `iosApp/iosApp/Screens/Player/AVPlayerRoute/DVSegmentWriter.swift` * `iosApp/iosApp/Screens/Player/AVPlayerRoute/LocalHLSPlaylistPolicy.swift` * `iosApp/iosApp/Screens/Player/CoreMedia/AudioOutput.swift` * `iosApp/iosApp/Screens/Player/CoreMedia/PlayerCore.swift` * `iosApp/iosApp/Screens/Player/PlayerNoticeOverlay.swift` * `iosApp/iosApp/Screens/Player/PlayerView.swift` * `iosApp/iosApp/Screens/Player/PlayerViewModel.swift` * `iosApp/iosApp/Screens/Player/Sheets/ChapterSheet.swift` * `iosApp/iosApp/Screens/Player/Sheets/PlayerSettingsSheet.swift` * `iosApp/iosApp/Screens/Player/iOS/MobilePlayerControls.swift` * `iosApp/iosApp/Screens/Player/tvOS/TVPlayerControls.swift` * `iosApp/iosApp/Screens/Profiles/CreateProfileView.swift` * `iosApp/iosApp/Screens/Profiles/EditProfileView.swift` * `iosApp/iosApp/Screens/Profiles/PINEntryView.swift` * `iosApp/iosApp/Screens/Profiles/ProfileSelectionView.swift` * `iosApp/iosApp/Screens/Settings/SettingsView.swift` * `iosApp/iosApp/Theme/ContinuumButtonStyles.swift` * `iosApp/iosApp/Theme/ContinuumTheme.swift` * `iosApp/iosApp/tvOS-Info.plist` * `iosApp/iosApp/tvOS/Components/TVSkylineSectionFeed.swift` * `iosApp/iosApp/tvOS/Navigation/TVMainTabView.swift` * `iosApp/iosApp/tvOS/Navigation/TVTopMenuBar.swift` * `iosApp/iosApp/tvOS/Screens/Detail/ReadableFocusSection.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVDetailActions.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVDetailHero.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVExpandableSynopsis.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVItemDetailView.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVMovieDetailView.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVPlaybackSelectorRow.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVSeasonChip.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVSeasonDetailView.swift` * `iosApp/iosApp/tvOS/Screens/Detail/TVSeriesDetailView.swift` * `iosApp/project.yml` * `iosApp/scripts/strip-ffmpeg-framework-signatures.sh` </details> <details> <summary>💤 Files with no reviewable changes (3)</summary> * iosApp/iosApp/Screens/Detail/Phone/PhoneVersionFormatting.swift * iosApp/iosApp/Screens/Detail/Phone/PhoneVersionSheet.swift * iosApp/iosApp/tvOS/Screens/Detail/ReadableFocusSection.swift </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
| - **Cast-channel security (#12): defer + document.** Keep the static TLS-PSK for this plan; the `serverId` gate is the only authorization. Phase G writes the threat model and a per-pair-auth follow-up into the docs. No pairing-key exchange in this plan. | ||
| - **Volume (#5): playback attenuation + mute, honestly scoped.** tvOS exposes **no** system/TV volume API (`MPVolumeView` is absent from the tvOS SDK; `AVAudioSession.outputVolume` is read-only — confirmed via Apple docs/forums). What *is* controllable is per-player gain: `AVPlayer.volume` (decoded-PCM routes only) and the `PlayerCore` `AVAudioEngine` main-mixer `outputVolume` (always, since it decodes to PCM). So the remote gets a **playback-volume slider + mute** that attenuates 0–100% of the current TV volume (cannot boost above it) and is a no-op on bitstream/passthrough/AirPlay audio on the AVPlayer route. The UI labels it "Volume", the cast state echoes the *applied* value, and Phase G documents the route caveat. | ||
| - **Next-episode (#5): included.** The player already exposes `nextUpEpisode` and `playNextEpisodeNow()` — wire a remote transport to them. |
There was a problem hiding this comment.
Static shared cast secret with serverId-only auth is a release-risk authorization model.
This plan explicitly allows any LAN device running the app to control a TV on the same server. That is an auth boundary gap, not just hardening debt; it should be treated as a pre-release requirement for remote-control surfaces.
Also applies to: 1412-1413
🤖 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 `@docs/superpowers/plans/2026-06-16-ios-tvos-cast-remote-improvements.md`
around lines 15 - 17, The Cast-channel security approach in the plan has an
authorization boundary gap that poses a release risk: the static TLS-PSK with
only serverId-based gating allows any LAN device running the app to control a TV
on the same server, which is insufficient for a released product. Revise the
"Cast-channel security (`#12`)" bullet point to either include proper per-device
authorization (such as pairing-key exchange) as a pre-release requirement in
this phase, or explicitly document this as a known security limitation that
blocks release until Phase G completes the threat model and implements per-pair
authentication. Ensure the plan clearly states what authorization work is
required before the remote-control feature can be shipped to users.
| xcrun simctl launch booted com.silo.app 2>/dev/null || xcrun simctl launch booted "$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' iosApp/Info.plist 2>/dev/null)" | ||
| ``` | ||
|
|
||
| > If the bundle id lookup is unclear, find it with `grep -i bundleIdentifier iosApp/project.yml` or read it from the build settings (`PRODUCT_BUNDLE_IDENTIFIER`). Sign-in for the dev server is admin / water1234 (see the SiloTV simulator-debugging memory). |
There was a problem hiding this comment.
Remove plaintext credentials from this plan document.
Line 418 exposes a username/password pair in clear text. Even if intended for local simulator use, this is still credential leakage and should be removed from versioned docs.
🔐 Suggested redaction
-- If the bundle id lookup is unclear, find it with `grep -i bundleIdentifier iosApp/project.yml` or read it from the build settings (`PRODUCT_BUNDLE_IDENTIFIER`). Sign-in for the dev server is admin / water1234 (see the SiloTV simulator-debugging memory).
+- If the bundle id lookup is unclear, find it with `grep -i bundleIdentifier iosApp/project.yml` or read it from the build settings (`PRODUCT_BUNDLE_IDENTIFIER`). Use locally provisioned dev credentials from secure onboarding notes (do not store credentials in repository docs).🤖 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 `@docs/superpowers/plans/2026-06-16-now-playing-shelf.md` at line 418, Remove
the plaintext credentials (admin / water1234) from line 418 in the
now-playing-shelf.md documentation file. Keep the technical instructions about
finding the bundle ID using grep and PRODUCT_BUNDLE_IDENTIFIER, but replace the
exposed username/password pair with a reference directing readers to securely
obtain credentials from the SiloTV simulator-debugging memory instead of
including them inline in the versioned documentation.
| The cast channel uses **TLS-PSK with a single static pre-shared key compiled into | ||
| every build** (`SiloCastSession.tlsParameters()`). The channel is therefore | ||
| **encrypted but not authenticated**: the only authorization is the `serverId` | ||
| match performed in the `hello` handshake. Hardening added in this work makes that | ||
| check **fail-closed** (missing/empty/mismatched `serverId` is rejected; `.launch` | ||
| and `.control` are refused until a session is `isAuthorized`; an unauthorized | ||
| session is closed by a 5 s watchdog). That is consistency/defense-in-depth — it | ||
| is **not** real authentication: any device on the LAN running a Silo build can | ||
| control any Silo TV bound to the same server. | ||
|
|
||
| **Deferred follow-up (recommended):** derive a per-pair / per-server secret from | ||
| the existing companion-pairing trust (`_silopair`, see the pairing flow) and bind | ||
| it into the cast `hello` handshake (e.g. HMAC the hello/launch with the per-pair | ||
| secret, or a one-time PIN echoed from the TV), so only paired devices can control | ||
| the TV. Until then, treat LAN access as the trust boundary. |
There was a problem hiding this comment.
Static shared PSK leaves cast control effectively unauthenticated.
This design allows any LAN device running a Silo build to control any eligible TV (as the doc itself notes), which is an authorization flaw and should not ship unguarded.
Please gate .launch/.control on proof-of-possession tied to companion pairing (or hard-disable this remote mode outside trusted/internal builds until that is implemented).
🤖 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 `@docs/tvos-player/cast-remote.md` around lines 83 - 97, The cast control
authentication is currently unauthenticated due to the static pre-shared key in
SiloCastSession.tlsParameters(), allowing any LAN device to control any TV.
Implement proof-of-possession authentication by deriving a per-pair secret from
the companion-pairing trust mechanism (_silopair) and bind it into the cast
handshake, then gate both the `.launch` and `.control` operations to only allow
authenticated/authorized sessions. Alternatively, hard-disable the cast remote
control feature outside of trusted/internal builds until the proper
authentication mechanism is implemented. Update the documentation to reflect
whichever approach is taken.
| Button { controller.showRemoteControl() } label: { | ||
| HStack(spacing: 12) { | ||
| thumb | ||
| VStack(alignment: .leading, spacing: 2) { | ||
| Text(controller.state?.title ?? "Connected") | ||
| .font(.subheadline.weight(.semibold)) | ||
| .lineLimit(1) | ||
| if !isInline { | ||
| Text("Playing on \(controller.activeTarget?.name ?? "Silo TV")") | ||
| .font(.caption) | ||
| .foregroundStyle(Color.continuumSecondaryText) | ||
| .lineLimit(1) | ||
| } | ||
| } | ||
| Spacer(minLength: 8) | ||
| Button { | ||
| controller.togglePlayPauseOptimistic() | ||
| } label: { | ||
| Image(systemName: controller.clock.isPlaying() ? "pause.fill" : "play.fill") | ||
| .font(.system(size: 18, weight: .semibold)) | ||
| .frame(width: 32, height: 32) | ||
| } | ||
| .buttonStyle(.plain) | ||
| .accessibilityLabel(controller.clock.isPlaying() ? "Pause" : "Play") |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n iosApp/iosApp/Cast/iOS/SiloCastMiniBar.swift | head -100Repository: Silo-Server/silo-apple
Length of output: 1966
🌐 Web query:
SwiftUI nested buttons gesture handling conflict accessibility
💡 Result:
In SwiftUI, nesting interactive elements like buttons often results in gesture conflicts because SwiftUI’s event handling system prioritizes parent gestures or misinterprets the intended tap target [1]. Standard Buttons are designed to be independent; placing one inside another or within a container with its own tap gesture typically causes the parent to capture the tap [2][3]. Gesture Handling Best Practices To resolve conflicts and maintain expected behavior, use these strategies: 1. Avoid True Nesting: Never place a Button inside another Button [2]. Instead, use a ZStack or layout containers to position them side-by-side or as overlays [2]. 2. Decouple Interactions: If you have a row with multiple actions (e.g., a List row with a button and a row-wide gesture), use the.buttonStyle modifier. Setting buttons to.borderless or.plain prevents them from inheriting the automatic platform behaviors that often cause conflicts with container gestures [3][4]. 3. Prioritize Gestures Explicitly: If a parent container’s gesture is stealing touches from a child element, use.simultaneousGesture or.highPriorityGesture on the child to ensure it processes the touch event as intended [5][1][6]. 4. Respect Hit-Testing: Ensure your content shapes are clearly defined using.contentShape. This is particularly important for transparent or irregular views, as it forces the gesture system to recognize the intended tappable area correctly [1]. Accessibility Considerations Nesting interactive elements can break accessibility, as VoiceOver and other technologies expect distinct, predictable focus points [7][8]. 1. Expose Elements Individually: Use.accessibilityElement(children:.contain) to ensure each interactive child (like a button within a card) remains a separate, navigable stop for VoiceOver users [9][8]. 2. Avoid Default Combining: By default, SwiftUI may combine child elements into a single parent element, which masks individual actions [9]. If you need specific interactions, avoid.combine unless the goal is to merge everything into one single, non-interactive focus point [10][8]. 3. Use Explicit Actions: For custom components that don't use standard buttons but offer interactivity, use the.accessibilityAction(named:_:) modifier [11][8]. This exposes your custom logic to assistive technologies, ensuring they are discoverable even if the underlying view isn't a native Button [7][8]. General Rule: Always prefer native Button components over gesture-based interactions (like.onTapGesture) whenever possible. Native buttons automatically provide accessibility traits, keyboard/pointer support, and consistent hit-testing behavior that custom gesture handlers often lack [1].
Citations:
- 1: https://dev.to/sebastienlato/swiftui-hit-testing-event-propagation-internals-2106
- 2: https://stackoverflow.com/questions/72935021/siwftui-nested-buttons-child-tap-triggers-parent-animation
- 3: https://openillumi.com/en/en-swiftui-list-multiple-button-conflict-fix/
- 4: https://stackoverflow.com/questions/78790218/swiftui-how-to-distinguish-tap-gestures-when-there-is-a-button-inside-a-bigger
- 5: https://developer.apple.com/forums/thread/765559
- 6: https://developer.apple.com/documentation/swiftui/view/simultaneousgesture(_:including:)?changes=latest_major
- 7: https://developer.apple.com/videos/play/wwdc2024/10073/
- 8: https://swiftcrafted.dev/article/swiftui-accessibility-complete-guide-voiceover-dynamic-type-inclusive-design
- 9: https://developer.apple.com/forums/thread/725008
- 10: https://medium.com/ios-ic-weekly/the-quiet-rule-of-swiftui-accessibility-why-combine-and-contain-dont-compose-1c7446806b0d
- 11: https://developer.apple.com/documentation/swiftui/view-accessibility?changes=_5
Refactor to decouple nested buttons using gesture handling.
The current structure nests a Button inside another Button's label, which causes gesture conflicts and breaks accessibility semantics. Tapping the play/pause control will also trigger the outer remote control button, and VoiceOver will not properly expose both interactive elements.
Use .onTapGesture on the HStack container for the outer action, and apply .accessibilityAddTraits(.isButton) to preserve accessibility semantics while decoupling gesture handling:
Suggested patch
- Button { controller.showRemoteControl() } label: {
- HStack(spacing: 12) {
+ HStack(spacing: 12) {
thumb
VStack(alignment: .leading, spacing: 2) {
Text(controller.state?.title ?? "Connected")
@@
Button {
controller.togglePlayPauseOptimistic()
} label: {
@@
.buttonStyle(.plain)
.accessibilityLabel(controller.clock.isPlaying() ? "Pause" : "Play")
- }
- .padding(.horizontal, 14)
- .padding(.vertical, isInline ? 4 : 8)
- .modifier(NowPlayingBarChrome(style: style))
- .foregroundStyle(Color.continuumOnSurface)
- .contentShape(Rectangle())
}
- .buttonStyle(.plain)
+ .padding(.horizontal, 14)
+ .padding(.vertical, isInline ? 4 : 8)
+ .modifier(NowPlayingBarChrome(style: style))
+ .foregroundStyle(Color.continuumOnSurface)
+ .contentShape(Rectangle())
+ .onTapGesture { controller.showRemoteControl() }
+ .accessibilityAddTraits(.isButton)
.padding(.horizontal, style == .card ? 12 : 0)🤖 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/Cast/iOS/SiloCastMiniBar.swift` around lines 18 - 41, The outer
Button wrapping the HStack contains a nested Button for play/pause, which breaks
gesture handling and accessibility semantics. Replace the outer Button structure
by removing the Button wrapper and instead apply .onTapGesture to the HStack
container to call controller.showRemoteControl(), keeping the inner play/pause
Button unchanged. Then add .accessibilityAddTraits(.isButton) to the HStack to
preserve accessibility semantics and ensure both the outer remote control action
and inner play/pause button are properly exposed to VoiceOver.
| /// Serializes the decode-recovery state group above | ||
| /// (`consecutiveDecodeFailures`, `hasReportedDecodeFailure`, | ||
| /// `isRebuildingDecoder`, `decoderRebuildPending`, | ||
| /// `decodeBurstRecoveryAttempts`, `framesDecodedSinceRecovery`, | ||
| /// `pendingDecodeBurstResync`, `isRecoveringDecodeBurst`). VT delivers | ||
| /// async output callbacks on its own thread while the submit/recovery work | ||
| /// runs on `videoFeedQueue`, and VT does not guarantee the two are | ||
| /// serialized — so these fields are genuinely shared. `RealtimeAudioLock` | ||
| /// is a generic `os_unfair_lock` wrapper (named for its first use). The | ||
| /// lock is *never* held across the blocking decoder flush/recreate, which | ||
| /// drains async frames that re-enter on the callback thread: decisions are | ||
| /// made under the lock and the heavy work runs after release. | ||
| private let decodeRecoveryLock = RealtimeAudioLock() |
There was a problem hiding this comment.
Protect every decode-recovery writer with decodeRecoveryLock.
This new lock owns the recovery state group, but Line 1177-1186 and Line 4747-4748 still reset members without it. A late VT callback can race those resets and leave mixed recovery state across loads/dispose.
Suggested fix direction
- consecutiveDecodeFailures = 0
- hasReportedDecodeFailure = false
- isRebuildingDecoder = false
- decoderRebuildPending = false
- decodeBurstRecoveryAttempts = 0
- framesDecodedSinceRecovery = 0
- pendingDecodeBurstResync = false
- isRecoveringDecodeBurst = false
+ decodeRecoveryLock.lock()
+ consecutiveDecodeFailures = 0
+ hasReportedDecodeFailure = false
+ isRebuildingDecoder = false
+ decoderRebuildPending = false
+ decodeBurstRecoveryAttempts = 0
+ framesDecodedSinceRecovery = 0
+ pendingDecodeBurstResync = false
+ isRecoveringDecodeBurst = false
+ decodeRecoveryLock.unlock()Apply the same lock discipline to teardown/reset sites for this state group.
🤖 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/CoreMedia/PlayerCore.swift` around lines 409 -
421, The decode-recovery state group is now protected by the
`decodeRecoveryLock` as documented in the comment, but the reset operations at
lines 1177-1186 and lines 4747-4748 are still modifying the recovery state
members (consecutiveDecodeFailures, hasReportedDecodeFailure,
isRebuildingDecoder, decoderRebuildPending, decodeBurstRecoveryAttempts,
framesDecodedSinceRecovery, pendingDecodeBurstResync, isRecoveringDecodeBurst)
without holding this lock. Wrap the reset operations at both locations with the
`decodeRecoveryLock` using the same locking pattern to prevent race conditions
where VT callbacks might interfere with these state resets during teardown or
dispose operations.
| // A rebuild recreates the VT session outright, which supersedes a | ||
| // pending burst resync — running both in one pass would reset the | ||
| // freshly-rebuilt decoder a second time. Drop the stale resync. | ||
| if doRebuild { pendingDecodeBurstResync = false } | ||
| let doResync = !doRebuild && pendingDecodeBurstResync |
There was a problem hiding this comment.
Clear burst-recovery state when a rebuild supersedes resync.
If pendingDecodeBurstResync is dropped here, performDecodeBurstResync() never clears isRecoveringDecodeBurst. The branch at Line 4203 can then keep swallowing future -12909 failures indefinitely.
Suggested fix
- if doRebuild { pendingDecodeBurstResync = false }
+ if doRebuild {
+ pendingDecodeBurstResync = false
+ isRecoveringDecodeBurst = false
+ framesDecodedSinceRecovery = 0
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // A rebuild recreates the VT session outright, which supersedes a | |
| // pending burst resync — running both in one pass would reset the | |
| // freshly-rebuilt decoder a second time. Drop the stale resync. | |
| if doRebuild { pendingDecodeBurstResync = false } | |
| let doResync = !doRebuild && pendingDecodeBurstResync | |
| // A rebuild recreates the VT session outright, which supersedes a | |
| // pending burst resync — running both in one pass would reset the | |
| // freshly-rebuilt decoder a second time. Drop the stale resync. | |
| if doRebuild { | |
| pendingDecodeBurstResync = false | |
| isRecoveringDecodeBurst = false | |
| framesDecodedSinceRecovery = 0 | |
| } | |
| let doResync = !doRebuild && pendingDecodeBurstResync |
🤖 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/CoreMedia/PlayerCore.swift` around lines 3588 -
3592, When a rebuild supersedes the pending decode burst resync, the
`pendingDecodeBurstResync` flag is dropped in the conditional `if doRebuild {
pendingDecodeBurstResync = false }` block. However, this prevents
`performDecodeBurstResync()` from ever executing, which means the
`isRecoveringDecodeBurst` flag is never cleared. This causes the branch at Line
4203 to continue swallowing future `-12909` failures indefinitely. In addition
to dropping `pendingDecodeBurstResync`, also clear the `isRecoveringDecodeBurst`
flag in the same `if doRebuild` conditional block to ensure the burst-recovery
state is properly cleaned up when the resync is skipped due to a rebuild.
| let ok = createDecompressionSession() | ||
| print("[CMP] decoder rebuild: \(ok ? "succeeded" : "FAILED")") |
There was a problem hiding this comment.
Surface rebuild failure instead of only printing it.
When createDecompressionSession() fails here, the current packet path returns with no installed decoder and no onError/fallback signal, leaving playback frozen silently.
Suggested fix
let ok = createDecompressionSession()
print("[CMP] decoder rebuild: \(ok ? "succeeded" : "FAILED")")
+ if !ok {
+ if !fireRejectionIfPending() {
+ reportTerminalDecodeFailure("Video decoder unavailable after VideoToolbox session rebuild failed.")
+ }
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let ok = createDecompressionSession() | |
| print("[CMP] decoder rebuild: \(ok ? "succeeded" : "FAILED")") | |
| let ok = createDecompressionSession() | |
| print("[CMP] decoder rebuild: \(ok ? "succeeded" : "FAILED")") | |
| if !ok { | |
| if !fireRejectionIfPending() { | |
| reportTerminalDecodeFailure("Video decoder unavailable after VideoToolbox session rebuild failed.") | |
| } | |
| } |
🤖 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/CoreMedia/PlayerCore.swift` around lines 4047 -
4048, The createDecompressionSession() call failure is only being logged with a
print statement but not actually handled, causing playback to freeze silently
when decoder rebuild fails. After the createDecompressionSession() call assigns
its result to ok, add a check for when ok is false and invoke an appropriate
error handler (such as onError callback) to signal the failure and allow the
player to take corrective action, rather than only printing the status and
continuing execution.
| case .reportUnsupported(let reason, let url): | ||
| DispatchQueue.main.async { [weak self] in | ||
| guard let self else { return } | ||
| self.onUnsupportedStream?( | ||
| reason, | ||
| url, | ||
| self.lastLoadHeaders, | ||
| self.lastLoadStartTime | ||
| ) |
There was a problem hiding this comment.
Snapshot the full unsupported-stream context before dispatch.
The action carries the old URL, but lastLoadHeaders and lastLoadStartTime are read later on main. A quick new load() can mutate them first, sending the fallback callback mixed source context.
Suggested fix
- case reportUnsupported(StreamRejection, URL)
+ case reportUnsupported(StreamRejection, URL, [String: String], Double)- return .reportUnsupported(.videoToolboxBadDataH264, url)
+ return .reportUnsupported(.videoToolboxBadDataH264, url, lastLoadHeaders, lastLoadStartTime)- return .reportUnsupported(.videoToolboxBadDataHEVC, url)
+ return .reportUnsupported(.videoToolboxBadDataHEVC, url, lastLoadHeaders, lastLoadStartTime)- case .reportUnsupported(let reason, let url):
+ case .reportUnsupported(let reason, let url, let headers, let startTime):
DispatchQueue.main.async { [weak self] in
guard let self else { return }
self.onUnsupportedStream?(
reason,
url,
- self.lastLoadHeaders,
- self.lastLoadStartTime
+ headers,
+ startTime
)
}🤖 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/CoreMedia/PlayerCore.swift` around lines 4176 -
4184, In the `.reportUnsupported` case handler, the values `lastLoadHeaders` and
`lastLoadStartTime` are being accessed inside the DispatchQueue.main.async
closure, which means they can be mutated by a new load() call before the
callback executes, resulting in mixed source context being passed to
onUnsupportedStream. Snapshot these values immediately when handling the
`.reportUnsupported` case (before the async dispatch) so the callback receives
the correct context for the actual failed load operation, not values from a
subsequent load.
|
|
||
| @MainActor | ||
| func makeSiloCastPlaybackState(contentId: String?) -> SiloCastPlaybackState { | ||
| let liveContentId = lastLoadRequest?.contentId ?? contentId |
There was a problem hiding this comment.
Use receiver-provided contentId as the primary source.
Line 5448 currently prefers lastLoadRequest?.contentId over the contentId argument. That can leak stale item IDs into cast state even though TVCastReceiver.sendState passes the current playerContentId. Prefer the method argument first to preserve the receiver→state contract.
Suggested fix
- let liveContentId = lastLoadRequest?.contentId ?? contentId
+ let liveContentId = contentId ?? lastLoadRequest?.contentId📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let liveContentId = lastLoadRequest?.contentId ?? contentId | |
| let liveContentId = contentId ?? lastLoadRequest?.contentId |
🤖 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/PlayerViewModel.swift` at line 5448, In the
PlayerViewModel.swift file, the assignment of liveContentId on line 5448
currently prioritizes the optional contentId from lastLoadRequest over the
contentId method argument, which can result in stale item IDs being used.
Reverse the precedence by swapping the order of the nil-coalescing operation so
that the contentId argument is checked first, and only fall back to
lastLoadRequest?.contentId if the argument is unavailable. This ensures the
receiver-provided contentId is always preferred, maintaining the proper receiver
to state contract.
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| case "${PLATFORM_NAME:-}" in | ||
| iphoneos|appletvos) | ||
| ;; | ||
| *) | ||
| exit 0 | ||
| ;; | ||
| esac | ||
|
|
||
| roots=() | ||
|
|
||
| if [[ -n "${BUILD_DIR:-}" && "${BUILD_DIR}" == *"/Build/"* ]]; then | ||
| derived_data_root="${BUILD_DIR%%/Build/*}" | ||
| roots+=("${derived_data_root}/SourcePackages/artifacts/ffmpeg-build") | ||
| fi | ||
|
|
||
| if [[ -n "${SRCROOT:-}" ]]; then | ||
| roots+=("${SRCROOT}/build/SourcePackages/artifacts/ffmpeg-build") | ||
| fi | ||
|
|
||
| if [[ -n "${TARGET_BUILD_DIR:-}" && -n "${FRAMEWORKS_FOLDER_PATH:-}" ]]; then | ||
| roots+=("${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}") | ||
| fi | ||
|
|
||
| for root in "${roots[@]}"; do | ||
| [[ -d "${root}" ]] || continue | ||
| find "${root}" -type d -name _CodeSignature -prune -exec rm -rf {} + | ||
| done |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify the new script is wired into project.yml as a build phase
rg -n 'strip-ffmpeg-framework-signatures' iosApp/project.ymlRepository: Silo-Server/silo-apple
Length of output: 48
Script must be wired into iosApp/project.yml as a build phase.
The script logic is sound—it correctly follows the platform-gating pattern from prepare-macos-ffmpeg-frameworks.sh, safely handles environment variables, and uses efficient batched deletion. However, the script is not currently integrated into the build system. Per coding guidelines, build structure changes must be controlled through iosApp/project.yml. Add this script as a build phase there to activate it.
🤖 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/scripts/strip-ffmpeg-framework-signatures.sh` around lines 1 - 30, The
strip-ffmpeg-framework-signatures.sh script contains valid logic for removing
code signatures from FFmpeg frameworks during the iOS build process, but it is
not currently integrated into the Xcode build system. Wire this script into the
build process by adding it as a build phase in iosApp/project.yml, following the
same pattern used for the prepare-macos-ffmpeg-frameworks.sh script. This will
ensure the script executes automatically during the iOS app build and the
signature stripping logic is actually invoked.
Source: Coding guidelines
…ession fixes The pin pointed at the first revision of AetherEngine #13. Review on #12 then fixed more of the direct-play authorization path: resolvers run off the cooperative pool, backward detour reads honour a latched refusal, and every resolver-supplied header stays off cross-origin redirect and pinned targets. #13 merged those changes. Pin d0aa7c2baff59fd5df53c576530acac3208b3d61, the head of #13, and list both engine pull requests in the notices. Re-pin to the engine merge commit once they land. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Summary
This branch started as a tvOS item-detail refinement and grew into a broader iOS/tvOS playback-experience redesign. Three pillars:
1. Item-detail redesign (tvOS + iOS)
FileVersion.edition2. Remote Control redesign (formerly "Cast", iOS + tvOS)
TVCastReceiver) with standby state/view3. Now-playing shelf (iOS)
Design specs and implementation plans for each pillar are included under
docs/.Test Plan
xcodebuild build— schemeSilo(iOS simulator)xcodebuild build— schemeSiloTV(tvOS simulator)xcodebuild test—DetailVersionSelectionTests,SiloCastTestsNotes
remote-account-profile-handofffeature are intentionally not included in this branch.Summary by CodeRabbit
Release Notes
New Features
Design & UI