Skip to content

fix(sections): keep ebook and manga rows to their media scope - #4520

Open
Quick104 wants to merge 1 commit into
mainfrom
fix/sections-media-scope-type-filter
Open

Quick104 wants to merge 1 commit into
mainfrom
fix/sections-media-scope-type-filter

Conversation

@Quick104

@Quick104 Quick104 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: not checked (the board query was unavailable to the author's token); ebook and manga rows are beta and outside the 1.0 board, and movie, series, audiobook, and video rows behave as before

Other clients: N/A (no client change; every client shows the rows the server returns)

A section row whose config sets media_scope to ebook or manga applied no type filter. Its See All page did filter by type. The affected rows include the default Recently Added, Recently Released, and Random rows on ebook and manga library pages. When the row's scope holds other kinds of titles, the row can show titles of other types, while See All shows only the scoped type. A row placed on another library page or on Home through the API shows the same mismatch.

This was found while reviewing #4506 and predates it.

Approach

sections.ParseConfigFilters turned a structured media_scope into the row's type filter only for movie, series, and audiobook. It now does the same for ebook and manga, the type filter See All already applies through parseCatalogSectionFilters. Every row fetcher that reads ParseConfigFilters gets the filter: Recently Added, Recently Released, Random, and the personal-list rows.

The section save check used the same parser to limit the legacy filter_type key to movie, series, or audiobook. Once the parser started returning ebook and manga from media_scope, that check would have rejected saving the default ebook and manga rows. The check now reads the raw filter_type key. The accepted values are unchanged, and media_scope is still validated when the query definition parses.

The video scope covers two item types and stays out of this change. Recently Added already filters it separately, and no default Recently Released or Random row uses it.

Validation

  • A Postgres-backed test fetches Recently Added, Recently Released, and Random rows with the default ebook and manga configs from a library that holds an ebook, a manga, and an audiobook title. On main every row returned all three titles. With this change each row returns only its own type.
  • A unit test checks that rows with the default ebook and manga scopes still save. It fails if only the parser is widened.
  • The bug was not reproduced on a running server. A normal scan writes one item type per ebook or manga library, so a mixed scope needs API edits or data drift. The test above runs the real row queries against a migrated database instead.
  • go test ./internal/sections/... ./internal/api/handlers/ passes, and make lint-changed reports no issues.

Evidence

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

Surface and build: section row queries at commit edb4742 (on main e78f889), tested against a migrated local Postgres.

Follow-ups

Risks

Ebook and manga rows that showed other types will now show fewer titles. That only happens when a row's scope holds other types, which is the bug. Rows with no scope or another scope are unchanged.

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 how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5 (code and review agents), claude-sonnet-5-5 (cleanup and validation review agents)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: A multi-agent code review of the branch diff (three finders on claude-opus-5-5 and claude-sonnet-5-5) found one problem in the first draft: the save check compared the raw legacy filter_type, so a stored "Movie" that main accepts would have been rejected. Fixed, and the unit test covers it. It also found that rows scoped to video or episode still differ from See All on main; that is left out of this PR and tracked as a follow-up. The plan round was skipped because the fix is a few lines at the root cause and adds nothing. A background adversarial review (gpt-6.2-sol, reviewed edb4742) found one case: a config with an empty legacy filter_type beside media_scope now filters the row but not See All. The same split already exists on main for the movie, series, and audiobook scopes, so it was added to Section rows scoped to video or episode differ from their See All page #4521 with the shared-parser fix rather than patched here.

🤖 Generated with Claude Code

Section rows read a structured media_scope through ParseConfigFilters,
which kept only movie, series, and audiobook. An ebook or manga scope
became no type filter, so the default Recently Added, Recently Released,
and Random rows for those kinds could show titles of any type in their
scope while their See All page showed only the scoped type.

Carry ebook and manga as the row's type filter. The section config check
now limits only the legacy filter_type key, so rows saved with these
scopes keep passing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 18, 2026
@silo-kody

silo-kody Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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

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

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T20:40:04.456342Z edb4742 PR opened
🔒 Security Review ✅ Completed 2026-11-18T20:43:27.226796Z edb4742 PR opened
ℹ️ About Codex in GitHub

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

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

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

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Nov 18, 2026
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change maps structured ebook and manga media scopes to filter types, adjusts section-config validation to accept those scopes while retaining validation for legacy filter_type, and adds database coverage for scoped section results. The recently released movie query continues to use the literal movie filter.

Changes: Book media scopes

Layer / File(s) Summary
Scope mapping and configuration validation
internal/sections/types.go, internal/api/handlers/sections.go, internal/api/handlers/sections_test.go
Structured ebook and manga media scopes now map to filter types. Section-config validation accepts these structured scopes and checks nonempty legacy filter_type values against the allowed types. The test covers accepted scopes and legacy filter-type validation.
Scoped section results
internal/sections/fetcher.go, internal/sections/media_scope_rows_db_test.go, scripts/ci/db-contracts.txt
The recently released movie query retains its literal movie filter. A PostgreSQL integration test checks ebook- and manga-scoped results across recently added, recently released, and random sections. The database-contract list includes the test.

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

Change: Bug fix

Suggested labels: bug, go

Suggested reviewers: rhainland, blurbery

Merge Risk: Minimal · up to edb47

Ebook and manga section rows now use the same type filter as their See All pages. Existing behavior for other scopes is unchanged, and database tests cover the new behavior. No merge-blocking risk remains.

Security architecture risk: Minimal · up to edb47

The change keeps ebook and manga rows within their intended media types without expanding library access or changing stored data formats. No introduced security or state-management risk was identified in the inspected change.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: ebook and manga section rows are now limited to their media scope. It matches the raw summary, which says the parser now derives the type filter for ebook and manga sc…
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 is specific and on-topic. It names the bug (ebook and manga section rows apply no type filter), the affected files and functions (ParseConfigFilters, the save check for legacy filter_t…
Full details: Title check

Explanation

The title names the main change: ebook and manga section rows are now limited to their media scope. It matches the raw summary, which says the parser now derives the type filter for ebook and manga scopes and that the save check reads the raw filter_type key. The title is specific and uses the fix() prefix and the sections scope.

Full details: Description check

Explanation

The description is specific and on-topic. It names the bug (ebook and manga section rows apply no type filter), the affected files and functions (ParseConfigFilters, the save check for legacy filter_type), the validation (a Postgres-backed test and a unit test), and the known follow-ups for video and episode scopes. It describes the changeset in meaningful detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • 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: 5fe93102-29fe-4737-8876-a560c8c10c4b
Commits

Reviewing files that changed from the base of the PR and between 4102bca and edb4742.

Files selected for processing: 6

  • internal/api/handlers/sections.go
  • internal/api/handlers/sections_test.go
  • internal/sections/fetcher.go
  • internal/sections/media_scope_rows_db_test.go
  • internal/sections/types.go
  • scripts/ci/db-contracts.txt
Files with no reviewable changes: 1

  • internal/sections/fetcher.go

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

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adversarial review (gpt-6.2-sol, reviewed edb4742)

AI-generated review (Codex, gpt-6.2-sol).

Comment thread internal/sections/types.go Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant