Skip to content

fix(jellycompat): parse repeated Fields query params - #110

Merged
Quick104 merged 3 commits into
Silo-Server:mainfrom
d3v1l1989:fix/jellycompat-repeated-fields-param
Jun 10, 2026
Merged

Quick104 merged 3 commits into
Silo-Server:mainfrom
d3v1l1989:fix/jellycompat-repeated-fields-param

Conversation

@d3v1l1989

@d3v1l1989 d3v1l1989 commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

parseItemsQuery reads the Fields parameter via q.Get("Fields"), which returns only the first value when a client sends Fields as repeated query params (Fields=A&Fields=B&...) rather than comma-separated in a single param (Fields=A,B,C).

The jellyfin-sdk-kotlin (used by Wholphin) sends repeated params. When such a request lists a detail-only field like MediaSources after other fields, silo only sees the first value and never switches to the detail path — so the response comes back without MediaSources.

Concretely, Wholphin's episode-playlist request is:

GET /Shows/{id}/Episodes?Fields=PrimaryImageAspectRatio&Fields=SeasonUserData&...&Fields=MediaSources&...&startItemId=...&limit=100

q.Get("Fields") returns PrimaryImageAspectRatio, so needsDetailFields stays false, the request takes the list path, and the returned episodes have no MediaSources. Wholphin then can't start playback of those episodes — it shows "Item has no media sources, skipping…" when auto-advancing to the next episode (and after skip-outro).

This looked data-dependent because the season-display request happened to list MediaSources first (worked), while the playlist request listed it later (broke). Comma-separated single-param clients (VidHub, Infuse) were never affected.

Fix

Join all repeated Fields values before splitting on commas, so field order and delimiter style no longer matter:

fieldsRaw := strings.Join(q.Values("Fields"), ",")

Testing

  • New TestRepeatedFieldsParamTriggersDetail reproduces the exact Wholphin request shape and asserts needsDetailFields + the parsed field set.
  • New TestCommaSeparatedFieldsStillParsed guards the existing single-param comma-separated form.
  • Full internal/jellycompat suite passes; go vet clean.
  • Verified live against a real Wholphin client (next-episode / skip-outro now advances cleanly).

Authored with AI assistance; reviewed and verified by me.

Summary by CodeRabbit

  • New Features

    • Added support for the ThemeSongs endpoint to return properly structured responses.
  • Bug Fixes

    • Fixed CanDownload flag incorrectly indicating download support availability.
    • Fixed repeated Fields query parameter parsing to capture all submitted values instead of only the first.
  • Documentation

    • Added comprehensive endpoint coverage report documenting Wholphin-to-Jellycompat API compatibility status and prioritized follow-up items.

parseItemsQuery read the Fields parameter via q.Get("Fields"), which
returns only the first value when a client sends Fields as repeated
query params (Fields=A&Fields=B&...) instead of comma-separated in a
single param (Fields=A,B,C).

The jellyfin-sdk-kotlin (used by Wholphin) sends repeated params. When
such a request listed a detail-only field like MediaSources after other
fields — e.g. the episode-playlist request
  /Shows/{id}/Episodes?Fields=PrimaryImageAspectRatio&...&Fields=MediaSources&...
silo saw only the first value (PrimaryImageAspectRatio), so
needsDetailFields stayed false, the request took the list path, and the
response came back without MediaSources. Clients then could not start
playback of the returned episodes ("no media sources").

Join all repeated Fields values before splitting on commas so field
order and delimiter style no longer matter. Comma-separated single-param
clients (e.g. VidHub) are unaffected.
@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR implements three identified Jellyfin compatibility gaps and documents the full endpoint coverage analysis. Theme Songs stub endpoint returns empty results with OwnerID, query parameter parsing now handles repeated Fields values correctly, CanDownload is disabled to prevent 404 attempts, and coverage report records methodology and resolutions.

Changes

Jellycompat Endpoint Gaps and Correctness Fixes

Layer / File(s) Summary
Theme Songs Stub Endpoint
internal/jellycompat/dto.go, internal/jellycompat/handlers_items.go, internal/jellycompat/path_normalization.go, internal/jellycompat/router.go, internal/jellycompat/theme_songs_stub_test.go
New themeMediaResultDTO with Items, TotalRecordCount, StartIndex, and OwnerId fields. HandleThemeSongsStub authenticates, extracts item ID from route, and returns empty media list. Path segment themesongs normalized to ThemeSongs. Routes registered for /Items/{id}/ThemeSongs and /Users/{userId}/Items/{id}/ThemeSongs. Handler test validates 200 response with correct OwnerID.
Repeated Query Parameters Handling
internal/jellycompat/query.go, internal/jellycompat/query_repeated_fields_test.go
parseItemsQuery now joins all repeated Fields occurrences instead of using only the first. Correctly aggregates Fields=A&Fields=B&Fields=C forms. fieldsExplicit set based on combined payload. Two tests verify repeated parameter aggregation and backward compatibility with comma-separated form.
CanDownload Correctness
internal/jellycompat/mapping.go
Item detail mapping sets CanDownload to false. Prevents clients from attempting downloads via missing /Items/{id}/Download endpoint.
Endpoint Coverage Analysis and Recording
docs/architecture/wholphin-endpoint-coverage.md
Wholphin→Jellycompat coverage report documents scope, methodology (SDK call discovery, websocket subscriptions, route inventory), and categorizes endpoints as fully covered, partially stubbed, safely gated, or missing/reachable. Records 2026-06-09 resolutions (theme songs, CanDownload). Includes prioritized follow-up recommendations.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 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 PR title accurately describes the main fix: parsing repeated Fields query parameters in parseItemsQuery, which was the primary problem addressed in the first commit and is the core issue resolved by this changeset.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Quick104 and others added 2 commits June 9, 2026 20:39
Wholphin (jellyfin-sdk-kotlin) audit surfaced two reachable gaps:

- mapping.go set CanDownload=true on every playable item while no
  /Items/{id}/Download route exists, sending clients that honor the flag
  (e.g. Wholphin's screensaver/slideshow) into 404s. Advertise false until
  a download route exists.
- GET /Items/{id}/ThemeSongs 404'd, so enabling theme songs in Wholphin
  silently failed on every detail page. Stub it with an empty
  ThemeMediaResult. This cannot reuse the generic item stub: the SDK
  models OwnerId as non-nullable, so the response must include it even
  when empty.

Co-Authored-By: Claude Fable 5 <[email protected]>
Cross-references every Jellyfin endpoint the Wholphin client can call
against the routes jellycompat serves, with gating evidence for each
missing-but-unreachable endpoint and prioritized recommendations.

Co-Authored-By: Claude Fable 5 <[email protected]>
@Quick104
Quick104 merged commit 34a3de6 into Silo-Server:main Jun 10, 2026
1 check was pending
Quick104 added a commit that referenced this pull request Jun 11, 2026
* fix(jellycompat): parse repeated Fields query params

parseItemsQuery read the Fields parameter via q.Get("Fields"), which
returns only the first value when a client sends Fields as repeated
query params (Fields=A&Fields=B&...) instead of comma-separated in a
single param (Fields=A,B,C).

The jellyfin-sdk-kotlin (used by Wholphin) sends repeated params. When
such a request listed a detail-only field like MediaSources after other
fields — e.g. the episode-playlist request
  /Shows/{id}/Episodes?Fields=PrimaryImageAspectRatio&...&Fields=MediaSources&...
silo saw only the first value (PrimaryImageAspectRatio), so
needsDetailFields stayed false, the request took the list path, and the
response came back without MediaSources. Clients then could not start
playback of the returned episodes ("no media sources").

Join all repeated Fields values before splitting on commas so field
order and delimiter style no longer matter. Comma-separated single-param
clients (e.g. VidHub) are unaffected.

* fix(jellycompat): stop advertising CanDownload and stub ThemeSongs

Wholphin (jellyfin-sdk-kotlin) audit surfaced two reachable gaps:

- mapping.go set CanDownload=true on every playable item while no
  /Items/{id}/Download route exists, sending clients that honor the flag
  (e.g. Wholphin's screensaver/slideshow) into 404s. Advertise false until
  a download route exists.
- GET /Items/{id}/ThemeSongs 404'd, so enabling theme songs in Wholphin
  silently failed on every detail page. Stub it with an empty
  ThemeMediaResult. This cannot reuse the generic item stub: the SDK
  models OwnerId as non-nullable, so the response must include it even
  when empty.

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

* docs(architecture): add Wholphin endpoint coverage audit

Cross-references every Jellyfin endpoint the Wholphin client can call
against the routes jellycompat serves, with gating evidence for each
missing-but-unreachable endpoint and prioritized recommendations.

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

---------

Co-authored-by: Quick <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Quick104 added a commit that referenced this pull request Jun 17, 2026
* fix(jellycompat): parse repeated Fields query params

parseItemsQuery read the Fields parameter via q.Get("Fields"), which
returns only the first value when a client sends Fields as repeated
query params (Fields=A&Fields=B&...) instead of comma-separated in a
single param (Fields=A,B,C).

The jellyfin-sdk-kotlin (used by Wholphin) sends repeated params. When
such a request listed a detail-only field like MediaSources after other
fields — e.g. the episode-playlist request
  /Shows/{id}/Episodes?Fields=PrimaryImageAspectRatio&...&Fields=MediaSources&...
silo saw only the first value (PrimaryImageAspectRatio), so
needsDetailFields stayed false, the request took the list path, and the
response came back without MediaSources. Clients then could not start
playback of the returned episodes ("no media sources").

Join all repeated Fields values before splitting on commas so field
order and delimiter style no longer matter. Comma-separated single-param
clients (e.g. VidHub) are unaffected.

* fix(jellycompat): stop advertising CanDownload and stub ThemeSongs

Wholphin (jellyfin-sdk-kotlin) audit surfaced two reachable gaps:

- mapping.go set CanDownload=true on every playable item while no
  /Items/{id}/Download route exists, sending clients that honor the flag
  (e.g. Wholphin's screensaver/slideshow) into 404s. Advertise false until
  a download route exists.
- GET /Items/{id}/ThemeSongs 404'd, so enabling theme songs in Wholphin
  silently failed on every detail page. Stub it with an empty
  ThemeMediaResult. This cannot reuse the generic item stub: the SDK
  models OwnerId as non-nullable, so the response must include it even
  when empty.

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

* docs(architecture): add Wholphin endpoint coverage audit

Cross-references every Jellyfin endpoint the Wholphin client can call
against the routes jellycompat serves, with gating evidence for each
missing-but-unreachable endpoint and prioritized recommendations.

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

---------

Co-authored-by: Quick <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Quick104 added a commit that referenced this pull request Aug 18, 2026
…orrections (#675)

* docs: prune shipped plan/spec artifacts, distill durable design into architecture docs

The docs/superpowers/{plans,specs} tree had grown to 121 files (~3.4MB), all
describing work that has since shipped. Stale plans are a hazard for agentic
work — agents retrieve and trust them over the code. This removes the tree and
the other one-shot artifacts (retired security-report tombstones, old audit
notes, PR screenshots, shipped-feature mockup HTML), and gitignores
docs/superpowers/ so future plans stay out of git.

Durable content from the source-referenced specs was distilled first:
- docs/architecture/notifications.md (fanout eligibility, webhook trust/SSRF
  rules, HMAC signing, retry/auto-disable, Discord URL-leakage policy)
- docs/architecture/settings-contract.md (canonical settings contract,
  canonicalization/versioning invariants)
- docs/architecture/invitations-onboarding.md (invite token lifecycle,
  account/profile mapping, onboarding tour contract)
- downloads design notes folded into docs/downloads-api.md
- kindle/epub conversion design folded into tools/mobitool-wasm/README.md

All source comments that pointed at plan/spec files now point at the surviving
docs (three were already dangling). Also fixes the dead
docs/architecture/plugin-development.md link in DEVELOPMENT.md and updates
CLAUDE.md/CONTRIBUTING.md with the plans-are-ephemeral policy. Migration file
comments referencing old specs are left as-is (historical records; content
recoverable from git history).

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

* docs: add 'What Silo is' identity section to CLAUDE.md

Captures the project's settled direction for agents and contributors: the
cluster-first scale bet, open-platform stance, the core-vs-plugin rule, KISS
taste, and the current QA-era posture. Deliberately names no other projects.

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

* docs: add glossary, dataflow map, and done-checklist to CLAUDE.md

Borrowed from T3 Code's hand-written AGENTS.md structure: a glossary pinning
the ambiguous nouns (account/profile, item/file, section, node, session,
jellycompat/v1), a five-line dataflow map of scanner-to-playback, an explicit
completeness checklist for client-visible changes, focused-tests-while-
iterating guidance, and a severity marker on the irreversible gotchas.

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

* docs: relax v1 API posture to match alpha reality

Pre-lock, restructuring the API is in scope and larger coordinated sweeps are
preferred over incremental breaks with compat shims. The additive-only rules
become binding at v1 lock (1.0); until then they are the design target for new
endpoints. The identity section now defers to the v1 rules section instead of
stating its own strictness level.

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

* docs: fix fact-check findings in distilled architecture docs

A code-verified fact-check pass caught two errors in the freshly distilled
docs and dead links left by the prune: invitations-onboarding named the
SQLite profile_onboarding table as the completion store when the default
backend is Postgres (user_profile_onboarding) behind userstore.UserStore;
notifications claimed allowed_mentions always serializes an empty parse list
when the payload actually omits the field (embeds cannot ping because content
is never set); v1-scope linked four times into the deleted docs/superpowers
tree, now pointed at settings-contract.md / playback-protocol-v3.md.

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

* docs: apply verified fact-check corrections, drop expired audit docs

A 29-doc fact-check pass (each claim chased to code, each finding
adversarially verified) found 8 docs with confirmed staleness. This applies
the corrections that belong on main:

- wiki/admin/collection-templates.md: rewritten against shipped code — the
  catalog has 100+ templates (doc listed ~34), five sources (doc listed
  three), the template-bundles feature was entirely undocumented, and the
  library picker is a multi-select. Now describes categories rather than
  enumerating templates so it cannot rot the same way again.
- architecture/observability.md: canonical component list gains access and
  diagnostics; the settings / webhook_sync api-handler exceptions are
  recorded as grandfathered.
- s3-storage-setup.md: 'Public Endpoint' renamed to the actual UI label
  'Read Endpoint' (s3.public_read_endpoint); the Cloudflare
  is_timed_hmac_valid_v0 guidance was verified correct against Cloudflare's
  docs and stands.
- design/2026-08-16-intro-skip-mode.md: status header corrected — shipped in
  silo-server (#660), not proposed.

Removed as expired rather than fixed:
- architecture/wholphin-endpoint-coverage.md: a 2026-06-09 endpoint audit
  whose 'missing/broken' claims were all fixed within a week (PRs #110,
  #164) and never updated; redoing the audit is the only honest fix.
- design/2026-07-09-streaming-write-deadline.md: marked 'planned' but
  shipped in the same commit that added it; the implementation and its
  tests (internal/httpstream/rolling_deadline.go) are the durable record.

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

---------

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

2 participants