0.99.12: one failed show in a pool refresh keeps its previous copy instead of losing the whole refresh; retry in 6 hours
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 2m7s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m43s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-04 12:50:58 +00:00
co-authored by Claude Opus 5.5
parent 3903d73304
commit e552871589
8 changed files with 123 additions and 12 deletions
@@ -0,0 +1,32 @@
package tv.orbit.classic
import org.junit.Assert.assertEquals
import org.junit.Assert.assertSame
import org.junit.Assert.assertThrows
import org.junit.Test
/** One show's failed read keeps its previous copy; nothing is ever dropped, and an outage still keeps the whole old pool. */
class PartialPoolReadTest {
private fun show(title: String) = PoolSeries(title, title, listOf(PoolEpisode("$title-1", "s", EpisodeMark(1, 1), "E1", 1_800_000)))
private val previous = listOf(show("X-Men: The Animated Series"), show("Batman Beyond"), show("Halloween"))
private val timeout = EmbyCheckException("timed out", retryable = true)
@Test fun aFailedShowKeepsItsPreviousCopy() {
val read = PartialRead(previous)
assertSame(previous[0], read.carry(seriesKey("X-Men: The Animated Series"), timeout))
// A film named with its year finds its plain-titled copy.
assertSame(previous[2], read.carry(seriesKey(FilmIdentity.of("Halloween (1978)").title), timeout))
assertEquals(2, read.carried)
}
@Test fun nothingIsDroppedAndAnOutageAbandonsTheRefresh() {
// No previous copy: the refresh is abandoned rather than lose the show.
assertThrows(EmbyCheckException::class.java) { PartialRead(previous).carry(seriesKey("Static Shock"), timeout) }
// A failure not worth retrying: abandoned.
assertThrows(EmbyCheckException::class.java) { PartialRead(previous).carry(seriesKey("Batman Beyond"), EmbyCheckException("refused", 401)) }
// More than three failures in one refresh means the provider is down: abandoned, so the whole old pool stays.
val read = PartialRead(previous + (1..3).map { show("Show $it") })
(1..3).forEach { read.carry(seriesKey("Show $it"), timeout) }
assertThrows(EmbyCheckException::class.java) { read.carry(seriesKey("Batman Beyond"), timeout) }
}
}