Skip to content

feat(sections): rework the default home rows - #2286

Merged
Quick104 merged 3 commits into
mainfrom
feat/home-default-rows
Oct 11, 2026
Merged

Quick104 merged 3 commits into
mainfrom
feat/home-default-rows

Conversation

@Quick104

@Quick104 Quick104 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1137
Validation tasks: changes #1140 C1; changes #1142 C1 (neither case has been run yet)

A fresh install's home page is mostly "Recently Added in X" and "Recently Released in X" rows, two for every library. A server with Movies and TV gets four recency rows out of eight; five libraries give ten out of fourteen. The rest of the defaults (Hidden Gems, Trending on Server) need watch history, so a new server shows little else. This change replaces the per-library rows with one Recently Added row for movies and TV, adds rows that fill without history, and raises default movie and TV rows to 100 items.

New default home rows, in order: Continue Watching, Continue Listening (audiobook servers only), Recently Added, Recommended for You, Because You Watched, Returning Shows, Trending This Week (TMDB), Top Rated, Hidden Gems, Seasonal Picks. Rows with nothing to show stay hidden, as before.

Approach

  • Recently Added for all movie and TV libraries. The row uses media_scope: "video". A recently-added row that spans series libraries and other libraries now takes TV cards from arrival-event grouping (the same path the TV library page uses, so a new episode of an old show brings the show to the top) and movies from the plain query, and merges them by added time. Before, a multi-library row skipped event grouping and showed series by first-added date. This also applies to existing admin-made Recently Added rows with no library filter.
  • New libraries. Creating a movie or TV library no longer adds per-library home rows when home has an enabled shared Recently Added row. Homes seeded with the old defaults, or whose admin disabled the shared row, keep getting per-library rows. Book, audiobook, and manga libraries keep their rows in both cases.
  • Rows that fill without history. Trending This Week uses the TMDB weekly feed the calendar already refreshes, matched to titles the server owns; it replaces Trending on Server, which is empty on a new server. Top Rated is the existing Critically Acclaimed row (TMDB 8.0+ with 500+ votes, daily mix).
  • Row size. Default rows and admin rows created without a limit use 100 items (sections.DefaultItemLimit); the old default was 20. Default rows for audiobook, ebook, manga, and other non-video libraries (including Continue Listening) stay at 20, since those beta surfaces are left as they are. The admin API maximum stays 500. Recommendation rows still top out near 60 because the recommendation cache holds 60 candidates.
  • TV library pages gain Returning Shows.

Existing servers keep their rows until an admin uses Restore Defaults.

Apple and Android: rows are rendered generically, so no client change is required. Silo-Server/silo-apple#731 and Silo-Server/silo-android#549 track checking 100-item rows on the native apps.

Validation

  • Go build, vet, gofmt, make lint-changed: clean.
  • Focused tests (internal/sections, internal/catalog, internal/api/handlers): pass, including new DB tests for the merged row's order, video scope, caller library scope, and the new-library rule (with the shared row enabled and disabled), run against Postgres.
  • make test-go: pass except two internal/mediasample tests that depend on the local ffmpeg build; this change does not touch that package.
  • On a test server (39-title library, profile with no history): Restore Defaults produced the new row set; Recently Added held all 7 shows and 32 movies in arrival order; Top Rated and Hidden Gems filled once TMDB vote data was present.

Evidence

Same test server and profile, before and after Restore Defaults, web desktop:

  • Before: Seasonal Picks, Recently Added in Movies, Recently Released in Movies, Recently Added in TV Shows, Recently Released Episodes in TV Shows.
  • After: Continue Watching, Recently Added (shows and movies in one row), Top Rated, Hidden Gems, Seasonal Picks. Recommended, Because You Watched, Returning Shows, and Trending This Week were empty for this profile and library and stayed hidden.

Surface and build: web app, this branch.

Risks

  • A series that sits in both a series library and a mixed library can appear twice on the merged row when it gets a new episode (once as the episode, once as the series).
  • On the web, Top Rated and Hidden Gems can show the same titles for a profile with little history: the web loads rows one at a time, which skips the cross-row duplicate filter that GET /api/v2/home/sections applies. The native apps use that endpoint and are not affected.
  • 100-item rows make GET /api/v2/home/sections responses larger (about 1.3 KB per card before compression).

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: Claude Code (Claude Agent SDK), running in T3 Code
  • Tool(s): Claude Code, including Claude Code subagents
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, at a maintainer's direction; maintainer review pending
  • Adversarial review: a separate Claude Code subagent reviewed the change for access scoping, cache keys, total counts, duplicate cards, and the new-library rule. It fixed three bugs before this PR (movies on the merged row sorted by the wrong timestamp, TV libraries typed tv/show/tvshows left out of the shared row, and an inflated total count); the remaining findings are listed under Risks.

🤖 Generated with Claude Code

Fresh installs and Restore Defaults now get one Recently Added row for all
movie and TV libraries instead of two rows per library. New episodes of a
show already in the library still bring the show to the top: TV libraries
use arrival-event grouping and the merged row interleaves them with movies
by added time. The home defaults add Recommended for You, Because You
Watched, Returning Shows, Trending This Week (TMDB), and Top Rated, which
replaces Trending on Server. Default rows and admin rows created without a
limit show 100 items. TV library pages gain Returning Shows.

A movie or TV library created later no longer adds its own home rows when
home already has a shared Recently Added row. Book, audiobook, and manga
libraries keep their per-library rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 11, 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 ❌

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T21:39:05.767312Z 3e9267c New commits
🔒 Security Review ✅ Completed 2026-10-11T21:39:57.940660Z 3e9267c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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: bf2efeff-2c87-4226-842f-243972349d0c


📥 Commits

Reviewing files that changed from the base of the PR and between bac0752 and 3e9267c.



📒 Files selected for processing (2)
  • internal/sections/fetcher.go
  • internal/sections/recently_added_shared_db_test.go


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




📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request updates home and library section defaults and item limits. It adds shared Recently Added behavior for video libraries and merges TV event cards with recent media from other libraries.

Changes

Shared Recently Added section behavior

Layer / File(s) Summary
Default section definitions and limits
internal/sections/defaults.go, internal/sections/defaults_test.go, internal/api/handlers/admin_sections_service.go, internal/api/handlers/sections_test.go
Home and library defaults use updated row definitions and item limits. Series defaults include Returning Shows. Admin section creation uses the shared default limit. Tests verify the revised defaults and ordering.
Shared-row recognition and generated rows
internal/sections/generated.go, internal/sections/repo.go, internal/sections/generated_mutations_test.go, internal/sections/recently_added_shared_db_test.go
A predicate identifies shared Home Recently Added sections. Video libraries skip generated per-library recent rows when an enabled shared row exists. Tests cover shared-row recognition and generated-row behavior.
Scoped recent-media fetching and merge
internal/catalog/recent_tv.go, internal/sections/fetcher.go, internal/sections/recently_added_shared_db_test.go
The fetcher separates TV and other libraries, fetches their recent items, and merges cards by added time with deduplication and limit handling. Media-scope filters constrain recent-media queries. Tests cover library scope, ordering, and merging.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant fetchRecentlyAdded
  participant fetchMixedRecentlyAdded
  participant SplitRecentLibraries
  participant fetchRecentTVItems
  participant buildRecentlyAddedQuery
  fetchRecentlyAdded->>fetchMixedRecentlyAdded: Try mixed fetch
  fetchMixedRecentlyAdded->>SplitRecentLibraries: Resolve TV and other library IDs
  SplitRecentLibraries-->>fetchMixedRecentlyAdded: Return library groups
  fetchMixedRecentlyAdded->>fetchRecentTVItems: Fetch arrival-grouped TV cards
  fetchMixedRecentlyAdded->>buildRecentlyAddedQuery: Fetch cards from other libraries
  fetchMixedRecentlyAdded-->>fetchRecentlyAdded: Return merged cards and lower-bound total
Loading

Suggested reviewers: rxwatcher, rhainland



Merge Risk: ⚪ Minimal · up to 3e926

No actionable merge-blocking issue remains in the reviewed changes. Normal checks can proceed before merging.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 10 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.
Description check Passed The description clearly explains the reworked default home rows, shared Recently Added behavior, validation, and known risks. It is directly related to the changeset.
Title check Passed The title concisely and accurately summarizes the primary change: reworking the default home rows.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR








🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR



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

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-triage silo-triage Bot added enhancement New feature or request evidence-required Needs before-and-after evidence before the Evidence check passes go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Oct 11, 2026
@silo-triage

silo-triage Bot commented Oct 11, 2026

Copy link
Copy Markdown

The Evidence section describes the before/after rows but contains no captures. Please attach or publish same-data before/after Home screenshots at desktop and phone width, showing the shared Recently Added row and new defaults, plus the TV library page's Returning Shows row. Name the builds used; if a surface is unaffected, explain why.

Comment thread internal/sections/repo.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02422441de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/sections/defaults.go Resolved
Comment thread internal/sections/fetcher.go Resolved
Comment thread internal/sections/fetcher.go Resolved
- Skip per-library Recently Added rows for a new video library only when
  the shared row is enabled.
- Keep audiobook, ebook, manga, and podcast default rows at 20 items;
  those beta surfaces stay as they were.
- Limit a configured mixed row's TV libraries to the caller's scope.
- Report one more card in total_count only when a card outside the page
  exists after deduplication.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 11, 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 ❌

Comment thread internal/sections/fetcher.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bac075206c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 113 to +114
if sec.ItemLimit <= 0 {
sec.ItemLimit = 20
sec.ItemLimit = sections.DefaultItemLimit

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the v1 omitted-limit default

HandleCreateSection serves POST /api/v1/admin/sections and calls this service, so a v1 request that omits item_limit now persists 100 instead of the previous 20, changing both the response and subsequent row payload size on the frozen bridge contract. Keep the v1 default at 20 and apply the new default only through a v2-specific path; the bulk-create fallback has the same issue.

AGENTS.md reference: AGENTS.md:L226-L238

Useful? React with 👍 / 👎.

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.

Not changing this. Neither the v1 routes nor the v2 admin schemas document a default for an omitted item_limit (v2's AdminSection item_limit is omitempty, minimum 0, with no stated default), so the server-chosen value isn't part of either contract. v1 and v2 also share one admin service and one set of stored rows. Splitting the default by API version would let the same request store different rows depending on the route, with no client-visible contract gained. Response shapes and validation (max 500) are unchanged.

Comment on lines +84 to +85
&PageSection{ID: idRecommendedForYou, Scope: scopeHome, SectionType: SectionRecommendedForYou, Title: titleRecommendedForYou, ItemLimit: DefaultItemLimit, Config: json.RawMessage(`{}`), Enabled: true},
&PageSection{ID: "default-because-you-watched", Scope: scopeHome, SectionType: SectionBecauseYouWatched, Title: defaultBecauseWatchedTitle, ItemLimit: DefaultItemLimit, Config: json.RawMessage(`{}`), Enabled: true},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep personalized home defaults from surfacing books

On a fresh install or after Restore Defaults, these unscoped rows consume recommendation caches that explicitly admit audiobook and ebook candidates (internal/recommendations/repo.go:95-100), so book content can now appear in two new default home rows. That changes the deferred beta surfaces despite the separate 20-item fixes; either restrict these defaults to video candidates or avoid adding them where they can expose book recommendations.

AGENTS.md reference: AGENTS.md:L30-L35

Useful? React with 👍 / 👎.

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.

Leaving this as is. Recommendations include audiobook and ebook candidates on purpose (recommendations/repo.go), and those rows already show the same candidates wherever an admin adds them. This PR doesn't change what the recommendation rows return; it only puts the existing rows on the default home. Not filtering them doesn't touch the beta book features, which the policy is about ("do not gate, remove, or rework"). Restricting recommendation types for the home default would be a new recommendation behavior, which belongs in its own change if the maintainers want it.

Intersecting a mixed recently-added row's configured libraries with the
caller's scope dropped items that belong to a configured library and,
separately, to a library in scope. The plain query checks the two as
separate memberships, so the non-TV side goes back to the configured
libraries and only the TV event query, which reads the libraries it is
given, is limited to the caller's scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 11, 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:

  • Preserve optional store capabilities through production wrappers

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e9267c084

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

})
result = append(result, &PageSection{ID: idContinueListening, Scope: scopeHome, SectionType: SectionContinueWatching, Title: titleContinueListening, ItemLimit: betaLibraryItemLimit, Config: ContinueTypeConfig(ContinueTypeListening), Enabled: true})
}
result = append(result, &PageSection{ID: idRecentlyAdded, Scope: scopeHome, SectionType: SectionRecentlyAdded, Title: titleRecentlyAdded, ItemLimit: DefaultItemLimit, Config: defaultMediaScopeConfig(catalog.MediaScopeVideo), Enabled: true})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep the new default row set off v1

DefaultHomeSections also supplies the fallback for GET /api/v1/home/* and the payload persisted by POST /api/v1/admin/sections/restore-defaults, so fresh installs and restores now replace v1's per-library recency rows with this shared row and the newly added recommendation/discovery rows. That changes the frozen v1 response and stored behavior; select the legacy defaults for v1 and expose this row set only through v2.

AGENTS.md reference: AGENTS.md:L226-L238

Useful? React with 👍 / 👎.

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.

Not changing this. The v1 freeze covers routes, request and response shapes, and error semantics. Home rows are server data stored in page_sections and served unchanged by both APIs, and an admin could configure this row set by hand today. Every row type here already exists on v1 with the same response shape. Keeping two default sets would make Restore Defaults depend on which API version the admin UI calls, and would leave v1 clients a different home from v2 clients on the same server.

&PageSection{ID: "default-because-you-watched", Scope: scopeHome, SectionType: SectionBecauseYouWatched, Title: defaultBecauseWatchedTitle, ItemLimit: DefaultItemLimit, Config: json.RawMessage(`{}`), Enabled: true},
&PageSection{ID: idReturningShows, Scope: scopeHome, SectionType: SectionReturningShows, Title: titleReturningShows, ItemLimit: DefaultItemLimit, Config: json.RawMessage(`{}`), Enabled: true},
&PageSection{ID: idTrendingDiscover, Scope: scopeHome, SectionType: SectionTrendingDiscover, Title: titleTrendingThisWeek, ItemLimit: DefaultItemLimit, Config: json.RawMessage(`{"source":"tmdb","window":"week"}`), Enabled: true},
&PageSection{ID: "default-top-rated", Scope: scopeHome, SectionType: SectionCriticallyAcclaimed, Title: titleTopRated, ItemLimit: DefaultItemLimit, Config: json.RawMessage(`{}`), Enabled: true},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restrict the new Top Rated default to video

When an audiobook, ebook, or other beta item has TMDB vote metadata, this unscoped SectionCriticallyAcclaimed row can surface it because fetchCriticallyAcclaimed passes no Types restriction to ListByRatingThreshold. Scope the new default to movies and series so Restore Defaults does not introduce another change to the deferred book surfaces.

AGENTS.md reference: AGENTS.md:L30-L35

Useful? React with 👍 / 👎.

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.

Leaving this as is. The row uses a TMDB rating floor (8.0 with at least 500 TMDB votes, AppendTMDBRatingFloor). Audiobook and ebook metadata comes from book providers that don't set TMDB votes, so in practice these items can't qualify. main's default Hidden Gems row already used the same unscoped high-rated discovery query. Adding a type filter would need a new config field on critically_acclaimed, which is outside this PR's scope.

@Quick104
Quick104 merged commit 9a7d875 into main Oct 11, 2026
30 of 31 checks passed
@Quick104
Quick104 deleted the feat/home-default-rows branch October 11, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request evidence-required Needs before-and-after evidence before the Evidence check passes go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant