Skip to content

feat(downloads): include the series poster in episode download manifests - #1746

Merged
Quick104 merged 4 commits into
Silo-Server:mainfrom
Rhainland:fix/offline-series-artwork
Oct 5, 2026
Merged

Quick104 merged 4 commits into
Silo-Server:mainfrom
Rhainland:fix/offline-series-artwork

Conversation

@Rhainland

@Rhainland Rhainland commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

Offline clients have no series poster for a downloaded show. An episode download's poster is the episode still, so the iOS Downloads screen shows a cropped still or a blurred placeholder where the series poster belongs. This change adds the parent series poster to v2 episode download manifests so clients can save it with each episode.

Approach

v2 episode manifests gain series_poster_thumbhash and artwork_urls.series_poster. GET /api/v2/downloads/{id}/artwork/series_poster serves the image after checking that the profile can see both the episode and its series; a series the profile can no longer see answers 404, like other offline assets. Movies and series without a poster get neither field.

The frozen v1 manifest does not change, and the v1 artwork route answers the new kind with 404. The iOS change that uses these fields is Silo-Server/silo-apple#564. Android already saves them (Silo-Server/silo-android#432).

Validation

  • Go tests for internal/downloads, internal/apiv2, and internal/api/handlers: pass, except TestAdminResourceCapabilitiesAndScope in internal/apiv2, which fails the same way on main.
  • make lint-changed: no issues. OpenAPI, web types, contract fixtures, and the local-path check are current.
  • End to end with the iOS branch on an iPhone simulator, against a local server storing artwork in S3: a season download fetched the series poster for each episode, and the offline series screen showed it.

Risks

  • Each episode download makes one more artwork request, and each one loads the series detail to check access.
  • Servers that keep artwork in local storage cannot serve any download artwork today, this kind included. That is an existing problem and is not changed here.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code
  • Tool(s): Claude Code; OpenAI Codex CLI (review only)
  • Model(s): claude-opus-5-5; gpt-6-astra and gpt-6.1-sol (review only)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: Claude Code (claude-opus-5-5) reviewed this diff together with the iOS change and found that the shared artwork handler also served the new kind on the frozen v1 route; fixed. Separate Codex reviews of both diffs with gpt-6-astra and gpt-6.1-sol reported no findings.

Note

Add parent series poster to episode download manifests

  • Episode download manifests now include an optional series_poster_thumbhash and an authenticated series_poster artwork URL in the v2 API
  • downloads.Service.artworkImageURL resolves series_poster only for episode entries with an accessible parent series; other kinds and non-episodes return ErrAssetNotFound
  • The frozen v1 artwork route rejects series_poster with 404, and the new OfflineManifest fields carry JSON omission tags so direct v1 serialization omits them
  • Updates the generated v2 OpenAPI contract, TypeScript schema, and downloads-api.md
  • Risk: v1 consumers calling the artwork route with series_poster now get 404 from downloads.go; the v2 manifest projection rejects series_poster URLs that are not internal download asset paths

Macroscope summarized c2f3981.

An episode's poster is its still, so offline clients had no series poster
for series-level screens and showed a cropped still or a blurred
placeholder instead.

v2 episode manifests now carry series_poster_thumbhash and
artwork_urls.series_poster, and the artwork proxy serves the new
series_poster kind after checking access to the parent series. The frozen
v1 manifest is unchanged.
… route

The v1 and v2 artwork routes share ServeArtwork, so the new v2-only
series_poster kind was also served on /api/v1. The v1 handler now answers
it with 404, as it does any unknown kind.
@kody-ai

kody-ai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Code Review Could Not Complete ⚠️

The review failed before suggestions could be generated.

Reason: Unexpected error while running the code review (openai_compatible).

openai_compatible · gpt-6.1-sol · generalist

After fixing the issue, comment @kody review on this PR to re-run the review.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

​

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a0989903-b2d9-476f-bd4d-639c6d504896
📥 Commits

Reviewing files that changed from the base of the PR and between e4aaab2 and c2f3981.

📒 Files selected for processing (10)
  • contracts/api/v2/openapi.json
  • docs/downloads-api.md
  • internal/api/handlers/downloads.go
  • internal/api/handlers/downloads_test.go
  • internal/apiv2/download_manifests.go
  • internal/apiv2/download_manifests_test.go
  • internal/downloads/manifest.go
  • internal/downloads/manifest_test.go
  • internal/downloads/offline.go
  • web/src/api/v2/schema.ts
 ______________________________________________________________
< How would you like your code review? Scrambled or over-easy? >
 --------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · 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.

@macroscopeapp

macroscopeapp Bot commented Sep 30, 2026

Copy link
Copy Markdown

The Validation tasks: line should not list changes #1168 C1: that case is marked Not run, and its server checks cover media-download permissions and bandwidth/storage limits, which this diff does not change. The related iOS #319 and Android #329 case results are also all Not run; their cases do not check artwork. Please replace the line with:

Suggested fix: Validation tasks: none

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

Posted via Macroscope — v1 validation impact

@Rhainland

Copy link
Copy Markdown
Contributor Author

Updated the line to Validation tasks: none here and on Silo-Server/silo-apple#564: no Downloads / offline case has a recorded result yet.

@Rhainland

Copy link
Copy Markdown
Contributor Author

@kody start-review

@kody-ai

kody-ai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

@Quick104 Quick104 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.

Code review of 93cc6f0: no blocking issues. The v2 additions are additive, the v1 manifest JSON is unchanged, and access to the series is checked before its poster is served. Inline comments, in order of severity:

  • Medium: a transient series lookup error silently drops the series poster from the manifest.
  • Low: the v1 series_poster guard runs before authorization, its comment doesn't match the code, and a denylist won't catch the next v2-only kind.
  • Low (performance): two full detail builds per series_poster request, and per-download URLs mean N fetches of one image per season.
  • Low (docs): §10 of docs/downloads-api.md doesn't mention the series poster.
  • Cleanup: the per-field ArtworkURLs copy, the duplicated series rule, and a duplicated test fake.

PR body: "Android does not read them yet" is out of date. Silo-Server/silo-android#432 merged on 2026-10-02 and already saves artwork_urls.series_poster and series_poster_thumbhash (OfflineTrackAssetFetcher.kt), so Android already consumes this contract.

Validation: no passed case on the v1.0 board reaches this diff. Validation tasks: none matches.

AI disclosure: written by claude-opus-5-5 in Claude Code via T3 Code (/silo code-review).

if detail.LogoURL != "" {
m.ArtworkURLs.Logo = artworkProxyURL(dl.ID, "logo")
}
if seriesDetail != nil {

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.

Medium. Needs your call. A transient series lookup error silently removes the series poster from the manifest.

The series lookup at line 211 treats every error as "no series": else if sd, err := b.detail.GetItemDetail(ctx, detail.SeriesID, filter); err == nil. That swallow is older than this PR. Before, it only cost stable_identity its series provider IDs. Now this block also hangs visible artwork on it.

  • Trigger: the series lookup fails with a DB timeout or pool exhaustion, and the episode lookup succeeds.
  • Impact: the manifest returns 200 without series_poster_thumbhash or artwork_urls.series_poster, and nothing is logged. Clients refetch a manifest only when the row revision goes up, and the iOS client fetches it once per download, so the downloaded series header stays without a poster. In a batch, only successful lookups are cached, so episodes of one season can disagree.
  • Repair: treat only catalog.ErrItemNotFound as "no series" and return any other error. An episode lookup error already fails the build, and the batch endpoint reports it as a skipped entry the client can retry. Whether a series error should fail the whole manifest is your decision, because it also changes the stable_identity path.

Comment on lines +793 to +797
if kind == "series_poster" {
// A v2-only kind; the frozen v1 route answers it like any unknown kind.
h.writeAssetError(w, "artwork", id, downloads.ErrAssetNotFound)
return
}

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.

Low. Needs your call. This guard keeps series_poster off the frozen v1 route, but it has two side effects.

  1. v1 status for this kind changed, and the comment is wrong. The check runs before ServeArtwork calls authorizeManagedAsset. On a revoked download, /api/v1/downloads/{id}/artwork/series_poster now returns 404, while /artwork/foo still returns 409 download_inactive. Both returned 409 before this PR. A disabled feature shows the same split (403 vs 404), and so do unconfigured offline assets (503 vs 404). No v1 manifest advertises this kind, so real clients are unlikely to notice. Still, "answers it like any unknown kind" is not what the code does.
  2. A denylist won't catch the next kind. The list of servable kinds lives in the shared artworkImageURL switch, which v1 and v2 both call. The v2 OpenAPI kind parameter is a plain string with no enum, and the test checks only this one literal. If someone adds a v2-only kind such as season_poster to the switch, v1 serves it with a 200 and nothing fails.

Repair: an allowlist of the original v1 kinds closes (2). Like this guard, it answers early, so unknown kinds on an inactive download would also get 404 instead of 409. If you'd rather keep v1's check order exactly, filter the kind inside the service after authorization instead.

Suggested change
if kind == "series_poster" {
// A v2-only kind; the frozen v1 route answers it like any unknown kind.
h.writeAssetError(w, "artwork", id, downloads.ErrAssetNotFound)
return
}
switch kind {
case "poster", "backdrop", "logo":
default:
// The frozen v1 route serves only its original kinds; anything else,
// including v2-only kinds, answers 404.
h.writeAssetError(w, "artwork", id, downloads.ErrAssetNotFound)
return
}

Comment thread internal/downloads/offline.go Outdated
if dl.EpisodeID == "" || detail.SeriesID == "" {
return "", ErrAssetNotFound
}
series, err := s.artworkSource.GetItemDetail(ctx, detail.SeriesID, filter)

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.

Low (performance). Needs your call. Each series_poster request builds two full catalog details in a row, and it reads only series.PosterURL from them.

  • Trigger: any series_poster fetch.
  • Impact: line 141 builds the whole episode detail. That build already loads, localizes, and fetches credits for the series row, then adds files, playback defaults, and presigns. Line 157 then builds the whole series detail: credits, videos, rating sources, extras, files, and presigns. Reading the code, I estimate 10 to 20 queries per build. I didn't measure it. A season of N episodes repeats this N times (see the next comment).
  • Repair: check access with EnsureAccessible(ctx, dl.ContentID, filter), which ServeSubtitle already uses for episode assets, then read the series poster with a narrow lookup. Skipping the episode build drops two checks: that the episode row still exists, and the presentation-library membership check on the episode ID. Decide whether those matter for a series poster.

Comment thread internal/downloads/manifest.go Outdated
if seriesDetail != nil {
m.SeriesPosterThumbhash = seriesDetail.PosterThumbhash
if seriesDetail.PosterURL != "" {
m.SeriesPosterURL = artworkProxyURL(dl.ID, "series_poster")

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.

Low (performance). Needs your call. Because the URL is per download, a season of N episodes gets N different URLs for one image.

  • Trigger: a season download or a series monitor sync. The iOS change fetches series_poster once per download record.
  • Impact: for 20 episodes, the server does 20 image-store fetches of the same poster plus 40 detail builds (previous comment). The artwork route has no ETag or 304 path and no server-side singleflight or cache, and distinct URLs mean the client HTTP cache never hits across episodes. The PR's Risks section mentions the extra request per episode, but not the repeated upstream fetch.
  • Repair (contract choice): use a URL that is the same for every episode of a series, so clients and caches dedupe it. Or tell clients in docs/downloads-api.md to dedupe by series_id, or coalesce concurrent fetches on the server. The first changes the v2 contract shape, so it's better decided before v2 locks.

Comment thread internal/apiv2/download_manifests.go Outdated
GeneratedAt: NewInstant(generated),
ArtworkURLs: row.ArtworkURLs,
}
out.ArtworkURLs.Poster = row.ArtworkURLs.Poster

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.

Cleanup. Copying field by field drops a compile-time check.

ArtworkURLs: row.ArtworkURLs compiled only while the domain struct and the v2 struct had the same fields, so the two couldn't drift apart. With per-field copies, a new field on downloads.OfflineManifest.ArtworkURLs reaches v1, which marshals that struct directly. It also compiles cleanly and is missing from v2 without any error, and the rewrite-guard list at line 184 has to be updated by hand.

Repair: move SeriesPoster into the domain ArtworkURLs struct tagged json:"-" (v1 output stays the same), and convert instead of assign. Plain assignment won't compile because the struct tags differ. A struct conversion ignores tags, so it does compile. I checked both in a scratch program. The pointer list at line 184 remains a manual step either way.

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.

Done in 87c93ad: SeriesPoster moved into the domain ArtworkURLs struct tagged json:"-", and v2 converts it through a type alias of its anonymous struct, so the OpenAPI schema stays inline and unchanged. The rewrite-guard list is still manual.

Comment thread internal/downloads/offline.go Outdated
case "logo":
imageURL = detail.LogoURL
case "series_poster":
if dl.EpisodeID == "" || detail.SeriesID == "" {

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.

Cleanup. This repeats the series rule from ManifestBuilder.build (manifest.go:205, dl.EpisodeID != "" && detail.SeriesID != ""), and the two handle errors differently.

They agree today. If a later change edits only one, for example adding caching, season-level entries, or a different guard, the manifest will advertise a series_poster URL that this route rejects, or the reverse. A small shared helper that returns the entry's series ID would keep them in step. The dl.EpisodeID check is needed: series extras and manga chapters also carry a non-empty SeriesID.

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.

Done in 87c93ad: episodeSeriesID holds the rule (an EpisodeID is required, then the detail's SeriesID), and both the manifest builder and artworkImageURL use it.

Comment thread docs/downloads-api.md
- Artwork and subtitle URLs are authenticated proxy paths on this server. Fetch
them once while online and cache the bytes locally.
- Thumbhash fields are inline placeholders for fast offline UI rendering.
- For an episode, `poster` and `poster_thumbhash` are the episode still and

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.

Low (docs). This bullet covers the new fields, but two places in §10 still describe the old set:

  • §10.1, the OfflineAsset row lists asset kinds as media, poster, backdrop, logo, subtitle. It is missing series_poster, and it now disagrees with the kind lists this PR updated in the artwork route section.
  • §10.8, "poster_thumbhash and backdrop_thumbhash are placeholders while local artwork bytes load." It should also mention series_poster_thumbhash for series-level screens.

A client author who follows §10 would use poster for the series header, but for an episode that's the episode still.

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.

Fixed in 87c93ad: §10.1 lists series_poster as an asset kind, and §10.8 says an episode's poster is its still and series-level screens use series_poster and series_poster_thumbhash.

Comment thread internal/downloads/manifest_test.go Outdated

// itemDetailsByID serves one catalog detail per content id; an unknown id is
// denied like an out-of-scope item.
type itemDetailsByID map[string]*catalog.ItemDetail

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.

Cleanup. mapManifestSource in offline_batch_test.go already does this: a map of *catalog.ItemDetail returning catalog.ErrItemNotFound for unknown IDs, plus a per-ID call counter. Reusing it removes a third GetItemDetail fake. Its calls["show"] counter would also let these tests assert the extra series lookup described in the PR body.

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.

Done in 87c93ad: the tests use mapManifestSource, and the manifest test checks calls["show"] is 1 after the episode build.

… URLs

The manifest and the artwork route now use one helper to find an episode
entry's parent series. The series poster URL moves into the domain
ArtworkURLs struct (hidden from the v1 JSON), and the v2 manifest converts
that struct instead of copying fields, so a new domain field fails to compile
until v2 has it. The manifest tests reuse mapManifestSource and check that the
series is looked up once.

The downloads API guide's offline client notes now list series_poster as an
asset kind and say which poster series-level screens use, and the v1 guard's
comment says it answers 404 before checking the download.
@silo-kody

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

@Rhainland

Copy link
Copy Markdown
Contributor Author

From the review summary: the PR body no longer says Android does not read these fields; it now points to Silo-Server/silo-android#432, which already saves them.

# Conflicts:
#	contracts/api/v2/fixtures/get_system_info_ok.json
#	internal/downloads/manifest_test.go
@Quick104
Quick104 merged commit 19e358d into Silo-Server:main Oct 5, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants