Smart setup: at least three running series in a part of the day that has any (Sakura's late nights leaned on two)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-07 10:44:49 +00:00
co-authored by Claude Opus 5.5
parent 384b1bd6e8
commit 3d09528e5d
2 changed files with 25 additions and 0 deletions
@@ -60,6 +60,11 @@ class SmartSetupRegressionTest {
assertTrue(repeats(r.plan) <= 15)
val firstRepeat = r.plan.entries.filter { it.startMs < now + week }.groupBy { it.media.item.id }.values.filter { it.size > 1 }.minOfOrNull { it[1].startMs }
assertTrue(firstRepeat == null || firstRepeat - now >= 5 * 24 * 3_600_000L)
// Late nights have at least three series (it leaned on two), and no one series takes more than 15 late slots a week.
assertTrue(r.rows.count { r.shape.slots[it.id] == Slot.Late && it.type == "Series" && (it.runMs ?: 0) >= SUBSTANTIAL_SERIES_HOURS * 3_600_000 } >= MIN_SERIES_PER_PART)
val lateBySeries = r.plan.entries.filter { it.startMs < now + week && java.time.Instant.ofEpochMilli(it.startMs).atZone(zone).hour.let { h -> h >= 22 || h < 6 } }
.filter { e -> r.rows.first { it.id == e.seriesId }.type == "Series" }.groupingBy { it.seriesId }.eachCount()
assertTrue(lateBySeries.toString(), lateBySeries.values.max() <= 15)
// Every title gets airtime in the week.
assertEquals(r.rows.size, r.plan.entries.filter { it.startMs < now + week }.map { it.seriesId }.toSet().size)
}