Repository navigation
fix(sections): load rule rows that use the viewer's watch state - #3156
Conversation
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
The API excerpts show the row request recovering, but the Evidence section has no captures of the affected screens. CONTRIBUTING.md’s “Show visible changes” requires before-and-after captures when a change alters which items an existing client shows; API excerpts alone cover server changes no client shows yet. Please add same-data before-and-after captures of the affected row on web (desktop and phone width, or explain why mobile is unaffected) and the affected native client surfaces, naming the builds used. |
|
Evidence covers rule-based home sections and sorting, but not the personal smart collection row path changed via Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
A Home or library row built from rules that use the viewer's own state (Watched, Favorited, In progress, a plays or progress sort) failed with 500 Internal error: the filtered fetch never passed the requesting profile to the query, so validation refused the rule. Pass the account and profile into the filtered fetch when the rules need them. Such rows already skip the shared cache, so the result stays per profile. A personal smart collection shown as a row gets the same fix.
6e549a9 to
28cfbe4
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
No introduced defects found at Fit: 10/10 · Readiness: 8/10 — conditional The fix restores personalized rows at the existing query boundary. It retains access constraints and the existing shared-cache exclusion. API contracts stay the same. Readiness remains conditional on the native before-and-after evidence required by CONTRIBUTING.md; native clients were not exercised in this review. GitHub CI is green on the reviewed head. All 16 checks completed with success, neutral, or skipped conclusions. GitHub reports the branch as mergeable, and no new review findings were posted. Verification
Remaining issue: #3216 tracks the disclosed smart-collection display-filter failure, reproduced on both main and this head. It is separate from this PR and should follow it because it changes the same function. Validated features: #1140 C1 and #1142 C1 are affected; both remain recorded as Not run. No passed case was identified as regressed, and no board result was changed. Related Apple/Android cases remain unverified by this run. Clients and manual: Apple/Android contracts and Jellyfin callers were checked from source. Existing clients receive the fix without a contract update; native and Jellyfin runtime behavior was not tested. The user-manual check found no change needed because this restores documented behavior. The branch was rebased with a lease to resolve the additive database-test-list conflict. Every registration was preserved; the implementation and regression test are unchanged. The PR body now links the web evidence and includes the smart-collection API comparison requested in the bot feedback. Note AI-assisted review posted as Quick104 using Codex through T3 Code ( |
Problem
Closes #3143
Related issue: N/A
Validation tasks: changes #1140 C1; changes #1142 C1
A Home or library row fails to load when its rules or sort depend on the viewer's state, such as "Watched is No", favorites, or plays. The items request returns HTTP 500 because the row query lacks the requesting account and profile. Catalog-only rules continue to work.
Approach
Pass the requesting account and profile to the existing rule query when the definition is personalized. These rows already bypass the shared cache. The same path fixes personal smart collections shown as rows when they have no display filter. Existing library, maturity, and collection-owner access restrictions are retained.
Native API and Jellyfin wire contracts do not change. Apple and Android receive the restored rows through their existing API calls; no client implementation change is required. The fix restores documented behavior, so no user-manual change is needed.
Validation
Verified on rebased head
28cfbe4614ed8c7bb3db0cb607eb3a24e4282659, against main793b9fc15fa20d01b2b7a94597ddb9547e9382cc:TestRuleRowsReadTheViewersWatchStatePostgresfails on main with the profile-scope error and passes on the PR. Allinternal/sections/...tests pass with a disposable PostgreSQL database.go build ./...,go vet ./internal/sections/...,make lint-changed, router recovery lint, local-path checks, and case-collision checks pass.make test-gorun fails inTestRunStatsWithRealFFmpegand the fmp4/seek and mpegts/seek cases ofTestCopyRemuxSubtitleRenditionRealFFmpeg. The same failures reproduce on clean main with the local FFmpeg. Database tests were run separately as described above.The branch was rebased to resolve an additive conflict in the database-contract test list, preserving every entry. The fetcher patch and regression test are unchanged.
Evidence
Before-and-after Home captures at desktop and phone widths use the same data. The evidence also includes build identities, personal smart-collection API results, profile isolation, and the catalog-only control. Before:
793b9fc1; after:28cfbe46.Evidence: https://evidence.siloserver.org/r/silo-server/pr-3156/
Risks and follow-up
An admin preview of a personalized row now evaluates the admin's own profile, where it previously failed.
A personal smart collection with a nonempty display filter still executes its base query without the viewer's profile. It fails on both main and this branch and is tracked in #3216. Its repair should follow this PR because it touches the same function.
Checklist
AI Disclosure
Review update: Codex through T3 Code (
gpt-6.1-sol) reviewed and verified the rebased head. An independent Claude Code review through T3 Code (claude-opus-5-5) checked caller identity, access constraints, cache isolation, and regression coverage. Neither found an introduced defect. The display-filter omission was reproduced on main and the PR and is tracked in #3216. The review changed only the additive test-list conflict during rebase; the implementation and regression test are unchanged. Human acceptance of validation cases is not claimed.Note
Fix section rule rows to use viewer's watch state in
sections.Fetcher.fetchFilteredfetchSectionandfetchUserCollectionnow passuserIDandprofileIDtofetchFiltered, which setsfilter.UserIDandfilter.ProfileIDonly whendef.IsPersonalized()is trueTestRuleRowsReadTheViewersWatchStatePostgres) proving watched-state rules use the requesting profile's history; registered in db-contracts.txtMacroscope summarized 6e549a9.