Skip to content

fix(AniList): library parsing and list updates - #3300

Merged
fire-light42 merged 1 commit into
recloudstream:masterfrom
liubquanti-frk:fix/anilist-parsing
Nov 4, 2026
Merged

fire-light42 merged 1 commit into
recloudstream:masterfrom
liubquanti-frk:fix/anilist-parsing

Conversation

@liubquanti

Copy link
Copy Markdown
Contributor

Fix AniList library parsing and list updates

Since #2952 (migration to kotlinx serialization) AniList sync is broken in two ways.

1. Library list fails to load

Jackson used to coerce null into 0 for non-nullable Int fields, kotlinx does not.
AniList returns null for completedAt / startedAt dates of any entry that isn't
completed, as well as episodes (airing shows) and seasonYear (unannounced shows), so
getFullAniListList fails on practically every account:

Unexpected JSON token at offset 116: Unexpected symbol 'n' in numeric literal at path:
$.data.MediaListCollection.lists[0].entries[0].completedAt.year

These fields are now nullable. StartedAt fields are Int? to match AniList's
FuzzyDate type (they were String?, but AniList sends numbers).

2. Adding / updating titles silently fails

SaveMediaListEntry always passes scoreRaw: $scoreRaw, progress: $progress, but only
declares those variables when they are non-null. When no score is set AniList rejects the
whole mutation:

Variable "$scoreRaw" is not defined.
Variable "$progress" is not defined.

postDataAboutId only checked data != "", so the failure was reported as success.
Now only the variables that have a value are declared and passed, and a response
containing GraphQL errors is logged and returns false.

Testing

  • Added AniListParsingTest covering a list response with null dates/episodes and
    GraphQL error detection.
  • Verified the broken mutation against the live AniList API.
  • Tested on a Chromecast with Google TV (Android 14): the AniList library tab loads
    again, and status updates without a score now reach AniList.

- Make nullable the AniList fields that can be null (dates, episodes,
  seasonYear, updatedAt). Since the move to kotlinx serialization these
  are no longer coerced to 0, which made the library list fail to parse
  for practically every account.
- SaveMediaListEntry: only declare and pass scoreRaw / progress when they
  have a value. AniList rejected the whole mutation otherwise
  ("Variable $scoreRaw is not defined"), while it was reported as success.
- Treat GraphQL errors in the mutation response as a failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fire-light42 fire-light42 added Review needed The pull request contains no obvious blockers. It just needs a review before merging. AI Assisted This pull request was AI assisted (or generated). labels Nov 1, 2026
@fire-light42

Copy link
Copy Markdown
Collaborator

Nice! It looks good, but I need to test before merging.

@fire-light42 fire-light42 added Looks good Nothing looks obviously wrong in this pull request. It just needs to be tested and reviewed. and removed Review needed The pull request contains no obvious blockers. It just needs a review before merging. labels Nov 3, 2026

@fire-light42 fire-light42 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Excellent work!

Thank you for your contribution!

@fire-light42
fire-light42 merged commit 03cbf6c into recloudstream:master Nov 4, 2026
2 checks passed
AryanMir15 added a commit to AryanMir15/cloudcache that referenced this pull request Nov 22, 2026
From upstream:
- AniList library parsing fix (recloudstream#3300): nullable date/episode/seasonYear/
  updatedAt fields so the library list parses instead of failing; only
  declare/pass mutation variables that have a value (AniList rejects
  undeclared vars); treat GraphQL errors in mutations as failures. Applied
  manually to the fork's version (kept LastWatched sort + Jackson style).
- APIRepository observer fix (recloudstream#3288): register the provider-cache reload
  observer once in the companion instead of per instance; restored fork's
  updateCacheSyncData (sync feature) on top of upstream's version.
- Chromecast episode index fix (recloudstream#3275): index within the selected season
  when casting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Assisted This pull request was AI assisted (or generated). Looks good Nothing looks obviously wrong in this pull request. It just needs to be tested and reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants