You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(home): read Home rows 20 cards at a time - #3276
Web Home downloaded every row in full, up to 100 cards each, even though a row shows about 20 before the viewer scrolls it. On a large library that made Home the heaviest screen in the web app and slow to load on mobile connections. The per-row read (getHomeSectionItems) and the layout read (getHomeLayout) had no way to ask for fewer cards; only the aggregate listHomeSections, which Android and Apple use, did. This change adds item_limit to both reads and a has_more flag to the rows they cap. Web Home now reads 20 cards per row and loads the rest of a row only when the server says it holds more, as its carousel nears the end.
Approach
Server, additive to v2: item_limit (1–100) on getHomeSectionItems and getHomeLayout. A capped row is fetched and filtered at its own limit, as the uncapped read does, and only its first item_limit cards are built and sent. On the layout only the included rows are capped; sections[].item_limit keeps each row's own limit. Without the parameter nothing changes. /api/v1 is untouched.
A capped row carries has_more: true exactly when reading it again without item_limit answers more cards. Fetching at the cap would miss cards that a fetcher drops after applying its limit: an unsorted collection cuts its members to the limit before the access filter runs. An admin curated list, which an uncapped read can answer past its own item_limit, reports has_more the same way. The field is absent when false and on every other read that answers a Section; listHomeSections is unchanged.
getHomeCapabilities gains row_item_limit_max. It is a new field because older servers already report section_item_limit_max but reject item_limit on these two reads.
Web: rows read 20 cards (two screens of standard posters at 1920 px, the size the native apps already request). A row is partial exactly when the server reports has_more. When a partial row's last card comes within a screen width, it reads the rest, and the cards already shown stay in place. A partial row whose cards the duplicate filter removes entirely reads the rest at once, since it has no carousel to scroll. A row without has_more is never read a second time. The featured hero row is read whole, because it counts and cycles every card; an included hero row the layout answered without has_more is already whole. A refresh, or a layout refetch, never shrinks a row the viewer has already extended. Against an older node during a rolling upgrade, a 422 makes the web retry without item_limit.
Contracts and docs: OpenAPI and web types regenerated, three fixtures added, docs/catalog-api.md and docs/architecture/api-contract.md updated. jellycompat needs nothing: Jellyfin clients build Home from /Items/Latest, /Items/Resume and /Shows/NextUp, which already honour Limit.
Validation
Go build, vet, gofmt, make lint-changed and make lint-router-recovery: pass.
make test-go: pass, except TestRunStatsWithRealFFmpeg and TestCopyRemuxSubtitleRenditionRealFFmpeg, which drive the local ffmpeg binary (6.1) and fail the same way on main.
Web: pnpm run lint, format:check, build, budget:check and make test-web: pass.
Generated contracts, fixtures and hygiene (every verify-* target in CONTRIBUTING, TestCommittedArtifactMatchesRouter): pass.
Not run: verify-actionlint and verify-shellcheck (tools not installed); no workflow or shell script changed.
On a large synthetic library: the capped reads answer 20 items with item_limit: 20, the uncapped reads are unchanged, the layout caps only its included rows, and item_limit=101 is a 422 naming the parameter. Replaying the web cold start and Home-after-playback screens showed the reduction recorded on the evidence page.
On 563fa0522, the has_more change: focused Go tests for internal/api/handlers, internal/apiv2 and internal/contractspec, gofmt, vet, make lint-changed, every verify-apiv2-* target, TestCommittedArtifactMatchesRouter, make verify-size-ratchet, and web tsc -b, eslint, prettier and make test-web: pass. A handler table test covers a row that ends at the cap, a row past the cap, a curated list longer than its own limit, rows that lose a Not interested or watched card, and uncapped reads; it fails if the extra card or the Not interested widening is removed. Not re-run for this change: the full make test-go, the synthetic-library replay and the browser captures.
In headless Chromium at desktop 1920 px and phone width on a small library, on da83077cf: a row holding more than 20 cards read 20, read the rest when its carousel came within a screen width of card 20, kept the shown cards in place, and reached its last card. Recordings are on the evidence page.
On 74fc4b1dc (main merged in, review fixes): focused Go tests for internal/api/handlers, internal/apiv2 and internal/contractspec, make lint-changed, every verify-apiv2-* target, verify-local-paths, and web tsc -b, eslint, prettier, build, budget:check and make test-web: pass. A TestHomeRowReportsHasMore row for a card dropped after the fetch limit failed on a2aed48ab. A sections.test.ts case for two completions in the same millisecond fails without its fix. Not re-run: the full make test-go, the synthetic-library replay and the browser captures.
Rows look the same and still reach their last card. One visible difference: Home's duplicate filter compares the cards each row has loaded, so on a library of about 100 movies or fewer the recommendations row can now appear where it was hidden, and the end of a long row can repeat a title another row shows. Android and Apple already behave this way.
The browser captures predate has_more. In them, Home read nine short or empty rows a second time: 16 row reads per desktop load against 7 on main. With has_more those rows report no more cards, so the same library should take 7 row reads per load, plus one when Recently Added Movies is scrolled near card 20. This has not been re-captured in a browser.
Risks
Changes validated-behaviour paths for Home rows (Curated home sections — Web #1142 C1) and recommendations (Recommendations — Web #1146 C1), both not yet run. The duplicate-filter difference above is deliberate: keeping the old behaviour would mean downloading every row whole again.
total_count on a capped row is a lower bound, as it already is on listHomeSections.
A capped row read does the same database fetch as the uncapped read. The savings are in card building (user states, artwork, playable targets) and the payload.
Main is merged in, including the artwork-widths change: Home row reads, completion reads and the watch-together shelf send both the row's artwork widths and item_limit.
The user manual's Home page describes when the recommendations row is hidden; an issue will be filed on siloserver.org. Apple and Android follow-ups (Apple's first launch and Top Shelf, Android's fallback row reads) will be filed in their repositories.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or says there is none.
AI Disclosure
Harness: Claude Code (in T3 Code)
Tool(s): Claude Code subagents
Model(s): claude-opus-5-5
Involvement: Fully AI-generated; human verification pending maintainer review
Adversarial review: a separate Claude Code agent (claude-opus-5-5) read this change together with four related branches, looking at partial rows, the 422 fallback, duplicate filtering and hero rows. It found that a layout refetch shrank rows the viewer had already extended, that a reload changed what the duplicate filter compared, that a cancelled load-the-rest request could leave a row stuck at 20 cards, and that the layout fallback lost include_items on older nodes. All four are fixed here, with a test for the fallback. A later Codex (gpt-6.1-sol) review of a2aed48ab found that a capped row could miss has_more when cards dropped after the fetch limit, and that two rows completed in the same millisecond restored in the wrong order. Both are fixed here, each with a test that failed before its fix.
Read Home rows 20 cards at a time via item_limit and lazy row completion
Home layout and section-item reads now accept an item_limit query parameter (1..100) through HomeLayoutInput and HomeSectionItemsInput in home.go. The server caps returned cards, reports has_more on Section, and advertises row_item_limit_max in capabilities.
The Home page initially requests ~20 cards per non-featured row (see HOME_ROW_ITEM_LIMIT in homeRowLimit.ts) and loads the rest when the carousel nears its end, using a new onNearEnd callback in MediaCarousel and completeSection in Home.tsx.
Cross-section duplicate filtering in dropCrossSectionDuplicates (sectionDedupe.ts) processes first cards in layout order and later cards in row-completion order, so completing a row does not steal an item another row already shows.
Layout and section-item readers retry without item_limit on 422, then fall back to an uncapped or layout-only request; see sections.ts.
Behavioral Change: Home row reads are now capped by default. Cached rows marked partial become immediately stale in the watch-together shelf hook (useHomeShelfSections), and card removal updates the cached shown count in removeItemFromHomeSectionCaches. Contract fixtures and OpenAPI schema in openapi.json gained item_limit, has_more, and row_item_limit_max.
Add item_limit to getHomeSectionItems and getHomeLayout (capped before
the row is built, as on listHomeSections) and advertise it as
row_item_limit_max. Web Home reads 20 cards per row and the rest when a
carousel nears its end; the featured row is read whole, a refetch never
shrinks an extended row, and older nodes get a retry without the limit.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
No actionable comments were generated in the recent review.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 1ba748b6-78ef-4cc2-892c-a12780330428
Commits
Reviewing files that changed from the base of the PR and between 563fa05 and a2aed48.
Files selected for processing: 3
web/src/hooks/queries/homeRowLimit.ts
web/src/pages/Home.test.tsx
web/src/pages/Home.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Walkthrough
The v2 API now advertises and accepts item_limit for Home layout and section-item reads. The Web client requests capped rows, retries without the parameter after a 422, and completes partial rows near the carousel end. Duplicate filtering uses displayed-card counts to order cards across rows.
Changes: Home row limits and completion
Layer / File(s)
Summary
Define Home row item limits contracts/api/v2/..., internal/apiv2/home.go, web/src/api/v2/schema.ts, docs/architecture/api-contract.md, docs/catalog-api.md
The API contract adds row_item_limit_max and optional item_limit parameters for Home layout and section-item reads. Fixtures and documentation describe the bounds, capability checks, and capped-row behavior.
Apply caps to Home reads internal/api/handlers/*views_service.go, internal/api/handlers/home_watched.go, internal/apiv2/home.go, internal/apiv2/*test.go
Home handlers apply the requested cap to individual rows and included layout rows. They account for filtering and set has_more when additional cards remain. Tests cover capability reporting, validation, and filtered rows.
Request and cache capped rows web/src/api/types.ts, web/src/hooks/queries/homeRowLimit.ts, web/src/hooks/queries/sections.ts, web/src/hooks/queries/sections.test.ts, web/src/pages/watchtogether/room/picker/usePickerData.ts
Query helpers select row limits, mark partial responses, and retry without the limit after a 422. Partial cached shelf rows use a stale time of zero.
The carousel signals when its last slide approaches view. Home fetches remaining items for partial rows and tracks shown counts; duplicate filtering processes initial and later cards in separate passes.
sequenceDiagram
participant Home
participant fetchHomeLayout
participant getHomeLayout
participant MediaCarousel
participant SectionRow
participant fetchHomeSectionItems
participant getHomeSectionItems
participant useDedupedSections
Home->>fetchHomeLayout: Request layout with HOME_ROW_ITEM_LIMIT
fetchHomeLayout->>getHomeLayout: Send include_items and item_limit
getHomeLayout-->>fetchHomeLayout: Return layout and included rows
fetchHomeLayout-->>Home: Return layout and capped row responses
MediaCarousel->>SectionRow: Detect last slide near view
SectionRow->>Home: Call onNearEnd with section ID
Home->>fetchHomeSectionItems: Request remaining row items
fetchHomeSectionItems->>getHomeSectionItems: Fetch row without item_limit
getHomeSectionItems-->>fetchHomeSectionItems: Return full row
fetchHomeSectionItems-->>Home: Return completed row response
Home->>useDedupedSections: Pass loaded rows and shown counts
Loading
Possibly related issues
Silo-Server/silo-server issue 1140: The changes add server-side handling and validation for capped Home layout and item reads.
Silo-Server/silo-server issue 1142: The changes update Home row fetching, completion, and duplicate filtering in the Web client.
Silo-Server/silo-server issue 1137: The changes cover server and Web behavior for curated Home rows.
Silo-Server/silo-server issue 1146: The changes update recommendation-row loading and duplicate filtering.
Possibly related PRs
Silo-Server/silo-server#3277: Both changes extend the Web section-query interface and must preserve query parameters, fallback behavior, and cache handling.
Silo-Server/silo-server#2889: Continue Watching row selection supplies rows that this change caps and completes.
Suggested labels:api-v2
Suggested reviewers:blurbery
Merge Risk: Minimal · up to a2aed
Home row loads retain a compatibility fallback for older servers. The extra request does not block loading, so the change is mergeable after normal checks.
Security architecture risk: Low · up to a2aed
The change keeps row completion behind the existing account, profile, and library-access controls. Cancellation, refresh ordering, and recovery paths are implemented. The remaining risk is concentrated in client compatibility and cached-row lifecycle behavior rather than increased privileges or unauthorized access.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The inspected exposure remains Home content available through the requesting account's resolved profile and library-access scope. A caller can choose a validated row cap or request the existing uncapped read; completion does not establish access to another account, profile, or service.
Trust Boundaries and Controls
observed — Home row cache keys do not include account, profile, or origin, so isolation relies on the existing cache lifecycle. Account replacement, sign-out, and profile changes clear the shared cache. The inspected Home requests use relative API routes, while server-origin identity is taken from the browser location rather than a mutable server setting.
Resilience and Maintainability Implications
observed — The completion merge uses both the originally shown cards and the latest cached row to avoid restoring cards removed while the whole-row request was running. Server-side user-agnostic rows are fetched through an access-scoped cache path, with profile-specific Not interested filtering applied after that shared cache.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title "perf(home): read Home rows 20 cards at a time" matches the main change. The PR adds optional item_limit and has_more to the Home row reads, and web Home now reads 20 cards per row and fetch…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The pull request description directly explains the changes to Home row limits, item_limit support, has_more responses, web loading behavior, compatibility fallbacks, tests, and risks. It is clearly re…
Full details: Title check
Explanation
The title "perf(home): read Home rows 20 cards at a time" matches the main change. The PR adds optional item_limit and has_more to the Home row reads, and web Home now reads 20 cards per row and fetches the rest on demand. The title is short, specific, and uses a conventional commit prefix.
Full details: Description check
Explanation
The pull request description directly explains the changes to Home row limits, item_limit support, has_more responses, web loading behavior, compatibility fallbacks, tests, and risks. It is clearly related to the changeset.
Full details: Docstring Coverage
Explanation
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 27 functions across 22 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
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
Please add before-and-after Home captures with the same library on desktop and phone-width web, showing the changed recommendations visibility and duplicate filtering. Include a short recording of a row loading beyond its initial 20 cards and reaching the last card; the description says that browser path has not been checked.
The reason will be displayed to describe this comment to others. Learn more.
Silent full-row refetch failures in web/src/pages/Home.tsx leave the cached partial row visible without an error notice or explicit retry action; scrolling near the end again provides neither. Track completion errors per section, preserve displayed cards, and render an inline notice with a Retry action that calls completeSection for the failed section, clearing the error after a successful retry.
File web/src/pages/Home.tsx:
Line 310:
Silent full-row refetch failures in web/src/pages/Home.tsx leave the cached partial row visible without an error notice or explicit retry action; scrolling near the end again provides neither. Track completion errors per section, preserve displayed cards, and render an inline notice with a Retry action that calls completeSection for the failed section, clearing the error after a successful retry.
The reason will be displayed to describe this comment to others. Learn more.
Not changing this in this PR. When the rest of a row fails to load, the row keeps the cards it already shows and its View all link, which opens the whole section. The retry claim doesn't match the code: the carousel's observer in MediaCarousel.tsx fires each time the last card comes back within one row width, so scrolling away and back tries again. The next visit to Home also retries, because the cached row stays partial. Whether a background read should show an inline error with a Retry button is a UI decision, so I've passed it to the maintainer.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the correction. Given the observer behavior you described, my claim that scrolling away and back would not retry was incorrect.
The row preserves its displayed cards and View all link, and completion can retry when the last card re-enters the observer’s range or on the next Home visit while the cached row remains partial.
The silent failure is still a potential feedback improvement, but an inline error and Retry button are a UI decision—not a demonstrated high-severity correctness issue here. I withdraw the recommendation as a required change for this PR and leave that UI decision to the maintainer.
silo-server#1142 C1: the Results table remains Not run; its October 22 AI sandbox report says it does not replace a validator run. It needs its first validation against the merged behavior.
silo-server#1146 C1: an October 23 task comment reports a runtime pass on build 31fabc723, although the Results table remains Not run and human acceptance is pending. The Home recommendation row now uses capped partial reads and changed cross-row deduplication, so revalidate that portion after merge.
silo-server#1140 C1/C4 remain unchanged as written: absent item_limit preserves the existing reads, and access filtering still precedes the cap.
The PR must explain why the Home output changes; its description already documents the intended visibility and duplicate-filter differences. The current Validation tasks: line matches these impacts.
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.
A row read in part whose first cards were all taken by the duplicate or
hide-watched filter was hidden with no carousel to load the rest, so its
other cards never showed. Home now reads the rest of such a row at once.
A completed row now keeps how many cards it showed before in its cache
entry. Home restores that boundary when it renders from cache, so a
return to Home filters duplicates as it did before, and a refresh or
layout refetch rereads a completed row whole.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Evidence link is present, but the described evidence does not establish the web-visible changes. Please ensure the linked page shows:
Home row contents (web/src/pages/sectionDedupe.ts, web/src/pages/Home.tsx): before-and-after desktop and phone-width captures with the same library, showing the changed recommendations visibility and cross-row duplicates.
Incremental row completion (web/src/pages/Home.tsx, web/src/components/MediaCarousel.tsx): a short recording of a row nearing its end, loading the rest, and reaching its last card. The description says this path was not checked in a browser; tests and typecheck do not show the interaction.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
Home's hide-watched and Not interested filters cut a capped row's items
and total_count together, so a short capped answer no longer proves the
row is exhausted. Treat every read the cap reached as partial; Home
already skips completing a row that is at its own limit.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Home restored the order completed rows get later cards in the duplicate
filter from each row's dataUpdatedAt. Any home cache edit, such as
removing a watched card, rewrites every row's dataUpdatedAt, so the next
Home mount fell back to layout order and shared cards could move from
the row that completed first to another.
completeHomeRow now records shownAt, the reread of a completed row
keeps it, and cachedShownCounts sorts by it. A row read whole without a
completion still counts from its last write.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Additional comments: 1
web/src/components/MediaCarousel.tsx-167-167: 1
167-167: Minor · Functional Correctness · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Complete the row at once when IntersectionObserver is unavailable.
If IntersectionObserver is undefined, the effect returns early and onNearEnd never runs. Home reads every non-featured row with a 20-card cap. In such a browser, a partial row stays at its first cards. The viewer cannot scroll to the rest. Only the View all link reaches them.
The rest of this file and Home.test.tsx already support browsers without IntersectionObserver. Call onNearEnd directly in that case. completeSection ignores calls for rows that are not partial and for rows already loading, so repeated calls are safe.
Proposed fix
- if (!onNearEnd || !viewport || !last || typeof IntersectionObserver === "undefined") return;+ if (!onNearEnd || !viewport || !last) return;+ if (typeof IntersectionObserver === "undefined") {+ onNearEnd();+ return;+ }
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 3f4043bb-a6c1-4f6f-8e16-5d258e458146
Commits
Reviewing files that changed from the base of the PR and between 7d830bd and 9720e97.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Home.test.tsx crossed the 800-line size ratchet. The duplicate-filter and
row-completion tests move unchanged to Home.duplicates.test.tsx with the
helpers they use.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
silo-triageBot
added
size/XXL
1000–2999 added + deleted lines (all files); change volume, not priority.
and removed
size/XL
500–999 added + deleted lines (all files); change volume, not priority.
labels
Oct 30, 2026
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 6e42824d-a473-47ec-b736-b6a50cce6bd6
Commits
Reviewing files that changed from the base of the PR and between 9720e97 and 6d764e4.
Files selected for processing: 8
internal/api/handlers/home_layout_items_test.go
internal/api/handlers/home_views_service.go
web/src/api/types.ts
web/src/hooks/queries/homeRowLimit.ts
web/src/hooks/queries/mediaSurfaceRefresh.ts
web/src/pages/Home.duplicates.test.tsx
web/src/pages/Home.test.tsx
web/src/pages/Home.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
…limit
A capped read of an admin curated list stops at the row's limit, but a
whole read answers every card the list holds. Home skipped completing a
row already at its own limit, so a 21-card list with an item_limit of 20
never showed its last card. A row with no item_limit was never marked
partial at all.
Complete a partial row when its own limit or its total_count is above
the cards shown, and mark a row with no item_limit partial when its
total_count is above the cards it answered.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The evidence page now has the browser captures you asked for:
Home before and after, at desktop 1920 px and phone width, with the same library and data. Before, the two full Recently Added rows hold every title, so the duplicate filter hides Hidden Gems. After, Hidden Gems shows the titles past the first 20 cards. The page lists the cards that appear in two rows for each run.
Recordings at desktop and phone width of Recently Added Movies reading 20 cards, loading the rest as the carousel nears card 20, and reaching its last card.
Recommended for You stays empty on the test server because it runs no recommendation jobs, so Hidden Gems, which uses the same duplicate filter, shows the change instead.
The reason will be displayed to describe this comment to others. Learn more.
Follow-up Comments
Cancel in-flight Home completions before removing a card.
285-306: Minor · Functional Correctness · Quick win
Cancel in-flight Home completions before removing a card.
A dismissal or Not interested mutation can remove a card while completeSection is fetching. The completion captures the old shown row, so fetchQuery can cache completeHomeRow(shown, whole) and restore the removed card. The generation check only guards setLoadedSections; it does not prevent fetchQuery from writing the stale response to the query cache. Await cancellation of matching Home row queries before applying removeItemFromHomeSectionCaches.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 3ba3d302-76dc-47be-b783-f31ef1ae8ac4
Commits
Reviewing files that changed from the base of the PR and between 6d764e4 and 7739d31.
Files selected for processing: 4
web/src/hooks/queries/homeRowLimit.ts
web/src/hooks/queries/sections.test.ts
web/src/pages/Home.test.tsx
web/src/pages/Home.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
A capped getHomeSectionItems or getHomeLayout read gave clients no way
to tell a row that ends at the cap from one that holds more: the
hide-watched and Not interested filters cut a row's items and
total_count together, and an admin curated list can hold more cards than
its own item_limit. Web therefore treated every row the cap reached as
partial and read short or empty rows a second time, doubling Home's row
requests.
A capped read of a row the cap lowers now fetches one card past the cap,
applies the filters, and trims back, and the section carries has_more:
true when the row holds more cards than it answered. Not interested
drops titles without refilling, so those rows fetch the wider window
hide-watched already uses. The field is absent when false and on every
other read that answers a Section; uncapped reads are unchanged.
Web marks a capped row partial exactly when the server reports
has_more, so completeSection drops its total_count and own-limit guard
and an empty row the server answered in full is not read again. A node
that rejects item_limit still answers 422 and the row is read whole.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pushed 563fa05: capped Home row reads now report has_more, and web Home completes only the rows that carry it.
Server: on a capped getHomeSectionItems or getHomeLayout read, a row the cap lowers is fetched one card past the cap, the hide-watched and Not interested filters run, and the row is trimmed back. The section carries has_more: true when the row holds more cards than it answered. Rows that Not interested applies to fetch the wider hide-watched window, since that filter does not refill. An admin curated list longer than its own limit reports it too. Uncapped reads and listHomeSections are unchanged.
Web: partial now comes only from has_more. It replaces the "cap reached" rule and the total_count guard, so short and empty rows are no longer read twice at load.
Expected on the evidence library: 7 row reads per load again (16 on desktop before), plus one when Recently Added Movies is scrolled near card 20. I worked this out from the logged row answers and have not re-captured it in a browser.
Completing a partial Home row merged the whole row into the copy of the
row captured when the read started. A dismissal or Not interested that
landed while the read ran removed the card from the cache, and the
completion then wrote it back, and Home's refresh served that entry as
fresh. The completion now merges against the row as cached when the
whole row arrives, keeps out cards removed since the read started, and
takes its shown boundary from that row.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The race was real. completeSection merged the whole row into the copy of the row it captured before the read. When a dismissal or Not interested removed a card from the cache during the read, the completion wrote the card back, and the next Home refresh served that entry as fresh.
The completion now merges against the row as it is cached when the whole row arrives:
completeHomeRow(shown, whole, current) keeps the cached row's cards in place and appends only whole-row cards that neither shown nor current holds. A removed card stays out even when the whole row, read before the server heard of the removal, still holds it.
The row's shown boundary is the cached row's card count, and Home takes the shown count from the completed response instead of the captured row.
I did not cancel Home row queries in removeItemFromHomeSectionCaches. That cancel would also hit rows the regular loader is reading for the first time. With no data to revert to, those reads reject and the row shows its error state until the refresh bump resets Home. The fix inside the completion needs no cancellation.
The new test in Home.test.tsx removes a card while the completion is in flight, then answers with a whole row that still holds it. It fails on 563fa05 and passes on 98a3aef.
Files skipped from review as they are similar to previous changes: 1
web/src/api/types.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
… dismissal
A dismissal or Not interested edits the cached Home row and then bumps
Home's refresh signal, which cancels a completion still in flight. The
cancel restores the row as last written, the edit included, since
TanStack Query takes a setQueryData made during a fetch as the state to
revert to. The new table row checks that the dismissed card stays out,
the row shows no error, and nearing the end again completes it. The
cleanup comment in Home said cancelling restores the pre-fetch data; it
now says what the cache actually keeps.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104 The current source addresses the reported race.
completeSection reads the current cache when the whole-row response arrives.
completeHomeRow preserves the current cards and excludes removed cards from the appended results.
Home uses the completed response’s shown count.
The regression test covers removal during completion, both with and without a Home refresh. The refresh case also checks that the row has no error and completion can run again.
No additional cancellation is needed for this fix. I inspected the source and test assertions; I did not run the tests.
✏️ Learnings added
Learnt from: Quick104
URL: https://github.com/Silo-Server/silo-server/pull/3276
Timestamp: 2026-10-30T15:51:55.301Z
Learning: Within repository "Silo-Server/silo-server", only for files matching one of ["web/src/pages/Home.tsx","web/src/hooks/queries/homeRowLimit.ts"]: When reviewing Home row completion in web/src/pages/Home.tsx or web/src/hooks/queries/homeRowLimit.ts, check that a whole-row response merges against the cache as it exists when the response arrives, preserves the current cards in order, and does not append cards removed by dismissal or Not interested while the request was in flight. Check that the completed row's shown boundary uses the current cached card count rather than the count captured before the request.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-19T23:34:11.654Z
Learning: Source excerpt:
# Silo Server
## Priorities
Performance and reliability first. Keep behavior predictable under load and during failures —
session restarts, reconnects, partial streams. When a tradeoff is forced, choose correctness and
robustness over short-term convenience.
Learnt from: CR
Repo: Silo-Server/silo-server PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-10-21T14:47:24.852Z
Learning: Source excerpt:
# Silo Server
## Tests
A test belongs here only if it would catch a regression that matters and that no other test, type
check, or lint would catch. Most changes need no new test, and some should delete one. Read
[Decide what to test](CONTRIBUTING.md#decide-what-to-test) before adding a test. In short:
- Don't test small changes, UI layout or copy, pass-through wiring, constants and defaults, or
frozen `/api/v1` behavior beyond its own authorization checks.
Resolve the overlap with the artwork-widths change (#3277): Home row
reads, the completion read and the watch-together shelf send both the
row's artwork widths and item_limit, and the layout's item_limit
fallback keeps the widths.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Review of a2aed48ab: two defects and one merge problem. I'm fixing all three in commits on this branch, so there's no need to change anything yourself.
Conflicts with main, and the red web test.#3277 merged after this branch was cut, so sections.ts, Home.tsx and the watch-together shelf now conflict with main. Web test (4/4) fails in MovieContent.test.tsx, a file this PR doesn't touch; #3282 fixed it on main. I'm merging main in. Home row reads, the completion read and the shelf will send both the row's artwork widths and item_limit, and the layout's item_limit fallback keeps the widths.
The two findings are inline. A cross-provider review (Codex, gpt-6.1-sol) found both. I confirmed each against the source and with a test that fails on this head.
…etch limit
A capped Home row read fetched one card past the cap. Some fetchers cut
their ID list to the limit before the access filter runs (an unsorted
collection rail, for one), so a restricted profile could get exactly the
cap back without has_more while the uncapped row held many more cards,
and the web never read the rest.
A capped read now fetches and filters the row at its own limit, as the
uncapped read does, and builds only the first item_limit cards, so
has_more means exactly that the uncapped read answers more. The
one-past-the-cap fetch and the Not interested widening go away.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A capped row could end at the cap without has_more when a fetcher dropped cards after applying its limit, such as an unsorted collection's members a restricted profile can't see (f144c4405). A capped read now fetches at the row's own limit and builds only the first item_limit cards, so has_more is exact. The test row failed on a2aed48ab.
Two rows completed in the same millisecond could restore in the wrong order (74fc4b1dc). The test fails without the fix.
Tests that failed on the base: the PR's handler tests don't build on the base, because they read the new HasMore field, and TestContractFixtures fails there on the new fixtures. Neither is a behavior proof. The two regression tests above failed on the PR head before their fixes.
Left for the maintainers
The evidence page predates has_more and today's server change, and no browser run covers either yet.
When a row's background read of the rest fails, it shows no error or Retry button (the open Kody thread). That's a UI call.
Validated features: no passed case touches Home. #1142 C1 and #1146 C1 are still not run, so the Validation tasks: line stands.
User manual: the "Home and calendar" page says the recommendations row leaves out titles the rows above it show, and may not appear on a small library. With rows read 20 at a time, the web compares only loaded cards, so that row appears more often. A siloserver.org issue for that page is still needed.
Apple and Android: no follow-up issues exist yet for the two new row-read parameters (Apple's first launch and Top Shelf, Android's fallback row reads), as the description plans.
Cross-provider review: Codex (gpt-6.1-sol), one round on a2aed48ab. It found the two defects above, and both are fixed.
CI:Go test fails in TestTokenHandlers_ScopeLibrariesToAuthenticatedProfile (Audiobookshelf login). It fails the same way on main: #2919 started refusing tokens issued with no source credential, and the test #2793 added doesn't sign in with one. #3302 fixes the test. Merge main again once it lands. This PR doesn't touch that code.
Fit: 8/10 · Readiness: 7/10 — conditional (assuming CI is green)
Fit: it makes Home much lighter on large libraries and slow connections through additive v2 fields behind a capability, and leaves /api/v1 alone. It adds new contract surface, a field and a capability. Readiness: the approach is sound and every finding is fixed with a test that failed before its fix. The browser behavior hasn't been re-verified since has_more and today's server change.
The reason will be displayed to describe this comment to others. Learn more.
Redundant fetching and card construction occur in Home whenever artwork.backdrop_width is enabled because the client discards included Continue Watching and Next Up rows, and their fetchers bypass the resolved-list cache in FetchOne; the default above-the-fold Continue Watching row repeats progress, metadata, and card-building work after the layout has already downloaded its cards. Request reusable card-sized artwork for included ordinary rows, or avoid building and downloading rows the client will discard.
Prompt for LLM
File web/src/hooks/queries/sections.ts:
Line 109 to 109:
Redundant fetching and card construction occur in Home whenever artwork.backdrop_width is enabled because the client discards included Continue Watching and Next Up rows, and their fetchers bypass the resolved-list cache in FetchOne; the default above-the-fold Continue Watching row repeats progress, metadata, and card-building work after the layout has already downloaded its cards. Request reusable card-sized artwork for included ordinary rows, or avoid building and downloading rows the client will discard.
The reason will be displayed to describe this comment to others. Learn more.
This comes from main, not from this PR. The check that skips included wide-card rows when the layout carries hero-sized backdrops arrived with #3277 (f57f5ef17) and reached this branch in the merge of main (943a3b3f1); this PR doesn't change it. #3277 chose to reread those rows at card size rather than draw hero-sized backdrops in small cards. That costs a second server read of those rows; it doesn't show anything wrong. Sending separate artwork widths per included row would need a new layout parameter, so it belongs in a separate change if a maintainer wants it. Leaving this thread open for them.
The reason will be displayed to describe this comment to others. Learn more.
Agreed—the redundant read is a performance tradeoff inherited from #3277, not a regression introduced by this PR. Re-fetching those rows at card-sized artwork widths avoids using hero-sized backdrops in small cards.
I wouldn’t treat this suggestion as a required change for #3276. Per-row artwork widths would be a separate API optimization for maintainers to consider. Leaving the thread open for that decision makes sense.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api-v2API v2 / Huma migration program (epic #135); long-running, stacked by phaseenhancementNew feature or requestevidence-requiredNeeds before-and-after evidence before the Evidence check passesgoPull requests that update go codejavascriptPull requests that update javascript codepriority: P2Limited scope, workaround exists, or polishsize/XXL1000–2999 added + deleted lines (all files); change volume, not priority.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A (follow-up: #3301)
Validation tasks: changes #1142 C1, #1146 C1; reaches #1140 C1, C4
Web Home downloaded every row in full, up to 100 cards each, even though a row shows about 20 before the viewer scrolls it. On a large library that made Home the heaviest screen in the web app and slow to load on mobile connections. The per-row read (
getHomeSectionItems) and the layout read (getHomeLayout) had no way to ask for fewer cards; only the aggregatelistHomeSections, which Android and Apple use, did. This change addsitem_limitto both reads and ahas_moreflag to the rows they cap. Web Home now reads 20 cards per row and loads the rest of a row only when the server says it holds more, as its carousel nears the end.Approach
item_limit(1–100) ongetHomeSectionItemsandgetHomeLayout. A capped row is fetched and filtered at its own limit, as the uncapped read does, and only its firstitem_limitcards are built and sent. On the layout only the included rows are capped;sections[].item_limitkeeps each row's own limit. Without the parameter nothing changes./api/v1is untouched.has_more: trueexactly when reading it again withoutitem_limitanswers more cards. Fetching at the cap would miss cards that a fetcher drops after applying its limit: an unsorted collection cuts its members to the limit before the access filter runs. An admin curated list, which an uncapped read can answer past its ownitem_limit, reportshas_morethe same way. The field is absent when false and on every other read that answers aSection;listHomeSectionsis unchanged.getHomeCapabilitiesgainsrow_item_limit_max. It is a new field because older servers already reportsection_item_limit_maxbut rejectitem_limiton these two reads.has_more. When a partial row's last card comes within a screen width, it reads the rest, and the cards already shown stay in place. A partial row whose cards the duplicate filter removes entirely reads the rest at once, since it has no carousel to scroll. A row withouthas_moreis never read a second time. The featured hero row is read whole, because it counts and cycles every card; an included hero row the layout answered withouthas_moreis already whole. A refresh, or a layout refetch, never shrinks a row the viewer has already extended. Against an older node during a rolling upgrade, a 422 makes the web retry withoutitem_limit.docs/catalog-api.mdanddocs/architecture/api-contract.mdupdated. jellycompat needs nothing: Jellyfin clients build Home from/Items/Latest,/Items/Resumeand/Shows/NextUp, which already honourLimit.Validation
Go build, vet, gofmt,
make lint-changedandmake lint-router-recovery: pass.make test-go: pass, exceptTestRunStatsWithRealFFmpegandTestCopyRemuxSubtitleRenditionRealFFmpeg, which drive the local ffmpeg binary (6.1) and fail the same way onmain.Web:
pnpm run lint,format:check,build,budget:checkandmake test-web: pass.Generated contracts, fixtures and hygiene (every
verify-*target in CONTRIBUTING,TestCommittedArtifactMatchesRouter): pass.Not run:
verify-actionlintandverify-shellcheck(tools not installed); no workflow or shell script changed.On a large synthetic library: the capped reads answer 20 items with
item_limit: 20, the uncapped reads are unchanged, the layout caps only its included rows, anditem_limit=101is a 422 naming the parameter. Replaying the web cold start and Home-after-playback screens showed the reduction recorded on the evidence page.On
563fa0522, thehas_morechange: focused Go tests forinternal/api/handlers,internal/apiv2andinternal/contractspec, gofmt, vet,make lint-changed, everyverify-apiv2-*target,TestCommittedArtifactMatchesRouter,make verify-size-ratchet, and webtsc -b, eslint, prettier andmake test-web: pass. A handler table test covers a row that ends at the cap, a row past the cap, a curated list longer than its own limit, rows that lose a Not interested or watched card, and uncapped reads; it fails if the extra card or the Not interested widening is removed. Not re-run for this change: the fullmake test-go, the synthetic-library replay and the browser captures.In headless Chromium at desktop 1920 px and phone width on a small library, on
da83077cf: a row holding more than 20 cards read 20, read the rest when its carousel came within a screen width of card 20, kept the shown cards in place, and reached its last card. Recordings are on the evidence page.On
74fc4b1dc(main merged in, review fixes): focused Go tests forinternal/api/handlers,internal/apiv2andinternal/contractspec,make lint-changed, everyverify-apiv2-*target,verify-local-paths, and webtsc -b, eslint, prettier,build,budget:checkandmake test-web: pass. ATestHomeRowReportsHasMorerow for a card dropped after the fetch limit failed ona2aed48ab. Asections.test.tscase for two completions in the same millisecond fails without its fix. Not re-run: the fullmake test-go, the synthetic-library replay and the browser captures.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3276/
Rows look the same and still reach their last card. One visible difference: Home's duplicate filter compares the cards each row has loaded, so on a library of about 100 movies or fewer the recommendations row can now appear where it was hidden, and the end of a long row can repeat a title another row shows. Android and Apple already behave this way.
The browser captures predate
has_more. In them, Home read nine short or empty rows a second time: 16 row reads per desktop load against 7 onmain. Withhas_morethose rows report no more cards, so the same library should take 7 row reads per load, plus one when Recently Added Movies is scrolled near card 20. This has not been re-captured in a browser.Risks
total_counton a capped row is a lower bound, as it already is onlistHomeSections.item_limit.Checklist
AI Disclosure
include_itemson older nodes. All four are fixed here, with a test for the fallback. A later Codex (gpt-6.1-sol) review ofa2aed48abfound that a capped row could misshas_morewhen cards dropped after the fetch limit, and that two rows completed in the same millisecond restored in the wrong order. Both are fixed here, each with a test that failed before its fix.🤖 Generated with Claude Code
Note
Read Home rows 20 cards at a time via
item_limitand lazy row completionitem_limitquery parameter (1..100) throughHomeLayoutInputandHomeSectionItemsInputin home.go. The server caps returned cards, reportshas_moreonSection, and advertisesrow_item_limit_maxin capabilities.HOME_ROW_ITEM_LIMITin homeRowLimit.ts) and loads the rest when the carousel nears its end, using a newonNearEndcallback inMediaCarouselandcompleteSectionin Home.tsx.dropCrossSectionDuplicates(sectionDedupe.ts) processes first cards in layout order and later cards in row-completion order, so completing a row does not steal an item another row already shows.item_limiton 422, then fall back to an uncapped or layout-only request; see sections.ts.useHomeShelfSections), and card removal updates the cachedshowncount inremoveItemFromHomeSectionCaches. Contract fixtures and OpenAPI schema in openapi.json gaineditem_limit,has_more, androw_item_limit_max.Macroscope summarized 74fc4b1.