Orbit Premiere: weighed release profile, three proposals a week, booking off

Paul's refined policy, 5 November 2026. Premiere is a curated premium film
channel. Recency, a major studio, an event-film description, trending lists
and viewer ratings are weighed into one priority; none is required. Format
(TV movie, documentary, under 75 minutes) and Orbit status (aired or booked:
no duplicate first run) are the only hard limits. Streaming originals are
weighed down by evidence (a streamer studio, a streaming list within weeks
of release), not excluded. Unread films are queued for the evidence reader,
which now reads the last 12 months' films (read only). At most three
proposals a week, apart from the picks. After the configurable window a
film joins its genre home, stays on Premiere if premium with no home, or is
held for review; never a forced home. ORBIT PREMIERE is its own What's On
label, apart from FIRST ON ORBIT. Booking from the Chair stays off
(PREMIERE_BOOKING_ACTIVE) until Paul approves.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-05 14:56:43 +00:00
co-authored by Claude Opus 5.5
parent 938e4ccc15
commit 6561af2fd5
10 changed files with 346 additions and 60 deletions
@@ -24,26 +24,27 @@ class DirectorPremiereTest {
.put("genres", JSONArray(listOf("Action", "Adventure", "Science Fiction"))).put("studios", JSONObject.NULL).put("rating", "PG-13")
.put("countries", JSONArray(listOf("United States"))).put("taglines", JSONObject.NULL)
private fun report(aired: Set<String>): DeskReport {
private fun report(status: OrbitStatus, studios: List<String> = listOf("Paramount Pictures"), released: String = "2026-10-13"): DeskReport {
val evidence = File.createTempFile("evidence", ".jsonl").apply { deleteOnExit(); writeText("$fighter\n") }
val sets = File.createTempFile("collections", ".jsonl").apply { delete(); deleteOnExit() }
return buildDeskReport(evidence, sets, emptyMap(), listOf(Arrival("8100001", "Movie", "Street Brawlers", 2026, "2026-10-30", "tmdb:81", 0)), emptySet(), emptyMap(), 1, true,
DirectorMode.Surprise, at(11, 5, 12), london, aired = aired)
val sets = File.createTempFile("collections", ".jsonl").apply { deleteOnExit(); writeText(JSONObject().put("name", "Trending Movies").put("members", JSONArray(listOf("8100001"))).toString() + "\n") }
val film = PremiereFacts("8100001", "Street Brawlers", 2026, setOf("Action", "Adventure"), studios, released, 108 * minute, "tmdb:81")
return buildDeskReport(evidence, sets, emptyMap(), listOf(Arrival("8100001", "Movie", "Street Brawlers", 2026, released, "tmdb:81", 0)), emptySet(), emptyMap(), 1, true,
DirectorMode.Surprise, at(11, 5, 12), london, premiere = PremiereInputs(listOf(film), { status }))
}
@Test fun premiereIsAStageNotAHomeAndOnlyForAFirstAiring() {
val r = report(emptySet())
val pick = (r.picks.map { it.options to it.firstRun } + r.asks.map { it.options to it.firstRun }).single()
assertTrue(pick.first.none { it.number == PREMIERE_NUMBER }) // never offered as a home
assertEquals(302, pick.first.first().number) // its genre home: Orbit Action
assertEquals(PREMIERE_NUMBER, pick.second!!.number) // and its first-run event
// Booked on Orbit before, by this item or another copy of the same work: new, but no premiere.
listOf(setOf("8100001"), setOf("tmdb:81")).forEach { aired ->
val again = report(aired)
assertTrue((again.picks.map { it.firstRun } + again.asks.map { it.firstRun }).all { it == null })
}
val back = DeskReport.of(r.toJson())
assertEquals(PREMIERE_NUMBER, (back.picks.map { it.firstRun } + back.asks.map { it.firstRun }).single()!!.number)
@Test fun premiereIsAProposalApartFromThePicksAndNeverASecondFirstRun() {
val r = report(OrbitStatus.Never)
val p = r.premieres.single()
assertEquals("8100001", p.id); assertEquals(302, p.home!!.number) // its genre home: Orbit Action; Premiere is never a home
assertTrue(p.reasons.any { "Paramount" in it })
assertTrue((r.picks.map { it.id } + r.asks.map { it.id }).none { it == "8100001" }) // shown once, as a premiere
assertEquals(p.title, DeskReport.of(r.toJson()).premieres.single().title)
// Already aired, or already booked: no duplicate first run, however big.
assertTrue(report(OrbitStatus.Aired).premieres.isEmpty()); assertTrue(report(OrbitStatus.Scheduled).premieres.isEmpty())
// An older film isn't proposed by the Chair.
assertTrue(report(OrbitStatus.Never, released = "2023-06-01").premieres.isEmpty())
// No studio in the library data, not trending... still weighed: here its event-film description and recency carry it.
assertNotNull(report(OrbitStatus.Never, studios = listOf("CAPCOM")).premieres.singleOrNull())
}
@Test fun theDebutIsAFridayOrSaturdayNightAfterTheCommittedPlan() {
@@ -70,8 +71,8 @@ class DirectorPremiereTest {
val plan = extendFilmSchedule(pool, ScheduleCursor(), at(11, 5, 6), debut + 2 * day, 7 * day, zone = london, fixed = slots)
val first = plan.entries.first { it.seriesId == "8100001" }
assertTrue(first.startMs in debut..debut + 20 * minute)
assertTrue(PREMIERE_WHY in first.why)
assertEquals("FIRST ON ORBIT", whatsOnPage(mapOf(PREMIERE_NUMBER to plan), null, debut - 6 * 60 * minute, london).let { p -> (listOfNotNull(p.pick) + p.tonight + p.comingUp).first { it.title.contains("Street Brawlers") }.tag })
assertTrue(first.why.startsWith(PREMIERE_WHY)); assertFalse("first airing on Orbit" in first.why) // apart from FIRST ON ORBIT
assertEquals("ORBIT PREMIERE", whatsOnPage(mapOf(PREMIERE_NUMBER to plan), null, debut - 6 * 60 * minute, london).let { p -> (listOfNotNull(p.pick) + p.tonight + p.comingUp).first { it.title.contains("Street Brawlers") }.tag })
// Before its window ends nothing moves; after, it leaves Premiere's list for Action's. Its bookings aren't touched here.
assertTrue(graduatePremieres(store, user, debut + PREMIERE_WINDOW_MS - 1).isEmpty())
assertEquals(setOf(PREMIERE_NUMBER, 302), graduatePremieres(store, user, debut + PREMIERE_WINDOW_MS))
@@ -0,0 +1,101 @@
package tv.orbit.classic
import org.json.JSONArray
import org.json.JSONObject
import org.junit.Assert.*
import org.junit.Assume.assumeTrue
import org.junit.Test
import java.io.File
import java.time.LocalDate
/** Orbit Premiere's candidates: weighed evidence, format and Orbit status as the only hard limits, at most three a week. */
class PremiereSelectionTest {
private val today = LocalDate.of(2026, 11, 5)
private fun facts(id: String, title: String, studios: List<String>, premiere: String = "2026-10-01", genres: Set<String> = setOf("Action"), minutes: Long = 110) =
PremiereFacts(id, title, 2026, genres, studios, premiere, minutes * 60_000, "tmdb:$id")
private val action = Briefs.first { it.number == 302 }
private fun ev(id: String, title: String) = TitleEvidence(id, "Movie", title, 2026, "An epic battle.", listOf("Action"), null, "PG-13", null, null)
private fun candidate(f: PremiereFacts, read: Boolean = true, community: Double? = 6.5, fit: Double? = .5, trending: Boolean = false, streaming: Boolean = false,
status: OrbitStatus = OrbitStatus.Never, home: Pair<Brief, Double>? = action to .5) =
premiereCandidate(f, if (read) ev(f.id, f.title) else null, community, if (read) fit else null, if (read) home else null, trending, streaming, status, today)
@Test fun aMajorRecentEventFilmIsWorthwhileWhateverItsReviews() {
val c = candidate(facts("1", "Big Sequel", listOf("Universal Pictures")), community = 4.8)
assertTrue(c.worthwhile)
assertTrue(c.cautions.any { "doesn't rule it out" in it }) // a poorly reviewed blockbuster is still a premiere
assertEquals(AfterWindow.GenreHome, c.afterWindow); assertEquals(302, c.home!!.number)
assertTrue(c.remainsOnPremiere) // premium: stays eligible for Premiere too
}
@Test fun signalsAreWeighedNotRequired() {
// No major studio in the library's data, but an event film, recent and rated: still a candidate (Street Fighter lists only CAPCOM).
assertTrue(candidate(facts("2", "Street Brawlers", listOf("CAPCOM")), community = 6.3, fit = .61).worthwhile)
// An older major film isn't proposed by the Chair, but isn't ruled out either.
val older = candidate(facts("3", "Classic", listOf("Warner Bros. Pictures"), premiere = "2023-06-01"))
assertNull(older.excluded); assertFalse(older.worthwhile); assertTrue(older.cautions.any { "editorial" in it })
// A streaming original is weighed down, not excluded.
val streamer = candidate(facts("4", "Streamer Film", listOf("Netflix", "Legendary Pictures")), trending = true)
assertNull(streamer.excluded); assertTrue(streamer.cautions.any { "streaming original" in it })
assertTrue(streamer.priority < candidate(facts("5", "Cinema Film", listOf("Legendary Pictures")), trending = true).priority)
}
@Test fun formatAndOrbitStatusAreTheOnlyHardLimits() {
assertEquals("made for TV", candidate(facts("6", "Holiday Romance", listOf("Hallmark Media"), genres = setOf("Romance", "TV Movie"))).excluded)
assertEquals("under 75 minutes", candidate(facts("7", "Special", listOf("Marvel Studios"), minutes = 25)).excluded)
// No duplicate first run: aired or already booked on Orbit means no premiere, however big.
assertFalse(candidate(facts("8", "Aired Hit", listOf("Pixar")), status = OrbitStatus.Aired).worthwhile)
assertFalse(candidate(facts("9", "Booked Hit", listOf("Pixar")), status = OrbitStatus.Scheduled).worthwhile)
// Not read yet: queued for reading, never judged on the catalogue alone.
val unread = candidate(facts("10", "Unread Hit", listOf("Pixar")), read = false, community = null, trending = true)
assertFalse(unread.worthwhile); assertTrue(unread.cautions.any { "queued" in it })
}
@Test fun noHomeIsNeverForced() {
val premium = candidate(facts("11", "Event Drama", listOf("Paramount Pictures")), fit = .6, trending = true, home = null)
assertEquals(AfterWindow.StaysOnPremiere, premium.afterWindow); assertNull(premium.home)
val modest = candidate(facts("12", "Quiet Drama", listOf("A24")), fit = .1, home = action to .2)
assertEquals(AfterWindow.EditorialReview, modest.afterWindow)
}
@Test fun atMostThreeAWeekAndDecidedOnesMakeWay() {
val all = (1..8).map { candidate(facts("2$it", "Film $it", listOf("Universal Pictures")), community = 6.0 + it * .2, trending = it % 2 == 0) }
val week = weeklyPremiereProposals(all, emptySet(), 0)
assertEquals(3, week.size); assertEquals(week.sortedByDescending { it.priority }, week)
assertEquals(1, weeklyPremiereProposals(all, emptySet(), 2).size)
assertTrue(weeklyPremiereProposals(all, emptySet(), 3).isEmpty())
assertTrue(weeklyPremiereProposals(all, setOf(week.first().facts.id), 0).none { it.facts.id == week.first().facts.id })
}
/** Hand-run on saved inputs: ORBIT_DIRECTOR_FIXTURE with premiere-facts.json, evidence-0.jsonl and the channels' episodes files. Writes premiere-selection.json. */
@Test fun replayOnTheLibrary() {
val dir = System.getenv("ORBIT_DIRECTOR_FIXTURE")?.let(::File)
assumeTrue(dir != null && File(dir, "premiere-facts.json").exists())
val input = JSONObject(File(dir, "premiere-facts.json").readText())
val cols = input.getJSONObject("collections")
fun members(names: Set<String>) = names.filter(cols::has).flatMap { n -> cols.getJSONArray(n).let { a -> (0 until a.length()).map { a.getString(it) } } }.toSet()
val trending = members(TrendingLists); val streaming = members(StreamingLists)
val lines = File(dir, "evidence-0.jsonl").readLines().map { JSONObject(it) }
val evidence = lines.associate { it.getString("id") to TitleEvidence.of(it) }
val pools = Briefs.mapNotNull { b -> File(dir, "episodes-${b.number}.json").takeIf { it.exists() }?.let { f ->
val rows = JSONObject(f.readText()).getJSONArray("series"); b.number to (0 until rows.length()).map { rows.getJSONObject(it).getString("id") } } }.toMap()
val text = ChannelText(pools, evidence)
val rows = input.getJSONArray("facts")
val out = JSONArray()
val candidates = (0 until rows.length()).map { rows.getJSONObject(it) }.map { o ->
val f = PremiereFacts(o.getString("id"), o.getString("title"), o.optInt("year").takeIf { it > 0 }, o.getJSONArray("genres").let { a -> (0 until a.length()).map { a.getString(it) }.toSet() },
o.getJSONArray("studios").let { a -> (0 until a.length()).map { a.getString(it) } }, o.getString("premiere"), if (o.isNull("runtime")) null else o.getLong("runtime"), o.getString("work"))
val e = evidence[f.id]
val placed = e?.let { placeTitle(it, text) }
val fit = placed?.ranked?.firstOrNull { it.first.number == PREMIERE_NUMBER }?.second ?: e?.let { 0.0 }
val home = placed?.let(::homeOf)?.let { it.top to it.s1 }
premiereCandidate(f, e, e?.community, fit, home, f.id in trending, f.id in streaming, OrbitStatus.valueOf(o.getString("status")), today)
}
candidates.sortedByDescending { it.priority }.forEach { c -> out.put(JSONObject().put("id", c.facts.id).put("title", c.facts.title).put("premiere", c.facts.premiere)
.put("priority", c.priority).put("worthwhile", c.worthwhile).put("read", c.evidenceRead).put("excluded", c.excluded ?: JSONObject.NULL).put("status", c.status.name)
.put("home", c.home?.name ?: JSONObject.NULL).put("after", c.afterWindow.label).put("stays", c.remainsOnPremiere)
.put("reasons", JSONArray(c.reasons)).put("cautions", JSONArray(c.cautions))) }
File(dir, "premiere-selection.json").writeText(out.toString(1))
File(dir, "premiere-week.json").writeText(JSONArray(weeklyPremiereProposals(candidates, emptySet(), 0).map { it.facts.title }).toString())
}
}