Skip to content

feat(artwork): upload posters, backdrops and logos as local artwork - #3088

Merged
Quick104 merged 14 commits into
Silo-Server:mainfrom
blurbery:feat/edit-metadata-image-upload
Oct 27, 2026
Merged

Quick104 merged 14 commits into
Silo-Server:mainfrom
blurbery:feat/edit-metadata-image-upload

Conversation

@blurbery

@blurbery blurbery commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1209
Validation tasks: none. No passed case is affected. #1210 C1–C2, #1211 C1–C2 and #1251 C2 cover this picker and its images lock but haven't been run yet; the validator can include an upload when they are.

Edit Metadata > Images only offers what the metadata providers and the sidecar files beside the media supply. When none of them has the poster, backdrop or logo you want, there's no way to use your own image short of writing a file into the media folder, and most installs mount media read-only. This adds an Upload button to the Images tab. The uploaded image becomes the item's image straight away and is listed under LOCAL as the current choice.

Approach

  • New v2 operation POST /api/v2/admin/items/{id}/images/upload: acting admin, demo-restricted, non-retryable like apply. It takes a multipart form with type (poster, backdrop or logo) and image (JPEG, PNG or WebP, at most 10 MiB). The bytes decide the format, not the part's declared type. Movies and series take all three types and seasons take a poster. There's no v1 route.
  • Silo doesn't write into library folders, so the upload lives in artwork storage only. The image cacher stores it under the item's local/... keys with a digest discriminator, the same layout as a cached sidecar, and PublishArtworkSelection publishes it with the images lock like any applied image. Its source is upload://sha256:<hex>, a scheme that image caching, artwork reconcile and the ladder backfill already treat as not downloadable.
  • The v2 image list offers the upload as a local choice while the item shows it, and apply takes that upload:// source back only when it matches what the item shows. Applying another image displaces the upload, and revision GC collects it after the grace period. So there's no new table, and nothing extra for content ID moves or GC reference checks to track. Keeping every upload as a pickable choice would need that table; I left it out.
  • A storage reconcile that resets cached artwork in bulk used to clear every row whose source isn't a provider URL, without checking its object. That is safe for a sidecar, which the next refresh copies again, but it would lose an upload whose object survived. Bulk mode now verifies each upload:// row and clears it only when the object is gone, as it already does for collection uploads.
  • Apply and upload both publish through the shared publishItemImage, which includes the home-rail eviction fix(metadata): keep manual metadata edits through refresh and show them in home rails #2254 added, so an upload refreshes cached home rows as an applied image does.
  • Web: an Upload button on each image tab, with the same type and size checks before sending. The listed upload is marked current. Upload and apply errors now show the problem's field detail, such as "The file is not a JPEG, PNG or WebP image", rather than the generic "did not pass validation" summary.
  • Huma validates multipart text fields at form.<name>, which the problem location grammar rejects. validationLocation now reports them under body.<name>, as it already did for file parts. That applies to any multipart text field Huma validates, not only this one.
  • Apple and Android don't call the admin image endpoints, so they need no change, and jellycompat has no image upload route to match.
  • Docs: docs/admin-catalog-api.md and the admin image picker section of docs/architecture/local-nfo-metadata.md. The user manual update is docs: cover uploading your own artwork in Edit Metadata siloserver.org#303.

Validation

  • Go: the new tests for the upload, listing and re-apply paths pass in internal/metadata, internal/api/handlers and internal/apiv2, and so do the whole internal/apiv2, internal/contractspec and internal/contractledger packages, the contract fixtures and the scenario catalogue gate.
  • TestArtworkReconcileBulkResetVerifiesUploadsDB (in scripts/ci/db-contracts.txt) checks that a bulk reset keeps a surviving upload and clears a lost one. It fails without the reconcile change.
  • Web: the Images tab, Edit Metadata dialog and src/api/v2 tests pass, as do tsc and ESLint and Prettier on the changed files.
  • OpenAPI and web types are regenerated. verify-size-ratchet, verify-local-paths, verify-case-collisions and verify-v1-route-freeze (against upstream main) pass. verify-bidi doesn't run with macOS git, so I checked the changed files for bidi characters separately.
  • By hand: I ran this branch and its base against a local Postgres with a generated test movie, uploaded a poster and a logo through the web app at desktop and phone widths, and checked the stored upload:// sources and the images lock in the database.
  • Not run locally: the full Go and web suites, make lint-changed and the DB-backed jobs. CI runs those.

Evidence

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

Surface and build: web admin, Edit Metadata > Images, at 1280 px and 390 px wide. Before: 6de6d5e5e (upstream main). After: 376020846 (later commits change tests and error messages, not this screen). Both use the same local test library and item: a generated video with a generated sidecar poster, and generated upload images.

Risks

  • An upload exists only in artwork storage. If its object is lost, a refresh can't fetch it again, the same as collection artwork; the admin uploads it again.
  • A replaced upload is gone after the GC grace period. There's no history of uploads.
  • Uploads need artwork storage. Without it the endpoint returns 503.
  • A JPEG or PNG over 4 MP whose header reads but whose pixel data is damaged returns 500 rather than 422, because the damaged-data check stops at that size. Collection uploads behave the same way.
  • The form.<name> to body.<name> change moves the error location in validation problems for multipart text fields. The internal/apiv2 tests and contract fixtures pass 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 says there is none.

AI Disclosure

  • Harness: Claude Code (Claude desktop app)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted
  • Adversarial review: an independent Claude Code subagent (claude-opus-5-5) reviewed the full diff without my notes. It covered authorisation and demo restriction, multipart limits and format checks, storage key safety, every reader of upload:// sources, lock and GC behaviour, the problem.go change, the web flow and test strength. It found that the handler tests never reached a successful publish, that upload errors showed only the generic validation summary, and that a failed re-publish queued the shown revision for cleanup. All three are fixed: the tests now check the published source, lock and season parent, the toast shows the field detail, and cleanup skips the shown revision. It also noted the damaged-large-image 500 listed under Risks, and an unbounded fallback decode in imageutil that predates this change and also applies to collection uploads; this PR doesn't change it.

AI-assisted with Claude Opus. I directed the task and designed the work.

Note

Add admin upload of poster, backdrop, and logo artwork

  • Adds POST /api/v2/admin/items/{id}/images/upload, which accepts JPEG, PNG, or WebP files up to 10 MiB, caches them under local artwork keys with a SHA-256 digest source, and publishes them to the target. Movies and series support poster, backdrop, and logo; seasons support posters only. See admin_catalog_images.go and uploaded_artwork.go.
  • The web metadata editor gains an upload control per image tab with client-side validation, toast feedback, and query invalidation. Currently shown uploads appear as local image choices with upload:// sources. See ImageSelectorTab.tsx and items.ts.
  • Reapplying an upload:// source republishes the currently shown image; other upload sources are rejected. Bulk artwork resets now skip uploaded-source rows in the bulk clear and sweep them per-row instead, preserving uploads that still exist in storage. See artwork_reconcile.go.
  • Publication failures queue revision cleanup with a detached 30-second-timeout context, but skip cleanup when the target already shows the stored revision.
  • Behavioral Change: bulkResetSurface clears uploads whose stored object is missing but keeps surviving uploads; the v1 API does not accept uploads; multipart validation errors now report under body instead of form in problem.go.

Macroscope summarized efa2f73.

Edit metadata > Images now has an Upload button on each tab. A movie or
series takes a poster, backdrop or logo, and a season takes a poster.

The upload goes through POST /api/v2/admin/items/{id}/images/upload, a
multipart form with the slot and a JPEG, PNG or WebP file of at most
10 MiB. Silo never writes into library folders, which are mounted
read-only, so the image is stored in artwork storage under the item's
local/ keys and published like an applied image, with the images lock.
Its source is upload://sha256:<hex>, a scheme image caching, reconcile
and the ladder backfill already treat as not downloadable.

The image list offers the upload as a local choice, marked current,
while the item shows it. Applying another image replaces it, and revision
GC collects it like any displaced revision, so no new table is needed.

Huma validates multipart text fields at form.<name>; problems now report
them under body.<name>, as they already did for file parts.
@silo-triage silo-triage Bot added the size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. label Oct 26, 2026
@silo-kody

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

@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026

Copy link
Copy Markdown

Visible change; evidence is incomplete. The Evidence section names the surface and builds, but “the link follows shortly” provides no evidence URL or attached captures.

  • web/src/components/ImageSelectorTab.tsx: The Images tab gains upload controls and an uploading state. Add before-and-after captures of the same screen at desktop and mobile widths.
  • internal/api/handlers/admin_images.go and web/src/components/ImageSelectorTab.tsx: Uploaded artwork becomes the item's current image and appears as a LOCAL choice. Show before-and-after captures of the same test item at desktop and mobile, including the resulting artwork and current LOCAL choice.

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

Posted via Macroscope — Visible change evidence

@silo-triage silo-triage Bot added enhancement New feature or request go Pull requests that update go code javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish labels Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

Adds a v2 admin endpoint for uploading supported artwork to movies, series, and season posters. Uploaded images are cached and published as local artwork, exposed as choices while displayed, and preserved during reconciliation when their stored objects exist. The web metadata editor adds upload controls and refreshes related image queries.

Changes: Admin artwork upload

Layer / File(s) Summary
Store uploaded artwork
internal/metadata/uploaded_artwork.go, internal/metadata/uploaded_artwork_test.go, docs/architecture/local-nfo-metadata.md
The metadata service validates image bytes, caches supported uploads under local artwork keys, and derives an upload:// source from the SHA-256 digest. The architecture documentation describes storage and lifecycle behavior.
Expose and publish admin uploads
internal/apiv2/admin_catalog_images.go, internal/api/handlers/admin_images.go, contracts/api/v2/openapi.json, docs/admin-catalog-api.md, internal/api/handlers/admin_images_upload_test.go, internal/apiv2/admin_catalog_images_test.go, internal/apiv2/problem.go, internal/api/testdata/media_routes.txt, internal/contractledger/ledger_test.go
The v2 endpoint accepts multipart uploads up to 10 MiB and passes image bytes and slot type to the handler. The handler publishes supported uploads, lists currently displayed uploads as local choices, and restricts reapplication to the upload shown for that item and type.
Preserve uploaded artwork during reconciliation
internal/metadata/artwork_reconcile.go, internal/metadata/artwork_reconcile_bulk_db_test.go, scripts/ci/db-contracts.txt
Bulk reconciliation checks uploaded objects before clearing their artwork rows. The database test verifies that rows remain when objects exist and clear when objects are missing.
Connect the web metadata editor
web/src/api/v2/adminImages.ts, web/src/api/v2/operations.ts, web/src/api/v2/schema.ts, web/src/hooks/queries/items.ts, web/src/components/ImageSelectorTab.tsx, web/src/api/v2/adminImages.test.ts, web/src/hooks/queries/items.test.ts, web/src/components/ImageSelectorTab.test.tsx
The web client submits uploads as multipart form data. The image selector validates file size and named MIME types, displays upload progress, reports errors, and marks a displayed upload as current. Successful uploads refresh related image and item queries.

Priority: Pending latest changes

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Admin as Admin editor
  participant Endpoint as v2 upload endpoint
  participant Handler as AdminImageHandler
  participant Metadata as MetadataService
  participant Cacher as ImageByteCacher
  participant Publisher as artworkPublisher
  Admin->>Endpoint: Submit item ID, image type, and file
  Endpoint->>Handler: Pass upload bytes and image type
  Handler->>Metadata: Apply uploaded image
  Metadata->>Cacher: Cache bytes under local artwork keys
  Cacher-->>Metadata: Return stored artwork details
  Metadata-->>Handler: Return stored path and upload source
  Handler->>Publisher: Publish artwork selection
  Endpoint-->>Admin: Return applied-image result
Loading

Possibly related issues

Possibly related PRs

  • Silo-Server/silo-server#2254: Adds catalog-change publication and home-rail cache eviction after artwork selection; this pull request adds upload and apply paths that publish item artwork.

Suggested labels: api-v2, impact: usability, needs-review

Suggested reviewers: quick104

Merge Risk: Low · up to aa353

The upload flow is mergeable with bounded documentation corrections: clarify season support and replaced-image listings, and qualify the invalid-image response.

Security architecture risk: Low · up to aa353

The upload retains administrator and demo restrictions, limits request size before parsing, and derives storage identity on the server. The remaining concern is a narrow recovery race that can clear the reference to a restored image. Its impact is localized artwork availability, not an established authorization bypass.

Retained concerns

  • Low · reliability · inferred: A missing-object reconciliation verdict can clear a concurrently restored upload. The update guards only the target key and previously observed stored path, while repeating identical uploads reuses that path. If restoration and publication finish after the missing-object check but before the update, the reference can still be cleared. Different-path replacement is protected. This path-only guard predates the PR, but uploaded artwork newly depends on it despite having no downloadable recovery source; recovery requires another upload.
Security review details

Security Blast Radius

  • inferred — The new mutation operates with global catalog-administration authority, not ordinary viewer authority. An authorized administrator can replace supported artwork across catalog items, and those images propagate through existing catalog views. The recovery race is localized to an individual target artwork reference per interleaving; no additional tenant, credential or infrastructure authority is established by the inspected path.

Trust Boundaries and Controls

  • observed — The shared middleware authorizes the caller before judging the multipart body. Acting-admin operations require authentication, viewer access and acting-admin authorization, and missing required gate dependencies fail closed. The multipart guard rejects excessive declared lengths and wraps the body in MaxBytesReader before parsing; the upload handler separately reads at most the image limit plus one byte. Multipart temporary files are cleaned up after handling.
  • observed — The upload's special source cannot select another item's cached image: reapplication requires the requested source to equal the resolved target's currently shown source. Upload caching consumes the submitted bytes directly rather than fetching that source as a URL.

Resilience and Maintainability Implications

  • observed — Catalog publication locks and updates the target, applies the images lock, and manages revision lifecycle transactionally. GC rechecks catalog references before deletion. These controls contain failed and competing publications, but do not eliminate the separate stale reconciliation verdict described in the concern.
  • inferred — The new route adds direct byte submission to the existing synchronous image-processing pipeline. Byte limits do not by themselves establish decoded-resource limits, but the same administrator-controlled decoder was already reachable through image application from HTTP sources in the PR base. Inspection did not establish a newly expanded privilege level or materially worsened decoder exposure.
Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: adding poster, backdrop, and logo uploads as local artwork.
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 states the PR adds an Upload button to the Images tab and a v2 upload endpoint for poster, backdrop, and logo images, with a storage approach, validation, and docs. It matches the chan…
Full details: Description check

Explanation

The description states the PR adds an Upload button to the Images tab and a v2 upload endpoint for poster, backdrop, and logo images, with a storage approach, validation, and docs. It matches the changeset in detail, so the check passes.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment thread internal/api/handlers/admin_images.go Resolved
- The Images tab toasts a validation problem's field detail, such as
  "The file is not a JPEG, PNG or WebP image", for both upload and apply,
  instead of the generic "did not pass validation" summary.
- When publishing fails, the handler no longer queues for cleanup a
  revision the target already shows (a re-applied upload, or the same
  bytes uploaded again). The collector would have kept it anyway, since it
  checks references, but it no longer has to.
- The handler takes its artwork publisher as an interface, so the upload
  and re-apply tests now check what gets published: the upload:// source,
  the images lock, and a season published with its series as parent.
@silo-kody

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

@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Please add C2 for both manual-metadata tasks, and Series admin C2, to the Validation tasks: line: the upload path publishes an upload:// source with the FieldImages lock, so the rescan/lock cases cover behavior this PR adds. The Series admin C2 also exercises this image editor. These cases are currently Not run.

Suggested line:
Validation tasks: changes #1210 C1–C2, #1211 C1–C2, and #1251 C2 (none has a recorded result yet)

I could not read validation issues in silo-apple or silo-android because repository access was denied, so I could not assess additional client-repo cases.

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

Posted via Macroscope — v1 validation impact

@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026

Copy link
Copy Markdown

Validation tasks: omits #1251 C2 (Series — Web admin). That case edits artwork and verifies persistence through rescan, and this PR adds an Upload control to the same Images selector for series. Please update the line to:

Validation tasks: changes #1210 C1, #1211 C1, and #1251 C2 (none have a recorded result yet)

#1251 C2 is Not run, so this flags an affected validation path, not a result.

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

Posted via Macroscope — v1 validation impact

The image list resolved each shown upload's stored path with its own lookup after already batch-resolving the provider choices. It now adds the stored paths to that batch.
Comment thread internal/api/handlers/admin_images.go Resolved
…uest

When publishing a chosen or uploaded image failed because the request was cancelled, the cleanup call inherited the cancelled context. It now runs on a detached context bounded to 30 seconds.
@silo-kody

silo-kody Bot commented Oct 26, 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 ❌
⚠️ 2 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
  • Detach mandatory cleanup from request cancellation and bound its lifetime

Comment thread internal/api/handlers/admin_images.go Resolved
@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026

Copy link
Copy Markdown

Regression

Major changes

  • #1210 C2 (Server) and #1211 C2 (Web admin): The upload endpoint adds a new upload://sha256:... source and images-lock/rescan path that earlier C2 runs did not exercise. The PR must explain why validated behavior changes, and both cases need re-validation after merge.

The task issues' ## Results tables still say Not run, but their comments record runs; the PR's claim that neither has a recorded result is outdated. No case is unblocked by this PR.

Use this corrected line:

Validation tasks: changes #1210 C1, C2 and #1211 C1, C2

I could not inspect validation tasks in Silo-Server/silo-apple or silo-android because API access was denied, so I have not inferred any client-task outcomes.

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

Posted via Macroscope — v1 validation impact

@coderabbitai coderabbitai Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase impact: usability Core flow broken or severely blocked needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. labels Oct 26, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2


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: a6b41f53-aa6b-46a9-a058-d772d22ec722
Commits

Reviewing files that changed from the base of the PR and between 6de6d5e and d8c4048.

Files selected for processing: 22
  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • docs/architecture/local-nfo-metadata.md
  • internal/api/handlers/admin_images.go
  • internal/api/handlers/admin_images_local_test.go
  • internal/api/handlers/admin_images_service_test.go
  • internal/api/handlers/admin_images_test.go
  • internal/api/handlers/admin_images_upload_test.go
  • internal/apiv2/admin_catalog_images.go
  • internal/apiv2/admin_catalog_images_test.go
  • internal/apiv2/problem.go
  • internal/contractledger/ledger_test.go
  • internal/metadata/uploaded_artwork.go
  • internal/metadata/uploaded_artwork_test.go
  • web/src/api/v2/adminImages.test.ts
  • web/src/api/v2/adminImages.ts
  • web/src/api/v2/operations.ts
  • web/src/api/v2/schema.ts
  • web/src/components/ImageSelectorTab.test.tsx
  • web/src/components/ImageSelectorTab.tsx
  • web/src/hooks/queries/items.test.ts
  • web/src/hooks/queries/items.ts

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

Comment thread internal/apiv2/admin_catalog_images.go Resolved
Comment thread web/src/components/ImageSelectorTab.tsx Resolved
Group the huma import with third-party packages, reword comments and test messages the spelling linter flags, and record the new upload route in the media route manifest.
@silo-kody

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

A browser that cannot name a file's type, such as a JPEG saved without an extension, sends it as application/octet-stream. The web check refused it and so did the form's part type, although the server checks the image's bytes. Both now let it through to that check. The handler also closes the uploaded part.
@silo-kody

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

The contract diff refuses approvals that match no change. Against current main, the two section-override approvals from Silo-Server#3050 match nothing, so the check fails for any branch from main until they are removed.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Enforce the image limit at multipart ingress. · admin_catalog_images.go:45-51

internal/apiv2/admin_catalog_images.go:45-51
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

Enforce the image limit at multipart ingress.

The upload operation declares only an 11 MiB total limit. An image larger than 10 MiB can therefore be parsed or spooled before the handler rejects it. Enforce a 10 MiB per-part limit in the multipart gate before Huma parses the form. Keep the handler checks as defense in depth.

A form-field declaration alone is not sufficient because Huma v2.38.0's FormFile provides file metadata after multipart parsing, not a streaming per-part limit.


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: 08e896a5-ae05-4ec2-a28d-f8e5d140b2e2
Commits

Reviewing files that changed from the base of the PR and between d8c4048 and b296922.

Files selected for processing: 12
  • contracts/api/v2/breaking-approvals.json
  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • internal/api/handlers/admin_images.go
  • internal/api/handlers/admin_images_upload_test.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_catalog_images.go
  • internal/apiv2/admin_catalog_images_test.go
  • internal/metadata/uploaded_artwork_test.go
  • web/src/api/v2/schema.ts
  • web/src/components/ImageSelectorTab.test.tsx
  • web/src/components/ImageSelectorTab.tsx
Files skipped from review as they are similar to previous changes: 3
  • internal/metadata/uploaded_artwork_test.go
  • internal/api/handlers/admin_images_upload_test.go
  • internal/api/handlers/admin_images.go

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

Comment thread contracts/api/v2/openapi.json Resolved
Finish the image part's description: an application/octet-stream part is accepted when its bytes are a JPEG, PNG or WebP image.
@silo-kody

silo-kody Bot commented Oct 26, 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 ❌
⚠️ 2 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
  • Detach mandatory cleanup from request cancellation and bound its lifetime

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Classify large damaged JPEG/PNG uploads as unsupported images. · uploaded_artwork.go:82-86

internal/metadata/uploaded_artwork.go:82-86
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Classify large damaged JPEG/PNG uploads as unsupported images.

A JPEG or PNG with a valid header, damaged pixel data, and more than 4,000,000 pixels can pass PixelDataUndecodable, then fail during caching with a generic error. The upload handler then returns 500, while the documented v2 response is a validation error (422).

Propagate a distinct pixel-data decode error from the image-cache layer and map that error to ErrUnsupportedUploadedImage at this boundary. Do not map every cache error, because storage failures must remain server errors.


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: 54448ecf-048b-4aec-8147-b03eb6884b53
Commits

Reviewing files that changed from the base of the PR and between b296922 and d7b3161.

Files selected for processing: 3
  • contracts/api/v2/openapi.json
  • internal/apiv2/admin_catalog_images.go
  • web/src/api/v2/schema.ts
Files skipped from review as they are similar to previous changes: 2
  • internal/apiv2/admin_catalog_images.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; 1 remain after this review.

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

Maintainer review of d7b3161. One finding below, and I'm fixing it in a commit on this branch, so there's no need to change it yourself. A summary with the scores follows once the fix is pushed.

Comment thread internal/metadata/uploaded_artwork.go Resolved
A reconcile that finds most of storage missing resets cached artwork
without checking each object, and clears every row whose source isn't a
provider URL. That cleared uploaded images whose objects survived, and
nothing can fetch an upload again. Bulk mode now leaves upload:// rows
out of the blind clear and verifies each one, clearing it only when its
object is gone, as it already does for collection uploads.

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

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

@Quick104

Quick104 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer review summary

Reviewed head: efa2f73. That is my two fix commits on top of the author's d7b3161, a merge of main (which brings in #2254), and three doc wording fixes from CodeRabbit.

Fit: 8/10 · Readiness: 8/10 — conditional

Fit. Edit Metadata had no way to use your own artwork when no provider or sidecar file has it, and most installs mount media read-only, so a sidecar file isn't an option. The PR reuses what already exists: the local/ key layout, the upload:// source scheme that collections use, the shared publish path with the images lock, and revision GC. It adds no new table. It does add a new v2 operation, and that new surface is what keeps the score below 9.

Readiness. The one verified defect is fixed on this branch and covered by a database test that fails without the fix. The upload flow itself is shown by the author's captures and covered by focused tests. I haven't exercised it live on the new head, and the open points below are for maintainers to settle.

Addressed

  • fix(metadata): keep manual metadata edits through refresh and show them in home rails #2254 is in. Main, now including fix(metadata): keep manual metadata edits through refresh and show them in home rails #2254, is merged into this branch, so its home-rail eviction runs in the shared publishItemImage and uploads evict cached home rows too.

  • A bulk storage reconcile cleared surviving uploads. In bulk mode, the reconcile clears every item and season row whose source isn't a provider URL without checking its object, and upload:// counts as non-provider. A sidecar comes back on the next refresh; an upload has no other copy. Fixed in 9f9327f: bulk mode now checks each upload:// row and clears it only when its object is gone. TestArtworkReconcileBulkResetVerifiesUploadsDB, now listed in scripts/ci/db-contracts.txt, fails on d7b3161 and passes with the fix. e67493b notes the rule in docs/architecture/local-nfo-metadata.md.

  • The PR body's Validation tasks: line said changes, but none of those cases has a passed result. The line now says no passed case is affected and names the cases that should include an upload when they run.

Left for maintainers

  • A damaged JPEG or PNG over 4 MP returns 500 rather than 422. The undecodable-pixel check stops at 4 MP to limit decode memory. Collection uploads share the same helper and behave the same way. The PR discloses this. I left it alone; changing it is a cross-cutting choice about imageutil.
  • Two older races this endpoint inherits (traced in source, not reproduced):
    • A refresh that read the item before an upload committed can write its older artwork back over the upload. Image apply has the same race today.
    • A sidecar re-cache deletes its old local/ prefix without checking references. An upload of exactly the old sidecar's bytes, made in the window between the catalog update and that delete, would lose its object. Applying that sidecar from the picker has the same window.

Checks

  • Code review at medium effort: three finder agents and a validation agent. Cross-provider round: one, Codex gpt-6.1-sol. It raised the reconcile defect and the two inherited races above.
  • Tests: internal/metadata, internal/api/handlers, internal/apiv2, internal/contractspec and internal/contractledger pass on the new head, and make lint-changed is clean. The PR's own new tests don't build on the base because they call the new API, so they show coverage rather than a failure on the base. The new reconcile test is the one that failed before the fix.
  • Validated features: no passed case on the v1.0 board is affected. Manual metadata edit / identify / artwork — Server #1210 C1–C2, Manual metadata edit / identify / artwork — Web admin #1211 C1–C2 and Series — Web admin #1251 C2 reach this picker and haven't been run yet. The PR-to-task lookup in the validation tooling failed, so this comes from reading those task issues directly.
  • User manual: docs: cover uploading your own artwork in Edit Metadata siloserver.org#303 is open and covers the upload. The reconcile fix changes nothing a user sees.
  • Apple / Android / jellycompat: none needed. The admin image endpoints have no native client callers, and jellycompat has no image upload route.
  • Evidence: the existing evidence page still matches. My commits don't change the screen.

@silo-kody

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3


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: 220d6be4-aa06-46f5-a3be-f8a1648e03a2
Commits

Reviewing files that changed from the base of the PR and between e67493b and aa353f9.

Files selected for processing: 8
  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • internal/api/handlers/admin_images.go
  • internal/api/testdata/media_routes.txt
  • internal/contractledger/ledger_test.go
  • scripts/ci/db-contracts.txt
  • web/src/api/v2/operations.ts
  • 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; 0 remain after this review.

Comment thread docs/admin-catalog-api.md Resolved
Comment thread docs/admin-catalog-api.md Resolved
Comment thread docs/admin-catalog-api.md Resolved
@silo-kody

silo-kody Bot commented Oct 27, 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 ❌
⚠️ 2 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
  • Detach mandatory cleanup from request cancellation and bound its lifetime

@Quick104
Quick104 merged commit e6df1d8 into Silo-Server:main Oct 27, 2026
28 checks passed
@blurbery
blurbery deleted the feat/edit-metadata-image-upload branch November 6, 2026 00:01
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 enhancement New feature or request go Pull requests that update go code impact: usability Core flow broken or severely blocked javascript Pull requests that update javascript code needs-review Needs maintainer review to resolve uncertain classification, scope, or changed evidence. priority: P2 Limited scope, workaround exists, or polish size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants