Repository navigation
fix(mobile): separate movies and series in mixed libraries - #447
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughMixed libraries now support movie and series scopes across browsing, recommendations, and collection details. Scope-specific preferences and requests are kept separate. Shared code filters and refills scoped sections, and TV delegates section scoping to that implementation. ChangesMixed-media library scoping
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~30 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
actor User
participant LibrariesScreen
participant LibrariesViewModel
participant SectionApi
participant scopeLibrarySection
User->>LibrariesScreen: Select movie or series scope
LibrariesScreen->>LibrariesViewModel: Update selected media scope
LibrariesViewModel->>SectionApi: Request library sections
SectionApi-->>LibrariesViewModel: Return section catalogs
LibrariesViewModel->>scopeLibrarySection: Filter sections and request refills
scopeLibrarySection-->>LibrariesViewModel: Return scoped sections and completion state
Suggested reviewers:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Quick104
left a comment
There was a problem hiding this comment.
Reviewed 4e40a9858d103e40755d4ada65246c424b135a69. Both findings were checked against the current server implementation and reproduced with the production shelf-scoping helper.
AI-assisted review with gpt-6.1-sol in T3 Code using the Codex provider (Codex harness).
| val target = (section.itemLimit.takeIf { it > 0 } ?: section.items.size.coerceAtLeast(20)).coerceAtMost(100) | ||
| fun result(items: List<SectionItem>, incomplete: Boolean = false) = | ||
| ScopedLibrarySection(section.copy(items = items.take(target), totalCount = items.size.coerceAtMost(target)), incomplete) | ||
| if (initial.size >= target || section.totalCount <= section.items.size) return result(initial) |
There was a problem hiding this comment.
[P2] Do not treat the inline shelf count as proof of exhaustion
For an untyped mixed library, the server’s Recently Added fetcher and Recently Released fetcher apply LIMIT item_limit and return len(items) as total_count; that count can equal the inline size while older matching titles remain pageable. With 20 inline movies and older series, selecting Series hits this return, makes zero refill requests, and hides the shelf without an incomplete notice. I reproduced that result using this production helper; changing only total_count to 21 makes it load the available series. Use a reliable exhaustion signal for pageable shelves so a full combined slice cannot suppress the selected type.
There was a problem hiding this comment.
Fixed in 7e7682b. total_count now counts as an exhaustion signal only when the inline slice is shorter than item_limit, meaning the server's query really ran out. A full slice keeps paging the section source until has_more=false. Added fullInlineSliceRefillsEvenWhenTotalCountEqualsItsSize (20 movies with total_count=20: the Series scope now makes one refill and shows the series) and underfilledInlineSliceIsExhaustedWithoutRefill.
| val result = v2.browse(CatalogQueryV2(source = "section", scope = "library", | ||
| libraryId = libraryId.toString(), sectionId = sectionId, limit = 100), continuation) |
There was a problem hiding this comment.
[P2] Preserve profile section overrides during refills
The layout uses profile-resolved sections, but this catalog source loads only the stored page_sections definition. For example, give an admin Random shelf a profile override of filter_type=movie, with more than 20 matching movies. Its inline row contains 20 movies and reports total_count=21. Selecting Series triggers this refill against the admin’s unfiltered definition; the helper then publishes series under the customized row instead of omitting the movie-only row. I reproduced the replacement with the production helper and the two server response shapes. Refill the same resolved section definition, or retain its scoped inline result when the catalog source cannot preserve the override.
There was a problem hiding this comment.
Fixed in 7e7682b. Confirmed that loadCatalogSection only reads page_sections. Sections flagged customized or is_custom are no longer refilled through the catalog section source. They keep their profile-resolved inline slice, filtered to the selected type, and are reported incomplete when that slice is short. Added profileCustomizedShelfNeverRefillsFromTheStoredDefinition (your movie-only Random case: no series published) and profileAddedShelfNeverRefillsFromTheCatalogSource.
Trade-off: customized doesn't say what was overridden, so a shelf that was only reordered or renamed also loses the refill. A complete fix needs the server's catalog section source to apply the resolved config; until then the client can't refill these shelves safely.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Silo's pull request guidance changed today (#490). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Missing here: Before-and-after phone screenshots of a mixed library showing the Movies/Series chips and the scoped results (the body marks them pending). The rules are in Show visible changes, and the PR template shows the Evidence section layout. I've converted this PR to draft for now. Mark it ready for review once the Evidence section is filled in. Generated by Claude Code |
7e7682b to
38f604a
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
38f604a to
d9d3132
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
d9d3132 to
7ed001e
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
7ed001e to
bada08b
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
bada08b to
a579f76
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
a579f76 to
97cb5da
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
c67aafb to
38e4d11
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
@Quick104 ready for review. Rebased on main after #441, now only the phone change and the shared refill helper that TV also uses. Your two P2s are fixed (replies on the threads). The Kody findings since are fixed or answered, including hiding shuffle in Movies/Series-scoped views and keeping inline items through refills. CI is green and the Evidence section is published. |
…overrides A full inline slice is not proof of exhaustion: Recently Added and Recently Released report total_count = len(items) after LIMIT item_limit, so a movie-only slice of 20 hid older series without a refill or notice. Only an under-filled slice (items < item_limit, total_count <= items) now skips the refill. The catalog section source pages the stored page_sections definition, not the profile-resolved one, so refilling a customized or profile-added shelf replaced its override (e.g. a movie-only Random row filled with series). Those shelves now keep their scoped inline slice and report it as incomplete instead of paging the admin definition. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…views The phone counterpart of the TV change: a shuffle request carries only the collection kind and id, so a scoped view of a mixed library's collection would shuffle both types. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A shuffle request carries no media type, so shuffling a mixed library with the Series chip selected would also play movies. Match the scoped collection views and hide it until the request can carry the scope. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A completed refill returned only what the catalog pages yielded, so a changing shelf such as Random could drop a series it already showed inline, or vanish. Merge matching inline items into the result with the same content-id deduplication the incomplete paths use. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…efill Appending them after the refilled items let the trim to the shelf limit evict them whenever a fresh Random sample alone filled the shelf. They are the start of an ordered shelf anyway, so leading with them keeps order and guarantees they survive. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
0507955 to
fdd439e
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
@Quick104 rebased on main again ( #532 is a small TV follow-up for the same #468 change: a mixed library's Movies and Series tabs currently share one saved Browse state. It uses the identical store change, so the two merge cleanly in either order. |
| permits.withPermit { | ||
| scopeLibrarySection(section, mediaScope) { cursor -> | ||
| currentCoroutineContext().ensureActive() | ||
| sectionRepository.getLibrarySectionCatalogItems(libraryId, section.id, owner, cursor) |
There was a problem hiding this comment.
Section override loss occurs because sectionRepository.getLibrarySectionCatalogItems(libraryId, section.id, owner, cursor) fetches the stored section ID rather than the profile-resolved definition used by the inline shelf; capturing owner preserves request authority but not section overrides, allowing refill results to replace profile-customized recommendations with items from the administrator's definition. Refill using the layout's resolved query and profile scope; if the catalog endpoint cannot preserve those overrides, retain the type-filtered inline results.
Kody rule violation: Preserve resolved library and profile scope across navigation and refills
Prompt for LLM
File androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesScreen.kt:
Line 601:
Section override loss occurs because `sectionRepository.getLibrarySectionCatalogItems(libraryId, section.id, owner, cursor)` fetches the stored section ID rather than the profile-resolved definition used by the inline shelf; capturing `owner` preserves request authority but not section overrides, allowing refill results to replace profile-customized recommendations with items from the administrator's definition. Refill using the layout's resolved query and profile scope; if the catalog endpoint cannot preserve those overrides, retain the type-filtered inline results.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
This is already handled, in the shared helper this call goes through. scopeLibrarySection (shared/.../catalog/LibraryMediaScope.kt) returns before any refill when a section is customized or is_custom. It keeps the profile-resolved inline items, filtered to the selected type, and marks the shelf incomplete so the Retry notice shows.
The server sets those flags for every profile override: sections.Resolve sets Customized = true whenever an override exists for the section (title, position, featured, item limit or config), and profile-added shelves resolve with is_custom. So getLibrarySectionCatalogItems only pages sections that have no profile overrides, where the stored definition is the resolved one. LibraryMediaScopeTest covers both flags. The rebase didn't change this; it's the fix from 7e7682b on the earlier thread.
There was a problem hiding this comment.
You're right—the original finding overlooked the guard in the shared helper.
I verified that scopeLibrarySection:
- Filters the profile-resolved inline items to the selected media type.
- Returns before invoking the refill callback when
section.customized || section.isCustom(shared/src/commonMain/kotlin/org/siloserver/silo/catalog/LibraryMediaScope.kt:29–41). - Marks that retained slice incomplete when it still needs a refill; already-full or demonstrably exhausted slices return earlier without a warning.
The tests cover both customized and profile-added shelves, including preserving an inline episode and preventing catalog access for profile-added sections (shared/src/commonTest/kotlin/org/siloserver/silo/catalog/LibraryMediaScopeTest.kt:58–82).
Given the server flag contract you described, the stored-definition request cannot replace profile-customized recommendations on this path. The original suggestion is already addressed; no additional code change is needed for this concern.
| if (visible.size >= target || !page.data.hasMore) | ||
| return result((initial + visible.values).distinctBy { it.contentId }) |
There was a problem hiding this comment.
Redundant pagination continues after the merged inline/refill items fill the shelf because the termination check counts only visible, while the result includes initial first. A mixed slice with 19 matching items and one new matching refill item already fills a 20-item shelf but can still trigger all eight page requests; terminate using the merged count deduplicated by contentId.
val merged = (initial + visible.values).distinctBy { it.contentId }
if (merged.size >= target || !page.data.hasMore)
return result(merged)Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/catalog/LibraryMediaScope.kt:
Line 55 to 56:
Redundant pagination continues after the merged inline/refill items fill the shelf because the termination check counts only `visible`, while the result includes `initial` first. A mixed slice with 19 matching items and one new matching refill item already fills a 20-item shelf but can still trigger all eight page requests; terminate using the merged count deduplicated by `contentId`.
Suggested Code:
val merged = (initial + visible.values).distinctBy { it.contentId }
if (merged.size >= target || !page.data.hasMore)
return result(merged)
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
Agreed, fixed in 539a5072. The loop now compares the merged, deduplicated inline and refilled items with the target, so a page that completes the shelf ends the paging. refillStopsOnceInlineAndRefilledItemsFillTheShelf covers it: two matching inline items plus one new item on a three-item shelf make one request (three before the fix). TV shares this helper.
There was a problem hiding this comment.
Thanks—the fix described in 539a5072 addresses this finding. Checking the merged, deduplicated count stops pagination as soon as inline and refilled items fill the shelf.
refillStopsOnceInlineAndRefilledItemsFillTheShelf covers the reported case: one request instead of three. Since TV shares the helper, it benefits from the same fix. No further change is needed for this suggestion.
…te it The refill loop compared only the newly paged items with the shelf target, although the result also keeps the matching inline items. A Random shelf whose inline items nearly filled it kept paging, up to eight requests, after one new item had already completed it. Count the merged, deduplicated items instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Android phone users can open mixed libraries, but movies and series remain combined across recommendations, the catalog, and collections. There is no way to browse just one video type.
Related issue: N/A
Validation tasks: changes #5 C1 (mixed-library collection routes on phone now carry the selected Movies/Series scope); its cases are all Not run, so no recorded result changes.
Approach
Add Movies/Series chips within the existing Libraries screen. Retain that selection through catalog queries, pagination, recommendations, collection routes, and saved filters. Switching types invalidates outstanding requests and cancels obsolete recommendation jobs, including pending shelf pages. Reuse the TV shelf-refill logic from the shared module and hide collection counts that describe both types together.
The TV half landed in #441. This branch is rebased on main and contains only the phone change and the shared refill helper, which TV now uses too. #468 moved
BrowsePrefsStoreinto Android shared code; the phone's per-scope saved filters now live there, as an optional media scope that leaves every unscoped key unchanged. #532 uses the identical store change to give TV's Movies and Series tabs their own saved filters, so either can merge first. Apple companion: Silo-Server/silo-apple#578 (merged). No server changes are required.Validation
On head
539a5072, rebased on main021c5eae:test-check-build-supply-chain.sh,check-build-supply-chain.sh): passed../gradlew testDebugUnitTest: 5,623 tests, zero failures, errors or skips (823 phone, 1,243 TV, 1,843 shared, 1,712 Android shared, 2 libass bridge).:androidApp:assembleDebugand:androidTvApp:assembleDebug: passed.lintDebugfor Android shared, phone and TV, plus phone and TVlintVitalRelease: no new issues beyond the baseline.git diff --check main...HEAD: passed.Regression coverage includes stale responses after scope changes, cancelled recommendation loads, separate saved filters, episode progress, Match Any queries and page two, regular/personal collection scope, shelf refill when the inline count equals the slice, completed refills keeping matching inline items, and paging stopping once inline and refilled items fill the shelf.
Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/pr-447/
Captured from real Android phone builds on the same Android 15 emulator and profile. Before:
9518b262305a3137949b90720ce263617d1e46a3, before the mixed-library changes. After:7e7682b7c1752640ab0a021f92b12aaac7dd8d3a, the current PR head. Both builds use the same deterministic synthetic API fixture: Movie One, Movie Two, Series One and Series Two, with identical poster data.The fixture serves API responses to the unmodified native apps. These captures verify client presentation and scoping; they do not verify a production server or playback.
Before, both types share the mixed library and there are no Movies/Series chips. After, each chip shows only matching recommendations and catalog results. The accessibility snapshots confirm the two movie titles in Movies and the two series titles in Series.
The captures predate the rebase onto main. The rebase merged the scope state into main's reworked library-list refresh and did not change the Movies/Series UI.
Risks
Recommendation refills use bounded paging and show a retry notice if incomplete. The phone checks below use synthetic API fixtures; production-server and playback verification are outside this evidence capture.
Mixed libraries appear only under the Movies and Series tabs on TV. They never matched the Music or Audiobooks tabs on main; a test now pins that.
Profile-customized shelves keep their profile-resolved inline items and are not refilled, because the catalog section source reads only the stored definition. A shelf that was only renamed or reordered is affected the same way until the server applies the resolved config there.
Shuffle is hidden while a Movies/Series chip is selected, in Browse and in scoped collection views, because a shuffle request carries no media type.
Checklist
AI Disclosure
gpt-6-astragpt-6.1-sol, with GitHub CLI, agent-device and Android emulators. AI prepared the fixture, built both revisions, drove the native app and updated this description. No independent agent reviewed this evidence follow-up.claude-opus-5-5[1m], resolved the conflict with main's library-list refresh and reran the gates above. No independent agent reviewed the rebase.claude-opus-5-5, moved the per-scope saved filters into the relocated sharedBrowsePrefsStoreafter fix(tv): keep library browse sort and filters across app restarts #468 and reran the gates above. No independent agent reviewed it.Automated review summary (refreshed by Kody)
Summary
Separate movies and series in mixed libraries on Android mobile and Android TV, keeping the selected media type consistent across recommendations, browsing, and collection details.
Changes
Test Coverage
Add and update tests covering:
Review Finding
Automated review reported one medium-severity finding concerning obsolete recommendation pagination when switching libraries or media scope (
LibrariesScreen.kt:512).Note
Add Movies and Series scope switching for mixed libraries on mobile
scopeLibrarySectionin LibraryMediaScope.kt filters inline items and refills shelves by paging the catalog (up to 8 pages); customized or profile-added shelves are never refilled and show a retry item when incomplete. The TV app now delegates to this shared implementation.Macroscope summarized 539a507.