Skip to content

fix(mobile): separate movies and series in mixed libraries - #447

Merged
Quick104 merged 8 commits into
Silo-Server:mainfrom
RXWatcher:fix/mobile-mixed-library-scope
Oct 9, 2026
Merged

Quick104 merged 8 commits into
Silo-Server:mainfrom
RXWatcher:fix/mobile-mixed-library-scope

Conversation

@RXWatcher

@RXWatcher RXWatcher commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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 BrowsePrefsStore into 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 main 021c5eae:

  • Build supply-chain checks (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:assembleDebug and :androidTvApp:assembleDebug: passed.
  • lintDebug for Android shared, phone and TV, plus phone and TV lintVitalRelease: 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.

Surface Before After: Movies After: Series
Recommended android447 before recommended android447 after movies recommended android447 after series recommended
Library android447 before library android447 after movies library android447 after series library

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

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Codex harness in T3 Code
  • Tool(s): Codex
  • Model(s): OpenAI gpt-6-astra
  • Involvement: AI-assisted
  • Adversarial review: The same coding agent reviewed stale-response rejection, type constraints with Match Any, saved-state separation, section owner checks, and collection routing against the API contracts. Regression tests exercise those paths. Combined collection counts were hidden for scoped views. No independent reviewer was used; native phone behavior is now verified in the Evidence section above.
  • Evidence follow-up: Codex harness in T3 Code, model gpt-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.
  • Rebase: Claude Code, model 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.
  • Second rebase: Claude Code in T3 Code, model claude-opus-5-5, moved the per-scope saved filters into the relocated shared BrowsePrefsStore after 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

  • Mobile: Add Movies and Series selectors for mixed libraries, defaulting to Movies. Store browse filters, sort order, and filter-preservation settings separately for each media type.
  • Android TV: Make mixed libraries available in both the Movies and Series tabs, with separate scoped library views.
  • Filter recommendation shelves to the selected media type and load additional pages when needed to find matching titles. Preserve shelf order and episode playback context, including series information and watch progress.
  • Retain available matching recommendations and display a retryable warning when shelves cannot be fully loaded.
  • Carry the selected media type into library and user-collection details, including subsequent pages, refreshes, and sorting requests. Hide unscoped collection counts on mobile while a media type is selected.
  • Reset mobile library content when switching libraries or media types, reject outdated browse responses, and return recommendations to the top.

Test Coverage

Add and update tests covering:

  • Default mixed-library scope, media switching, separate saved preferences, and stale browse-response rejection.
  • Media scoping across filtered queries, pagination, collection navigation, refreshes, and sorting.
  • Android TV access through both video tabs.
  • Recommendation refilling, shelf ordering, bounded concurrent loading, episode playback-context preservation, and partial-load failures.

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

  • Mixed libraries now open in a Movies scope with Movies/Series chips in the floating chrome; switching scope resets state, cancels pending requests, and loads the new selection (LibrariesScreen.kt).
  • Filter, sort, and preserve-filters preferences are stored per scope via new media-scope parameters in BrowsePrefsStore.kt.
  • Scoped collection detail loads and pages catalog items with the selected media type, library ID, and source; unscoped personal collections keep the opaque cursor path (CollectionDetailViewModel.kt).
  • Shared scopeLibrarySection in 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.
  • Behavioral Change: scoped views hide library and collection shuffle, hide item counts on scoped collection cards, and shuffle is unavailable for scoped collections; unscoped paths keep prior behavior.

Macroscope summarized 539a507.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1c5e1d9-8428-499e-9759-2bdb9d796a7c

📥 Commits

Reviewing files that changed from the base of the PR and between 0507955 and fdd439e.


📒 Files selected for processing (2)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/settings/BrowsePrefsStore.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesScreen.kt

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

Mixed 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.

Changes

Mixed-media library scoping

Layer / File(s) Summary
Shared media scope and section filtering
shared/src/commonMain/kotlin/org/siloserver/silo/catalog/LibraryMediaScope.kt, shared/src/commonMain/kotlin/org/siloserver/silo/network/api/SectionApi.kt, shared/src/commonTest/kotlin/org/siloserver/silo/catalog/LibraryMediaScopeTest.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/library/TvLibraryMediaScope.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/library/TvMixedLibraryScopeTest.kt
Shared code matches media types, filters scoped sections, and refills under-filled sections with catalog pages. It marks incomplete results when refill cannot verify a full scope. TV delegates section scoping to the shared implementation. Tests cover refill and customized-section cases.
Android mixed-library browsing
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesScreen.kt, android-shared/src/androidMain/kotlin/org/siloserver/silo/common/settings/BrowsePrefsStore.kt, androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesViewModelTest.kt
Mixed libraries default to movie scope and can switch between Movies and Series. Browse requests, request identity, filters, sort, and preservation settings use the active scope. Library or scope changes reset content and invalidate prior requests.
Scoped recommendations and library UI
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesScreen.kt, androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesViewModelTest.kt, androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibraryChromeInsetSourceTest.kt
Recommendation sections are scoped with up to three concurrent loads. Empty sections are omitted, and incomplete loads can show an inline retry message. Scoped views hide library shuffle and collection counts. Scope controls and collection callbacks receive the active scope.
Android scoped collection details
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/*, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/MainScreen.kt, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/collections/*, androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/navigation/CollectionRouteTest.kt, androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/collections/CollectionDetailViewModelTest.kt
Collection routes carry an optional media scope. Scoped collection details request items with the selected media type, library ID, and collection source. Scoped details do not expose a shuffle scope.

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
Loading

Suggested reviewers: quick104, rhainland


Merge Risk

Merge Risk: ⚪ Minimal · up to fdd43

The change adds Movies and Series scoping for mixed libraries on phones. The supplied evidence shows no remaining concrete merge-blocking issue, and the reported build, test and lint results are clean.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 4e40a

The inspected browsing flows retain identity checks and reject outdated scope-specific results. No introduced security vulnerability was established, but server-side resource authorization and account-switch lifecycle behavior remain incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected exposure is catalog metadata and personalized section results consumed by mobile and TV. Collection source and resource identifiers reach authenticated catalog requests; the maximum cross-library or cross-profile exposure cannot be established without server authorization evidence.

Trust Boundaries and Controls

  • observed — Movie and series selection is a presentation/query filter, not an authorization boundary. Section refills independently validate captured authority before and after catalog execution.
  • observed — Catalog transport pins requests and continuations to an identity snapshot and checks ownership before and after execution. IDENTITY compares server, identity generation, and credential epoch, rather than directly comparing profile identifiers. Complete profile-transition enforcement therefore remains unverified.

Resilience and Maintainability Implications

  • observed — Mobile query-generation and media-scope checks supplement transport ownership, while recommendation loaders additionally revalidate captured authority at publication. Profile-completion and server-switch navigation clear the back stack, providing lifecycle counterevidence to stale-state concerns, although complete teardown timing was not established.



Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 24.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 87 functions across 30 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly summarizes the primary change: separating movies and series in mixed libraries on mobile.
Description check Passed The description directly explains the mixed-library scoping changes, affected Android surfaces, implementation approach, validation, and known limitations.


  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

@Quick104 Quick104 left a comment

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.

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)

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.

[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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment on lines +43 to +44
val result = v2.browse(CatalogQueryV2(source = "section", scope = "library",
libraryId = libraryId.toString(), sectionId = sectionId, limit = 100), continuation)

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.

[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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

silo-kody Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Quick104 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

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 Evidence: none, no user-visible change. This PR was opened before the rule existed, so it hasn't had a chance to meet it yet.

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

@Quick104
Quick104 marked this pull request as draft October 6, 2026 19:25
@RXWatcher
RXWatcher marked this pull request as ready for review October 6, 2026 20:04
@RXWatcher
RXWatcher marked this pull request as draft October 7, 2026 20:44
@RXWatcher
RXWatcher force-pushed the fix/mobile-mixed-library-scope branch from 7e7682b to 38f604a Compare October 7, 2026 20:57
@silo-kody

silo-kody Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@RXWatcher
RXWatcher force-pushed the fix/mobile-mixed-library-scope branch from 38f604a to d9d3132 Compare October 7, 2026 21:56
@silo-kody

silo-kody Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@RXWatcher
RXWatcher force-pushed the fix/mobile-mixed-library-scope branch from d9d3132 to 7ed001e Compare October 7, 2026 22:26
@silo-kody

silo-kody Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@RXWatcher
RXWatcher force-pushed the fix/mobile-mixed-library-scope branch from 7ed001e to bada08b Compare October 7, 2026 23:11
@silo-kody

silo-kody Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@RXWatcher
RXWatcher force-pushed the fix/mobile-mixed-library-scope branch from bada08b to a579f76 Compare October 7, 2026 23:36
@silo-kody

silo-kody Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@RXWatcher
RXWatcher force-pushed the fix/mobile-mixed-library-scope branch from a579f76 to 97cb5da Compare October 8, 2026 00:58
@silo-kody

silo-kody Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@silo-kody

silo-kody Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@RXWatcher
RXWatcher force-pushed the fix/mobile-mixed-library-scope branch from c67aafb to 38e4d11 Compare October 8, 2026 02:18
@silo-kody

silo-kody Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@silo-kody

silo-kody Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 1 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Validate download ownership before publishing subtitle bytes

@RXWatcher
RXWatcher marked this pull request as ready for review October 8, 2026 02:53
@RXWatcher

Copy link
Copy Markdown
Contributor Author

@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.

RXWatcher and others added 7 commits October 9, 2026 19:30
…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]>
@RXWatcher
RXWatcher force-pushed the fix/mobile-mixed-library-scope branch from 0507955 to fdd439e Compare October 9, 2026 19:47
@silo-kody

silo-kody Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@RXWatcher

Copy link
Copy Markdown
Contributor Author

@Quick104 rebased on main again (021c5eae). The only conflict was #468 moving BrowsePrefsStore into Android shared code; the phone's per-scope saved filters now sit there as an optional media scope, and unscoped keys are unchanged. Full test suite, lint and both debug builds pass locally; description updated.

#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)

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 Kody Rules high

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.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment on lines +55 to +56
if (visible.size >= target || !page.data.hasMore)
return result((initial + visible.values).distinctBy { it.contentId })

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 Performance medium

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.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

silo-kody Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌
⚠️ 1 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Validate download ownership before publishing subtitle bytes

@Quick104
Quick104 merged commit 7401e55 into Silo-Server:main Oct 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants