Skip to content

fix(home): leave rows with nothing to show out of the v2 section lists - #2894

Merged
Quick104 merged 5 commits into
Silo-Server:mainfrom
Rhainland:fix/home-omit-empty-rows
Nov 9, 2026
Merged

Quick104 merged 5 commits into
Silo-Server:mainfrom
Rhainland:fix/home-omit-empty-rows

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1137
Validation tasks: unblocks #1140 C4

GET /api/v2/home/sections and GET /api/v2/library/{id}/sections return every row on the page, including rows whose titles all sit in libraries the viewer can't open or above their rating limit. Those rows arrive with a title and no cards. Every first-party client hides them on its own, but a third-party client shows an empty titled row, and the server response does not meet the curated home sections criterion that "rows with zero accessible items are omitted" (#1137 AC5), which the Server validation task checks directly.

This change makes both v2 lists leave out every row that has no items for the viewer.

Approach

The v2 Home and library section lists now drop a row with no items after access filtering, as they already did for an off-season seasonal row. Two reads keep their current behaviour on purpose:

  • getHomeSectionItems still answers an empty row requested by ID.
  • getHomeLayout still lists every resolved row, because it is built before any row is fetched. The web app reads Home this way and already hides empty rows.

A row whose fetch fails is now left out of the v2 lists rather than answered empty; per-row reads still return the 500. The frozen /api/v1 lists keep their current answers. api-contract.md and recommendations.md describe the new behaviour, the migration ledger rows for both operations record it as a deliberate difference from v1, and the OpenAPI operation descriptions are updated.

Validation

  • Handler, apiv2 and sections Go tests against a migrated Postgres, on the branch rebased onto current main: pass.
  • The new DB test fails on main's handler code (the empty row is still listed) and passes on this branch.
  • New DB contract test (listed in scripts/ci/db-contracts.txt): a viewer limited to one library gets the home and library lists without a row whose titles are all in the other library, while the by-ID read still answers that row empty.
  • make lint-changed: 0 issues. verify-apiv2-openapi, verify-apiv2-web-types and verify-migration-ledger: current.
  • Sandbox server built from this branch, with a profile restricted to one library and a kids profile limited to PG. No row in /api/v2/home/sections had zero items. Granting library access added the restricted row on the next request and revoking it removed the row again. Per-profile order and the admin override behaved as before, and /api/v1/home/sections still returned the empty rows.

Evidence

GET /api/v2/home/sections for a profile restricted to a kids library, same server data, before and after (row title and item count):

Before (main 8ab0e8e19) After (this branch)
Continue Watching (0) Recently Added Movies (4)
Trending This Week (0) Fixture: Trending (2)
Recently Added Movies (4) Fixture: Featured Picks (2)
Recently Added TV (0)
Recommended for You (0)
Because You Watched (0)
Returning Shows (0)
Top Rated (0)
Hidden Gems (0)
Fixture: Trending (2)
Fixture: Editorial 80s - 1980s (0)
Fixture: Mood Mind-Bending (0)
Fixture: Featured Picks (2)
Fixture: Grown-up Only (0)

Surface and build: native API v2, server built from this branch on a sandbox with synthetic media. Home and unscoped library views already hide empty rows; the scoped Apple tab differences are described under Risks. The library section list results are on the evidence page.

Evidence: https://evidence.siloserver.org/r/silo-server/pr-2894/

Risks

A client that expects listHomeSections or listLibrarySections to return a row with no items, for example to draw its own empty state for Continue Watching, no longer gets it. This is a v2 contract change made before the 1.0 lock and is recorded in api-contract.md.

Apple refills short rows on a mixed library's Movies or Series tab from catalog?source=section. A row left out here is not refilled. One case reaches this: a personalized row the cross-row duplicate filter emptied. A second case, an unsorted collection row whose first item_limit members are hidden from the viewer, was a fetcher bug that #3500 fixed on main (#3384).

Maintainer decision: keep empty v2 rows omitted and repair the collection fetcher separately (done in #3500). The scoped-tab limitation for personalized rows emptied by the duplicate filter is accepted for this PR.

Follow-ups: none open. #3384 (unsorted collection rows) and #3301 (curated rows ignoring item_limit on the list reads) both predated this change and are fixed on main by #3500 and #3419.

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

  • Decision follow-up: Codex in T3 Code (gpt-6-astra) recorded the maintainer’s scope decision.

  • Harness: Claude Code

  • Tool(s): Claude Code; OpenAI Codex CLI (review only)

  • Model(s): claude-opus-5-5; gpt-6.1-sol (review only)

  • Involvement: Fully AI-generated, human verified

  • Adversarial review: independent reviews by claude-opus-5-5 and gpt-6.1-sol of the diff for correctness, repository standards, and the [v1] Curated home sections #1137 criteria. Both found that the first version stopped the frozen v1 list from leaving out rows emptied by hiding watched titles; that was restored, and a v1 behaviour assertion that CONTRIBUTING.md rules out was removed. No other findings.

  • Maintainer review: claude-opus-5-5 (Claude Code) reviewed 5e282e3 and, after main moved, 5448e4b rebased onto main, each with one gpt-6.1-sol (Codex) round. A third round rebased the branch onto main again and reviewed it with one more gpt-6.1-sol round. Fixes: two stale comments and the contract paragraph (5448e4b), the migration ledger rows and v1 differences lists (5d96f63), and the contract paragraph's claim that every client gets the same rows (d0a9f43). The unsorted collection case went to [bug] Unsorted collection rows come back empty when their first members are hidden from the viewer #3384; the maintainer accepted keeping this PR scoped and repairing [bug] Unsorted collection rows come back empty when their first members are hidden from the viewer #3384 separately.

Note

Omit empty rows from v2 home and library section lists

  • v2 HomeSections and LibrarySections now drop every row that has no items after access, seasonal, fetch, watched-title, and duplicate filtering; v1 keeps its existing behavior of returning those rows empty
  • The aggregate Home and library implementations in home_views_service.go and library_views_service.go are extracted into shared helpers with a keepEmptyRows option, and the v1 handlers route through them with the option enabled
  • Adds a database integration test TestAggregateSectionsOmitRowsWithNoAccessibleItemsDB and registers it in the CI contract test list
  • Updates the v2 OpenAPI contract, generated schema, and architecture docs to describe the new behavior
  • Behavioral Change: clients on the v2 endpoints no longer receive rows with zero cards; the contract notes in migration.json record the change

Macroscope summarized d0a9f43.

@silo-kody

silo-kody Bot commented Oct 22, 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-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 22, 2026
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

Home and library aggregate section reads now omit rows with no items by default. The frozen v1 aggregate handlers retain their legacy behavior. Direct reads can still return an empty row.

Changes: Aggregate section filtering

Layer / File(s) Summary
Section filtering and legacy behavior
internal/api/handlers/home_views_service.go, internal/api/handlers/library_views_service.go, internal/api/handlers/sections.go
Home and library section loaders now omit all empty rows by default. Aggregate handlers request the legacy behavior, which retains empty non-seasonal rows.
Contract and behavior validation
internal/api/handlers/sections_empty_rows_db_test.go, scripts/ci/db-contracts.txt, docs/architecture/*, internal/apiv2/home.go, internal/apiv2/library_views.go, contracts/api/v2/openapi.json, web/src/api/v2/schema.ts
The database test checks aggregate filtering and direct reads of empty rows. Architecture documentation and API descriptions specify the section-list behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: quick104

Merge Risk: Minimal · up to 5e282

The section-list change appears ready to merge after normal checks; no actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: v2 section lists omit rows with no items.
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 states the problem (v2 Home and library section lists return rows with a title and no cards), the approach (omit rows with no viewer items, with exceptions for getHomeSectionItems and …
Full details: Description check

Explanation

The description states the problem (v2 Home and library section lists return rows with a title and no cards), the approach (omit rows with no viewer items, with exceptions for getHomeSectionItems and getHomeLayout), the validation performed, and the risks. It directly describes the changeset's files and behavior, so it is not off-topic and passes the lenient check.

Finishing Touches

🧪 Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
ℹ️ 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: 8a97c930-a082-4217-8526-1ad17968aeb9
📥 Commits

Reviewing files that changed from the base of the PR and between 3bc9e58 and 5e282e3.

📒 Files selected for processing: 11

  • contracts/api/v2/openapi.json
  • docs/architecture/api-contract.md
  • docs/architecture/recommendations.md
  • internal/api/handlers/home_views_service.go
  • internal/api/handlers/library_views_service.go
  • internal/api/handlers/sections.go
  • internal/api/handlers/sections_empty_rows_db_test.go
  • internal/apiv2/home.go
  • internal/apiv2/library_views.go
  • scripts/ci/db-contracts.txt
  • web/src/api/v2/schema.ts

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

@macroscopeapp

macroscopeapp Bot commented Oct 22, 2026

Copy link
Copy Markdown

The evidence shows before-and-after results for /api/v2/home/sections with rows empty because of viewer access, but it does not cover:

  • /api/v2/library/{id}/sections (internal/api/handlers/library_views_service.go): before-and-after response excerpts for the same library and viewer.
  • Rows omitted after a section fetch fails (internal/api/handlers/home_views_service.go, internal/api/handlers/library_views_service.go): before-and-after API response excerpts showing this behavior in the affected v2 lists.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@Rhainland Rhainland mentioned this pull request Oct 22, 2026
4 tasks done
@silo-triage silo-triage Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Oct 22, 2026
@Rhainland Rhainland mentioned this pull request Oct 22, 2026
4 of 13 tasks
@macroscopeapp

macroscopeapp Bot commented Oct 22, 2026

Copy link
Copy Markdown

Server/API #1140 C4 is ready for a human re-test after merge: the issue's AI sandbox note reports zero-accessible rows in the main v2 response, and this change filters those rows from the v2 aggregate list. The Results cell remains Not run, so no validation is claimed.

Suggested follow-up: After merge, rerun C4 against a published build and record the human result in #1140.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

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

Review of 5e282e3. Three findings, none blocking. I'm fixing the first two in a commit on this branch, so there's no need to change them yourself.

Low: a comment still describes the old v2 behaviour (internal/api/handlers/home_views_service.go:106, outside the diff). The comment in homeSectionItems says the aggregate read "keeps the page up with an empty row" when a row fails. After this PR only the frozen v1 aggregate read does that; the v2 lists leave the failed row out. A later change that trusts the comment could put empty-on-failure back into v2. I'm updating the comment.

Comment thread docs/architecture/api-contract.md Resolved
@silo-kody

silo-kody Bot commented Oct 23, 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 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: d0a9f43. Main had moved and the branch conflicted again, so I rebased it onto 4018816 and force-pushed with a lease. Only scripts/ci/db-contracts.txt conflicted; both entries are kept, and git range-diff shows the code commits otherwise unchanged. The head is that rebase plus one docs commit. (Earlier rounds reviewed 5e282e3, 5448e4b and 5d96f63.)

The approach still holds on current main. listHomeSections and listLibrarySections leave out rows with nothing to show; the frozen v1 reads take the same code with keepEmptyRows=true; the layout and per-row reads are unchanged. What main added since the last round doesn't change that: web-only hero rows (#2891) are filtered when rows are resolved, before any items are fetched; the item caps (#3419), Next Up injection and the watched filter all run before the empty-row drop; and building the response never removes items afterwards. The new DB test fails on current main's handler code, where the empty row is still listed, and passes on this head.

Addressed

  • d0a9f43: the contract paragraph said every client gets the same rows. A web-only hero row and the client's item_limit can change which rows a request resolves, so it now says no client has to hide an empty row itself and that the rule applies to each request's own rows.
  • Earlier rounds: stale comments, the duplicate-filter case in the contract paragraph, and the migration ledger rows and v1 differences lists.

Maintainer decision (settled)

Clients and parity

  • Android and Apple already hide empty rows on Home and in unscoped library views, and neither matches rows by index. Apart from the scoped-tab case, they look the same before and after.
  • The web reads the layout plus per-row items and doesn't call these two operations.
  • jellycompat has no section lists, so there's nothing to match.
  • The OpenAPI change only edits summary text.

Validated features
#1140 C4 is still Not run. Its criterion (rows with zero accessible items are omitted) can't pass on main and can on this head, so Validation tasks: unblocks #1140 C4 stays. No passed case reaches this code.

Other checks

Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)

Fit: the v2 contract now meets the curated home sections criterion that rows with zero accessible items are omitted, before the API locks, with a small change at the right boundary and v1 untouched. Readiness: a test that fails on main proves the behaviour, no open finding remains, and the scope decision is settled. This round ran no new live API or device check; the published sandbox evidence predates the rebase, which changed no code in this PR.

🤖 Claude Code (claude-opus-5-5)

@macroscopeapp

macroscopeapp Bot commented Oct 23, 2026

Copy link
Copy Markdown

Correction: #1140 C4 is still Not run, not failed or blocked, so this PR does not unblock a recorded validation result. The linked Curated home sections surface tasks also show Not run, leaving no passed, failed, or blocked result to invalidate or unblock. Please replace Validation tasks: unblocks #1140 C4 with Validation tasks: none. C4 still needs its first human validation after merge, as noted earlier.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

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

Review of 5448e4b, rerun after main moved. The branch conflicted with current main, so I'm rebasing it onto 81ae2ce; only two doc comments conflicted. One new finding, low severity. I'm fixing it in a commit on this branch, so there's no need to change it yourself.

Low: the migration ledger still says v2 answers the same rows as v1. api-contract.md says each deliberate v2 difference from v1 is recorded on the ledger rows. The listHomeSections row in contracts/api/v2/migration.json still reads "Same body as v1", and neither ledger row nor the catalog-libraries and catalog-home "Deliberate differences" lists mention the empty rows the v2 lists now leave out. Someone porting a v1 client, or checking v1 retirement (#886), would expect v2 to return the same rows as v1. I'm adding the difference to both ledger rows and both lists. The same commit corrects the v1 Home handler comment, which didn't mention the rows that hiding watched titles empties.

The cross-provider round found one more case of the open Apple scoped-tab question, which I've added to that thread.

🤖 Claude Code (claude-opus-5-5)

@Quick104
Quick104 force-pushed the fix/home-omit-empty-rows branch from 5448e4b to 5d96f63 Compare November 2, 2026 00:04
@silo-kody

silo-kody Bot commented Nov 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 ❌

Rhainland and others added 4 commits November 9, 2026 14:58
The v2 Home and library section lists answered every resolved row, even one
whose titles all sit in libraries or above rating limits the viewer cannot
open. Such a row reached clients with a title and no cards, and each client
had to hide it on its own. Both lists now leave out every row with no items,
as they already did for an off-season seasonal row. A row asked for by ID
still answers empty, and the frozen v1 lists keep their old answers.
The comment on the single-section read still said the aggregate read
answers a failed row empty, which is now only true of v1. The contract
paragraph also left out rows the cross-row duplicate filter empties,
which the per-row read answers with items.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
api-contract.md says every deliberate v2 difference from v1 is recorded on
the migration ledger rows, but the listHomeSections row still said "Same body
as v1" and neither ledger row nor either "Deliberate differences" list named
the rows the v2 lists now leave out. Also say in the v1 Home handler comment
that v1 drops a row hiding watched titles emptied.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104
Quick104 force-pushed the fix/home-omit-empty-rows branch from 5d96f63 to 5fe40c6 Compare November 9, 2026 15:17
The contract paragraph promised every client the same rows, but a web-only
hero row and the item_limit a client asks for can change which rows a
request resolves or which the duplicate filter empties.

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

silo-kody Bot commented Nov 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 ❌
⚠️ 4 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
  • Detach mandatory cleanup from request cancellation and bound its lifetime
  • Preserve durable media identity and share identity-evidence precedence
  • Bound decoder throughput trades and share direct-play eligibility

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

Review of 5fe40c6, rerun after main moved again. The branch conflicted with main, so I rebased it onto 4018816 and force-pushed with a lease. Only scripts/ci/db-contracts.txt conflicted (main's new web-only hero test sits next to this PR's entry; both are kept), and git range-diff shows the code commits otherwise unchanged. One new finding, low severity, already fixed in d0a9f43 on this branch, so there's no need to change it yourself.

🤖 Claude Code (claude-opus-5-5)

Comment thread docs/architecture/api-contract.md Resolved
@Quick104
Quick104 merged commit f3259cd into Silo-Server:main Nov 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants