Skip to content

Fixture replay drops titles moved to Completed, because the adult canary makes the Completed list read as CURRENT #221

Closed

Description

@zhollis21

Found while verifying #103 on the emulator: in a fixture build, an entry moved to Completed leaves Watching and never shows up under Completed. The completed count stays where it was, and the title is simply gone from the Library until the app restarts.

Problem

Two things that both landed in b741687 (#134) interact badly when the first list of the replayed MediaListCollection is not a Watching list.

1. The canary rides lists[0] with status CURRENT, whatever that list is. AdultCanary.SpliceIntoList (src/AniSprinkles.Core/Services/Fixtures/AdultCanary.cs:150) inserts its made-up 18+ entries at the front of the first list:

// Rides the first list, whichever it is, so the client-side filter is exercised on the
// section the Library renders first.
if (data["MediaListCollection"]?["lists"] is JsonArray { Count: > 0 } lists
    && lists[0]?["entries"] is JsonArray entries)

and every one of those entries is built with ["status"] = "CURRENT" (AdultCanary.cs:303). On the test account the first list is Completed, so Completed now opens with two CURRENT entries.

2. Replay reads a list's status off its first entry that has one. MutationState.ReinsertSavedEntries (src/AniSprinkles.Core/Services/Fixtures/MutationState.cs:282) decides where a saved entry goes back in like this (MutationState.cs:317):

var listStatus = entries
    .Select(e => e?["status"]?.GetValue<string>())
    .FirstOrDefault(s => s is not null);

FixtureReplayHandler splices the canary first and applies mutations after (src/AniSprinkles/Services/CI/FixtureReplayHandler.cs:115-116), so by the time this runs the Completed list reads as CURRENT. A saved COMPLETED entry matches no list and is never reinserted, while the removal pass (MutationState.cs:256) has already taken it out of Watching. Net effect: the title vanishes.

The same misreading works in reverse. A saved CURRENT entry matches the Completed list first, so a title added as Watching shows up under Completed.

Observed on device 2026-11-20 with -p:CiBuild=true, test-account fixtures. Marking Sword Art Online completed, moving ONE PIECE to Completed, and marking Gintama Season 4 completed each removed the title from Watching (4 → 3 → 2 → 1), but Completed stayed at 6. The replayed list read straight after the last save (captured through DevFlow's network log) had no trace of the three:

Completed: 999000001/CURRENT 999000011/CURRENT 182255/COMPLETED 154587/COMPLETED 156067/COMPLETED 170577/COMPLETED 144092/COMPLETED 101165/COMPLETED
Planning:  209939/PLANNING 178788/PLANNING 189323/PLANNING
Dropped:   180367/DROPPED 21127/DROPPED
Paused:    177709/PAUSED
Watching:  182205/CURRENT

A sequel added as Watching from the same session (media 99714) then appeared as a card under Completed. That card was also blank, a separate replay gap: there is no recorded Media fixture for 99714, so MutationState.MediaBlockFor borrows nothing.

Impact

  • Any on-device check of a completion flow in a fixture build shows a Library that looks broken: Mark as completed, +1 reaching the total, Move to → Completed, and Offer to add the next season/related entries when you complete a series #103's up-next adds. That is the exact situation replay exists to prevent (MutationState's own summary: "the app looks broken for a reason that has nothing to do with the app").
  • CI does not hit it today, because the screenshot pass never moves an entry to Completed. The first CI pass that does will screenshot a Library missing the title.
  • The existing MutationStateTests don't catch it. They run without the canary, and the canary tests don't run a mutation.

Options

Not settled; these are shapes the fix could take, noted while the context was fresh. Pick at kickoff against the real code.

A. The canary takes the status of the list it joins. Its entries copy the first real entry's status instead of hard-coding CURRENT. Smallest change, and the canary stays on the first-rendered section as intended. A canary entry under Completed would then render as a completed card, which the adult gate doesn't care about.

B. Replay ignores the canary when reading a list's status. For example, skip entries whose media id is in the canary's made-up range, or take the majority status. This keeps the canary's own status untouched, but MutationState then has to know about AdultCanary, a coupling the two don't have today.

C. Splice the canary after mutations are applied. Swapping the two calls in FixtureReplayHandler makes the status read see only real entries. But then a saved entry inserted at the front would sit ahead of the canary, and whether that matters to the gate needs checking.

Leaning A as the starting point because it's local to AdultCanary. That's a hypothesis for kickoff, not a decision.

Constraint

  • The adult canary gate must keep working: the 18PLUS CANARY marker must stay on the first-rendered Library section, and AdultCanaryTests must stay green.
  • A regression test should combine the two in one sequence: a recorded list whose first section is Completed, with the canary spliced, then a SaveMediaListEntry to COMPLETED, then the list read must show the entry under Completed.

Related

Activity

  1. added
    bug
    p3-medium
    Tech Debt
    on Nov 20, 2026
  2. zhollis21 commented on Nov 21, 2026

    @zhollis21
    OwnerAuthor

    Two more fixture-replay gaps in the same area, raised by Copilot on #224 (#103):

    • Replay does not apply saves to MediaRelations. MutationState (src/AniSprinkles.Core/Services/Fixtures/MutationState.cs) overlays saves and deletes onto the list reads, but not onto the relations read the Up Next sheet uses. After a sheet adds or moves a related title, the next completion that reads the same relations still sees the recorded entry, so the same add is offered again.
    • Only Library titles have relations recordings. tools/record-anilist-fixtures.cs records GetMediaRelationsAsync for each list title it walks, but Add to list → Completed also runs from Discover, Browse and Search results. Completing one of those off-list titles in fixture mode is a FIXTURE MISS, so no Up Next sheet.

    Neither affects CI today: the screenshot job never completes an entry. Both only bite when driving a fixture build by hand, which is this issue's territory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Tech Debtbugp3-medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions