Repository navigation
Apple parity sweep, playback gap closure, and v0.2.5 feedback fixes - #38
Conversation
…ixes Player fixes (user-reported): - Re-arm the 5s controls auto-hide on any key while the overlay is up (Apple TVPlayerControls parity) so the menu can't vanish mid-navigation - D-pad Left/Right no longer swallowed while the transport overlay or Up Next is on screen; hidden-controls seek behavior is preserved - Start Over: an explicit 0.0 resume override is honored verbatim through session resolution (was falling back to stale detail progress) - Resume: newest local progress write wins (recency, not furthest), so deliberate backward seeks stick; multi-version staleness fixed Apple parity features: - SiloCast rebuilt wire-compatible with silo-apple SiloControl: TLS-PSK transport, camelCase envelope, hello/serverId authorization with auth watchdog, ping/pong heartbeat, 500ms state cadence, graceful close, Apple TXT records (golden-JSON protocol tests) - Metadata AI description translation: capability store, translate-and- poll controller, detail-screen affordances (button/auto), metadata language setting on phone + TV - Live home refresh: events websocket (user_state/catalog) with debounce, profile filtering, foreground lifecycle; TV Home also refreshes on resume - MPV subtitle styling: SubtitleAppearance now translates to sub-* options (box/shadow/outline/position); authored ASS renders as-authored - Admin stats dashboard exposed to acting admins on phone + TV (Settings entry), matching Apple's dashboard; richer admin screens stay unlinked - Requests exposure docs corrected (feature was already live, server-gated) Playback capability gaps vs Apple (all additive, fallback ladder intact): - Codec floor: AV1/VP9/legacy codecs without hardware decoders now advertise + route to MPV software decode instead of transcoding - WMV/ASF containers direct-play via MPV - DV P7 unblocked: native DV on multi-instance-HEVC hardware, MPV base-layer HDR10 elsewhere (recovery-planned); server-independent - Styled (ASS/SSA) subtitles burn in server-side during full transcodes on devices below the MPV floor Infrastructure and cleanup: - Cleartext HTTP opt-in so plain-IP LAN servers connect on Android 9+ - CI runs the unit test suite on PRs/main; APK assembly gated on it - DownloadSubscriptionWorker scheduled periodically (was never enqueued) - Deleted dead legacy readers (EpubReader/FictionBookReader/TextReader) - Fixed duplicated deep-link scheme check; doc drift (PiP, version) Co-Authored-By: Claude Fable 5 <[email protected]>
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR updates cast transport and protocol handling, adds metadata-AI translation and admin-navigation wiring, changes playback routing for software-only codecs and subtitle styling, introduces home realtime refresh and download scoping updates, and removes legacy reader implementations. ChangesCast transport and protocol rework
Playback routing and MPV styling
Metadata AI, admin, and home refresh
Downloads, sync, and active playback state
Docs, build, and cleanup
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Phone as SiloCastController
participant TLS as SiloCastTls
participant TV as TvSiloCastReceiver
participant Adapter as TvSiloCastPlayerAdapter
Phone->>TLS: connect(host, port)
TLS->>TV: TLS-PSK handshake
Phone->>TV: Hello(serverId, deviceInfo)
Phone->>TV: Control(command)
TV->>Adapter: handle(command)
Adapter-->>TV: playback update
TV-->>Phone: State / Pong / Close
sequenceDiagram
participant Screen as ItemDetailScreen
participant ViewModel as ItemDetailViewModel
participant Controller as DescriptionTranslationController
participant Api as MetadataAiRepository
participant Catalog as CatalogRepository
Screen->>ViewModel: translateDescription(auto=true)
ViewModel->>Controller: translate(contentId, targetLanguage)
Controller->>Api: translateDescription(contentId, targetLanguage)
loop poll pendingTranslationLanguage
Controller->>ViewModel: refetchPendingLanguage()
ViewModel->>Catalog: getItemDetail(contentId)
end
Controller-->>Screen: phase Idle / Failed
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1baf0697c0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| val server = serverRegistry.activeEntry.value | ||
| advertiser.start( | ||
| port = socket.localPort, | ||
| serverId = server?.id, | ||
| serverName = server?.displayName, |
There was a problem hiding this comment.
Refresh SiloCast TXT record after server switches
Because this snapshots activeEntry only when the receiver starts, the advertised server/serverName TXT values become stale if the user switches servers while the TV app stays foregrounded; the receiver remains running until MainTvActivity.onStop, so discovery clients that filter _silocast._tcp by the TXT server will either hide this TV for the new server or show it under the old one until the app is backgrounded/restarted. Re-advertise or observe activeEntry changes so the Bonjour record stays in sync.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch — fixed: the receiver now observes serverRegistry.activeEntry while running; a server switch re-registers the Bonjour record with the new server/serverName and also drops the live controller session, since its hello was authorized against the previous server.
Review follow-up (P2): the receiver snapshotted the active server only at start, so a mid-session server switch left stale server/serverName TXT values in the Bonjour record (phones filtering by server would hide this TV or list it under the old server) — and the live controller session stayed authorized against the previous server. The receiver now observes activeEntry: on a switch it closes the controller session and re-registers the advertisement with the new identity. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/cast/SiloCastController.kt (1)
190-200: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winStale-connection error can clobber a freshly-established session's state.
The
finallyblock correctly guardscloseConnection()withsession === activeSession, but thecatch (t: Throwable)block above updates_state.errorunconditionally. SinceensureConnectedcloses the old session synchronously before awaiting the new TLS handshake (which can take up toCONNECT_TIMEOUT_MS), the old read loop's exception handler can race with — and finish after — the new connection succeeding, overwriting a healthy session's error field with the stale closed-connection error.🔧 Proposed fix: guard the error update the same way as closeConnection()
} catch (e: CancellationException) { throw e } catch (t: Throwable) { Log.w(TAG, "SiloCast read loop ended", t) - _state.update { it.copy(error = t.message) } + if (session === activeSession) { + _state.update { it.copy(error = t.message) } + } } finally { if (session === activeSession) { closeConnection() } }🤖 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 `@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/cast/SiloCastController.kt` around lines 190 - 200, The stale-connection error update in SiloCastController’s read loop is unguarded and can overwrite a newer healthy session. In the `catch (t: Throwable)` path, update `_state.error` only when `session === activeSession`, matching the existing `finally` guard around `closeConnection()`. Keep the `CancellationException` handling unchanged and preserve the current logging in `SiloCastController`.
🧹 Nitpick comments (10)
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyle.kt (2)
80-80: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse an import instead of a fully-qualified reference.
org.siloserver.silo.model.settings.SubtitlePositionPreset.Bottomis fully qualified inline while the file already imports sibling symbols from the same package (SubtitleBackgroundStylePreset,legacyPosition,pointSize). Adding the missing import would be more consistent.🤖 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 `@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyle.kt` at line 80, The subtitle position check in MpvSubtitleStyle uses a fully qualified reference inline instead of the existing import style. Add the missing import for SubtitlePositionPreset.Bottom in MpvSubtitleStyle and update the props["sub-use-margins"] assignment to use the imported symbol, matching the other sibling imports in this file.
45-53: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueRounding truncates instead of rounds for outline size.
(a.fontSize.pointSize * 0.08).coerceIn(2.0, 4.0).toInt()truncates toward zero rather than rounding, so e.g.3.9becomes3instead of4. Minor precision loss on a cosmetic sizing value.💡 Proposed fix
- (a.fontSize.pointSize * 0.08).coerceIn(2.0, 4.0).toInt().toString() + (a.fontSize.pointSize * 0.08).coerceIn(2.0, 4.0).roundToInt().toString()🤖 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 `@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyle.kt` around lines 45 - 53, The outline size calculation in MpvSubtitleStyle should round instead of truncate, since `toInt()` on the `outlineSize` expression floors values like 3.9 to 3. Update the `outlineSize` logic to round the clamped `a.fontSize.pointSize * 0.08` result before converting it to a string, keeping the existing `a.textOutline` guard and `props["sub-border-size"]` assignment intact.androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/home/TvHomeScreen.kt (1)
42-51: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse imports instead of fully-qualified references.
LocalLifecycleOwner,DisposableEffect,LifecycleEventObserver, andLifecycle.Event.ON_RESUMEare all fully-qualified inline, which is inconsistent with idiomatic Compose code elsewhere in the file.As per coding guidelines, `{androidApp,androidTvApp,android-shared}/**/*.kt`: "Follow Compose idioms in Android UI code."♻️ Suggested imports
+import androidx.compose.runtime.DisposableEffect +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleEventObserver +import androidx.lifecycle.compose.LocalLifecycleOwner ... - val lifecycleOwner = androidx.lifecycle.compose.LocalLifecycleOwner.current - androidx.compose.runtime.DisposableEffect(lifecycleOwner) { - val observer = androidx.lifecycle.LifecycleEventObserver { _, event -> - if (event == androidx.lifecycle.Lifecycle.Event.ON_RESUME) { + val lifecycleOwner = LocalLifecycleOwner.current + DisposableEffect(lifecycleOwner) { + val observer = LifecycleEventObserver { _, event -> + if (event == Lifecycle.Event.ON_RESUME) { viewModel.refreshFromRealtime() } }🤖 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 `@androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/home/TvHomeScreen.kt` around lines 42 - 51, The TvHomeScreen Compose block uses fully-qualified references instead of imports, which is inconsistent with the file’s idiomatic style. Update the imports for LocalLifecycleOwner, DisposableEffect, LifecycleEventObserver, and Lifecycle.Event.ON_RESUME, then use the unqualified symbols in the lifecycle observer setup inside TvHomeScreen. Keep the existing refreshFromRealtime behavior unchanged.Source: Coding guidelines
shared/src/commonMain/kotlin/org/siloserver/silo/cast/SiloCastMessage.kt (1)
186-203: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCompanion command constants use PascalCase instead of camelCase.
Play,Pause,PlayPause,Seek,Stop,SelectAudioTrack, ...,PlayNextareconst valproperties. As per path instructions for{androidApp,androidTvApp,android-shared,shared}/**/*.kt: "functions and properties must usecamelCase."♻️ Proposed rename (sample)
- const val Play = "play" - const val Pause = "pause" - const val PlayPause = "play_pause" - const val Seek = "seek" - const val Stop = "stop" - const val SelectAudioTrack = "select_audio_track" - const val SelectSubtitleTrack = "select_subtitle_track" - const val SetPlaybackSpeed = "set_playback_speed" - const val SetQuality = "set_quality" - const val SetVideoGravity = "set_video_gravity" - const val SetHdrEnabled = "set_hdr_enabled" - const val SetSubtitleSyncMs = "set_subtitle_sync_ms" - const val SetSubtitlePosition = "set_subtitle_position" - const val SetVolume = "set_volume" - const val SetMuted = "set_muted" - const val PlayNext = "play_next" + const val play = "play" + const val pause = "pause" + const val playPause = "play_pause" + const val seek = "seek" + const val stop = "stop" + const val selectAudioTrack = "select_audio_track" + const val selectSubtitleTrack = "select_subtitle_track" + const val setPlaybackSpeed = "set_playback_speed" + const val setQuality = "set_quality" + const val setVideoGravity = "set_video_gravity" + const val setHdrEnabled = "set_hdr_enabled" + const val setSubtitleSyncMs = "set_subtitle_sync_ms" + const val setSubtitlePosition = "set_subtitle_position" + const val setVolume = "set_volume" + const val setMuted = "set_muted" + const val playNext = "play_next"(rename all call sites accordingly)
🤖 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 `@shared/src/commonMain/kotlin/org/siloserver/silo/cast/SiloCastMessage.kt` around lines 186 - 203, The companion object command constants in SiloCastMessage use PascalCase, which violates the camelCase property naming rule. Rename the const val properties in SiloCastMessage.Companion (such as Play, Pause, PlayPause, Seek, Stop, SelectAudioTrack, SetPlaybackSpeed, and PlayNext) to camelCase, and update all references/call sites accordingly so the API remains consistent.Source: Path instructions
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt (1)
222-224: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting the shared start-over/software-codec logic.
suppressRewindandsoftwareOnlyVideoCodecare computed with byte-for-byte identical expressions in bothMobileVideoPlaybackStarterandTvVideoPlaybackStarter. Extracting a small shared helper (e.g., in theandroid-sharedplayer/video package alongsideisMpvSoftwareDecodableVideoCodec) would remove the duplication and guarantee both clients stay in sync as this logic evolves.🤖 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 `@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt` around lines 222 - 224, The `softwareOnlyVideoCodec` and `suppressRewind` checks are duplicated between `MobileVideoPlaybackStarter` and `TvVideoPlaybackStarter`, so extract the shared play-method/codec capability logic into a small helper in the shared player/video area near `isMpvSoftwareDecodableVideoCodec`. Update both call sites to use that helper so the start-over and software-codec behavior stays in sync and only needs to be changed in one place..github/workflows/android-build.yml (1)
5-9: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueLGTM! Trigger/job restructuring reads correctly —
unit-testsruns unconditionally on push/PR whilebuild-debugis correctly gated to tag pushes and manual dispatch, satisfying itsneeds: unit-testsdependency in both cases.Optional: consider adding
timeout-minutesto the newunit-testsjob (andbuild-debug) so a hung Gradle run doesn't tie up a runner indefinitely.Also applies to: 25-68
🤖 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 @.github/workflows/android-build.yml around lines 5 - 9, Add timeout-minutes to the new unit-tests and build-debug jobs in the Android workflow so a stuck Gradle execution cannot hold a runner indefinitely; update the job definitions for unit-tests and build-debug directly in the workflow while keeping their existing trigger and needs structure unchanged.androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/AccountSection.kt (1)
131-137: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdmin row reuses the same icon as "Manage Sessions".
Both rows use
Icons.Default.Securitywith the same gray badge, making them visually indistinguishable at a glance. Consider a distinct icon (e.g.Icons.Default.AdminPanelSettings) for the Admin row.🤖 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 `@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/AccountSection.kt` around lines 131 - 137, The Admin entry in AccountSection is visually too similar to Manage Sessions because it reuses the same Security icon and gray badge. Update the SettingsRowLabel call for the Admin row to use a distinct icon via the existing onAdmin block, preferably a more specific admin symbol such as AdminPanelSettings, while keeping the rest of the row behavior unchanged.shared/src/commonMain/kotlin/org/siloserver/silo/metadata/DescriptionTranslationController.kt (1)
71-76: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueString-concat key risks collision on
|-containing ids.
"$contentId|$targetLanguage"could theoretically collide across different (contentId, targetLanguage) pairs if either value contains|. Low real-world likelihood given IDs/language codes, but aPairkey would be unambiguous.🤖 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 `@shared/src/commonMain/kotlin/org/siloserver/silo/metadata/DescriptionTranslationController.kt` around lines 71 - 76, The auto-fire tracking in DescriptionTranslationController uses a concatenated string key in shouldAutoFire and markAutoFired, which can collide if contentId or targetLanguage contains the separator. Replace the string-based membership tracking with an unambiguous key type such as a Pair for autoFired, and update both methods to use the same structured key when checking and recording fired entries.android-shared/src/androidMain/kotlin/org/siloserver/silo/common/lan/SiloCastTls.kt (1)
187-234: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winAvoid reallocating 64KB scratch buffers on every read/write/drain call.
chunkinread()is allocated even on the fast path where it's unused, anddrainOutputLocked()allocates a fresh buffer on everywrite()/flush()call. Since reads/writes run continuously on separate threads during casting, hoisting these to lock-guarded instance fields avoids per-call GC churn.♻️ Proposed fix: reuse buffers
class SiloCastTlsSession( private val socket: Socket, private val protocol: TlsServerProtocol, private val rawIn: InputStream, private val rawOut: OutputStream, ) { + private val readChunk = ByteArray(64 * 1024) + private val writeChunk = ByteArray(64 * 1024) + val input: InputStream = object : InputStream() { private val one = ByteArray(1) override fun read(): Int { val n = read(one, 0, 1) return if (n <= 0) -1 else one[0].toInt() and 0xff } override fun read(b: ByteArray, off: Int, len: Int): Int { - val chunk = ByteArray(64 * 1024) while (true) { synchronized(protocol) { if (protocol.availableInputBytes > 0) { return protocol.readInput(b, off, len) } } - val read = rawIn.read(chunk) + val read = rawIn.read(readChunk) if (read < 0) return -1 if (read == 0) continue synchronized(protocol) { - protocol.offerInput(chunk, 0, read) + protocol.offerInput(readChunk, 0, read) drainOutputLocked() } } } } ... private fun drainOutputLocked() { - val out = ByteArray(64 * 1024) while (protocol.availableOutputBytes > 0) { - val read = protocol.readOutput(out, 0, out.size) + val read = protocol.readOutput(writeChunk, 0, writeChunk.size) if (read <= 0) break - rawOut.write(out, 0, read) + rawOut.write(writeChunk, 0, read) } rawOut.flush() } }🤖 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 `@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/lan/SiloCastTls.kt` around lines 187 - 234, The read/write path in SiloCastTls is allocating new 64KB scratch buffers on every call, causing avoidable GC churn. Hoist the temporary buffers used by read() and drainOutputLocked() into reusable instance fields on the SiloCastTls stream wrapper, and reuse them under the same protocol synchronization so the fast path in read() and the output draining in write()/flush() no longer allocate per invocation.android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayer.kt (1)
1097-1113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSilently swallowed property-set failures.
Each
mpv.setPropertyStringcall here is wrapped inrunCatching { }with the result discarded, unlikesetOption()in this same class which logs failures viaLog.e. Since these values come from user-configurable subtitle appearance settings, a bad value (e.g. malformed hex color) would fail silently with no diagnostic trail.🩹 Proposed fix: log failures like `setOption` does
for ((name, value) in subtitleAppearanceToMpvProperties(appearance, nativeAssTrack = nativeAss)) { - runCatching { mpv.setPropertyString(name, value) } + runCatching { mpv.setPropertyString(name, value) } + .onFailure { e -> Log.w(TAG, "Failed to set subtitle style property: $name = $value", e) } }🤖 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 `@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayer.kt` around lines 1097 - 1113, The property updates in applySubtitleAppearance are swallowing mpv.setPropertyString failures with discarded runCatching results, so bad subtitle appearance values fail silently. Update this loop to handle the Result the same way setOption does elsewhere in MpvPlayer: keep the existing per-property iteration, but log any exception with a clear message and the property name/value context instead of ignoring it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/lan/SiloCastTls.kt`:
- Around line 173-224: The SiloCastTlsSession close path is mutating the TLS
engine without the same protocol lock used by input.read, output.write, and
output.flush, which can race concurrent access. Update
SiloCastTlsSession.close() so protocol.close() runs inside
synchronized(protocol), keeping all TlsServerProtocol interactions serialized,
then close the socket after that block.
- Around line 51-73: `SiloCastTls.accept()` leaves the accepted `Socket` open
when the TLS handshake fails, which can leak file descriptors. Update the
handshake flow so any exception thrown while using
`TlsServerProtocol`/`CastPskTlsServer` closes the socket before rethrowing,
similar to the cleanup behavior in `connect()`. Keep the timeout restoration in
place, but ensure socket cleanup happens for timeout, EOF, and malformed
ClientHello failures before returning `SiloCastTlsSession`.
In
`@shared/src/commonMain/kotlin/org/siloserver/silo/metadata/DescriptionTranslationController.kt`:
- Around line 39-68: The translate() flow in DescriptionTranslationController
can leave _phase stuck in Translating if refetchPendingLanguage(),
onTranslated(), or cancellation interrupts the polling loop. Wrap the
translate() body in a try/finally (or equivalent structured cleanup) so _phase
is always moved out of Translating on failure/cancellation, and keep the success
path setting Idle after a completed translation. Make sure the fix preserves the
existing Failed state for real translation errors while preventing the
early-return guard in translate() from blocking future calls indefinitely.
In
`@shared/src/commonMain/kotlin/org/siloserver/silo/network/HomeRealtimeClient.kt`:
- Around line 62-89: The cancellation handling in HomeRealtimeClient.connect()
is too broad because the catch-all block converts normal flow cancellation into
HomeRealtimeEvent.Closed(e.message) instead of letting it propagate. Add a
dedicated catch for CancellationException in connect() that rethrows
immediately, then keep the existing broad catch for real failures and preserve
the current Closed event behavior for non-cancellation errors.
In `@shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/HomeViewModel.kt`:
- Around line 53-69: `refreshFromRealtime()` in `HomeViewModel` is not truly
single-flight because it relies on `_uiState.value.isRefreshing`, which is only
managed by `refresh()` and not by the realtime path. Add dedicated in-flight
tracking for the realtime fetch inside `refreshFromRealtime()`/`fetchSections()`
(or reuse the same guard with a shared state) so the `refreshSignals.collect`
loop cannot start a second `viewModelScope.launch { fetchSections() }` while one
is already running.
---
Outside diff comments:
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/cast/SiloCastController.kt`:
- Around line 190-200: The stale-connection error update in SiloCastController’s
read loop is unguarded and can overwrite a newer healthy session. In the `catch
(t: Throwable)` path, update `_state.error` only when `session ===
activeSession`, matching the existing `finally` guard around
`closeConnection()`. Keep the `CancellationException` handling unchanged and
preserve the current logging in `SiloCastController`.
---
Nitpick comments:
In @.github/workflows/android-build.yml:
- Around line 5-9: Add timeout-minutes to the new unit-tests and build-debug
jobs in the Android workflow so a stuck Gradle execution cannot hold a runner
indefinitely; update the job definitions for unit-tests and build-debug directly
in the workflow while keeping their existing trigger and needs structure
unchanged.
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/lan/SiloCastTls.kt`:
- Around line 187-234: The read/write path in SiloCastTls is allocating new 64KB
scratch buffers on every call, causing avoidable GC churn. Hoist the temporary
buffers used by read() and drainOutputLocked() into reusable instance fields on
the SiloCastTls stream wrapper, and reuse them under the same protocol
synchronization so the fast path in read() and the output draining in
write()/flush() no longer allocate per invocation.
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayer.kt`:
- Around line 1097-1113: The property updates in applySubtitleAppearance are
swallowing mpv.setPropertyString failures with discarded runCatching results, so
bad subtitle appearance values fail silently. Update this loop to handle the
Result the same way setOption does elsewhere in MpvPlayer: keep the existing
per-property iteration, but log any exception with a clear message and the
property name/value context instead of ignoring it.
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyle.kt`:
- Line 80: The subtitle position check in MpvSubtitleStyle uses a fully
qualified reference inline instead of the existing import style. Add the missing
import for SubtitlePositionPreset.Bottom in MpvSubtitleStyle and update the
props["sub-use-margins"] assignment to use the imported symbol, matching the
other sibling imports in this file.
- Around line 45-53: The outline size calculation in MpvSubtitleStyle should
round instead of truncate, since `toInt()` on the `outlineSize` expression
floors values like 3.9 to 3. Update the `outlineSize` logic to round the clamped
`a.fontSize.pointSize * 0.08` result before converting it to a string, keeping
the existing `a.textOutline` guard and `props["sub-border-size"]` assignment
intact.
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt`:
- Around line 222-224: The `softwareOnlyVideoCodec` and `suppressRewind` checks
are duplicated between `MobileVideoPlaybackStarter` and
`TvVideoPlaybackStarter`, so extract the shared play-method/codec capability
logic into a small helper in the shared player/video area near
`isMpvSoftwareDecodableVideoCodec`. Update both call sites to use that helper so
the start-over and software-codec behavior stays in sync and only needs to be
changed in one place.
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/AccountSection.kt`:
- Around line 131-137: The Admin entry in AccountSection is visually too similar
to Manage Sessions because it reuses the same Security icon and gray badge.
Update the SettingsRowLabel call for the Admin row to use a distinct icon via
the existing onAdmin block, preferably a more specific admin symbol such as
AdminPanelSettings, while keeping the rest of the row behavior unchanged.
In
`@androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/home/TvHomeScreen.kt`:
- Around line 42-51: The TvHomeScreen Compose block uses fully-qualified
references instead of imports, which is inconsistent with the file’s idiomatic
style. Update the imports for LocalLifecycleOwner, DisposableEffect,
LifecycleEventObserver, and Lifecycle.Event.ON_RESUME, then use the unqualified
symbols in the lifecycle observer setup inside TvHomeScreen. Keep the existing
refreshFromRealtime behavior unchanged.
In `@shared/src/commonMain/kotlin/org/siloserver/silo/cast/SiloCastMessage.kt`:
- Around line 186-203: The companion object command constants in SiloCastMessage
use PascalCase, which violates the camelCase property naming rule. Rename the
const val properties in SiloCastMessage.Companion (such as Play, Pause,
PlayPause, Seek, Stop, SelectAudioTrack, SetPlaybackSpeed, and PlayNext) to
camelCase, and update all references/call sites accordingly so the API remains
consistent.
In
`@shared/src/commonMain/kotlin/org/siloserver/silo/metadata/DescriptionTranslationController.kt`:
- Around line 71-76: The auto-fire tracking in DescriptionTranslationController
uses a concatenated string key in shouldAutoFire and markAutoFired, which can
collide if contentId or targetLanguage contains the separator. Replace the
string-based membership tracking with an unambiguous key type such as a Pair for
autoFired, and update both methods to use the same structured key when checking
and recording fired entries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 20d5e436-e08a-4570-b387-3d61d6e1d630
📒 Files selected for processing (101)
.github/workflows/android-build.ymlAGENTS.mdFEATURES.mdREADME.mdandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/cast/SiloCastNsdAdvertiser.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/repository/RoomUserItemStateRepository.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/downloads/DownloadSubscriptionWorker.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/lan/SiloCastTls.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackCapabilityDetector.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackRecoveryPlanner.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendRequest.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendSelector.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayer.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyle.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/MpvSoftwareVideoCodecs.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/PlaybackContainerPolicy.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackSessionCoordinator.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackStartResult.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlayerUiState.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/data/repository/LatestProgressTest.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/downloads/DownloadSubscriptionScopeTest.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/PlaybackRecoveryPlannerTest.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/StyledSubtitleBurnInTest.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/MpvSoftwareVideoCodecPolicyTest.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/backend/VideoPlaybackBackendSelectorTest.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/mpv/MpvSubtitleStyleTest.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/video/PlaybackContainerPolicyTest.ktandroidApp/src/androidMain/AndroidManifest.xmlandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/SiloApplication.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/cast/SiloCastController.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/di/AndroidModule.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/downloads/AppWorkerFactory.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/home/HomeRealtimeForegroundStarter.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/Routes.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/MainScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/cast/SiloCastRemoteScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/DescriptionTranslationSection.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/DetailSharedComponents.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/ItemDetailScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/ItemDetailViewModel.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/MovieDetailContent.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/SeriesDetailContent.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/reader/EpubReader.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/reader/FictionBookReader.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/reader/TextReader.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/AccountSection.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SettingsScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SettingsViewModel.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SubtitleSettings.ktandroidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/navigation/ClientSurfaceVisibilitySourceTest.ktandroidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/admin/AdminEntryViewModelTest.ktandroidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/detail/MobileDetailActionsSourceTest.ktandroidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/reader/FictionBookReaderTest.ktandroidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/reader/ReaderEngineHostSourceTest.ktandroidTvApp/src/androidMain/AndroidManifest.xmlandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/MainTvActivity.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/SiloTvApplication.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/cast/TvSiloCastPlayerAdapter.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/cast/TvSiloCastReceiver.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/di/AndroidTvModule.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/home/HomeRealtimeForegroundStarter.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvDescriptionTranslationSection.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvDetailHero.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvItemDetailScreen.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvItemDetailViewModel.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/home/TvHomeScreen.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerRemoteKeyAction.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/TvSettingsScreen.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/TvSettingsViewModel.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.ktandroidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerRemoteKeyActionTest.ktshared/src/commonMain/kotlin/org/siloserver/silo/cast/SiloCastMessage.ktshared/src/commonMain/kotlin/org/siloserver/silo/di/NetworkModule.ktshared/src/commonMain/kotlin/org/siloserver/silo/di/RepositoryModule.ktshared/src/commonMain/kotlin/org/siloserver/silo/metadata/DescriptionTranslationController.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/admin/AdminClientPolicy.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/catalog/CatalogModels.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/feature/MetadataAiFeatureStore.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/metadata/MetadataAiModels.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackModels.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackStartPosition.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/profile/ProfileModels.ktshared/src/commonMain/kotlin/org/siloserver/silo/network/HomeRealtimeClient.ktshared/src/commonMain/kotlin/org/siloserver/silo/network/api/MetadataAiApi.ktshared/src/commonMain/kotlin/org/siloserver/silo/repository/HomeRealtimeCoordinator.ktshared/src/commonMain/kotlin/org/siloserver/silo/repository/MetadataAiRepository.ktshared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/HomeViewModel.ktshared/src/commonTest/kotlin/org/siloserver/silo/cast/SiloCastMessageTest.ktshared/src/commonTest/kotlin/org/siloserver/silo/metadata/DescriptionTranslationControllerTest.ktshared/src/commonTest/kotlin/org/siloserver/silo/model/admin/AdminClientPolicyTest.ktshared/src/commonTest/kotlin/org/siloserver/silo/model/feature/MetadataAiFeatureStoreTest.ktshared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackStartOverTest.ktshared/src/commonTest/kotlin/org/siloserver/silo/network/HomeRealtimeDecodeTest.kt
💤 Files with no reviewable changes (5)
- androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/reader/TextReader.kt
- androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/reader/FictionBookReaderTest.kt
- androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/reader/FictionBookReader.kt
- androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/reader/ReaderEngineHostSourceTest.kt
- androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/reader/EpubReader.kt
- SiloCastTls.accept() closes the socket on handshake failure so a LAN probe storm can't leak file descriptors (connect() already did) - SiloCastTlsSession.close() takes the protocol lock like every other engine access, so teardown can't race a concurrent read/write - DescriptionTranslationController resolves the Translating phase on throwing refetch/onTranslated (Failed) and on cancellation (Idle + rethrow) instead of stranding the single-flight latch; regression test - HomeViewModel.refreshFromRealtime() is actually single-flight via an in-flight guard (isRefreshing is only set by manual refresh) - HomeRealtimeClient rethrows CancellationException ahead of the broad catch so flow cancellation propagates instead of becoming Closed Co-Authored-By: Claude Fable 5 <[email protected]>
Review-body follow-ups: the controller's old read loop could outlive a reconnect and clobber the fresh session's state with its stale error — now guarded like closeConnection(). The TLS session also reallocated 64KB scratch buffers on every read/drain in the streaming hot path; they're hoisted (reader is single-consumer, drain buffer only touched under the protocol lock). Remaining style nitpicks (FQN imports, constant casing, icon reuse) intentionally skipped. Co-Authored-By: Claude Fable 5 <[email protected]>
media3 1.10.1, navigation 2.9.8, work 2.11.2, datastore 1.2.1, lifecycle 2.10.0, activity-compose 1.12.4, security-crypto 1.1.0 (off the alpha), bouncycastle 1.84, zxing 3.5.4, robolectric 4.16.1. BouncyCastle 1.84 ships duplicate OSGi manifests under META-INF/versions/17 — the packaging exclusion is now version-glob. Deliberately deferred to a coordinated toolchain branch: Kotlin 2.4 + KSP + Compose Multiplatform 1.11 + AGP 9.2 (breaking major) + Ktor 3.5 + coroutines/serialization 1.11 + Koin 4.2 (needs Kotlin 2.2+ metadata) + lifecycle 2.11/activity 1.13 (need AGP 9.1) + tv-compose 1.1.0. Full unit suite green; both debug APKs assemble. Co-Authored-By: Claude Fable 5 <[email protected]>
Sync/data: - Outbox: a malformed payload is dropped terminally per-op instead of rethrowing and permanently stalling the entire scope's sync (HIGH) - Token reads verify the cache against the live registry id so a direct ServerRegistry.switchTo() can't send server A credentials to server B - ConflictPolicy tolerates bounded clock skew so a backward-skewed device doesn't see its own edits reverted on refresh - latestProgress gains a deterministic final tiebreak (fileId) - Home realtime reconnect observes ProfileRepository.profileSwitches instead of piggybacking on the notifications reset signal Downloads: - Subscription evaluations are globally serialized (periodic worker and manual run live in different WorkManager namespaces and could overlap, double-downloading episodes); the periodic worker also aborts on a mid-run server/profile switch - DownloadWorker's in-memory UI pushes are scope-guarded so a background scope's worker can't paint progress onto the wrong scope's records - Reclaim Watched excludes the file the player is currently using (ActivePlaybackFile tracker; reachable via PiP -> Downloads) Playback: - MPV resumes after transient audio-focus loss (the resume guard read playWhenReady after it was already zeroed — playback stayed paused forever after any notification sound) and no longer arms auto-resume on permanent loss (HIGH) - MPV subtitle styling re-applies on subtitle track switches so ASS<->SRT changes re-evaluate the native-ASS override - An audio switch that forces a server transcode resumes at the request cut point instead of the original start, and keeps the playback plan - TV gains the phone's one-shot engine-switch-failure guard Cast/LAN: - Goodbye frames go through the session write mutex (no more torn frames against the 500ms state pusher) and off the receiver monitor (HIGH) - Session epochs: handshakes in flight across a server switch or newer accept can no longer register as the active controller - Phone controller connect/teardown is serialized behind a mutex - NSD: lost-service removal matches the mDNS instance name; serviceType comparison tolerates Android's trailing-dot form - Receiver start no longer races a quick background into advertising UI/lifecycle: - TV deep links and phone notification routes are queued until the authenticated graph is showing instead of pushing over Login - TV account/admin header keeps its previous snapshot on transient /me failures instead of flickering out - Feature-store generation guards are volatile; reflow WebView drops post-dispose JS callbacks; cold-start filesystem/health checks moved off the main dispatcher Full suite green; both debug APKs assemble. Co-Authored-By: Claude Fable 5 <[email protected]>
Adversarial self-review of the 23-fix commit:
- ActivePlaybackFile.set() was only called in the transcode-recovery
fallback, leaving the Reclaim-Watched guard INERT on normal/offline
playback (the exact scenario it protects). Now mirrored from every
load path via a uiState observer on both phone and TV VMs. (HIGH)
- SiloCastTls.close() took the protocol monitor before closing the
socket; a write blocked on a frozen-but-open peer (no socket write
timeout) deadlocked teardown forever. Close the socket first. (MED)
- getProfileToken() missed the ensureCacheMatchesRegistryLocked() guard
its siblings got, so realtime/player callers could send server A's
profile token to server B across a direct switchTo(). (MED)
- TvSiloCastReceiver: bump sessionEpoch unconditionally (a handshake in
flight during a switch, activeSession still null, could register); and
stop() now closes the session directly so its goodbye isn't cancelled.
- Phone deep-link gate completed to the full pre-auth route set (was an
incomplete blacklist vs TV's Main-graph whitelist).
Ship-UX audit:
- TV Home: focusedRowIndex no longer keyed on `rows`, so a quiet realtime
/ on-resume refetch can't reset focus to the menu bar. (BLOCKER)
- Phone metadata-language setting stored display labels ("English") where
the server expects ISO 639-1 ("en"), making the whole new phone surface
dead — now stores codes with a label map, matching TV. (BLOCKER)
- TV "Translate description" keeps a disabled focusable button while
translating so pressing it doesn't bounce D-pad focus to the hero.
- Phone AdminStats surfaces refresh failures via snackbar; TvAdminScreen
gains an explicit empty-state retry branch.
- SiloCast remote: misleading fake-tappable error chip -> plain error text.
Full unit suite green (--rerun-tasks); both release APKs build under R8
with serializers intact.
Co-Authored-By: Claude Fable 5 <[email protected]>
Informational-only note in the server-add flow (phone + TV) when the entered address resolves to plaintext HTTP — an explicit http scheme or http:// prefix. Never blocks connecting: LAN/plain-IP servers still work exactly as before (the whole point of the cleartext opt-in). Auto mode isn't pre-warned since it tries HTTPS first. Pure helper, unit-tested on both platforms. Addresses the security review's cleartext finding without re-breaking plain-IP connectivity. Co-Authored-By: Claude Fable 5 <[email protected]>
The phone setup screen's port placeholder said 8096 — Jellyfin's port, relevant only to the jellycompat layer. Silo clients talk to the server directly on 8090 (matching DefaultSiloServerPort and the Auto-mode probe candidate). Test fixtures aligned. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/sync/SyncEngine.kt (1)
90-102: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winCatching
Throwablealso swallowsErrorsubclasses.Converting any
Throwable— includingOutOfMemoryError/StackOverflowError— into a silently-dropped op could mask serious runtime failures behind a normal-looking drop count. Consider narrowing toExceptionso unrecoverable JVM errors still propagate.Proposed narrowing
val outcome = try { dispatch(op, scope) } catch (e: kotlinx.coroutines.CancellationException) { throw e - } catch (t: Throwable) { + } catch (t: Exception) { android.util.Log.w("SyncEngine", "op ${op.id} (${op.opKind}) failed to dispatch; dropping", t) WriteOutcome.TERMINAL }🤖 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 `@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/sync/SyncEngine.kt` around lines 90 - 102, The try/catch in SyncEngine.dispatchOutcome handling is too broad because it catches Throwable and can swallow unrecoverable Error types. Narrow the non-cancellation catch in SyncEngine so only recoverable exceptions are treated as terminal drops, while fatal JVM errors still propagate; keep the CancellationException rethrow path unchanged and update the android.util.Log.w fallback around dispatch(op, scope) accordingly.androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SubtitleSettings.kt (1)
8-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider hoisting
metadataLanguageOptionsto a shared module.The comment already flags this list must stay "in lockstep with the TV list" — moving it into
android-shared/shared/commonMain(alongside the similar subtitle-language options) would eliminate the manual-sync risk between phone and TV instead of relying on convention.🤖 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 `@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SubtitleSettings.kt` around lines 8 - 22, Move metadataLanguageOptions out of SubtitleSettings into a shared source set/module used by both Android and TV so the list is defined once with the existing subtitle-language options. Update the SubtitleSettings screen to consume the shared constant instead of its own local copy, and ensure the shared location uses the same symbols/shape as the current metadataLanguageOptions list.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/downloads/DownloadWorker.kt`:
- Around line 69-73: `uiPushAllowed()` is letting `scope()` exceptions flow into
`doWork()` and even into the error-handling path, which can turn a transient
UI-scope lookup failure into a download failure or crash. Update
`uiPushAllowed()` in `DownloadWorker` to catch failures from
`activeScope`/`scope()` and treat them as “not allowed” (or otherwise skip UI
pushing), so the download’s main success/failure logic stays independent. Also
make sure the `doWork()` catch path that re-checks UI push behavior uses the
same safe helper and cannot throw from `scope()`.
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SettingsViewModel.kt`:
- Around line 71-73: The comment on SettingsViewModel.metadataLanguage is stale
and still mentions the old "Off" sentinel, which no longer matches the actual
empty-string default. Update the nearby metadataLanguage documentation to
describe "" as the server/library default (or remove the outdated line entirely)
so the comment matches the current behavior.
---
Nitpick comments:
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/sync/SyncEngine.kt`:
- Around line 90-102: The try/catch in SyncEngine.dispatchOutcome handling is
too broad because it catches Throwable and can swallow unrecoverable Error
types. Narrow the non-cancellation catch in SyncEngine so only recoverable
exceptions are treated as terminal drops, while fatal JVM errors still
propagate; keep the CancellationException rethrow path unchanged and update the
android.util.Log.w fallback around dispatch(op, scope) accordingly.
In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SubtitleSettings.kt`:
- Around line 8-22: Move metadataLanguageOptions out of SubtitleSettings into a
shared source set/module used by both Android and TV so the list is defined once
with the existing subtitle-language options. Update the SubtitleSettings screen
to consume the shared constant instead of its own local copy, and ensure the
shared location uses the same symbols/shape as the current
metadataLanguageOptions list.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b174269-3da8-4d34-bd8d-9602c3a3f121
📒 Files selected for processing (50)
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/cast/SiloCastNsdBrowser.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/repository/RoomUserItemStateRepository.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/sync/ConflictPolicy.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/sync/SyncEngine.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/downloads/DownloadSubscriptionEvaluator.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/downloads/DownloadSubscriptionWorker.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/downloads/DownloadWorker.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/lan/SiloCastTls.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/ActivePlaybackFile.ktandroid-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/mpv/MpvPlayer.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/data/sync/ConflictPolicyTest.ktandroid-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/data/sync/SyncEngineTest.ktandroidApp/build.gradle.ktsandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/MainActivity.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/SiloApplication.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/cast/SiloCastController.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/downloads/AppWorkerFactory.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/home/HomeRealtimeForegroundStarter.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/admin/AdminStatsScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/cast/SiloCastRemoteScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/downloads/DownloadsViewModel.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/reader/reflow/ReflowWebView.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SettingsViewModel.ktandroidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SubtitleSettings.ktandroidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/packaging/AndroidAppPackagingTest.ktandroidTvApp/build.gradle.ktsandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/MainTvActivity.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/SiloTvApplication.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/cast/TvSiloCastReceiver.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/home/HomeRealtimeForegroundStarter.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/components/TvSkylineSectionFeed.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/navigation/TvAppNavigation.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/admin/TvAdminScreen.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvDescriptionTranslationSection.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.ktandroidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.ktandroidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/components/TvSkylineSectionFeedSourceTest.ktgradle/libs.versions.tomlshared/src/androidMain/kotlin/org/siloserver/silo/network/EncryptedTokenManagerImpl.ktshared/src/commonMain/kotlin/org/siloserver/silo/metadata/DescriptionTranslationController.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/feature/MetadataAiFeatureStore.ktshared/src/commonMain/kotlin/org/siloserver/silo/model/feature/RequestsFeatureStore.ktshared/src/commonMain/kotlin/org/siloserver/silo/network/HomeRealtimeClient.ktshared/src/commonMain/kotlin/org/siloserver/silo/repository/ProfileRepository.ktshared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/HomeViewModel.ktshared/src/commonTest/kotlin/org/siloserver/silo/metadata/DescriptionTranslationControllerTest.kt
🚧 Files skipped from review as they are similar to previous changes (15)
- androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/cast/SiloCastRemoteScreen.kt
- shared/src/commonMain/kotlin/org/siloserver/silo/model/feature/MetadataAiFeatureStore.kt
- androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/SiloTvApplication.kt
- androidApp/src/androidMain/kotlin/org/siloserver/silo/android/SiloApplication.kt
- androidApp/src/androidMain/kotlin/org/siloserver/silo/android/home/HomeRealtimeForegroundStarter.kt
- shared/src/commonMain/kotlin/org/siloserver/silo/network/HomeRealtimeClient.kt
- androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvDescriptionTranslationSection.kt
- androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
- android-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/repository/RoomUserItemStateRepository.kt
- shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/HomeViewModel.kt
- shared/src/commonMain/kotlin/org/siloserver/silo/metadata/DescriptionTranslationController.kt
- android-shared/src/androidMain/kotlin/org/siloserver/silo/common/downloads/DownloadSubscriptionWorker.kt
- android-shared/src/androidMain/kotlin/org/siloserver/silo/common/lan/SiloCastTls.kt
- androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/cast/TvSiloCastReceiver.kt
- androidApp/src/androidMain/kotlin/org/siloserver/silo/android/cast/SiloCastController.kt
- DownloadWorker.uiPushAllowed() wraps the active-scope resolution in runCatching: it runs inside doWork()'s outer catch, so a throw there would escape uncaught and could abort a healthy download. A resolution failure now means "not the active scope" (skip the UI push), which is the safe default. - Drop a stale comment line referencing the old "Off" metadata-language sentinel (the field now uses ""). Co-Authored-By: Claude Fable 5 <[email protected]>
Summary
One branch covering three arcs: the reported v0.2.5 player regressions, the Apple-parity feature sweep (SiloCast wire compat, metadata AI, live home refresh, MPV subtitle styling, admin dashboard), and closure of the playback capability gaps vs the Apple clients. Everything is client-only and safe against stock servers; all changes are additive with the existing fallback ladder intact.
Player fixes (user-reported)
rearmAutoHideOnFocusMoveparity), and D-pad Left/Right fall through to focus navigation while the overlay or Up Next is visible. Hidden-controls Left/Right = seek is preserved.0.0override is treated as start-from-beginning (Apple models this asstartFromBeginning) and honored verbatim after session resolution.Apple parity
silo-cast-v1), Apple's JSON envelope and command names, hello/serverId authorization + watchdog, heartbeat, 500ms state cadence, graceful close frames, Apple TXT records. Protocol pinned by golden-JSON tests. Cross-device interop (iPhone↔Android TV) still needs an on-device pass./metadata/ai/statuscapability store, POST-then-poll controller on Apple's backoff schedule, detail-screen affordances (button + once-latched auto), metadata-language profile setting on both platforms.user_state+catalog) with 2s debounce, foreign-profile filtering, foreground-gated lifecycle; TV Home gains an on-resume refresh (previously had no freshness path at all).SubtitleAppearancenow translates to MPVsub-*properties (box/shadow/outline/position per Apple's semantics); authored ASS stays as-authored (sub-ass-override=no).Playback capability gaps closed
Infrastructure
DownloadSubscriptionWorkerperiodic scheduling (background monitored downloads never ran before).Testing
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes