Repository navigation
feat(apiv2): let clients size each artwork slot by drawn width - #2627
Merged
Merged
Conversation
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]>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
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. Comment |
3 tasks done
This was referenced Oct 17, 2026
…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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> # Conflicts: # contracts/api/v2/fixtures/get_image_capabilities_ok.json # internal/api/handlers/favorites.go # internal/api/handlers/sections.go # internal/catalog/detail.go
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:
|
Quick104
added a commit
to Silo-Server/silo-android
that referenced
this pull request
Oct 17, 2026
Silo-Server/silo-server#2627 merged, so the vendored bodies now come from main at 2fe4518e9 instead of an uncommitted server checkout. The bodies are unchanged; SOURCE now names that commit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104
added a commit
to Silo-Server/silo-android
that referenced
this pull request
Oct 17, 2026
* test(fixtures): vendor the image capability fixture The capability response now advertises per-slot artwork widths (slot_width_params), and the client decodes it, so the contract test needs the server's body. Add get_image_capabilities_ok to the vendored subset and re-vendor from the server checkout that carries it. The bodies come from an unmerged silo-server change (branch feat/episode-image-original-quality); SOURCE records snapshot=uncommitted. Re-vendor from the merged server commit before relying on them. The other fixture diffs are drift between the previously vendored commit and that checkout. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(artwork): request artwork at the size each screen draws it Artwork came back at the server's default sizes however large a screen drew it. On Android TV that left detail logos (drawn up to 650px from a 500px image) and episode stills soft, and the hero preload assumed 2x density. On phones the detail hero, episode cards and grid posters were upscaled. Servers that list slot_width_params in /api/v2/images/capabilities take poster_width, backdrop_width, logo_width, still_width and photo_width on every v2 read that returns artwork. Each app now describes how wide it draws each surface (dp x the device's density), and the repositories send those widths when the active server advertises them: - Android TV: Home, For You and library shelves send poster 88dp, backdrop 672dp (fills the 614x378dp hero) and logo 440dp; detail sends the same backdrop with logo 325dp and photo 100dp, so opening an item reuses the hero image Home loaded. Episodes send still 180dp on the series page and 230dp elsewhere, the similar rail poster 130dp, catalog grids poster 138dp. The hero and startup preloads use density-derived sizes instead of 1229x756px. - Phone and tablet: the detail hero, episodes and catalog grids send widths from their layouts, taking the larger of both orientations so rotating keeps a listing's widths. Rails (Home, For You, similar) ask for their cards at the largest card size, since that preference loads after launch. Opening a Home card warms its backdrop at full-screen size only on servers without widths, where detail uses the same URL. Requests wait up to 2s for the capability probe and otherwise go out as today, as they do on older servers, which reject width parameters. Widths are bound to the server that advertised them, so a read issued during a server switch can't carry them to the next server, and a probe that fails on the network is retried with backoff. Catalog cursors keep the widths of their first page, and the Room caches key detail, episodes, library pages and Home by the widths the device draws them at. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(artwork): size cards by the card-size preference and keep cache keys stable Review follow-ups on the per-slot artwork widths: - Cards and grid cells grow with the card-size preference: TV cards, episode stills and grids scale with cardScaled(), and phone grids drop columns for larger posters. Requests sized them at the standard card size, so Large posters got an image a size too small (a phone grid cell of 551px got a 500px poster). Each app now reads the active preference when it builds a request. Cache keys stay at the standard size, so they don't change when the preference loads after launch. - Cache writes rebuilt their key from the live layout, so a fold while a read was in flight filed one layout's artwork under the other's key. Detail, episodes, library pages, library sections and Home now capture the key before the read and cache the answer under it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(fixtures): re-vendor the API fixtures from server main Silo-Server/silo-server#2627 merged, so the vendored bodies now come from main at 2fe4518e9 instead of an uncommitted server checkout. The bodies are unchanged; SOURCE now names that commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(artwork): keep pre-update caches and skip caching unsized reads - Rows cached before artwork widths existed are keyed without them, so after an update offline Home, detail, episodes, library pages and library sections found nothing. A read now falls back to the old row until that item is cached again, which removes it. - A read that went without widths only because the capability check hadn't answered was still cached under the layout's key, and prefetch then reused it after the check succeeded. Such reads are no longer cached; reads to a server that doesn't take widths still are. The cache key is captured with the widths, after the check. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(artwork): load the saved card size before the first reads The startup Home warm-up ran before the card-size preference loaded, so a user with Large cards got Home sized for Standard (a 420px request for a 504px card at 3.5x). Cache keys also used the standard size while requests used the active one, so after a card-size change cached Home, library and episode reads reused smaller images. The layouts now seed the preference from its local cache, without the network, the first time a read needs it, and cache keys use the active card size again. A card-size change starts a new cache entry. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(artwork): decide cacheability with the request and retire only the writer's legacy row A read that went without widths because the capability check timed out could still be cached if the check answered before the response: the write consulted live probe state. ArtworkSizing.sizedRead now returns the widths and whether the answer may be cached together, before the read goes out, and replaces mayCache. Retiring a pre-update cache row re-read the active identity after the write, so a profile switch during Room's upsert could delete the next profile's row. put() now returns the owner it wrote for, and only that owner's legacy row is deleted. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: Silo-Server/silo-apple#819, Silo-Server/silo-android#609, #2611
Validation tasks: none
A v2 response takes one
image_size, but a TV screen draws one item's artwork at very different sizes. A home row shows each item's poster as a card and the focused item's backdrop full-screen behind it, and a detail page pairs a full-screen hero with small cast photos. With one size, a TV client either downloads large posters for every card or shows a soft hero. This adds per-slot target widths to the v2 API: a client says how wide it draws each field and gets the narrowest cached image that covers it.Stacked on #2626, which adds the sizes these widths resolve to.
Approach
image_sizealso takesposter_width,backdrop_width,logo_width,still_widthandphoto_width, in device pixels from 1 to 7680. That covers catalog items, browse and query, item and watch detail, seasons and episodes, home and library sections, favorites, the watchlist, history, shuffles, the not-interested list and notification series.backdrop_widthgovernsbackdrop_urlandbackdrop_urls, including an episode's backdrop that holds its still, which then resolves on the still ladder.image_sizefor that slot; other slots keepimage_size, or the per-context default when it is absent. The server returns the narrowest size of the image's own ladder at least that wide, including sizesimage_sizecannot name, else the original. Plugin-hosted artwork gets the nearest semantic hint for its slot; listings resolve cached keys in one batch and plugin-hosted paths once per hint, so a card poster and a hero backdrop from the same plugin are asked for at different sizes. A headshot keeps thelargehint cast lists already use unless its width needs the original, because plugins' smaller headshots (TMDB's are 185px) are softer than a cast card.image_size.image_size(catalog browse and query, audiobook groups, history) are bound to the widths too. The widths are appended only when present, so cursors issued before this change stay valid. Lists whose cursors never boundimage_size, such as favorites and the watchlist, do not bind the widths either.GET /api/v2/images/capabilitiesgainsslot_width_params. A server without this change rejects the parameters with422 validation_failed, so clients must check the capability first./api/v1does not take the parameters, and the widths stay out of every key derived from the access filter's encoding.Validation
image_size, plugin hints, cursor binding, the 1–7680 bounds, extended art ignoringbackdrop_width, and the v2 home seam: pass.make verify-apiv2-contractreports only additions (new optional query parameters).make test-webpass with the regeneratedschema.ts.mainbuild answers each of them with422.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/artwork-slot-widths/
API responses for the TV requests on home, item detail and episodes, from a
mainbuild and this stack.Risks
422;slot_width_paramsis the feature check.Checklist
AI Disclosure
/api/v1or unsized v2 changes, cursor binding, manifest fallbacks, the backfill query, Jellyfin sizing and plugin hints. It found JellyfinPrimaryand 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 boundimage_sizeeither. Separately, captures from the sandboxes showed that headshot widths sent plugins a hint that returns 185px images, so headshots keep thelargehint unless they need the original.🤖 Generated with Claude Code
Note
Add per-slot artwork width query params to API v2 artwork sizing
poster_widthandbackdrop_width, on top of the existingimage_size. The sharedArtworkQuerymodel in artwork_query.go replaces standaloneimage_sizefields across all apiv2 inputs, and widths are retained in pagination cursors for listings.ArtworkBatch/ArtworkURLstypes in artwork_batch.go, deduplicating cached paths and resolving plugin-hosted paths per variant hint.slot_width_paramscapability.Macroscope summarized 9d5bfe8.