A series is asked about on every scan, and its id is resolved again first #158
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?
A series is asked about on every scan, and its id is resolved again first.
Found while closing #155, which fixed the same shape for a music folder. After
that fix a rescan of an unchanged enriched library is silent except for three
requests, all of them a series:
Two series in the fixture, each described again, plus one
findto resolve anid. A film is quiet — the same rescan asks nothing about one — so this is the
series path alone.
Two separate causes, and the first is the cheaper one.
The id is resolved before anything is read.
crates/ephyra-app/src/scan/run/remote.rs::identified_seriesruns for everySeriesrow in the pass, unconditionally, and its own doc says why it runswhere it does: a season and an episode resolve nothing themselves, so the
series has to carry a
TMDbid before anything below it is asked. But it asksagain for a series whose row already carries one from the last scan — the
lookup is built from the item the pass holds rather than from what is filed.
The series is described again. The
/3/tv/…pair is the descriptionitself, and nothing short-circuits it. #155 gave a music folder that
short-circuit: a row a database has answered about —
DateLastRefreshed, nowcarried on
Tracked— is described again only where the pass read the folderor something under it, which is
MetadataService.GetProviders' own shape.Nothing equivalent exists for a series.
Upstream does not do this.
runAllProvidersis false past a row's firstrefresh unless a change monitor reports one, so a second scan of an unchanged
show asks nobody.
Where to start
identified_seriesfor the first half — what it should read the id off is thefiled row rather than the resolved item.
The second half is the harder one, and #155 is the precedent rather than the
answer: a series is not summarised from what is under it the way an album is,
so what stands in for "nothing changed" is a different question. The gate #155
landed is
crates/ephyra-app/src/scan/summary.rs::folders.How to know it is done
A second scan of an unchanged library with a shows library makes no request at
all.
crates/ephyra-app/tests/scan_enriched.rsholds the shape this ismeasured in —
a_rescan_of_an_unchanged_music_library_asks_nothing_and_rewrites_nothingcounts the hosts a pass asked, and its
MUSIC_DATABASESfilter is what hidesthese three today.
A rescan after an episode is added or a show's document changes still asks.
House rules
CLAUDE.mdis the short version and these are the parts that bite: tests rununder
cargo nextest; upstream's source is the checkout inupstream/at thepin and not the clone beside the repository; generated files are regenerated
rather than edited; a comment says what the code does, not how it got there.
A test that cannot fail is worse than none — check each new assertion against
the mutation it exists to catch.
Landed in
3265aed, with review fixes in22de82e.Both requests were one function.
identified_seriesran for everySeriesrow in the pass, before anything decided what to read — the
findto resolve anid, and the
tv/…for the document the other ids come out of. Two series in thefixture, three requests, on a library where nothing had changed. There was no
second cause: the description the issue attributes to the reading pass was this
function's own second call.
It reads the ids off the filed row now, as upstream does, and asks nothing for a
series already described.
What "already described" takes — the review made this precise, and both
halves matter because getting either wrong strands the episodes rather than
the series, which is quiet:
TMDbid has to agree with the one the pass read. Merging thefiled ids over the pass's own and then skipping meant a folder corrected to
another
[tmdbid-…]kept the old show'sImdbid —learnedfills an emptyslot rather than replacing a full one — and every episode below resolved
through OMDb by the wrong show. The filed ids go on after the pass's now.
databases' ids, so a row that was identified and never described — pinned by
hand, or a harvest that failed on the network — still owes that reading.
My first attempt gated on the merged lookup instead of the filed row, and a
series named
[tmdbid-1437]in its own folder then skipped the harvest on afirst pass: the Firefly episode lost its
TV-14rating.already_resolvedspells all of it, with the cases as unit tests.
On the test.
scan_enriched.rs's rescan now asserts that no host at all isasked, rather than filtering to
MUSIC_DATABASES— which is exactly what hidthese three. And a series whose row names no database is still asked about, so
the short-circuit is what the last pass resolved rather than a stamp that
switches asking off for good.
Adding an episode is unaffected: it lands in the season folder, the series row is
left alone either way, and the episode resolves through the ids already on the
series — which is what upstream does too.