Setup counts toward the household's hour; comfort settings stay with each TV
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 3m12s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 3m19s
release-gate / verify (push) Successful in 9m37s

- Channel setup (one request a second) now keeps to the household's share of
  SETUP_HOURLY (600) in any 60 minutes, slowing rather than refusing, so a channel
  always finishes (12 Nov: 502 requests in the living room's first hour).
- Joining a room no longer copies reduce motion or subtitles: comfort settings stay
  with each TV, like its sound and picture switches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 17:37:55 +00:00
co-authored by Claude Opus 5.5
parent 8be7790ad4
commit be84fdbfe5
3 changed files with 33 additions and 5 deletions
@@ -20,3 +20,19 @@ class HouseholdBudgetTest {
assertEquals(BackgroundPacing.MIN_CEILING, BackgroundPacing.ceiling)
}
}
class SetupBudgetTest {
@org.junit.After fun reset() = BackgroundPacing.resetForTest()
@Test fun setupSlowsOnceTheHouseholdsHourIsUsedButNeverStops() {
var now = 0L
val waits = mutableListOf<Long>()
BackgroundPacing.resetForTest()
BackgroundPacing.clock = { now }
BackgroundPacing.sleep = { ms -> waits += ms; now += ms }
BackgroundPacing.tvs = 2
BackgroundPacing.setup { repeat(301) { BackgroundPacing.beforeRequest() } }
// 300 at a second apart, then the 301st waits 12 s (300 an hour for each of two TVs).
assertEquals(1_000L, waits[waits.size - 2])
assertEquals(12_000L, waits.last())
}
}