Skip to content

fix(lists): keep hidden titles out of personal list cursors - #3537

Merged
Quick104 merged 7 commits into
Silo-Server:mainfrom
blurbery:fix/personal-list-cursor-access
Nov 5, 2026
Merged

Quick104 merged 7 commits into
Silo-Server:mainfrom
blurbery:fix/personal-list-cursor-access

Conversation

@blurbery

@blurbery blurbery commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #3536
Related issue: #1182
Validation tasks: changes #1183 C2; changes Silo-Server/silo-apple#324 C2; changes Silo-Server/silo-apple#325 C2

This deliberately changes behaviour #1183 C2 validated on build 1804: for a restricted profile, Favorites, Watchlist and Not interested pages no longer come back empty because of hidden entries, and no cursor names a hidden title. The C2 criterion (a profile cannot see titles outside its access) is still met, now including the cursor. C2 needs a re-test after merge, with paging under a library restriction. The iOS and tvOS C2 cases (silo-apple#324, #325) load the whole list through the same pages, which now come from a different query on PostgreSQL; for an unrestricted profile they should show the same entries in the same order. Both need a re-test after merge, browsing the full lists as an unrestricted profile and as a restricted profile with hidden entries (which should no longer appear, and should not leave gaps or empty pages). This PR does not touch ratings, so it does not affect C2's #3530 blocker (that is #3531).

A profile with a library restriction or a content-rating ceiling could find out which hidden titles were on its Favorites, Watchlist and Not interested lists by paging through them. The lists already left hidden titles out, but the v2 next_cursor was built from the last raw store row of the page, which could be a hidden title. A cursor is signed, not encrypted, so its base64 payload carried that title's item ID, and item IDs name the title's source. A page made only of hidden entries also came back empty with has_more: true. This is the same leak #3530 reported for ratings (fixed in #3531).

This change skips hidden entries when the page is read, so a cursor never names a title the profile can't see.

Approach

  • The three PersonalDataHandler page seams (ListFavoritesPage, ListWatchlistPage, ListNotInterestedPage) now answer only entries the viewer may see, by the same rule that decides whether an entry gets a card: a catalog item the access filter admits, or an episode whose parent series it admits (Favorites and the watchlist can hold episodes, for example from jellycompat clients). The probe row and the cursor row are therefore always visible titles, and hidden entries never show up as empty pages.
  • With the PostgreSQL user store (the default), the lists sit beside the catalog, so ItemRepository.ListVisiblePersonalPage answers a page in one query. It joins media_items (and episodes for the episode case) with the predicates EnsureAccessibleIDs uses, and reads each list's profile index in page order, so a page costs one index-ordered read however many hidden entries come before it. The handler uses it when the store reports userstore.HasCatalogSQLState and the item repository supports it.
  • A SQLite user store has no catalog to join, so there the seams read the store's keyset pages in batches and check them: the first read asks for the page size, each later one is four times larger up to 400 rows, and an empty library allowlist reads nothing.
  • The user store's own list methods stay unfiltered, so the userstore interface is unchanged (it can't take a catalog.AccessFilter, since catalog imports userstore) and recommendations, which read the same lists without an access filter, are unaffected.
  • Cards are still resolved once, for the kept entries only. The watchlist still promotes newly arrived titles on the first page only, and still hides fully watched series after the read. A fully watched series stays an entry without a card, which is fine: the profile can see it.
  • Stored entries are not touched, so hidden titles come back once the restriction is lifted.
  • The v2 handlers, cursor scope and response shapes are unchanged. Only which entries the seams return changes. v1 lists page by offset and have no cursor, so they are not affected.
  • docs/architecture/api-contract.md now describes the paging rule. fix(ratings): hide ratings of titles the profile may not see #3531 edits the same paragraph, so whichever PR merges second will need a small conflict fix there.

Not changed here: listWatchlistTitles (wanted titles outside the library) also leaves out titles above the rating ceiling and pages from raw rows, but its cursor holds only an internal numeric row ID and a timestamp, not the title. It can still reveal that an omitted title exists, so it may be worth its own issue.

Clients need no change: the response shapes are the same, and pages simply stop coming back empty. jellycompat has no equivalent paged lists with cursors.

Validation

  • go test ./internal/api/handlers/ -run 'TestPersonalListPagesSkipHiddenEntries|NotInterested|Favorite|Watchlist|PersonalList' -count=1: pass. The new test runs the real handler seams on a real SQLite user store for all three lists: a run of 60 hidden entries (longer than several read batches) and a run of 3, paged two at a time. Every page holds only visible entries with a card each, the walk reaches every visible entry, and a failed access check answers 500. With the helper changed to stop after one read, the test fails on all three lists.
  • Against a freshly migrated local Postgres 18 (both tests added to db-contracts.txt):
    • go test ./internal/catalog/ -run TestPersonalListPageFollowsAccessDB -count=1: pass. It runs the single query for all three lists: an episode of a visible series is kept, entries in a hidden or disabled library and entries the catalog no longer has are skipped, the keyset continues past hidden entries, an empty allowlist answers nothing, and EXPLAIN shows each list's profile index supplying the order with no full sort, for unrestricted and restricted viewers. With the library predicate removed from the query it fails.
    • go test ./internal/api/handlers/ -run TestPersonalListPagesKeepVisibleEpisodesDB -count=1: pass. It runs the real handler seams with the real item and episode repositories through both user stores, SQLite (batched path) and PostgreSQL (single-query path): under a TV-only restriction the favourited episode and its series are answered and the movie is skipped, and under a movies-only restriction only the movie is, on Favorites and the watchlist. With the single-query path made to return nothing, only the PostgreSQL runs fail, which shows that path is the one taken.
  • go test ./internal/apiv2/ -run 'Favorite|Watchlist|NotInterested|PersonalList|TestContractFixtures' -count=1: pass (fixtures unchanged).
  • go vet on internal/api/handlers and internal/apiv2: clean.
  • Not run locally: lint, make test and make test-web; CI runs them.

Tested commit: 88be321ce (the Postgres tests were rerun on it; it only splits the two database tests to satisfy funlen, so the evidence below from e7d51dc0a still applies).

Evidence

Real server runs, same data and requests, before and after. Before is a server built from upstream/main at 2d5f22e7d, after is a server built from this branch at e7d51dc0a. Both used the default PostgreSQL user store, against the same local Postgres and Redis with throwaway test data: an admin account with a Parent profile and a Kid profile, a Movies library (Test Movie One, Test Movie Two) and a TV library (Test Series One). As Kid I added all three titles to Favorites, Watchlist and Not interested, oldest first, then as Parent I restricted Kid to the Movies library with PATCH /api/v2/profiles/{id}. All requests are made as Kid. Item lists show each card's content_id; "next_cursor names" is the item ID in the base64-decoded cursor payload. pg_stat_statements on that database shows the after server ran the new single list query (12 calls) for these requests. No client screen pages these lists one at a time, so these API responses are the visible change.

Request as Kid, limit=1 following next_cursor Before After
Favorites 3 pages; page 2 is empty with has_more: true and its cursor names series-test-1 2 pages; no page or cursor names the series
Watchlist same as Favorites same as Favorites
Not interested same as Favorites same as Favorites
Full lists (default limit) the two movies the two movies (unchanged)
GET /api/v2/catalog/items/series-test-1 404 404 (unchanged)
Responses
# before: upstream/main 2d5f22e7d
GET /api/v2/catalog/items/series-test-1 -> 404
GET /api/v2/favorites -> 200 items=['movie-test-1', 'movie-test-2'] has_more=False
GET /api/v2/favorites?limit=1, following next_cursor:
  page 1: 200 items=['movie-test-1'] has_more=True next_cursor names movie-test-1
  page 2: 200 items=[] has_more=True next_cursor names series-test-1
  page 3: 200 items=['movie-test-2'] has_more=False
GET /api/v2/watchlist -> 200 items=['movie-test-1', 'movie-test-2'] has_more=False
GET /api/v2/watchlist?limit=1, following next_cursor:
  page 1: 200 items=['movie-test-1'] has_more=True next_cursor names movie-test-1
  page 2: 200 items=[] has_more=True next_cursor names series-test-1
  page 3: 200 items=['movie-test-2'] has_more=False
GET /api/v2/not-interested -> 200 items=['movie-test-1', 'movie-test-2'] has_more=False
GET /api/v2/not-interested?limit=1, following next_cursor:
  page 1: 200 items=['movie-test-1'] has_more=True next_cursor names movie-test-1
  page 2: 200 items=[] has_more=True next_cursor names series-test-1
  page 3: 200 items=['movie-test-2'] has_more=False

# after: fix/personal-list-cursor-access e7d51dc0a
GET /api/v2/catalog/items/series-test-1 -> 404
GET /api/v2/favorites -> 200 items=['movie-test-1', 'movie-test-2'] has_more=False
GET /api/v2/favorites?limit=1, following next_cursor:
  page 1: 200 items=['movie-test-1'] has_more=True next_cursor names movie-test-1
  page 2: 200 items=['movie-test-2'] has_more=False
GET /api/v2/watchlist -> 200 items=['movie-test-1', 'movie-test-2'] has_more=False
GET /api/v2/watchlist?limit=1, following next_cursor:
  page 1: 200 items=['movie-test-1'] has_more=True next_cursor names movie-test-1
  page 2: 200 items=['movie-test-2'] has_more=False
GET /api/v2/not-interested -> 200 items=['movie-test-1', 'movie-test-2'] has_more=False
GET /api/v2/not-interested?limit=1, following next_cursor:
  page 1: 200 items=['movie-test-1'] has_more=True next_cursor names movie-test-1
  page 2: 200 items=['movie-test-2'] has_more=False

Entries are kept: on the after server, with Kid's library restriction lifted, the series is back on all three lists.

after: lift Kid's library restriction -> 200
after: GET /api/v2/favorites -> items=['movie-test-1', 'series-test-1', 'movie-test-2'] has_more=False
after: GET /api/v2/watchlist -> items=['movie-test-1', 'series-test-1', 'movie-test-2'] has_more=False
after: GET /api/v2/not-interested -> items=['movie-test-1', 'series-test-1', 'movie-test-2'] has_more=False

Risks

  • With the PostgreSQL user store, a list page is one query that also checks access, in place of a store query plus a separate access check. With a SQLite user store, a page that crosses a long run of hidden entries costs a few extra batched reads (four times larger each time, capped at 400 rows), bounded by the list's length.
  • Entries for titles the catalog no longer has are now skipped the same way, so they no longer produce empty pages either.
  • Cursors keep their scope, so cursors issued before the upgrade keep working.

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 (desktop app)
  • Tool(s): Claude Code (Bash, Read, Edit, Write), GitHub CLI
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted. I directed the task and designed the work.
  • Adversarial review: a separate Claude Code subagent, given only [bug] Favorites, Watchlist and Not Interested cursors name titles hidden from the profile #3536 and the diff, reviewed cursor and probe derivation, the kept-entry rule against how cards are built, paging across batches and ties, query cost, other callers, and other surfaces with the same leak. It found that the first version dropped episode entries from Favorites and the watchlist (fixed in 1517ca460 with a Postgres test), suggested stopping early for an empty allowlist and fixing stale v2 comments (both done), and flagged listWatchlistTitles as a separate surface (noted above, not changed here). Kody's later review asked for the batched scan's cost to be bounded; on PostgreSQL that is now one query per page (e7d51dc0a).

Note

Filter hidden titles out of personal list page cursors

  • Favorites, watchlist, and Not interested keyset pages now return only entries the viewer may see, instead of raw store rows that could include hidden or inaccessible titles. A new visibleListPage helper in favorites.go backs all three handlers.
  • On PostgreSQL, ItemRepository.ListVisiblePersonalPage in personal_list_page.go runs a single SQL query that applies access predicates, including episodes whose parent series is accessible. Other stores use a batch-scan fallback (listScanBatchMax) that filters entries and refills the page.
  • An episode entry is visible when its series passes the access filter, even if the episode's own card is filtered out. Fully watched watchlist series remain entries without cards.
  • Adds SQLite and PostgreSQL tests for hidden-entry pagination, access filters, and query plans (no Sort node, profile index used), registered in db-contracts.txt.
  • Behavioral Change: pages never contain hidden entries; an access-check failure now returns a server error rather than an empty page. Check visibleListPage and PersonalDataHandler.listEntriesVisible in favorites.go and the empty-allowlist short-circuit in ListVisiblePersonalPage.

Macroscope summarized a3fe659.

A profile with a library restriction or content-rating ceiling could learn
which hidden titles were on its Favorites, Watchlist and Not interested
lists by paging them: the v2 cursor was built from the last raw store row,
which could be a hidden title, and a cursor payload is signed but not
encrypted. Pages made only of hidden entries also came back empty with
has_more true.

The three PersonalDataHandler page seams now read past entries the viewer
may not see, in growing batches, until they have a full page of visible
entries, so the probe row and the cursor row are always titles the viewer
can see. The store queries stay unfiltered: the user store may be SQLite,
and recommendations read the same lists without an access filter.

Closes Silo-Server#3536
The visibility check added for the list pages only looked at media_items,
so it dropped episode entries from Favorites and the watchlist for every
viewer. Those lists can hold episodes (jellycompat clients favourite
them), and an episode gets a card when its parent series is visible.

The kept-entry check now applies the same episode fallback as the cards.
It also stops at once for an empty library allowlist, and the v2 listing
comments no longer say has_more comes from the raw rows.
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 5, 2026
@silo-kody

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

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Favorites, Watchlist, and Not Interested pages now fill pages with entries visible to the viewer. Catalog queries or keyset batch scans skip inaccessible entries. Visible entries determine the page probe and cursor. Episodes are visible when their parent series is accessible.

Changes: Personal-list pagination

Layer / File(s) Summary
Query visible catalog entries
internal/catalog/personal_list_page.go
A catalog query pages Favorites, Watchlist, and Not Interested under the viewer’s access filter. It includes episodes whose parent series is accessible and uses keyset ordering.
Fill pages with visible entries
internal/api/handlers/favorites.go, internal/api/handlers/not_interested.go
The handlers use the catalog query when available. Otherwise, the shared helper scans keyset batches, skips inaccessible entries, and checks episode access through the parent series.
Validate pagination behavior
internal/catalog/personal_list_page_db_test.go, internal/api/handlers/not_interested_test.go, scripts/ci/db-contracts.txt, internal/apiv2/favorites.go, internal/apiv2/watchlist.go, docs/architecture/api-contract.md
Tests cover hidden-entry scanning, access-check failures, episode visibility, and catalog query plans. API comments and architecture documentation describe visible-entry probes and cursors. They also state that a fully watched Watchlist series remains an entry without a card.

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

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ListHandler
  participant visibleListPage
  participant ItemRepository
  Client->>ListHandler: Request a personal-list page
  ListHandler->>visibleListPage: Configure list reads and page limit
  visibleListPage->>ItemRepository: Query visible entries or check access
  ItemRepository-->>visibleListPage: Return visible rows or access results
  visibleListPage-->>ListHandler: Return a page of visible entries
  ListHandler-->>Client: Return entries and pagination cursor
Loading

Possibly related issues

  • Silo-Server/silo-server#1183: This issue covers profile access and paging for Favorites and Watchlist. This change filters those pages by viewer access.
  • Silo-Server/silo-server#1182: This issue covers browsing dedicated lists. This change prevents hidden entries from creating empty pages.

Possibly related PRs

  • Silo-Server/silo-server#3531: Both PRs apply viewer-access filtering to personal-list pagination. That PR covers ratings; this one covers Favorites, Watchlist, and Not Interested.

Suggested reviewers: quick104

Merge Risk: Minimal · up to a3fe6

Visible personal-list pagination is ready to merge after normal checks; no blocking issue was identified.

Security architecture risk: Low · up to a3fe6

The change reduces hidden-title disclosure by filtering list entries before creating pagination cursors. The inspected paths preserve account and profile ownership and apply existing visibility restrictions. Remaining uncertainty concerns deployment-specific fallback behavior and concurrent changes during pagination.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The affected disclosure surface is item identity in authenticated profiles' Favorites, Watchlist, and Not Interested pagination. The new SQL query explicitly restricts rows by both account and profile; the inspected change does not introduce a client-selected list owner.

Security Findings and Attack Paths

  • observed — The addressed attack path is reading hidden item identifiers from signed but unencrypted cursor payloads. Filtering entries before selecting the cursor row removes raw hidden rows from that path when catalog enforcement is available.

Trust Boundaries and Controls

  • observed — The existing viewer construction derives account, profile, and access restrictions from request context. Cursor scope remains bound to operation, account, profile, viewer-policy digest, and ordering rather than accepting ownership from the cursor payload.
  • observed — Both paging paths apply existing catalog authorization. The SQL path reuses library and maturity predicates, including disabled-library denial; the fallback checks direct item identifiers and then unresolved episodes' parent series. An explicitly empty library allowlist returns no entries when a catalog repository is present.

Resilience and Maintainability Implications

  • observed — The nil-catalog branch still returns raw store rows. This preserves the base behavior rather than introducing a new bypass, but the evidence does not establish whether production personal-list endpoints can reach that configuration, limiting assurance that the fix covers every deployment.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing hidden titles from appearing in personal list cursors.
Description check Passed The description directly explains the personal-list pagination changes, visibility rules, implementation approach, validation, scope, and risks.
Linked Issues check Passed [#3536] Requirement: a Favorites, Watchlist or Not interested cursor never names an entry the acting profile cannot see, and hidden entries do not produce empty pages with has_more true.

Evidence at …
Out of Scope Changes check Passed The changed areas map to [#3536]:
- internal/api/handlers/favorites.go and not_interested.go: shared visibleListPage, personalListSource, listEntriesVisible and the three seam rewrites. These implemen…
Docstring Coverage Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Full details: Linked Issues check

Explanation

[#3536] Requirement: a Favorites, Watchlist or Not interested cursor never names an entry the acting profile cannot see, and hidden entries do not produce empty pages with has_more true.

Evidence at head a3fe659, whole-PR diff against merge base 2c76d59:

  • internal/api/handlers/favorites.go: ListFavoritesPage and ListWatchlistPage now read through visibleListPage. ListNotInterestedPage uses the same helper per the PR summary. The helper keeps only entries that pass listEntriesVisible, which applies the card rule: a catalog item the access filter admits, or an episode whose series it admits. The cursor and the limit+1 probe are therefore built from visible entries only.
  • PostgreSQL path: when the item repository implements visiblePersonalListReader and userstore.HasCatalogSQLState holds, ListVisiblePersonalPage (internal/catalog/personal_list_page.go) answers the page in one query. The PR reports that its library and maturity predicates match EnsureAccessibleIDs and that tests fail when the library predicate is removed.
  • SQLite path: store keyset pages are read in batches (first read equals limit, then 4x, capped at 400) and checked with listEntriesVisible. The loop stops when the page is full or the store is exhausted, so a run of hidden entries does not produce an empty page while visible entries remain.
  • Stored entries are not deleted. The user store list methods are unchanged, so recommendations are unaffected.
  • Empty library allowlist returns no entries without a read.

Unresolved detail: when h.itemRepo is nil, visibleListPage returns the unfiltered store page. The diff does not show whether production handlers always set itemRepo. The PR and review state that production supplies it, but that is not source evidence I checked. If a deployment ran without itemRepo, the leak would remain on that path. The requirement is met on the code paths that the PR wires.

No coding requirement is unmet on the evidence available. The PR's reported before and after responses for series-test-1 show no cursor naming the series and no empty page 2 on the after server.

Full details: Out of Scope Changes check

Explanation

The changed areas map to [#3536]:

  • internal/api/handlers/favorites.go and not_interested.go: shared visibleListPage, personalListSource, listEntriesVisible and the three seam rewrites. These implement the visible-entry paging rule.
  • internal/catalog/personal_list_page.go: the PostgreSQL single-query visible page. Its predicates reuse the EnsureAccessibleIDs rules, so it is part of the same fix.
  • internal/apiv2 comments, docs/architecture/api-contract.md, scripts/ci/db-contracts.txt: documentation of the paging rule and contract registration of the new tests.
  • Tests in internal/api/handlers and internal/catalog: cover hidden-run skipping, episode visibility and query plans for the new behaviour.

The api-contract.md diff only changes the personal-list paragraph. Its ratings sentences are unchanged from the base, so no ratings behaviour is changed here. The PR states that v1 lists, recommendations, userstore interface, ratings and listWatchlistTitles are not changed. The reviewed diff does not show unrelated changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 87.50% which is sufficient. 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 8 functions across 7 files. (2 skipped: 2 unsupported.)

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: 54eb57e5-5610-4ea3-bbd2-3c0a9e09553c
Commits

Reviewing files that changed from the base of the PR and between ab1a067 and a3fe659.

Files selected for processing: 3

  • docs/architecture/api-contract.md
  • internal/api/handlers/not_interested_test.go
  • scripts/ci/db-contracts.txt

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

@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 impact: security Auth, privacy, or permission boundary priority: P0 Fix/merge first: data-loss, security, or widespread breakage labels Nov 5, 2026
Comment thread internal/api/handlers/favorites.go Resolved
Comment thread internal/api/handlers/favorites.go Resolved
Several episodes of one series on a page shared its access check, so the
series ID went into the access query once per episode. Deduplicate the
series IDs first.
@silo-kody

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

@macroscopeapp

macroscopeapp Bot commented Nov 5, 2026

Copy link
Copy Markdown

Major change — Server #1183 C2. The /api/v2/favorites, /api/v2/watchlist, and /api/v2/not-interested page seams now skip hidden entries and scan ahead to fill visible pages, so restricted-profile paging differs from build 1804. The PR must explain why this validated behavior changes; its current description ties the change to the hidden-title cursor disclosure. C2 needs re-validation after merge. This does not unblock its recorded blocker #3530, which concerns hidden-rating reads and is unchanged here.

Suggested fix: No diff; this is an intentional behavior change. Keep Validation tasks: changes #1183 C2 (paging the lists under restricted access) and arrange re-validation after merge.

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

Posted via Macroscope — v1 validation impact

Reading past hidden list entries in batches cost a store query and an
access query per batch, so a long run of hidden entries took several
round trips for each page that crossed it.

With the PostgreSQL user store the lists sit beside the catalog, so
ItemRepository.ListVisiblePersonalPage now answers a page of visible
entries in one query: it joins media_items (and episodes, for an episode
whose series is visible) with the predicates EnsureAccessibleIDs uses and
reads each list's profile index in page order. The batched read stays as
the fallback for a SQLite user store, which has no catalog to join.
@silo-triage silo-triage Bot added size/XL 500–999 added + deleted lines (all files); change volume, not priority. and removed size/L 200–499 added + deleted lines (all files); change volume, not priority. labels Nov 5, 2026
@silo-kody

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

@macroscopeapp

macroscopeapp Bot commented Nov 5, 2026

Copy link
Copy Markdown

Major validation changes: #1183 C2, Silo-Server/silo-apple#324 C2 (iPhone/iPad), and Silo-Server/silo-apple#325 C2 (tvOS) exercise the direct personal-list pagination path changed here. Apple’s list loader drains /api/v2/favorites and /api/v2/watchlist cursors, so its recorded complete-list results do not exercise hidden-entry scanning.

The PR must keep its explanation of why the validated list behavior changes explicit: hidden rows are skipped so pages and cursors cannot name them. These cases need human re-validation after merge, including restricted-profile pagination. The recorded #1183 C2 blocker #3530 concerns rating reads, which this PR does not change, so this PR does not unblock that finding.

The current Validation tasks: line omits the two Apple cases. Suggested replacement:
Validation tasks: changes #1183 C2, Silo-Server/silo-apple#324 C2, Silo-Server/silo-apple#325 C2

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

Posted via Macroscope — v1 validation impact

TestPersonalListPageFollowsAccessDB and TestPersonalListPagesKeepVisibleEpisodesDB
were over the 100-line funlen limit. Move the index plan check and the
catalog and list seeding into helpers; what the tests check is unchanged.
@silo-kody

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

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

Additional comments: 1

docs/architecture/api-contract.md-1452-1452: 1

1452-1452: Minor · Maintainability & Code Quality · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Hyphenate the compound adjective.

Change “one page query” to “a one-page query”. This fixes the compound adjective and completes the noun phrase.

Source: Linters/SAST tools

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: 865fed7d-4606-42f7-82d1-d5edc2d74acb
Commits

Reviewing files that changed from the base of the PR and between 278b401 and 88be321.

Files selected for processing: 7

  • docs/architecture/api-contract.md
  • internal/api/handlers/favorites.go
  • internal/api/handlers/not_interested.go
  • internal/api/handlers/not_interested_test.go
  • internal/catalog/personal_list_page.go
  • internal/catalog/personal_list_page_db_test.go
  • scripts/ci/db-contracts.txt

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

The misspell linter wants "favor" in Go code. Reword the api-contract
sentence on the PostgreSQL path to say a single query per page.
@silo-kody

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

@macroscopeapp

macroscopeapp Bot commented Nov 5, 2026

Copy link
Copy Markdown

Major change — Apple C2 list paging. silo-apple#324 C2 (iPhone/iPad) and silo-apple#325 C2 (tvOS) were validated against server build 1804. Their list screens follow cursors from GET /api/v2/favorites and GET /api/v2/watchlist; this PR changes those exact page seams to filter hidden rows and advance through a new keyset-query/scan path. Because C2 covers browsing the complete lists, the earlier passes do not exercise the updated pager. The PR must explain this validation impact, and both cases need re-validation after merge, including a restricted profile with hidden entries.

Suggested fix: No diff; extend the Validation tasks: line to Validation tasks: changes #1183 C2; changes Silo-Server/silo-apple#324 C2; changes Silo-Server/silo-apple#325 C2 and arrange re-validation after merge.

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

Posted via Macroscope — v1 validation impact

@Quick104

Quick104 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: ab1a067f6. I found no defects, and the independent review found none either, so I'm not posting a findings review or changing anything on the branch.

What I checked

  • The new PostgreSQL query (ListVisiblePersonalPage) applies the same library, disabled-library, maturity and media-type predicates as buildEnsureAccessibleIDsSQL. Its episode rule (the episode is kept when its series passes) is the rule resolveItemsByIDs uses to build episode cards. So an entry the query keeps always gets a card, and the cursor and probe rows are always titles the profile can see.
  • The query's base conditions, keyset predicate, order and added_at format match the pgstore page queries it replaces. Cursors issued before the upgrade still resume.
  • The SQLite batch loop stops when the page is full or the store runs out, and it never keeps more than limit rows from a batch.
  • Production always sets the item repository, so the "no catalog" branch of visibleListPage only runs in tests.
  • v1, recommendations and jellycompat keep their existing paths. d941225b4, merged to main after this branch was cut, changes how an episode is checked against the presentation library on detail and watch reads. These list predicates don't use that check, and the branch still merges cleanly.

Tests against the base (2d5f22e7d)

  • TestPersonalListPagesSkipHiddenEntries fails on the base with a hidden entry returned without a card, and passes on the head.
  • TestPersonalListPagesKeepVisibleEpisodesDB fails on the base for both user stores: the movie stays on the list under the TV-only restriction, and the episode and series stay under the movies-only restriction. It passes on the head.
  • TestPersonalListPageFollowsAccessDB passes on the head. It can't build on the base because it calls the new method, so it doesn't count toward proving the fix.

The independent review also ran a local Postgres plan with 9,999 hidden entries before one visible entry. Each list's profile index supplied the order with no full sort. Work still grows with the length of the hidden run, which is the same tradeoff discussed in the Kody thread.

Cross-provider review: one round, Codex gpt-6.1-sol (xhigh), on ab1a067f6. No findings.

Validated features: I couldn't read the validation board from here. The Validation tasks: line in the body (#1183 C2, Silo-Server/silo-apple#324 C2, Silo-Server/silo-apple#325 C2) matches what the code reaches. The C2 criterion is still met, and all three need the re-test after merge that the body describes.

User manual: unaffected. The manual doesn't describe list paging or cursors, and the visible lists don't change.

Apple/Android parity: no client change needed. Response shapes are unchanged, and pages just stop coming back empty.

Merge with #3531: after #3531 merged, I merged main into this branch (a3fe6598e). In docs/architecture/api-contract.md I kept this branch's paging rule and #3531's ratings and removal sentences. Both PRs had added the same idsFailingItemRepo test helper to internal/api/handlers, so I dropped this branch's copy. Focused handler and apiv2 tests and the Postgres tests for both PRs passed on the merged tree, and CI passed on a3fe6598e.

Fit: 9/10 · Readiness: 9/10 — ready

Fit: this closes an access gap in a core feature, keeping a restricted profile from learning hidden titles through list cursors. It applies the existing access rule instead of adding a new one. The extra SQLite path is the only stretch, and it's needed because that store has no catalog to join.
Readiness: no open concern remains, tests that fail on the base cover all three lists on both user stores, and CI is green.

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

Resolve the api-contract.md conflict with Silo-Server#3531: keep this branch's
visible-entry paging rule for favorites, watchlist and Not interested, and
Silo-Server#3531's ratings access and removal sentences. Drop this branch's copy of
idsFailingItemRepo, which Silo-Server#3531 added to the same package with the same body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Quick104
Quick104 merged commit c374e83 into Silo-Server:main Nov 5, 2026
16 checks passed
@blurbery
blurbery deleted the fix/personal-list-cursor-access branch November 6, 2026 00:01
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 impact: security Auth, privacy, or permission boundary priority: P0 Fix/merge first: data-loss, security, or widespread breakage size/XL 500–999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Favorites, Watchlist and Not Interested cursors name titles hidden from the profile

2 participants