Skip to content

feat(collections): back collections with user-authored Trakt lists - #286

Merged
Quick104 merged 2 commits into
Silo-Server:mainfrom
fluxis:feat/trakt-user-list-collections
Jul 5, 2026
Merged

Quick104 merged 2 commits into
Silo-Server:mainfrom
fluxis:feat/trakt-user-list-collections

Conversation

@fluxis

@fluxis fluxis commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Collections could sync only Trakt's built-in trending/popular/recommended feeds. A server admin couldn't populate a collection from a specific user's Trakt list — e.g. a curated "Saw cinematic universe in timeline order" list pulled from a Kometa config (#214). The biggest community-signal item on the board (a 43-reply thread).

Approach

  • trakt.Client.GetUserList fetches /users/{user}/lists/{slug}/items in list order, mixing movies and shows and skipping non-title entries (people/episodes/seasons). Public lists need only the app client id; the access token is passed through for a private owner list.
  • New trakt_list collection source mode: catalog.ParseTraktListURL accepts a trakt.tv/users/{user}/lists/{slug} URL (with or without scheme/query) or a bare user/slug shorthand; syncTraktListCollection fetches the list and reuses the preset pipeline's matching, dedupe, ranking, and sync-run recording via an extracted completeTraktEntrySync helper (no logic duplicated between preset and list paths).
  • Import handler accepts list_url as an alternative to preset; the admin collection editor's Trakt form gains a Source toggle (discovery feed vs user list) with a list-URL input and summary row.

Reuses the whole existing collection machinery (auto-sync schedule, collage, library matching) that #227's provider work and the earlier preset modes already established — this is a new source, not a new subsystem.

API contract

Additive-only: a new accepted source_config.mode, a new optional list_url request field; preset/media_type become optional but the preset path is unchanged. No renames or type changes.

Testing

  • GetUserList: httptest-backed mixed movie/show decoding in list order, unknown-type skipping, and required user/slug validation.
  • ParseTraktListURL: full URL, query string, no-scheme, shorthand, trailing slash, and rejection of non-list URLs / missing slug (these caught two parser bugs during development — a non-list URL that resolved and a no-scheme URL that didn't).
  • Trakt import handler + full catalog/sections/api suites green; tsc + prettier clean.
  • Not live-validated: exercising the real Trakt API needs a configured Trakt client id; the sync path reuses the preset pipeline end to end.

Fixes #214

AI-use disclosure

Implemented with Claude Code (test-first); human-reviewed before submission.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for importing Trakt collections from either a preset feed or a user list URL.
    • The import form now lets you choose the source type and enter a Trakt list link when needed.
    • List imports now preserve item order and show the chosen source in the summary.
  • Bug Fixes

    • Improved validation for Trakt list inputs and required fields.
    • Kept item limits consistent across both import modes.

Collections could sync only Trakt's built-in trending/popular/recommended
feeds; a server admin could not populate a collection from a specific
user's Trakt list (e.g. a curated 'Saw in timeline order' list) (Silo-Server#214).

- trakt.Client.GetUserList fetches /users/{user}/lists/{slug}/items in
  list order, mixing movies and shows and skipping non-title entries.
- New 'trakt_list' collection source mode: catalog.ParseTraktListURL
  accepts a trakt.tv list URL (or bare user/slug), and
  syncTraktListCollection reuses the preset pipeline's matching/ordering
  via an extracted completeTraktEntrySync helper. Public lists need no
  access token.
- Trakt import handler accepts list_url as an alternative to preset;
  the admin collection editor's Trakt form gains a Source toggle
  (discovery feed vs user list) with a list-URL input.

Additive-only: new source mode + optional request field; preset path
unchanged.

Fixes Silo-Server#214

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Quick104, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8803440c-e83b-43b0-bd06-d1b5c8f9d07b

📥 Commits

Reviewing files that changed from the base of the PR and between 2834c7b and 821d258.

📒 Files selected for processing (4)
  • internal/api/handlers/library_collections.go
  • internal/catalog/library_collection_service.go
  • internal/catalog/trakt_list_url_test.go
  • web/src/pages/adminCollectionsShared.tsx
📝 Walkthrough

Walkthrough

This PR adds support for importing and syncing Trakt collections from user-authored list URLs in addition to existing preset-based imports. Changes span the Trakt API client (GetUserList), catalog sync service (trakt_list mode, URL parsing), API handler (list URL request handling), router adapter wiring, and frontend form with a source-mode selector.

Changes

Trakt user list support

Layer / File(s) Summary
Trakt client GetUserList API
internal/metadata/trakt/client.go, internal/metadata/trakt/user_list_test.go
Adds Client.GetUserList to paginate through a user's Trakt list, validate inputs, URL-escape path segments, and convert movie/show items into CollectionEntry with rank preservation; tests cover mixed-type decoding, order preservation, and validation errors.
Catalog sync for trakt_list mode
internal/catalog/library_collection_service.go, internal/catalog/trakt_list_url_test.go
Extends TraktCollectionFetcher with GetUserList, adds a trakt_list sync mode routed to new syncTraktListCollection, adds exported ParseTraktListURL to parse full URLs or {user}/{slug} shorthand, and fixes completeTraktEntrySync to use the passed limit argument; includes parsing unit tests.
Router adapter wiring
internal/api/router.go, internal/sections/trending_refresher_test.go
Adds traktCollectionAdapter.GetUserList mapping client results into catalog.TraktCollectionEntry, and adds a stub GetUserList to the fakeTrakt test double.
Import handler list URL support
internal/api/handlers/library_collections.go
Adds optional list_url to the import request, branches validation between list URL (ParseTraktListURL) and preset normalization, computes source_config/source_url accordingly via new buildTraktListSourceConfig, and sets SourceURL from the computed value.
Frontend Trakt source mode UI
web/src/api/types.ts, web/src/pages/adminCollectionsShared.tsx
Makes preset/media_type optional and adds list_url to ImportTraktCollectionRequest; adds a Source selector in TraktPresetForm toggling between preset and user-list modes, with mode-specific validation, submit payload, and summary rendering.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Frontend as TraktPresetForm
  participant Handler as HandleImportTraktCollection
  participant Service as LibraryCollectionService
  participant Adapter as traktCollectionAdapter
  participant TraktAPI as Trakt Client

  User->>Frontend: Selects "User list" source, enters list URL
  Frontend->>Handler: POST import request (list_url)
  Handler->>Handler: ParseTraktListURL(list_url)
  Handler->>Handler: buildTraktListSourceConfig
  Handler-->>Frontend: Collection created (source_config, source_url)
  Service->>Service: SyncCollectionWithOptions (trakt_list mode)
  Service->>Adapter: GetUserList(user, list, limit, token)
  Adapter->>TraktAPI: GetUserList(user, list, limit, token)
  TraktAPI-->>Adapter: paginated list items
  Adapter-->>Service: []TraktCollectionEntry
  Service->>Service: completeTraktEntrySync(entries, limit)
Loading

Possibly related PRs

  • Silo-Server/silo-server#184: Modifies the same Trakt sync/matching pipeline in internal/catalog/library_collection_service.go, intersecting with the new trakt_list sync mode's use of completeTraktEntrySync.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: backing collections with user-authored Trakt lists.
Linked Issues check ✅ Passed The changes implement user-authored Trakt list support end-to-end, matching the directly linked issue's core requirement.
Out of Scope Changes check ✅ Passed The diff stays focused on Trakt user-list support, with supporting API, UI, and tests that align with the stated objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2834c7b99d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

URL string `json:"url"`
Limit *int `json:"limit,omitempty"`
}{
Mode: "trakt_list",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve Trakt list source when editing

Creating collections with this new mode: "trakt_list" makes them enter the existing admin edit flow as collection_type === "trakt", but that form still parses only preset config and on every save rewrites the source as mode: "trakt_preset" with a trakt://... URL (web/src/pages/adminCollectionsShared.tsx:1349-1422). In practice, an admin who edits only the title, artwork, or libraries of a Trakt-list collection will silently replace the user list with the default/picked preset, so future syncs no longer use the list. The edit flow needs to detect and preserve trakt_list (or lock those source fields) before enabling this mode.

Useful? React with 👍 / 👎.

<SelectItem value="preset">
Discovery feed (Trending / Popular / Recommended)
</SelectItem>
<SelectItem value="list">User list (trakt.tv URL)</SelectItem>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow all library kinds for Trakt lists

When this new User list source is selected, the media-type control is hidden, but the library picker above still receives eligibility derived from the hidden mediaType state (defaulting to movie). On servers with separate movie and TV libraries, switching to list mode leaves TV-only libraries disabled by default, even though Trakt lists can contain both movies and shows and the backend matches each entry by type. Use mixed/no eligibility in list mode so admins can select both library kinds for mixed lists.

Useful? React with 👍 / 👎.

@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

🧹 Nitpick comments (3)
internal/api/router.go (1)

2965-2984: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate entry-mapping logic between GetCollectionPreset and GetUserList.

Both adapter methods now contain the identical field-by-field mapping loop from client results to catalog.TraktCollectionEntry. Consider extracting a shared helper.

♻️ Proposed refactor to share the mapping logic
+func mapTraktCollectionEntries(results []metatrakt.CollectionEntry) []catalog.TraktCollectionEntry {
+	entries := make([]catalog.TraktCollectionEntry, len(results))
+	for i, r := range results {
+		entries[i] = catalog.TraktCollectionEntry{
+			TraktID:   r.TraktID,
+			TMDBID:    r.TMDBID,
+			TVDBID:    r.TVDBID,
+			IMDbID:    r.IMDbID,
+			MediaType: r.MediaType,
+			Title:     r.Title,
+			Year:      r.Year,
+			Rank:      r.Rank,
+		}
+	}
+	return entries
+}
+
 func (a *traktCollectionAdapter) GetCollectionPreset(ctx context.Context, preset, mediaType string, limit int, accessToken string) ([]catalog.TraktCollectionEntry, error) {
 	results, err := a.client.GetCollectionPreset(ctx, preset, mediaType, limit, accessToken)
 	if err != nil {
 		return nil, err
 	}
-	entries := make([]catalog.TraktCollectionEntry, len(results))
-	for i, r := range results {
-		entries[i] = catalog.TraktCollectionEntry{
-			TraktID:   r.TraktID,
-			TMDBID:    r.TMDBID,
-			TVDBID:    r.TVDBID,
-			IMDbID:    r.IMDbID,
-			MediaType: r.MediaType,
-			Title:     r.Title,
-			Year:      r.Year,
-			Rank:      r.Rank,
-		}
-	}
-	return entries, nil
+	return mapTraktCollectionEntries(results), nil
 }

 func (a *traktCollectionAdapter) GetUserList(ctx context.Context, user, list string, limit int, accessToken string) ([]catalog.TraktCollectionEntry, error) {
 	results, err := a.client.GetUserList(ctx, user, list, limit, accessToken)
 	if err != nil {
 		return nil, err
 	}
-	entries := make([]catalog.TraktCollectionEntry, len(results))
-	for i, r := range results {
-		entries[i] = catalog.TraktCollectionEntry{
-			TraktID:   r.TraktID,
-			TMDBID:    r.TMDBID,
-			TVDBID:    r.TVDBID,
-			IMDbID:    r.IMDbID,
-			MediaType: r.MediaType,
-			Title:     r.Title,
-			Year:      r.Year,
-			Rank:      r.Rank,
-		}
-	}
-	return entries, nil
+	return mapTraktCollectionEntries(results), nil
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/api/router.go` around lines 2965 - 2984, The entry-to-catalog
mapping in GetUserList duplicates the same field-by-field loop already used in
GetCollectionPreset, so extract that shared conversion into a helper and have
both adapter methods call it. Reuse the existing traktCollectionAdapter methods
and the catalog.TraktCollectionEntry mapping logic so the conversion stays in
one place and both paths remain identical.
internal/metadata/trakt/user_list_test.go (1)

10-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Good coverage for single-page decode/validation; consider adding a multi-page pagination test.

The pagination loop in GetUserList (page increment, pageLimit shrinking, termination via len(resp) < pageLimit) is the most intricate part of the new method and isn't exercised here — both tests return a single page.

🧪 Suggested additional test sketch
func TestGetUserListPaginatesAcrossPages(t *testing.T) {
	var requests int
	server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		requests++
		if requests == 1 {
			writeJSON(t, w, []map[string]any{
				{"rank": 1, "type": "movie", "movie": map[string]any{"title": "A", "ids": map[string]any{"tmdb": 1}}},
			})
			return
		}
		writeJSON(t, w, []map[string]any{})
	}))
	defer server.Close()

	client := NewClient("client-id", 1000)
	client.SetBaseURL(server.URL)

	results, err := client.GetUserList(context.Background(), "user", "list", 5, "")
	if err != nil {
		t.Fatalf("GetUserList: %v", err)
	}
	if len(results) != 1 || requests < 2 {
		t.Fatalf("results = %d, requests = %d; want pagination to terminate correctly", len(results), requests)
	}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/metadata/trakt/user_list_test.go` around lines 10 - 72, Add a
pagination-focused test for GetUserList because the current coverage only
exercises a single response page. Create a test around GetUserList that uses an
httptest.Server to return data on the first request and an empty page on the
next, then assert the client makes multiple requests, preserves results across
pages, and stops when len(resp) drops below the requested pageLimit. Use the
GetUserList method, NewClient, and SetBaseURL symbols to locate the code path.
internal/api/handlers/library_collections.go (1)

3002-3015: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Sync-failure log loses context for list-based imports.

When listURL is set, preset/mediaType stay empty strings, but the failure log further down (slog.Error("failed to sync imported Trakt collection", ..., "preset", preset, "media_type", mediaType, ...)) still logs those now-blank fields without any list_url, making it hard to diagnose which list failed to sync.

📝 Proposed fix to add list_url to the failure log
 		slog.Error("failed to sync imported Trakt collection",
 			"collection_id", collection.ID,
 			"library_id", req.LibraryID,
 			"title", req.Title,
 			"preset", preset,
 			"media_type", mediaType,
+			"list_url", listURL,
 			"error", err,
 		)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/api/handlers/library_collections.go` around lines 3002 - 3015, The
Trakt sync failure log in the import handler is missing context for list-based
imports because the `preset` and `mediaType` fields are empty when `listURL` is
used. Update the error logging in the same handler that calls
`catalog.ParseTraktListURL` and `normalizeTraktPresetRequest` so the
`slog.Error("failed to sync imported Trakt collection", ...)` path includes
`list_url` when `listURL` is set, while still logging `preset`, `media_type`,
and `profile_id` for preset-based imports.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/catalog/library_collection_service.go`:
- Around line 1012-1050: ParseTraktListURL currently accepts any URL with the
right path shape because it never checks the host. Update the URL branch in
ParseTraktListURL to validate parsed.Hostname() is trakt.tv (and optionally
www.trakt.tv if supported) before extracting the /users/{user}/lists/{slug}
path, and return badFormat() for any other host. Keep the shorthand
"{user}/{slug}" handling unchanged, and ensure the existing ParseTraktListURL
validation messages still cover malformed or non-Trakt inputs.

In `@web/src/pages/adminCollectionsShared.tsx`:
- Around line 1002-1060: The Trakt edit form is not preserving list-backed
configurations, so saving a `trakt_list` collection gets rewritten as a preset
and loses `list_url`. Update the Trakt edit/save flow in
`adminCollectionsShared.tsx` so the edit state detects and round-trips `mode:
"trakt_list"` alongside `trakt_preset`, and ensure
`parseTraktPresetSourceConfig()` and the submit handler keep `source_config`,
`source_url`, and `list_url` intact for list sources instead of defaulting to
`trending`.

---

Nitpick comments:
In `@internal/api/handlers/library_collections.go`:
- Around line 3002-3015: The Trakt sync failure log in the import handler is
missing context for list-based imports because the `preset` and `mediaType`
fields are empty when `listURL` is used. Update the error logging in the same
handler that calls `catalog.ParseTraktListURL` and `normalizeTraktPresetRequest`
so the `slog.Error("failed to sync imported Trakt collection", ...)` path
includes `list_url` when `listURL` is set, while still logging `preset`,
`media_type`, and `profile_id` for preset-based imports.

In `@internal/api/router.go`:
- Around line 2965-2984: The entry-to-catalog mapping in GetUserList duplicates
the same field-by-field loop already used in GetCollectionPreset, so extract
that shared conversion into a helper and have both adapter methods call it.
Reuse the existing traktCollectionAdapter methods and the
catalog.TraktCollectionEntry mapping logic so the conversion stays in one place
and both paths remain identical.

In `@internal/metadata/trakt/user_list_test.go`:
- Around line 10-72: Add a pagination-focused test for GetUserList because the
current coverage only exercises a single response page. Create a test around
GetUserList that uses an httptest.Server to return data on the first request and
an empty page on the next, then assert the client makes multiple requests,
preserves results across pages, and stops when len(resp) drops below the
requested pageLimit. Use the GetUserList method, NewClient, and SetBaseURL
symbols to locate the code path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b4fc9a61-b0fe-49d3-8573-aba9004267f1

📥 Commits

Reviewing files that changed from the base of the PR and between 5172155 and 2834c7b.

📒 Files selected for processing (9)
  • internal/api/handlers/library_collections.go
  • internal/api/router.go
  • internal/catalog/library_collection_service.go
  • internal/catalog/trakt_list_url_test.go
  • internal/metadata/trakt/client.go
  • internal/metadata/trakt/user_list_test.go
  • internal/sections/trending_refresher_test.go
  • web/src/api/types.ts
  • web/src/pages/adminCollectionsShared.tsx

@Quick104

Quick104 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Code review

Found 3 issues (the first two confirm the earlier Codex/CodeRabbit inline comments — I validated each against the code):

  1. Editing a Trakt user-list collection silently destroys the list source. The edit form enters as collection_type === "trakt", parses only preset config (parseTraktPresetSourceConfig falls back to trending), and on save always rewrites source_config as mode: "trakt_preset" with a trakt:// URL — an admin who edits just the title or artwork converts the list-backed collection into a Trending Movies preset.

} else if (isTraktCollection) {
sourceUrlValue =
traktPreset === "recommended"
? `trakt://${traktPreset}/${traktMediaType}/${traktProfileId}`
: `trakt://${traktPreset}/${traktMediaType}`;
sourceConfig = {
mode: "trakt_preset",
provider: "trakt",
preset: traktPreset,
media_type: traktMediaType,
...(traktPreset === "recommended" ? { profile_id: traktProfileId } : {}),
...(parsedTraktLimit ? { limit: parsedTraktLimit } : {}),
};
}

  1. In "User list" mode the media-type control is hidden but library eligibility is still derived from the hidden mediaType state (default movie), so TV-only libraries stay disabled even though Trakt lists mix movies and shows and the backend matches each entry by type.

const [sourceKind, setSourceKind] = useState<"preset" | "list">("preset");
const [listUrl, setListUrl] = useState("");
const [preset, setPreset] = useState<TraktPreset>("trending");
const [mediaType, setMediaType] = useState<TraktMediaType>("movie");
const eligibility = libraryEligibilityForMediaKind(mediaType);

  1. ParseTraktListURL never validates the host: https://example.com/users/x/lists/y is accepted and misinterpreted as a Trakt list, deferring the user's feedback to a confusing later sync failure instead of an immediate validation error (CodeRabbit's inline comment; confirmed).

}
isURL := strings.Contains(trimmed, "://") || strings.Contains(strings.ToLower(trimmed), "trakt.tv")
if isURL {
normalized := trimmed
if !strings.Contains(normalized, "://") {
normalized = "https://" + normalized

I am pushing fixes for all three to this branch.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

… mixed libraries, validate list host

Three review fixes for user-list-backed collections:

- The admin edit form now detects mode "trakt_list", shows an editable
  list URL (mirroring the create form) and saves the source back as
  trakt_list with list_url preserved — previously any edit silently
  rewrote the collection into a trakt_preset Trending Movies feed.
- Library eligibility in list mode is mixed (movies + shows) instead of
  inheriting the hidden media-type default of movie, since Trakt lists
  mix both and entries match by their own type.
- ParseTraktListURL only accepts trakt.tv / www.trakt.tv hosts, so a
  list-shaped URL on another domain fails fast with the format error
  instead of a confusing later sync failure.

source_config now carries list_url alongside the legacy url key
(additive); sync reads list_url, then url, then source_url.

Co-Authored-By: Claude Fable 5 <[email protected]>
@Quick104

Quick104 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

All three issues addressed in 821d258:

  • The edit form now detects mode: "trakt_list", shows an editable list URL (mirroring the create form), and saves the source back as trakt_list with list_url preserved — editing title/artwork no longer converts the collection into a Trending Movies preset.
  • In list mode the library picker uses mixed eligibility (movie + TV libraries selectable) in both the create and edit forms, instead of the hidden mediaType default of movie.
  • ParseTraktListURL validates the host (trakt.tv / www.trakt.tv, case-insensitive) and rejects list-shaped URLs on other domains with the immediate format error; parser tests extended.

source_config now carries list_url alongside the legacy url key (additive-only), and sync reads list_url → url → source_url so pre-fix collections keep working. Verified with go build ./..., go test ./internal/catalog/... ./internal/api/..., tsc --noEmit, ESLint (no new warnings), and Prettier. Diff written by GPT-5.5 (Codex) under review supervision; validated and committed by Claude.

@Quick104
Quick104 merged commit e5379cd into Silo-Server:main Jul 5, 2026
1 check passed
Quick104 added a commit to RXWatcher/silo-server that referenced this pull request Jul 10, 2026
…ilo-Server#286)

* feat(collections): back collections with user-authored Trakt lists

Collections could sync only Trakt's built-in trending/popular/recommended
feeds; a server admin could not populate a collection from a specific
user's Trakt list (e.g. a curated 'Saw in timeline order' list) (Silo-Server#214).

- trakt.Client.GetUserList fetches /users/{user}/lists/{slug}/items in
  list order, mixing movies and shows and skipping non-title entries.
- New 'trakt_list' collection source mode: catalog.ParseTraktListURL
  accepts a trakt.tv list URL (or bare user/slug), and
  syncTraktListCollection reuses the preset pipeline's matching/ordering
  via an extracted completeTraktEntrySync helper. Public lists need no
  access token.
- Trakt import handler accepts list_url as an alternative to preset;
  the admin collection editor's Trakt form gains a Source toggle
  (discovery feed vs user list) with a list-URL input.

Additive-only: new source mode + optional request field; preset path
unchanged.

Fixes Silo-Server#214

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(collections): round-trip trakt_list through the edit form, unlock mixed libraries, validate list host

Three review fixes for user-list-backed collections:

- The admin edit form now detects mode "trakt_list", shows an editable
  list URL (mirroring the create form) and saves the source back as
  trakt_list with list_url preserved — previously any edit silently
  rewrote the collection into a trakt_preset Trending Movies feed.
- Library eligibility in list mode is mixed (movies + shows) instead of
  inheriting the hidden media-type default of movie, since Trakt lists
  mix both and entries match by their own type.
- ParseTraktListURL only accepts trakt.tv / www.trakt.tv hosts, so a
  list-shaped URL on another domain fails fast with the format error
  instead of a confusing later sync failure.

source_config now carries list_url alongside the legacy url key
(additive); sync reads list_url, then url, then source_url.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Quick <[email protected]>
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.

[v1] Collections backed by external user lists / watchlists (Trakt, IMDb)

2 participants