Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1175,21 +1175,16 @@ fun AppNavigation(
CollectionDetailScreen(
collectionId = backStackEntry.arguments?.getString("collectionId") ?: "",
onBackClick = { navController.popBackStack() },
// Collection items can live in other libraries, and a
// library-scoped item read 404s for those. Open them, and
// shuffle picks, unscoped, like the web client.
onShuffleStarted = { shuffle ->
navController.navigate(
org.siloserver.silo.android.ui.screens.shuffle.shufflePlayerRoute(
shuffle,
backStackEntry.arguments?.getString("libraryId")?.toIntOrNull(),
),
org.siloserver.silo.android.ui.screens.shuffle.shufflePlayerRoute(shuffle),
)
Comment on lines 1181 to 1184

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Watch Party solo-playback guard bypass in the collection and series shuffle callbacks starts independent playback without leave confirmation while membership remains active, because PlayerScreen does not leave RoomSession on disposal. Wrap both new onShuffleStarted navigation callbacks in the existing externalSoloGuard.

Prompt for LLM

File androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.kt:

Line 1181 to 1184:

Watch Party solo-playback guard bypass in the collection and series shuffle callbacks starts independent playback without leave confirmation while membership remains active, because PlayerScreen does not leave RoomSession on disposal. Wrap both new onShuffleStarted navigation callbacks in the existing externalSoloGuard.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gap predates this PR, so I'm leaving it out of scope here. The onShuffleStarted callbacks came from main in #476 through the merge; this PR's commit only drops the library argument. On main, none of the three phone shuffle entry points runs the solo guard: the collection and series callbacks in AppNavigation.kt, and the library shuffle in MainScreen.kt (rememberShuffleLauncher { shuffle -> navController.navigate(shufflePlayerRoute(...)) }). externalSoloGuard in AppNavigation.kt covers external routes only. If shuffle should confirm before leaving a Watch Party, all three need the guard at once, and that belongs in its own change against #476's shuffle. I haven't confirmed the leave-on-disposal claim.

Claude Code (claude-opus-5-5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed—my suggestion incorrectly treated a pre-existing shuffle behavior as a regression introduced by this PR.

Based on the history you’ve described, #478 only removes the library scope from collection navigation and shuffle playback. The callbacks came from #476, and the same guard gap affects all three phone shuffle entry points. Wrapping just the two callbacks I cited would be an incomplete fix, and externalSoloGuard should not be treated as a general shuffle guard without checking its intended use.

I retract this suggestion as a required change for #478. Any Watch Party confirmation change should be reviewed separately across all three entry points.

I also retract the definite claim about PlayerScreen disposal: that behavior has not been verified here and should be traced before asserting that room membership remains active.

},
onItemClick = { contentId ->
navController.navigate(
Route.ItemDetail(
contentId,
libraryId = backStackEntry.arguments?.getString("libraryId")?.toIntOrNull(),
).route,
)
navController.navigate(Route.ItemDetail(contentId).route)
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ class CollectionDetailViewModel(
org.siloserver.silo.model.shuffle.ShuffleScopeKind.USER_COLLECTION
}

/** The library the collection was opened from, carried into shuffled playback. */
val browseLibraryId: Int? get() = libraryId
private val pageSize = 40

fun initialize(id: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,21 @@ class CollectionRouteTest {

assertEquals(1, Regex("navArgument\\(\"source\"\\)").findAll(collectionDestination).count())
}

@Test
fun collectionItemsAndShufflesOpenWithoutALibraryScope() {
val collectionDestination = appNavigationSource.substringAfter(
"route = Route.CollectionDetail.ROUTE",
).substringBefore(
"// ---- Detail screens ----",
)

// A library-scoped read 404s for an item filed in another library.
assertEquals(
0,
Regex("Route\\.ItemDetail\\([^)]*libraryId").findAll(collectionDestination).count(),
)
// A collection shuffle draws from the whole collection.
assertEquals(1, Regex("shufflePlayerRoute\\(shuffle\\)").findAll(collectionDestination).count())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1674,12 +1674,15 @@ fun TvAppNavigation(
collectionId = collectionId,
title = title,
libraryType = libraryType,
// Collection items can live in other libraries, and a
// library-scoped item read 404s for those. Open them, and
// shuffle picks, unscoped, like the web client.
onItemClick = { contentId ->
navController.navigateToTvItemDetail(contentId, libraryId = libraryId)
navController.navigateToTvItemDetail(contentId)
},
onBack = { navController.popBackStack() },
onShuffleStarted = { shuffle ->
navController.navigateToTvShufflePlayback(shuffle, libraryId, lastPlaybackNavigation)
navController.navigateToTvShufflePlayback(shuffle, null, lastPlaybackNavigation)
},
)
}
Expand Down
Loading