Skip to content

Remove unused Trakt collection-template posters and catch orphaned template assets in tests #1641

Description

@Quick104

Problem

30e9830 removed the six built-in Trakt collection templates but left their poster files behind: 12 files, about 15 MB, in the repository, and the six final JPGs (about 2 MB) still ship in the web build. No test notices, because the asset tests only check that every registered template has its files, not that every file has a template.

The final JPGs may still be in use. A collection created from a template stores the template's poster path (/images/collection-templates/<id>.jpg) and only switches to a stored copy when the upload to artwork storage succeeds. Jellycompat serves those paths straight from the embedded frontend. Existing Trakt collections still sync after the removal, so a Trakt collection created before 30e9830 may still point at one of these JPGs, and deleting them would blank its poster. The raw PNG plates are never served; they only exist to regenerate typography.

I found this by comparing the poster directories with the template IDs in builtin.go while auditing the docs for #1635.

Files with no template:

web/assets-source/collection-templates/raw/trakt_popular_movies.png
web/assets-source/collection-templates/raw/trakt_popular_shows.png
web/assets-source/collection-templates/raw/trakt_recommended_movies.png
web/assets-source/collection-templates/raw/trakt_recommended_shows.png
web/assets-source/collection-templates/raw/trakt_trending_movies.png
web/assets-source/collection-templates/raw/trakt_trending_shows.png
web/public/images/collection-templates/trakt_popular_movies.jpg
web/public/images/collection-templates/trakt_popular_shows.jpg
web/public/images/collection-templates/trakt_recommended_movies.jpg
web/public/images/collection-templates/trakt_recommended_shows.jpg
web/public/images/collection-templates/trakt_trending_movies.jpg
web/public/images/collection-templates/trakt_trending_shows.jpg

Fix

  • Delete the six raw PNGs.
  • Keep the six JPGs while existing collections can reference them. Remove them later, once stored poster URLs no longer point at them, for example after a migration that copies them into artwork storage.
  • Extend the asset tests to fail on any file in either directory without a registered template. Add an explicit allowlist of retired template IDs whose final JPG stays for existing collections, starting with the six Trakt IDs.

Technical notes

  • Asset tests: TestBuiltinTemplatePosterAssetsExist (internal/collections/templates/templates_test.go:39) and TestBuiltinTemplateSourcePlatesStayOutOfPublicAssets (templates_test.go:51) iterate List() only.
  • Stored poster path: createCollectionFromTemplate sets PosterURL: tmpl.PosterPath (internal/api/handlers/library_collections.go:2119). storeBundledCollectionPosterIfS3Configured (internal/api/handlers/collection_artwork.go:30) replaces it only when the upload succeeds.
  • Serving: serveBundledAsset, internal/jellycompat/handlers_images.go:627.
  • Legacy Trakt collections keep syncing but can't be changed: internal/apiv2/personal_collections.go:133 and internal/api/handlers/admin_collections_service.go:333.
  • .dockerignore already excludes web/assets-source from the image (452990e).
  • Some web tests still use Trakt template IDs as fixtures (CollectionTemplateGallery.test.tsx, CollectionTemplateCard.test.tsx). They don't load the assets, so they don't block the cleanup.

AI disclosure

  • Harness: T3 Code (Claude Code agent harness)
  • Tool(s): Claude Code, GitHub CLI
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted; filed at the maintainer's request
  • Adversarial review: n/a

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions