metadata: featured_sync reads every rating and reports orphaned ones #340

Merged
mysticalsoap merged 1 commit from fix/featured-sync-orphans into trunk 2026-10-01 12:47:18 -04:00
Owner

Problem

featured_sync.py has pushed "2 item(s) failed" every night since 2026-09-24 (one since 09-20). Both ids are StarTrack ratings whose movie Radarr upgraded that week: Jellyfin derives an item's id from its file path, so the new file got a new id and the rating stayed on the old one, which now 404s. The script treated that as a tag failure and re-notified nightly.

While tracing it: /Plugins/StarTrack/Recent clamps its limit to 100 server-side regardless of the limit=5000 the script asks for. With 254 ratings on the server the sync only ever saw the newest 100, so 12 items were marked featured where 66 qualify at the 4.0 threshold.

Fix

  • Ratings come from Members/{userId}/Profile, whose recentRatings is the user's complete list and works with a bare server API key.
  • A 404 on tagging is an orphaned rating, not a failure: resolved to the movie's current id through movie_poster_state.json's TMDB record, reported once (state/featured_sync_state.json), and dropped from the failure count.
  • New startrack_rekey.py moves the entries across every StarTrack json file (ratings, diary, lists, watchlist, likes all key on item id). Host-side, Jellyfin stopped, since the plugin holds the files in memory and rewrites them whole on save.
  • --dry-run on featured_sync.py, same as movie_poster_sync.py.
  • Maintenance.md: one sentence on the orphan report and the re-key step.

Verification

Dry run against the live server from the branch file (docker exec -i -w /jobs/metadata metadata python3 - --dry-run < featured_sync.py):

  66 items qualify
  10 items currently marked 'featured'
Marking 56 new items...
Unmarking 0 items that no longer qualify...

5 rating(s) point at an item Jellyfin no longer has:
  new: Everything Everywhere All at Once (2022): 35a2b54cbe30da2359342ac22bc7f745=c45dffe2570b8e823c6c2b00d425bc60
  new: Forbidden Planet (1956): 0e45da92dcd0f172e047545e70391557=09626afc802c33eeb65ed80a3fbd8ba3
  new: unknown item: 4c443647933e192bc009a2c60fabff97 (no current id found)
  new: Dead Poets Society (1989): 3f054c4f9ed9aade675896e54a4255c3=841638c2118ab35d4111ba0e6d5980fe
  new: Look Back (2024): 6dda80b10486ecaedb31c55adaa414f6=2ee5afd975d1d7f2d8a376ad595fe807

Three of the five orphans predate this week and were invisible under the 100-entry cap. The unidentified one is a 4.5-star rating dated 2026-05-04T00:00:00Z (a Letterboxd import) on an item movie_poster_sync never saw.

startrack_rekey.py tested on synthetic ratings/diary files: dict keys and itemId values both move, and a rating list already present under the new id is merged, whichever order the two keys appear in. Not run against the real files yet: that is the host-side step after merge (docker stop jellyfin, re-key with the five pairs above, docker start jellyfin).

Not run live: the first non-dry run tags 51 more movies featured, which is the media bar's rotation. If that is too many, RATING_THRESHOLD=4.5 in media/metadata/.env gives 37.

🤖 Generated with Claude Code

## Problem `featured_sync.py` has pushed "2 item(s) failed" every night since 2026-09-24 (one since 09-20). Both ids are StarTrack ratings whose movie Radarr upgraded that week: Jellyfin derives an item's id from its file path, so the new file got a new id and the rating stayed on the old one, which now 404s. The script treated that as a tag failure and re-notified nightly. While tracing it: `/Plugins/StarTrack/Recent` clamps its limit to 100 server-side regardless of the `limit=5000` the script asks for. With 254 ratings on the server the sync only ever saw the newest 100, so 12 items were marked `featured` where 66 qualify at the 4.0 threshold. ## Fix - Ratings come from `Members/{userId}/Profile`, whose `recentRatings` is the user's complete list and works with a bare server API key. - A 404 on tagging is an orphaned rating, not a failure: resolved to the movie's current id through `movie_poster_state.json`'s TMDB record, reported once (`state/featured_sync_state.json`), and dropped from the failure count. - New `startrack_rekey.py` moves the entries across every StarTrack json file (ratings, diary, lists, watchlist, likes all key on item id). Host-side, Jellyfin stopped, since the plugin holds the files in memory and rewrites them whole on save. - `--dry-run` on `featured_sync.py`, same as `movie_poster_sync.py`. - Maintenance.md: one sentence on the orphan report and the re-key step. ## Verification Dry run against the live server from the branch file (`docker exec -i -w /jobs/metadata metadata python3 - --dry-run < featured_sync.py`): ``` 66 items qualify 10 items currently marked 'featured' Marking 56 new items... Unmarking 0 items that no longer qualify... 5 rating(s) point at an item Jellyfin no longer has: new: Everything Everywhere All at Once (2022): 35a2b54cbe30da2359342ac22bc7f745=c45dffe2570b8e823c6c2b00d425bc60 new: Forbidden Planet (1956): 0e45da92dcd0f172e047545e70391557=09626afc802c33eeb65ed80a3fbd8ba3 new: unknown item: 4c443647933e192bc009a2c60fabff97 (no current id found) new: Dead Poets Society (1989): 3f054c4f9ed9aade675896e54a4255c3=841638c2118ab35d4111ba0e6d5980fe new: Look Back (2024): 6dda80b10486ecaedb31c55adaa414f6=2ee5afd975d1d7f2d8a376ad595fe807 ``` Three of the five orphans predate this week and were invisible under the 100-entry cap. The unidentified one is a 4.5-star rating dated 2026-05-04T00:00:00Z (a Letterboxd import) on an item `movie_poster_sync` never saw. `startrack_rekey.py` tested on synthetic ratings/diary files: dict keys and `itemId` values both move, and a rating list already present under the new id is merged, whichever order the two keys appear in. Not run against the real files yet: that is the host-side step after merge (`docker stop jellyfin`, re-key with the five pairs above, `docker start jellyfin`). Not run live: the first non-dry run tags 51 more movies `featured`, which is the media bar's rotation. If that is too many, `RATING_THRESHOLD=4.5` in `media/metadata/.env` gives 37. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
metadata: featured_sync reads every rating and reports orphaned ones
All checks were successful
validate / validate (pull_request) Successful in 24s
57eeaf9983
/Plugins/StarTrack/Recent clamps its limit to 100 server-side, so the
sync only ever saw the newest 100 of 254 ratings and marked 12 items
where 66 qualify. Members/{userId}/Profile carries the user's whole
rating list, and it is user-scoped by route rather than by login, so it
works with a bare server API key where /MyRatings returns empty.

StarTrack keys ratings by Jellyfin item id, and Jellyfin hashes that id
from the file path, so every Radarr upgrade leaves the rating on an id
that 404s. Those were counted as tag failures and pushed a notification
every night with nothing to act on. They are now split out, resolved to
the current id through movie_poster_sync's TMDB record, reported once
via a state file, and moved with the new startrack_rekey.py -- a host-
side edit with Jellyfin stopped, because the plugin holds its json in
memory and rewrites the whole file on every save.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mysticalsoap deleted branch fix/featured-sync-orphans 2026-10-01 12:47:18 -04:00
Sign in to join this conversation.
No description provided.