Skip to content

feat(ios): split autoplay next video from the suggestion setting - #225

Merged
altaywtf merged 3 commits into
nextfrom
feat/autoplay-next-video
Sep 12, 2026
Merged

altaywtf merged 3 commits into
nextfrom
feat/autoplay-next-video

Conversation

@altaywtf

@altaywtf altaywtf commented Sep 12, 2026

Copy link
Copy Markdown
Member

Problem

iOS derived both the Up Next suggestion and autoplay from the account's next_episode setting. The web app treats them separately: the suggestion follows the account setting, autoplay follows the per-user config key autoplay_next_video (default off). The remaining #132 criteria also lacked proof for the manual play-next path, offline successors, and VoiceOver labels.

Solution

  • PutioAppConfigModel (tab-shell owned) loads the config document through runtime.appConfig() and saves through setAutoplayNextVideo. The local value flips only after the server acknowledges; a failed save keeps the authoritative value with a retry, and a failed load offers a reload. A load already in flight is awaited rather than duplicated.
  • Playback Preferences gains a "Next video" section with the autoplay toggle; its footer states when suggestions are off in the account settings.
  • PutioNextVideoModel shows the suggestion first, then awaits the autoplay policy. The app's policy (resolveAutoplayNextVideo) joins a config load still in flight, or starts one when nothing loaded, so a document that arrives after playback ends still counts. Manual play and cancel while the policy settles win over a late autoplay. With autoplay off the suggestion stays with its manual play and cancel actions.
  • Successor lookup: the server owns the order; when it cannot answer, PutioOfflineQueue.nextVideo(after:) returns the next downloaded video in the same folder by name, so a finished download still advances offline. A server answer of "none" never consults the queue.
  • Successor resolution prefers PutioOfflineQueue.localSource(for:), so a downloaded successor plays from its local file with its locally recorded position.
  • The seeded fixture serves autoplay_next_video (on for the recorded journey; persisted production default off under the playback-preferences fixture with one failed save for retry proof).

Proof

  • Unit: AppConfigModelTests, PutioNextVideoModelTests, PutioVideoPlaybackModelTests, OfflineDownloadsTests cover the late config load (arrives true → autoplay, false → suggestion only, cancel/manual play during the wait), the offline successor fallback (queue answers only after a failed server lookup, never after a cancelled one or a definitive "none"), and the queue's folder-name ordering among downloaded videos.
  • Journey: the playback-preferences preflight opens the root video with autoplay off, asserts the reset drained before the suggestion, checks the VoiceOver labels on title/play/cancel, waits past the countdown without a transition, plays the successor manually at its saved position (37 s), then proves the toggle's failed save and retry and its persistence across relaunch. The recorded loop keeps proving autoplay.
  • Local on the rebased head: mise run harness -- test --platform ios (404 feature tests, 0 failures), mise run harness -- journey --platform ios --scenario files-browser (1/1), mise run verify (exit 0). Earlier captures: runtime-playback-preferences.png and runtime-playback.png.

Refs #132

Copilot AI lite review requested due to automatic review settings September 12, 2026 15:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-12T19:48:37.215945Z f61c38f New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI 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.

🟡 Changes recommended

There are correctness/reliability issues in the updated UI copy and UI test flow that should be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Splits iOS “Up Next” suggestion enablement (account setting) from autoplay behavior (per-user config key autoplay_next_video), aligning with the web app contract and extending harness proof to cover manual play-next, offline successors, and VoiceOver labels.

Changes:

  • Introduces PutioAppConfigModel to load/save the config-backed autoplay flag, and wires it through the tab shell and Playback Preferences UI.
  • Updates next-video playback behavior to read autoplay policy at suggestion time and prefer offline successor playback sources.
  • Expands unit/UI/harness coverage and documentation to prove manual-next, retry behavior, and accessibility labels.
File summaries
File Description
Tools/PutioHarness/Sources/PutioHarnessKit/SimulatorHarness.swift Increases playback-preferences journey time allowance to reduce harness timeouts.
Tools/PutioHarness/Sources/PutioHarnessKit/Models.swift Updates the harness test identifier to match the renamed UI test.
Tests/iOSUITests/Sources/PlaybackPreferencesJourneyTests.swift Extends the Playback Preferences journey to prove manual-next (autoplay off), retry, and persistence.
Tests/iOS/Sources/PutioVideoPlaybackModelTests.swift Adds coverage ensuring local successor playback doesn’t trigger online resolution.
Tests/iOS/Sources/PutioNextVideoModelTests.swift Adds coverage for late-loaded autoplay policy and offline successor resolution.
Tests/iOS/Sources/AppConfigModelTests.swift Adds unit tests for config load/save/retry semantics and authoritative-value behavior.
docs/HARNESS.md Updates harness journey documentation to reflect new autoplay/manual-next proof steps.
Apps/Shared/Sources/HarnessSeededAPI.swift Extends seeded config endpoints/fixtures to serve and persist autoplay_next_video with retry proof.
Apps/iOS/Sources/VideoPlayback.swift Changes autoplay input from a Bool to a policy closure passed into PutioNextVideoModel.
Apps/iOS/Sources/VideoNext.swift Reads autoplay policy at suggestion time and adds resolveSuccessorSource to prefer offline sources.
Apps/iOS/Sources/PutioApp.swift Instantiates/loads PutioAppConfigModel, injects into settings and playback, and prefers offline successor sources.
Apps/iOS/Sources/PlaybackPreferencesView.swift Adds a “Next video” section with config-backed autoplay toggle + retry UI.
Apps/iOS/Sources/AppConfigModel.swift New app-owned model for config document loading and saving autoplay_next_video.
Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Tests/iOSUITests/Sources/PlaybackPreferencesJourneyTests.swift
Comment thread Apps/iOS/Sources/PlaybackPreferencesView.swift
@altaywtf

Copy link
Copy Markdown
Member Author

Final proof on 6f4c39e (rebased on next 08eaecc): local mise run verify passed, harness journey --platform ios --scenario files-browser --run-id wt-132b passed 1/1 with a manifest, and slopguard (cursor-grok-4.6-high, branch mode) reported clean.

@altaywtf
altaywtf force-pushed the feat/autoplay-next-video branch from 6f4c39e to 5240a96 Compare September 12, 2026 16:37

@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: 5240a96a3c

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

Comment thread Apps/iOS/Sources/PutioApp.swift
Comment thread Apps/iOS/Sources/VideoNext.swift Outdated
Autoplay reads the per-user config document (autoplay_next_video) through
a config model owned by the tab shell; the suggestion keeps following the
account setting. Playback Preferences gains the toggle with failed-save
retry and reload recovery. A downloaded successor plays from its local
source. The seeded preferences journey proves the manual play-next path
with autoplay off, the toggle's retry, and persistence across relaunch.

Refs #132
…in the queue

The end-of-video decision awaits a config load still in flight, or starts
one when nothing loaded, so a late document still enables autoplay. When
the server cannot answer the successor lookup, the next downloaded video
in the same folder comes from the offline queue.

Copilot AI 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.

🟢 Approval recommended

The behavior split is implemented end-to-end with updated UI, harness fixtures, and comprehensive unit/journey coverage for the new autoplay and offline-successor flows.

Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@altaywtf
altaywtf merged commit a7481f6 into next Sep 12, 2026
2 checks passed
@altaywtf
altaywtf deleted the feat/autoplay-next-video branch September 12, 2026 20:03
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.

2 participants