Add Vortex and fairer repeats, with a longer Terra list (0.41.0, Phase C in testing)
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m37s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m22s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-02 06:34:20 +00:00
co-authored by Claude Opus 5.5
parent a43d7ec70a
commit e83ae88d29
9 changed files with 88 additions and 23 deletions
@@ -296,4 +296,50 @@ class ChannelScheduleTest {
assertEquals(now, guideDayJump(now + 60 * minute, now, false))
assertTrue(guideDayJump(now + 7 * day, now, true) < now + 7 * day)
}
@Test fun aVeryLongSeriesStaysInOrderWithNoRepeats() {
val long = listOf(show("dbz", 9, 33, 24), show("bb", 3, 17, 22), show("nar", 9, 25, 24))
val entries = extendSchedule(long, ScheduleCursor(), now, now + 7 * day, finishTogether = true).entries.filter { it.seriesId == "dbz" }
assertTrue(entries.size > 100)
assertEquals(entries.map { it.mark }.sorted(), entries.map { it.mark })
assertEquals(entries.size, entries.map { it.mark }.distinct().size)
}
@Test fun aFinishedShowWaitsForTheOthers() {
val short = show("s", 1, 2)
val long = show("l", 1, 6)
val entries = extendSchedule(listOf(short, long), ScheduleCursor(), now, now + 8 * 45 * minute, finishTogether = true).entries
assertEquals(listOf("s", "l", "s", "l", "l", "l", "l", "l"), entries.map { it.seriesId })
assertEquals(EpisodeMark(1, 6), entries.last().mark)
}
@Test fun onceEveryShowHasFinishedTheyAllStartAgain() {
val pool = listOf(show("s", 1, 1), show("l", 1, 2))
val entries = extendSchedule(pool, ScheduleCursor(), now, now + 5 * 45 * minute, finishTogether = true).entries
assertEquals(listOf("s" to 1, "l" to 1, "l" to 2, "s" to 1, "l" to 1), entries.map { it.seriesId to it.mark.episode })
}
@Test fun finishingTogetherSurvivesAnExtension() {
val pool = listOf(show("s", 1, 2), show("l", 1, 300))
val first = topUpPlan(null, ScheduleCursor(), pool, now, finishTogether = true)!!
val later = topUpPlan(first, ScheduleCursor(), pool, now + 2 * day, finishTogether = true)!!
assertEquals(2, later.entries.count { it.seriesId == "s" } + first.entries.count { it.seriesId == "s" && it.endMs < now + day })
}
@Test fun takingTurnsSkipsOnlyWhatItMust() {
val pool = listOf(show("a", 1, 1), show("b", 1, 1), show("c", 1, 1))
assertEquals("c", nextInTurn(pool, "a") { it.id != "b" }.id)
assertEquals("a", nextInTurn(pool, null) { true }.id)
}
@Test fun theEpisodeCacheKeepsItsSignature() {
val store = store()
store.savePool(user, 140, ScheduleStore.SavedPool(pool, now, "sig"))
assertEquals("sig", store.loadPool(user, 140)!!.signature)
val dir = folder.newFolder(); val old = ScheduleStore(dir)
old.savePool(user, 140, ScheduleStore.SavedPool(pool, now, "sig"))
val file = java.io.File(dir, "episodes-140.json")
file.writeText(JSONObject(file.readText()).apply { remove("signature") }.toString())
assertEquals("", old.loadPool(user, 140)!!.signature)
}
}