Skip to content

Fix resume loss (0-position clobber) + phone Continue Watching? dialog - #54

Merged
RXWatcher merged 2 commits into
Silo-Server:mainfrom
RXWatcher:fix/resume-loss-and-continue-watching
Jul 10, 2026
Merged

RXWatcher merged 2 commits into
Silo-Server:mainfrom
RXWatcher:fix/resume-loss-and-continue-watching

Conversation

@RXWatcher

@RXWatcher RXWatcher commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Two item-detail playback fixes from Jim's on-device QA (2026-07-10).

① Resume loss — phone + TV (root-cause fix)

RoomUserItemStateRepository.recordPosition accepted a 0.0 position and blindly upserted it (fresh clientUpdatedAtMs, no monotonic guard), overwriting a good resume row locally and enqueuing SET_POSITION=0 to the server. On player teardown the final recordPosition snapshots _uiState.position, which is 0 in the race where the player was already reset/released — so backing out of a title and returning showed "Play" instead of "Resume."

Fix: reject positionSeconds <= 0 on the progress path. Reads already treat 0 as "no resume," and real resets go through markUnwatched (a separate API), so nothing legitimate breaks. One shared-store change fixes both clients. Added a regression test that a 0 write can't wipe a good resume.

② Phone "Continue Watching?" dialog — iOS parity

The phone detail hero had a single Resume button that always resumed, with no way to start over. iOS offers a resume-vs-restart dialog; ported it:

  • Play label is now neutral ("Play" / "Play S·E"), matching iOS.
  • When there's resume progress, tapping it opens a "Continue Watching?" dialog (Resume / Play from Beginning, with "You stopped at 12:34.").
  • Mirrors silo-apple ViewExtensions.continuumResumePlaybackAlert + MovieDetailContent.swift.

(Android TV already had a dedicated "Start Over" button — unchanged.)

Deviation from iOS: the dialog uses Material3's two-button form (Resume / Play from Beginning) with cancel via tap-outside/back, rather than an explicit Cancel button — the idiomatic Android pattern.

Verification

  • ./gradlew :androidApp:assembleDebug :androidTvApp:assembleDebug test — BUILD SUCCESSFUL, tests pass (incl. new recordPositionZeroDoesNotClobberAnExistingResume and updated DetailPlayLabelTest).
  • Not yet installed on-device.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a “Continue Watching?” prompt when resuming movies or episodes.
    • Users can choose to resume playback or play from the beginning.
    • The prompt displays where playback was last stopped.
  • Bug Fixes

    • Prevented zero-second progress updates from overwriting valid resume positions.
    • Updated playback buttons to use neutral “Play” labels while offering resume choices separately.

… Watching? dialog

Two detail-screen playback fixes from Jim's QA (2026-07-10).

Resume loss (phone + TV): RoomUserItemStateRepository.recordPosition accepted a
0.0 position and blindly upserted it (fresh timestamp, no monotonic guard),
overwriting a good resume row locally AND enqueuing SET_POSITION=0 to the
server. On player teardown the final recordPosition snapshots _uiState.position,
which is 0 in the race where the player was already reset/released — so backing
out of a title and returning showed "Play" instead of "Resume". Reject
positionSeconds <= 0 (reads already treat 0 as "no resume", and real resets go
through markUnwatched, not this path). Fixes both clients via the shared store.

Phone Start Over parity: the phone detail hero had a single Resume button that
always resumed, with no way to restart — iOS offers a "Continue Watching?"
dialog (Resume / Play from Beginning). Ported it: the play label is now neutral
("Play" / "Play S·E"), and when there's resume progress tapping it opens the
dialog. Mirrors silo-apple ViewExtensions.continuumResumePlaybackAlert. (TV
already had a Start Over button.)

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@RXWatcher, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b7367750-2f02-41f2-a8e5-7c9053d38d17

📥 Commits

Reviewing files that changed from the base of the PR and between b0154d3 and 27c3553.

📒 Files selected for processing (1)
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/ItemDetailScreen.kt
📝 Walkthrough

Walkthrough

The change prevents zero-position resume writes and adds a resume confirmation flow to Android detail screens. Users can resume or play from the beginning, with neutral play labels and formatted stopped-at text.

Changes

Resume playback behavior

Layer / File(s) Summary
Zero-position persistence guard
android-shared/src/androidMain/.../RoomUserItemStateRepository.kt, android-shared/src/androidUnitTest/.../RoomUserItemStateRepositoryTest.kt
recordPosition ignores zero positions, preserving existing resume data and queued outbox payloads.
Resume confirmation dialog
androidApp/src/androidMain/.../DetailSharedComponents.kt
HeroActionStack presents Resume and Play from Beginning actions and formats stopped-at timestamps.
Detail-screen resume wiring
androidApp/src/androidMain/.../ItemDetailScreen.kt, androidApp/src/androidMain/.../MovieDetailContent.kt, androidApp/src/androidMain/.../SeriesDetailContent.kt
Movie and series screens derive resume positions and forward restart callbacks and labels to the action stack.
Neutral play labels
androidApp/src/androidMain/.../DetailSharedComponents.kt, androidApp/src/androidUnitTest/.../DetailPlayLabelTest.kt
Episode labels use neutral Play wording, with updated test expectations.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ItemDetailScreen
  participant MovieDetailContent
  participant HeroActionStack
  ItemDetailScreen->>MovieDetailContent: pass resume position and restart callback
  MovieDetailContent->>HeroActionStack: configure play actions
  HeroActionStack->>HeroActionStack: display Continue Watching dialog
  HeroActionStack-->>ItemDetailScreen: invoke Resume or Play from Beginning
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the two main changes: fixing zero-position resume clobbering and adding the phone Continue Watching dialog.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0154d353a

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

Comment on lines +495 to +496
val seriesResume = nextEpisode?.let { playbackResumePosition(it) }
?: playbackResumePosition(detail.userData)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid falling back to series progress for the dialog

When a series has a nextEpisode but that episode has no resumable position, this fallback can still make seriesResume non-null from detail.userData. In that scenario the hero opens a "Continue Watching?" dialog and displays the series-level stopped time, but the Resume action still launches nextEpisode with playbackResumePosition(it) (null), so Resume and Play from Beginning both start the next episode at 0. Only use the detail-level fallback when there is no nextEpisode, or make the Resume action use the same progress source.

Useful? React with 👍 / 👎.

…el fallback

Codex P2 on PR #54: seriesResume fell back to detail.userData when nextEpisode
existed but had no resume, so the Continue Watching? dialog could show a
series-level "stopped at" time while Resume launched the episode at 0 (both
buttons started from the beginning). Match the Resume action's source: when
nextEpisode exists, key the dialog off its own progress only.

Co-Authored-By: Claude Fable 5 <[email protected]>
@RXWatcher
RXWatcher merged commit 9100f9f into Silo-Server:main Jul 10, 2026
2 checks passed
@RXWatcher
RXWatcher deleted the fix/resume-loss-and-continue-watching branch July 13, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant