Skip to content

fix(phone): stop in-place reload from writing progress under the next episode - #251

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-fa78
Draft

fix(phone): stop in-place reload from writing progress under the next episode#251
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-fa78

Conversation

@cursor

@cursor cursor Bot commented Aug 27, 2026

Copy link
Copy Markdown

Bug and impact

During an in-place phone player reload (auto-advance, On Deck, version switch), backing out while the next item is still loading could persist the previous episode's timestamp under the next episode's content id.

Concrete trigger: watch episode A, auto-play starts loading episode B, hit Back during the loading spinner. Episode B then resumes at episode A's position.

Root cause

publishLoadingState retargets contentId immediately but leaves position and versions on the previous item until Ready. onExit submitted finalPlaybackPositionWriter using that mix of identities.

onPositionChanged already ignores samples while positionReportsBlockedForPendingLoad is set. PR #241 guards the matching hole in onPlayingChanged. This is the remaining durable-write sink on the same transition.

Fix

Remember the last Ready (contentId, fileId) and, when a load is still pending, attribute the exit write to that identity instead of the loading target. Same-content recovery still writes the previous item correctly rather than dropping the snapshot.

Validation

  • PlayerViewModelLoadOwnershipIntegrationTest.exitDuringInPlaceReloadWritesPreviousItemNotTheLoadingTarget
  • PlayerViewModelLoadOwnershipIntegrationTest.exitAfterReadyStillWritesCurrentProgress
  • MobilePlayerLifecyclePerformanceSourceTest (teardown source contract still holds)

Test plan

  • Auto-advance to the next episode and press Back during the loading spinner; the next episode must not inherit the previous timestamp
  • Watch a title to a non-zero position and leave the player normally; progress still saves
  • Version switch, then Back during reload; the previous version keeps its last position
Open in Web View Automation 

publishLoadingState retargets contentId immediately on in-place reloads
(auto-advance, On Deck, version switch) while position and versions still
belong to the previous item. onExit then persisted that timestamp under
the next episode's id.

Keep the last Ready (contentId, fileId) and use it for the durable write
while a load is still pending.

Co-authored-by: Quick <Quick104@users.noreply.github.com>
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