fix(base-scanner): derive media availability from actual season state…#2412
Conversation
… instead of scanner input The media-level status was incorrectly set to AVAILABLE when only some seasons were available. The issue was isAllStandardSeasons/isAll4kSeasons checked the scanner's input array which only contains seasons found by current scanner (e.g. 1 seaason in jellyfin). If that single season was fully available, the check passes and the media gets marked AVAILABLE regardless of how many total seasons existed. And the shouldStayAvailable (and its 4k check) locked the AVAILABLE status once set, as long as no new seasons were added with a status which prevented the incorrect status from correcting itself.
|
Confirmed working by the original bug reporter: |
gauthier-th
left a comment
There was a problem hiding this comment.
LGTM. Tested and confirmed working.
|
Let me do one quick final pass with copilot and then merge |
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where TV show media was incorrectly marked as AVAILABLE when only some seasons were actually available. The root cause was that the scanner determined media-level availability by checking only the input array of seasons (which might be a subset) rather than the full set of tracked seasons in the database. Additionally, a shouldStayAvailable guard was locking in this incorrect status permanently.
Changes:
- Removed flawed availability logic that checked scanner input array instead of actual season state
- Replaced with logic that checks the merged season objects (
media.seasons) to determine overall availability - Removed
shouldStayAvailableandshouldStayAvailable4kguards that prevented status correction - Applied the same fix to both existing media update path and new media creation path
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The Jellyfin scanner only passed seasons found in the library to processShow, so a show with only one season downloaded would have all its Season entities marked available, causing the overall show status to be AVAILABLE. Despite PR #2412 fixing the availability check to use actual Season entities instead of scanner input, the underlying issue remained because Season entities were never created for seasons missing from Jellyfin. This aligns the Jellyfin scanner with how the Plex scanner already handles unmatched seasons.

Description
Fixes media being marked as
AVAILABLEwhen only some seasons are actuallyavailable (should be
PARTIALLY_AVAILABLE). Previously, the scanner determined media-level availability by checking its own input array rather than the full set of tracked seasons. For example, a show with 33 seasons but only 1 available in Jellyfin would be marked AVAILABLE because the scanner only saw that 1 season and it was complete. A secondaryshouldStayAvailableguard then locked this incorrect statuspermanently.
This PR added availability checks against actual merged season objects and applied same fix to new media creation path.
Available to be tested at:
preview-media-availability-status-fixtag. You'll need to run a full jellyfin scan/sonarr scan to fix the statuses.How Has This Been Tested?
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extract