A season keeps a series key its series has moved off, and /Shows/{id}/Seasons answers nothing #177
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by clicking through the throwaway instance in
TESTCONTAINER/— a reallibrary of 294 series and 717 seasons, scanned by the image built at
33a1bdd.What it looks like
A series page renders a
Seasonsheading with nothing under it, and noNext Up. There is no way to reach an episode from the series page at all.What answers
Why
Both empty answers query on
series_presentation_unique_key(
crates/ephyra-http/src/routes/library/tv_shows.rs:266and:351), and acrossthis library 704 of 717 seasons carry a
SeriesPresentationUniqueKeythattheir series' own
PresentationUniqueKeydoes not equal:series_presentation_keykeys onCustom, thenTvdb, thenImdb, and fallsback to
series-<folded name>(crates/ephyra-core/src/item/keys.rs:120). Theseasons were written while the series had no id, and the series was re-keyed
when its
Imdbid landed — see #176 for where that id comes from — withoutthe rows below it being re-keyed with it.
The 13 that match are the 9 series that never resolved an id at all, so both
sides kept the name-derived key.
season_presentation_key's doc comment names this order dependence and says thenext pass makes the season catch up. It does — a per-item
Replace all metadataon Ted Lasso re-keyed its four seasons and the page filled in — buta library rescan does not:
RefreshLibrarycompleted at 13:27 and again at14:15 with the mismatch untouched, because a pass that finds no changed file
rewrites no row. A library scanned once and left alone stays broken.
Upstream
Season.FindSeriesPresentationUniqueKey()resolves the live series' current keyat save time (
upstream/MediaBrowser.Controller/Entities/TV/Season.cs:237), soa child cannot hold a key its parent has moved off — the two converge inside one
pass rather than on the next one.
Where to start
Either re-key the children when a series'
PresentationUniqueKeychanges, orresolve the key at write time from the series row the way upstream does rather
than carrying whatever the child was created with.
How to know it is done
SELECTover a scanned fixture returns no season or episode whoseSeriesPresentationUniqueKeydiffers from its series'PresentationUniqueKey,after one pass;
/Shows/{id}/Seasonsanswers with the seasons for a seriesthat acquired an id during that same pass.
House rules
Tests run under
cargo nextest; upstream's source is the checkout inupstream/at the pin. Generated artifacts are regenerated, never edited.Fixed in
de308ac, with the review's findings in113caba.Verified end to end on the throwaway instance's real library — 294 series, 717
seasons, 7,975 episodes. Before, 704 of 717 seasons carried a key their series
had moved off and
/Shows/{id}/Seasonsanswered nothing. After one scan on thefixed build:
and the listings answer:
The series page renders its seasons, with the posters the seasons carry.
The repair runs at the end of every pass rather than only where a row is
rewritten, because that is the case this was about: a library scanned once and
left alone never rewrites the children, so two scheduled
RefreshLibraryrunshad left all 704 behind.
Two things the review corrected: a season's own
PresentationUniqueKeyisderived from its series' and moves with it — upstream recomputes it on every
save, and a season left on the old one groups with nothing — and only a season
and an episode are touched, because a book carries that column as its own
rather than its parent's.