Skip to content

fix(recommendations): size recommendation artwork like home sections - #2628

Merged
Quick104 merged 8 commits into
mainfrom
feat/recommendation-artwork-sizes
Oct 17, 2026
Merged

Quick104 merged 8 commits into
mainfrom
feat/recommendation-artwork-sizes

Conversation

@Quick104

@Quick104 Quick104 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: Silo-Server/silo-apple#819, Silo-Server/silo-android#609
Validation tasks: none

Recommendation reads ignore image_size and always return the featured defaults, and they presign each image on its own, so a 25-card row costs 75 lookups. A TV client can get a hero-sized backdrop and a card-sized poster on home but not on For You, discover or Watch Tonight. This makes recommendation cards size and batch their artwork the way home sections do.

Stacked on #2627, whose width parameters this extends to recommendations.

Approach

  • Every v2 recommendation read takes image_size and the per-slot widths: discover, For You, recommendation sections, because-watched, popular, recently added, similar, similar users, the taste-seed grid, Watch Tonight and Watch Tonight cards.
  • Cards resolve through the batch resolver home sections use, so a title's card artwork is the same file on both surfaces and a page of cached artwork costs one lookup. The taste-seed grid batches its posters the same way.
  • Watch Tonight cards on v2 now fill each cast member's photo_url, which was always empty, on the profile ladder: 500px without a size, like item detail.
  • Without sizes, cards keep the files and plugin hint they had, so the /api/v1 recommendation routes, which take no new parameters, return the same artwork.

Validation

  • Unit tests: unsized cards keep their previous files and hint; cards resolve in one batch at the requested widths; Watch Tonight cast photos use the profile ladder, keep plugin-hosted paths with the large hint, and pass http(s) photos through; the v2 seam carries the artwork query and rejects out-of-range widths: pass.
  • make verify-apiv2-contract: additions only. Top-of-stack gate as in feat(artwork): cache originals up to 4K and add wider rungs #2626.
  • Sandboxes: recently added with no size, image_size=small, and Apple TV 4K widths. For You and Watch Tonight return no cards there without watch history, so unit tests cover them.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/recommendation-artwork-sizes/

Recently added responses from a main build and this stack. On main the size and width parameters are rejected with 422. On this stack the response without sizes is unchanged, and small and the TV widths return the sizes they name.

Risks

  • None identified: without sizes the files are the same; batching changes how many lookups a page makes.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code, running in T3 Code
  • Tool(s): Claude Code; Codex for the adversarial review
  • Model(s): claude-opus-5-5; gpt-6.1-sol (review)
  • Involvement: Fully AI-generated, human verified. The maintainer chose the design and checked the artwork on devices; the code has not had a line-by-line human review.
  • Adversarial review: Codex (gpt-6.1-sol) reviewed the whole three-commit stack in three read-only rounds, checking for keys that name sizes an image never had, unintended /api/v1 or unsized v2 changes, cursor binding, manifest fallbacks, the backfill query, Jellyfin sizing and plugin hints. It found Jellyfin Primary and fallback images sized on the wrong ladder, plugin-hosted artwork on list endpoints ignoring slot widths, and unsized hero logos degrading to 500px on artwork cached before revision manifests; all three are fixed with tests. It also flagged that favorites, watchlist and similar cursors ignore widths; that is unchanged on purpose, because those cursors never bound image_size either. Separately, captures from the sandboxes showed that headshot widths sent plugins a hint that returns 185px images, so headshots keep the large hint unless they need the original.

🤖 Generated with Claude Code

Note

Size recommendation artwork like home sections

  • Recommendations now support the same artwork sizing as home and library: image_size plus poster_width, backdrop_width, logo_width, still_width, and photo_width query params on 12 recommendation, discovery, similarity, taste-seed, and Watch Tonight operations.
  • All recommendation request models in recommendations.go embed ArtworkQuery, and a new recommendationFilter helper passes the requested size and widths into the catalog access filter for each handler.
  • Handlers in recommendations_service.go and watch_tonight.go now resolve poster, backdrop, and logo artwork in one shared batch featured-artwork pass before building cards, instead of presigning per card.
  • Watch Tonight cast photos resolve in batches at the requested profile size in watch_tonight_cards.go; HTTP(S) photos pass through unchanged, and swipe cards resolve artwork only for the returned page, not all hydrated candidates.
  • Behavioral Change: unsized requests keep current defaults; callers passing the new params get sized URLs. OpenAPI contract and generated web schema in openapi.json and schema.ts now advertise the new query parameters.

Macroscope summarized 3bb206a.

Quick104 and others added 3 commits October 16, 2026 21:03
Cached originals were downscaled to 1920px on ingest, so a 4K TV hero or a
high-density tablet never got more than a 1080p backdrop. Originals now keep
the source's resolution up to 3840px, and the ladder gains rungs between the
old default and the original: backdrop w2560, poster w1000, still w1280
(LadderVersion 3, so the one-shot backfill regenerates existing artwork,
backdrops included).

Every storage backend now reads the publication manifest, so a request for a
rung an older revision never generated falls back to one it did publish
instead of a 404. Local and direct-S3 backends only look up the added rungs;
external delivery still checks every key.

Unsized defaults stop serving the 4K original where no client draws it: cast
headshots in item detail use the 500px rung, and an episode still standing
in for a backdrop uses the widest still rung that fits. Jellyfin-compatible
MaxWidth/MaxHeight/FillWidth/FillHeight requests pick the narrowest rung
covering four fifths of the requested width on the resolved image's own
ladder and aspect ratio; a request is sized on every ladder it can resolve
to, since Primary and fallbacks land on different image types.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One image_size per response cannot serve a TV home row, which draws each
item's poster as a card and its backdrop full-screen behind the focused row,
or a detail page with a full-screen hero beside small cast photos. Every v2
read that takes image_size now also takes poster_width, backdrop_width,
logo_width, still_width and photo_width: the width in device pixels the
client draws that response field at.

The server returns the narrowest cached rung at least that wide on the
image's own ladder, including rungs image_size cannot name, else the
original. A slot is named for the field, so backdrop_width also governs an
episode's still when it fills backdrop_url. A slot width overrides
image_size for that slot; slots without one keep image_size or the
per-context default. Plugin-hosted art gets the nearest semantic hint for
its slot: listings resolve cached keys in one batch and plugin-hosted paths
once per hint. Cursors bound to image_size are bound to the widths too, and
only when widths are present, so existing cursors stay valid.

The images capability lists the parameters as slot_width_params. /api/v1 is
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Recommendation cards ignored image_size and always returned the featured
defaults, presigning each image separately, so a 25-card For You row cost 75
lookups. TV clients had no way to ask for a hero-sized backdrop or a
card-sized poster on For You, discover or Watch Tonight.

Every v2 recommendation read now takes image_size and the per-slot widths.
Cards resolve through the batch resolver home sections use, so a title's
artwork is the same file on both surfaces and a page costs one lookup for
cached artwork. The taste seed grid batches its posters the same way. Watch
Tonight cards on v2 now carry each cast member's photo_url on the profile
ladder (500px when unsized, like item detail).

Without sizes, cards keep the artwork keys and plugin hint they had, so the
frozen /api/v1 routes return the same artwork.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. label Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c29b8008-ff0e-40d5-b503-d5cadf42849e
📥 Commits

Reviewing files that changed from the base of the PR and between 2fe4518 and 3bb206a.

📒 Files selected for processing: 14
  • contracts/api/v2/openapi.json
  • docs/images-api.md
  • internal/api/handlers/artwork_widths_test.go
  • internal/api/handlers/episode_image_provenance_test.go
  • internal/api/handlers/recommendations.go
  • internal/api/handlers/recommendations_service.go
  • internal/api/handlers/sections.go
  • internal/api/handlers/taste_seed.go
  • internal/api/handlers/watch_tonight.go
  • internal/api/handlers/watch_tonight_cards.go
  • internal/api/handlers/watch_tonight_cards_access_test.go
  • internal/apiv2/recommendations.go
  • internal/apiv2/recommendations_test.go
  • 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; 2 remain after this review.

📝 Walkthrough

Recommendation reads now accept artwork size and surface-width parameters. The API passes these selections to recommendation services, and handlers resolve artwork for recommendation results and Watch Tonight cards, including cast photos.

Changes: Recommendation artwork sizing

Layer / File(s) Summary
Artwork query contract and propagation
contracts/api/v2/openapi.json, web/src/api/v2/schema.ts, internal/apiv2/recommendations.go, internal/apiv2/recommendations_test.go, docs/images-api.md
The API contracts add image_size and surface-specific width parameters to recommendation reads. The API inputs pass artwork selections with viewer access filters. Tests check parameter propagation and validation. The documentation lists supported recommendation surfaces and notes that frozen /api/v1 recommendation routes ignore image_size.
Recommendation artwork resolution
internal/api/handlers/recommendations.go, internal/api/handlers/recommendations_service.go, internal/api/handlers/taste_seed.go, internal/api/handlers/sections.go, internal/api/handlers/artwork_widths_test.go, internal/api/handlers/episode_image_provenance_test.go
Recommendation artwork is resolved in batches and passed into section-item construction. Taste-seed poster paths are sized and batch-resolved. Tests cover requested widths and unsized artwork.
Watch Tonight cards and cast photos
internal/api/handlers/watch_tonight.go, internal/api/handlers/watch_tonight_cards.go, internal/api/handlers/artwork_widths_test.go, internal/api/handlers/watch_tonight_cards_access_test.go, docs/images-api.md
Watch Tonight resolves artwork for returned cards and resolves local cast photos using the profile image-size setting. Remote cast-photo URLs pass through. Tests cover card paging and cast-photo resolution.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant RecommendationsAPI
  participant recommendationFilter
  participant RecommendationService
  participant featuredCardArtwork
  participant Presigner as PresignURLsWithExpiry
  Client->>RecommendationsAPI: Send artwork sizing query parameters
  RecommendationsAPI->>recommendationFilter: Build viewer and artwork filter
  recommendationFilter-->>RecommendationService: Provide combined access filter
  RecommendationService-->>featuredCardArtwork: Provide enriched recommendation items
  featuredCardArtwork->>Presigner: Batch-presign artwork paths
  Presigner-->>featuredCardArtwork: Return resolved image URLs
Loading

Suggested reviewers: dannyshafer

Merge Risk: ⚪ Minimal · up to 3bb20

Recommendation reads gain artwork sizing and batched artwork resolution, and unsized cards keep their existing artwork. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 11 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: recommendation artwork now uses sizing behavior consistent with home sections.
Description check Passed The description directly explains the recommendation artwork sizing, batch resolution, query parameters, Watch Tonight cast photos, validation, and compatibility behavior.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 11 files. (3 skipped: 2 unsupported, 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@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 stacked Base is another open PR; merge in stack order named in the body labels Oct 17, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 17, 2026

Copy link
Copy Markdown

Evidence is incomplete for the visible API changes not represented by Recently Added. internal/apiv2/recommendations.go adds artwork sizing to Discover, because-watched, popular, recommendation-section, similar, and similar-users reads; internal/api/handlers/taste_seed.go resolves seed-grid posters on a separate path. Add before-and-after API excerpts for these omitted surfaces, using the same request and showing the changed artwork fields, to the linked evidence page.

Suggested fix: No diff; add the missing response captures to the linked evidence page.

Posted via Macroscope — Visible change evidence

Quick104 and others added 3 commits October 16, 2026 22:03
…twork

The database fence that reopens a finished ladder backfill still checked for
the v2 rungs: every poster or still published under ladder v3 lacks w780, so
each newly cached image would have reset a completed backfill, and backdrops
were not fenced at all. A new migration replaces it with one trigger function
that takes the fenced ladder version and checks the v3 rungs on posters,
stills, logos, backdrops and extra backdrops; its Down restores the v2 fence.

A revision cached under an earlier ladder now serves its own widest rung that
fits a request (a w780 poster for a w1000 request during the backfill), not
only the current ladder's.

Favorites, the watchlist and history resolved each card image on its own,
which now costs a manifest lookup per image for rungs wider than medium. They
resolve in one batch per hint instead.

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

macroscopeapp Bot commented Oct 17, 2026

Copy link
Copy Markdown

Evidence does not show the newly populated Watch Tonight Cards cast-photo field. internal/api/handlers/watch_tonight_cards.go changes Cast[].photo_url from empty to resolved headshots; add before-and-after API excerpts for the same Watch Tonight Cards request showing this field.

Suggested fix: No diff; add the response excerpts to the linked evidence page.

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

Posted via Macroscope — Visible change evidence

@Quick104

Copy link
Copy Markdown
Contributor Author

On the evidence notes from the Visible change evidence check:

  • Other recommendation reads (discover, because-watched, popular, sections, similar, similar users, taste seed): all of them take the same ArtworkQuery as recently added, so on main every one rejects image_size and the width parameters with 422 validation_failed, as the recently added capture shows. Without sizes, cards keep the files and plugin hint they had (TestRecommendationCardsUnsizedKeepTheirArtwork), so there is no unsized before/after difference to show. The taste seed's poster batch is covered by the handler tests.
  • Watch Tonight cards cast[].photo_url: on main the field is always empty, so there is no earlier value to compare. The evidence library has no watch history, so Watch Tonight returns no cards there. TestWatchTonightCastPhotosResolveOnProfileLadder covers cached, plugin-hosted, http(s) and missing headshots.

Base automatically changed from feat/artwork-slot-widths to main October 17, 2026 03:04
@silo-triage silo-triage Bot added size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. and removed size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. labels Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	docs/images-api.md
#	internal/api/handlers/artwork_widths_test.go
#	internal/api/handlers/sections.go
@silo-triage silo-triage Bot added size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. and removed size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. labels Oct 17, 2026
@silo-kody

silo-kody Bot commented Oct 17, 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 ❌

…d cards

swipeCards resolved artwork for the whole hydration window, up to limit + 10 items, before picking the cards it returns. It now batches only the cards on the page; the rest of the window still decides whether more remain.

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

silo-kody Bot commented Oct 17, 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 ❌
⚠️ 1 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

@Quick104
Quick104 merged commit 19e0528 into main Oct 17, 2026
22 checks passed
@Quick104
Quick104 deleted the feat/recommendation-artwork-sizes branch October 17, 2026 03:30
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/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant