Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

test(live): lock playback request contracts

David Nashash23c26d64e7aa
diff --git a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
index b6cfe739..b71d6b24 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -311,7 +311,7 @@ Expected: FAIL because `LiveRoutePatterns` does not exist.
Implement the four constants exactly as asserted. Rerun the focused test; expected PASS.
-- [ ] **Step 3: Write failing playback-request value tests**
+- [x] **Step 3: Write playback-request value tests**
Define tests that construct a real `Channel`/`Program` fixture and assert every field survives construction:
@@ -331,7 +331,12 @@ assertThat(request.returnDestination).isEqualTo(AppDestination.Guide(12L, 1_700_
Run the test and expect a missing-type compilation failure.
-- [ ] **Step 4: Implement the immutable request values**
+The request value types were introduced with the feature contracts before this
+checkpoint. `LivePlaybackRequestContractTest` now locks channel and archive
+field identity, virtual/combined-source metadata, and Guide return-route
+preservation; the focused suite is green.
+
+- [x] **Step 4: Implement the immutable request values**
```kotlin
data class LiveChannelPlaybackRequest(
diff --git a/feature/live/src/test/java/com/streamvault/feature/live/navigation/LivePlaybackRequestContractTest.kt b/feature/live/src/test/java/com/streamvault/feature/live/navigation/LivePlaybackRequestContractTest.kt
new file mode 100644
index 00000000..a73d786c
--- /dev/null
+++ b/feature/live/src/test/java/com/streamvault/feature/live/navigation/LivePlaybackRequestContractTest.kt
@@ -0,0 +1,75 @@
+package com.streamvault.feature.live.navigation
+
+import com.google.common.truth.Truth.assertThat
+import com.streamvault.domain.model.Channel
+import com.streamvault.domain.model.Program
+import com.streamvault.feature.live.api.LiveArchivePlaybackRequest
+import com.streamvault.feature.live.api.LiveChannelPlaybackRequest
+import org.junit.Test
+
+class LivePlaybackRequestContractTest {
+
+ @Test
+ fun channelRequest_preservesEveryCompositionField() {
+ val channel = Channel(
+ id = 42L,
+ name = "News",
+ streamUrl = "https://example.test/news.m3u8",
+ providerId = 7L,
+ )
+
+ val request = LiveChannelPlaybackRequest(
+ channel = channel,
+ categoryId = 12L,
+ providerId = 7L,
+ isVirtual = true,
+ combinedProfileId = 34L,
+ combinedSourceFilterProviderId = 56L,
+ returnRoute = "epg?categoryId=12&anchorTime=1700000000000&favoritesOnly=true",
+ )
+
+ assertThat(request.channel).isSameInstanceAs(channel)
+ assertThat(request.categoryId).isEqualTo(12L)
+ assertThat(request.providerId).isEqualTo(7L)
+ assertThat(request.isVirtual).isTrue()
+ assertThat(request.combinedProfileId).isEqualTo(34L)
+ assertThat(request.combinedSourceFilterProviderId).isEqualTo(56L)
+ assertThat(request.returnRoute)
+ .isEqualTo("epg?categoryId=12&anchorTime=1700000000000&favoritesOnly=true")
+ }
+
+ @Test
+ fun archiveRequest_preservesChannelProgramAndReturnRoute() {
+ val channel = Channel(
+ id = 42L,
+ name = "News",
+ streamUrl = "https://example.test/news.m3u8",
+ providerId = 7L,
+ )
+ val program = Program(
+ id = 99L,
+ channelId = "news",
+ title = "The Briefing",
+ startTime = 1_700_000_000_000L,
+ endTime = 1_700_000_600_000L,
+ providerId = 7L,
+ )
+
+ val request = LiveArchivePlaybackRequest(
+ channel = channel,
+ program = program,
+ categoryId = 12L,
+ isVirtual = true,
+ combinedProfileId = 34L,
+ returnRoute = "epg?categoryId=12&anchorTime=1700000000000&favoritesOnly=true",
+ )
+
+ assertThat(request.channel).isSameInstanceAs(channel)
+ assertThat(request.program).isSameInstanceAs(program)
+ assertThat(request.categoryId).isEqualTo(12L)
+ assertThat(request.isVirtual).isTrue()
+ assertThat(request.combinedProfileId).isEqualTo(34L)
+ assertThat(request.returnRoute)
+ .isEqualTo("epg?categoryId=12&anchorTime=1700000000000&favoritesOnly=true")
+ }
+}