Network audit: report, not fail, a premiere-night film repeat when nothing else fits (Paul chose on time, option 2)
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m46s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m31s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-04 17:47:22 +00:00
co-authored by Claude Opus 5.5
parent 2a529e006a
commit 4c923bd6b5
@@ -105,6 +105,11 @@ class FinalNetworkAuditTest {
val waits = if (isFilmChannel) emptyMap() else inBlocks.filter { !it.isFilm }.associate { s -> s.title to (listOf(first) + entries.filter { it.seriesId == s.id }.map { it.startMs } + listOf(last)).zipWithNext().maxOf { (a, b) -> b - a } / day.toDouble() }
val fileGaps = entries.groupBy { it.media.item.id }.values.flatMap { es -> es.zipWithNext().map { (a, b) -> b.startMs - a.startMs to b } }
val sameDay = fileGaps.count { (g, b) -> g < day && (weightedAt(b) || isFilmChannel) }
// Paul chose on time over no repeats for the film before a premiere (4 November 2026): when no other short film
// fits before 21:00, the one shown the night before may play again. Reported, not a failure.
val premiereFilmRepeats = fileGaps.count { (g, b) -> g < day && b.media.item.type == "Movie" && p.dayParts.any { it.premiereNights == true && it.key == b.presentation } &&
p.dayParts.any { it.premiere } && entries.any { e -> e.presentation == p.dayParts.first { it.premiere }.key && e.startMs in b.endMs..(b.endMs + 30 * 60_000L) } }
if (premiereFilmRepeats > 0) notes.appendLine("- ${p.name}: $premiereFilmRepeats film(s) before a premiere repeated the night before's, as approved, because nothing else fitted")
val sameWeek = fileGaps.count { it.first < 7 * day }
val twice = if (isFilmChannel) 0 else entries.zipWithNext().count { (a, b) -> a.seriesId == b.seriesId && weightedAt(b) && choice(b) && "elsewhere then" !in b.why }
val ordered = series.filter { !(p.shuffleEpisodes || p.mixes(it)) && !it.isFilm }.associateBy { it.id }
@@ -133,7 +138,7 @@ class FinalNetworkAuditTest {
}
// Hard rules.
val kept = all.getValue(p.number).sortedBy { it.startMs }.take(committed.getValue(p.number).entries.size) == committed.getValue(p.number).entries
val failures = listOf("committed kept" to (if (kept) 0 else 1), "gaps" to gaps, "in-order stepping back" to back, "off deck" to offDeck, "same file within 24 h (weighted)" to sameDay.takeIf { p.tierWeights != null }.let { it ?: 0 },
val failures = listOf("committed kept" to (if (kept) 0 else 1), "gaps" to gaps, "in-order stepping back" to back, "off deck" to offDeck, "same file within 24 h (weighted)" to (sameDay - premiereFilmRepeats).takeIf { p.tierWeights != null }.let { it ?: 0 },
"twice running with a choice (weighted)" to twice, "clashes" to (clashCount[p.number] ?: 0)).filter { it.second > 0 }
failures.forEach { (what, n) -> notes.appendLine("- **${p.name}: $what $n**"); hardFailures++ }
}