Skip to content

Offer related entries when you complete something (#103) - #224

Merged
zhollis21 merged 4 commits into
mainfrom
feature/103-up-next-related-entries
Nov 21, 2026
Merged

zhollis21 merged 4 commits into
mainfrom
feature/103-up-next-related-entries

Conversation

@zhollis21

Copy link
Copy Markdown
Owner

Closes #103.

Completing an entry now opens an Up Next sheet with its sequels, side stories, spin-offs and alternatives, so the next thing to watch or read is one tap away.

What it does

  • Every way of completing opens it: Mark as completed, Move to / Add to list as Completed (Library, Search, Discover, Browse), and the details page's status dropdown and +1.

  • The sheet: one row per related title (same media type, 18+ filtered), each showing its relation, format and year, and where it will go ("→ Watching", "Completed → Rewatching"). Every row starts unticked. The main button says what it will do ("Add 1 · Move 2"), and reads "Select titles" and is disabled while nothing is ticked. Not now is an outlined secondary button.

  • Where titles go follows a new Settings list, Watching (default) or Plan to Watch:

    On your list as… Released, Watching set Released, Planning set Unreleased
    Not on list Add → Watching Add → Planning Add → Planning
    Planning Move → Watching not offered not offered
    Watching / Rewatching not offered not offered not offered
    Paused / Dropped Move → Watching Move → Planning Move → Planning
    Completed Move → Rewatching Move → Planning (progress → 0) Move → Planning (progress → 0)

    Cancelled titles are never offered. The whole matrix is pinned in UpNextTests.Candidates_FollowTheMatrix.

  • Toasts: the save's toast is never shown while the sheet is open (an Android toast draws over every window and sat on its buttons). It shows at once when there is nothing to offer, and after the sheet closes on Not now; when titles are picked, their own toast replaces it.

  • Settings: a new Up Next section with a toggle (on by default) and Suggestions Go To. Both are device-local, saved on tap and logged.

Notable decisions

  • One new AniList read per completion (MediaRelations, never cached). It starts behind the rating prompt, so it is usually done by the time the sheet is due. It returns the viewer's whole entry for each related title, so a move saves that entry back with its score, notes, private flag and rewatch count intact rather than overwriting it.
  • Each candidate's destination is fixed once, when it is chosen, so a row's label, its save and its toast cannot disagree (an earlier toast said "moved to Watching" for a rewatch).
  • Rewatch count fix: entering Rewatching no longer adds 1 to repeat. AniList counts the rewatch itself when the entry is completed again, so every rewatch was counted twice (confirmed on the test account). ListEntryStatusMutationsTests updated.
  • MediaRelations fixtures are recorded for the CI replay. AGENTS.md now names the AniList test account and allows writes to it.

Verification

  • 2,005 unit tests pass, and the test project, the Android app and the -p:CiBuild=true variant all build with 0 warnings. New behaviour was written test-first, and the invariants were mutation-checked: the settings list ignored for adds and for moves, the same-list skip, the progress reset (both missing and over-applied), the toast after Not now (both missing and shown with picks), and the load guard on the settings log lines.
  • On device, Debug build signed in as the test account: every completion path; the Planning / Paused / Dropped / Completed moves under both settings; first watch and rewatch; manga wording; failed saves and lookups; the sheet's empty, ticked and Not now states; the toast timing; the Settings section; and the log lines. Not seen on device: the unreleased and cancelled rules (no such relations were at hand), which are covered by unit tests.

Follow-ups (not in this PR)

Completing an entry now opens an "Up Next" sheet listing its sequels, side
stories, spin-offs and alternatives of the same media type (18+ filtered).
Each row says where it will go, every row starts unticked, and the main
button says what it will do ("Add 1 · Move 2"), reading "Select titles" and
disabled while nothing is ticked. Not now is an outlined secondary button.

- Every way of completing triggers it: Mark as completed, Move to / Add to
  list as Completed, and the details page's status dropdown and +1.
- One new AniList read per completion (MediaRelations, never cached). It
  starts behind the rating prompt and returns the viewer's whole entry for
  each related title, so a move saves the entry back with its score, notes
  and rewatch count intact.
- Destinations follow a new Settings list, Watching (default) or Plan to
  Watch: titles not on the list are added there; Planning, Paused and
  Dropped ones move there; Completed ones go to Rewatching, or to Plan to
  Watch with progress reset to 0. Unreleased titles only ever go to Plan to
  Watch, cancelled ones are never offered, and anything already in progress
  or already in its target list is left alone. The full matrix is pinned in
  UpNextTests.Candidates_FollowTheMatrix.
- The save's toast is never shown under the sheet (an Android toast draws
  over every window): it shows at once when nothing is offered, after the
  sheet closes on Not now, and is replaced by the picks' own toast.
- Settings get an "Up Next" section: a toggle (on by default) and
  "Suggestions Go To". Both are device-local, saved on tap and logged.
- Entering Rewatching no longer adds 1 to the rewatch count: AniList counts
  the rewatch itself when the entry is completed again, so every rewatch was
  counted twice (confirmed on the test account).
- MediaRelations fixtures recorded for CI replay; AGENTS.md names the
  AniList test account and allows writes to it.
Copilot AI lite review requested due to automatic review settings November 20, 2026 22:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Active moderate issues remain in both retry paths: a successful retry can save the completed entry without showing Up Next or applying the deferred saved-toast notification flow.

2 open issues
What changed in this PR

Adds an end-to-end Up Next workflow after completing anime and manga entries, allowing users to select eligible related titles for addition or movement on AniList.

Changes:

  • Added uncached media-relation fetching, candidate filtering, destination rules, viewer-entry preservation, and fixture coverage.
  • Integrated Up Next into library, search, discover, browse, and details completion flows with settings, persistence, popup UI, and toast handling.
  • Corrected rewatch-count behavior and expanded unit-test coverage across the new completion and settings paths.
File Description
tools/​record-anilist-fixtures.cs Records MediaRelations responses for fixture-backed media.
tests/​AniSprinkles.UnitTests/​SettingsUpNextTests.cs Tests Up Next preference persistence, validation, and logging.
tests/​AniSprinkles.UnitTests/​SearchPageModelTests.cs Updates Search page-model tests for Up Next integration.
tests/​AniSprinkles.UnitTests/​MediaListPageModelTests.cs Updates library page-model tests for Up Next integration.
tests/​AniSprinkles.UnitTests/​MediaListPageModelKindTests.cs Updates anime and manga library construction tests for Up Next.
tests/​AniSprinkles.UnitTests/​MediaListFilterAndSortTests.cs Updates library filter and sort test construction.
tests/​AniSprinkles.UnitTests/​MediaListAdultFilterReloadTests.cs Updates adult-filter library test construction.
tests/​AniSprinkles.UnitTests/​MediaDetailsPageModelTests.cs Tests details-page completion and Up Next behavior.
tests/​AniSprinkles.UnitTests/​MediaBrowsePageModelTests.cs Updates Browse page-model tests for Up Next integration.
tests/​AniSprinkles.UnitTests/​ListEntryStatusMutationsTests.cs Verifies the rewatch-count correction when entering Rewatching.
tests/​AniSprinkles.UnitTests/​Fakes/​ScriptedDialogService.cs Adds scripted Up Next dialog behavior for tests.
tests/​AniSprinkles.UnitTests/​EntryActionCoordinatorTests.cs Updates coordinator tests for Up Next dependencies and flows.
tests/​AniSprinkles.UnitTests/​DisplaySettingsReprojectionTests.cs Updates details and library test construction for the new dependency.
tests/​AniSprinkles.UnitTests/​DiscoverPageModelTests.cs Updates Discover page-model tests for Up Next integration.
tests/​AniSprinkles.UnitTests/​DetailsSpineAdapters.cs Updates details adapter construction for Up Next.
tests/​AniSprinkles.UnitTests/​DetailsAdultFilterTests.cs Updates details adult-filter test construction.
tests/​AniSprinkles.UnitTests/​ConverterTests.cs Verifies the dedicated Up Next settings accent.
tests/​AniSprinkles.UnitTests/​AniListClientOperationsTests.cs Tests MediaRelations query mapping and complete viewer-entry data.
tests/​AniSprinkles.UnitTests/​AiringNotificationWiringTests.cs Updates library wiring test construction.
tests/​AniSprinkles.UnitTests/​AdultContentCommitTests.cs Updates Discover wiring test construction.
src/​AniSprinkles/​Views/​UpNextPopup.xaml.cs Implements Up Next sheet state, selection, dismissal, and presentation behavior.
src/​AniSprinkles/​Views/​UpNextPopup.xaml Defines the Up Next bottom-sheet layout and controls.
src/​AniSprinkles/​Views/​UpNextPickerView.cs Builds selectable related-title rows and destination indicators.
src/​AniSprinkles/​Views/​SettingsLoadedContentView.xaml Adds Up Next settings controls to the settings view.
src/​AniSprinkles/​Views/​BottomSheetChrome.cs Centralizes bottom-sheet edge-to-edge and inset handling.
src/​AniSprinkles/​Services/​Maui/​MauiDialogService.cs Displays the Up Next popup through the dialog service.
src/​AniSprinkles/​MauiProgram.cs Registers the Up Next service in dependency injection.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__c9508fd360ad_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__b3a5c19a711f_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__a5fa68e4d6ce_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__a369e242d8ec_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__8ffa37e167b0_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__893f8aef3bda_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__6d503fea4d3f_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__66a4c685bbdf_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__6538157ab064_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__5590ecf63147_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__506a5a9aaf0c_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__338636d7f32f_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__3017e7cffcf3_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__2f47be2c4c57_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__1d6f814f4e76_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__1ae736c3e251_96e3e757da32.json Adds an empty MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__12c0ad40ec40_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles/​Fixtures/​AniList/​MediaRelations__069ec8d45798_96e3e757da32.json Adds a recorded MediaRelations response for a fixture media item.
src/​AniSprinkles.Core/​Services/​UpNext/​UpNextPreferences.cs Defines device-local Up Next preferences.
src/​AniSprinkles.Core/​Services/​UpNext/​UpNextOffer.cs Coordinates relation loading, selection, saving, logging, and feedback.
src/​AniSprinkles.Core/​Services/​UpNext/​UpNextCandidate.cs Implements relation filtering, destination rules, labels, and selection summaries.
src/​AniSprinkles.Core/​Services/​ListEntryStatusMutations.cs Stops incrementing repeat count when entering Rewatching.
src/​AniSprinkles.Core/​Services/​ListEntryStatusFlow.cs Starts relation loading during completion flows.
src/​AniSprinkles.Core/​Services/​IAniListClient.cs Adds the media-relations client contract.
src/​AniSprinkles.Core/​Services/​FaultInjection/​FaultInjectingAniListClient.cs Adds fault-injection support for relation requests.
src/​AniSprinkles.Core/​Services/​CachingAniListClient.cs Passes media-relation requests through without caching.
src/​AniSprinkles.Core/​Services/​AniListClient.cs Implements media-relation queries and relation-entry mapping.
src/​AniSprinkles.Core/​Services/​Abstractions/​UpNextChoice.cs Defines the selected-title result from the Up Next dialog.
src/​AniSprinkles.Core/​Services/​Abstractions/​IDialogService.cs Adds the Up Next dialog abstraction.
src/​AniSprinkles.Core/​PageModels/​SettingsPageModel.UpNext.cs Implements Up Next settings state, persistence, commands, and logging.
src/​AniSprinkles.Core/​PageModels/​SettingsPageModel.cs Loads device-local Up Next preferences.
src/​AniSprinkles.Core/​PageModels/​SearchPageModel.cs Integrates Up Next into Search actions.
src/​AniSprinkles.Core/​PageModels/​MediaListPageModel.cs Integrates Up Next into shared library actions.
src/​AniSprinkles.Core/​PageModels/​MediaDetailsPageModel.cs Integrates Up Next into details-page status and progress completion paths.
src/​AniSprinkles.Core/​PageModels/​MediaBrowsePageModel.cs Integrates Up Next into Browse actions.
src/​AniSprinkles.Core/​PageModels/​MangaLibraryPageModel.cs Passes Up Next into manga library flows.
src/​AniSprinkles.Core/​PageModels/​EntryActionCoordinator.cs Integrates Up Next into add, move, and completion flows.
src/​AniSprinkles.Core/​PageModels/​DiscoverPageModel.cs Integrates Up Next into Discover actions.
src/​AniSprinkles.Core/​PageModels/​AnimeLibraryPageModel.cs Passes Up Next into anime library flows.
src/​AniSprinkles.Core/​Models/​RelatedMedia.cs Stores complete viewer list-entry snapshots for related media.
src/​AniSprinkles.Core/​Models/​MediaRelationKind.cs Adds typed AniList relation kinds.
src/​AniSprinkles.Core/​Models/​MediaRelationEdge.cs Adds typed relation metadata to relation edges.
src/​AniSprinkles.Core/​Converters/​RainbowAccentConverter.cs Assigns a distinct settings accent to Up Next.
AGENTS.md Documents the AniList test account and permitted fixture writes.
.claude/​skills/​project-architecture/​SKILL.md Documents Up Next architecture and dependency-injection wiring.

Review effort: Lite

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📱 UI Screenshots

✅ Authenticated UI — stubbed auth plus real AniList responses recorded against a test account and replayed at the HTTP layer (#134). No OAuth token required.

View Workflow Run →

Anime Library Manga Library Discover View All (Browse) Search One Piece Details Toei Animation (Studio) Luffy (Character) Mayumi Tanaka (Staff) Settings
Anime Library Manga Library Discover View All (Browse) Search One Piece Details Toei Animation (Studio) Luffy (Character) Mayumi Tanaka (Staff) Settings

Review on #224: a completion whose save failed lost its offer, because the
offer ends with the flow that made it. A Retry that went through then
completed the title with no sheet (and, from the Library menu, no toast).

- EntryActionCoordinator: the completion Retry begins its own offer and
  confirms through it, like the first attempt.
- Details page, +1: a completion save's Retry is a completion too
  (RetryCompletionSaveAsync), with its own offer.
- Details page, status dropdown: whether the pick is a completion is
  decided once and carried into the Retry. Re-deciding at retry time read
  the already-Completed entry and offered nothing.
Copilot AI lite review requested due to automatic review settings November 20, 2026 22:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Two active issues remain: a partial viewer entry can expose nulls as complete data, and missing media totals can leave progress at the cap when moving an entry to Watching.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Apply progress cap correction to existing relation entries

src/​AniSprinkles.Core/​Services/​UpNext/​UpNextOffer.cs:99

candidate.Existing comes from MediaRelations, where it has no Media (and that query does not select episodes/chapters/volumes). For a Planning/Paused/Dropped candidate whose target is Current, ApplyStatusChange therefore cannot see HasKnownProgressTotal and will not walk an at-cap entry back by one, unlike the normal Move-to-list path. The saved entry can remain at its total while Watching, leaving the +1/completion invariant broken. Populate the existing entry with the related media's totals (or otherwise apply the same cap correction) before calling the shared mutation.

2 resolved since last review

Review effort: Lite

github-actions Bot added a commit that referenced this pull request Nov 20, 2026
…Entry (#103)

Review on #224:

- A related title moved to Watching at its total stayed there, leaving +1
  dead: the relations entry had no media, so the shared step-back could not
  see the total. MediaRelations now selects episodes, chapters and volumes,
  and the offer gives the entry those totals before the status change.
- The details query maps its relations through the same mapper, but its
  per-node mediaListEntry is four fields. ViewerEntry is now filled only by
  the relations read, so no consumer can move a partial entry and save the
  rest back as nulls.

MediaRelations fixtures re-recorded for the new query against the test
account, pinning the three titles the old set covered that the account's
current list no longer does. No other fixtures change.
Copilot AI lite review requested due to automatic review settings November 20, 2026 23:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The change spans AniList mutations, shared completion flows, settings persistence, and Android popup behavior, so popup lifecycle, accessibility, and runtime save/toast ordering still require human device verification.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@zhollis21
zhollis21 requested an adaptive review from Copilot November 20, 2026 23:43
github-actions Bot added a commit that referenced this pull request Nov 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved data-integrity bugs allow completion retries to overwrite rewatch counts and stale Library entries to undo Up Next status changes.

7 open issues

Review effort: Max (adaptive)

Comment thread tools/record-anilist-fixtures.cs Resolved
…us pick (#103)

Review on #224:

- Completing a rewatch sent the old repeat count. AniList adds the rewatch
  itself on that save, and the client retries saves as idempotent upserts,
  so a retry after a lost response could set AniList's 4 back to 3. The
  count is now nulled on Rewatching -> Completed, which leaves it out of
  the mutation on every attempt. Checked on the test account: 9 -> 10.
- A score or progress edit still waiting on its debounce saved again in
  the middle of a details-page status change, toasting over the Up Next
  sheet. The status save is of the same entry, so it cancels the queued
  save and carries the edit.
Copilot AI adaptive review requested due to automatic review settings November 21, 2026 00:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The optional relations lookup can block completion saves, while CI replay returns stale list entries that can reset progress or overwrite recent edits.

5 open issues
2 resolved since last review

Review effort: Max (adaptive)

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.

Offer to add the next season/related entries when you complete a series

2 participants