Skip to content

feat(jellycompat): add Filters2, LocalTrailers, UserImage, ClientLog and Sessions endpoints - #164

Merged
Quick104 merged 4 commits into
Silo-Server:mainfrom
d3v1l1989:feat/jellycompat-missing-client-endpoints
Jun 16, 2026
Merged

Quick104 merged 4 commits into
Silo-Server:mainfrom
d3v1l1989:feat/jellycompat-missing-client-endpoints

Conversation

@d3v1l1989

Copy link
Copy Markdown
Contributor

Problem

Five endpoints that real Jellyfin clients call were unregistered and fell through
to chi's default 404 (or, for /Items/Filters2, were swallowed by /Items/{id}
→ JSON "Item not found"). Surfaced from real client traffic against the compat
surface:

  • Fladder's filter sheet calls /Items/Filters2.
  • Infuse/Moonfin probe /Items/{id}/LocalTrailers on every item-detail load.
  • okhttp clients fetch avatars from /UserImage?userId=.
  • Android-TV / Fire-TV apps POST /ClientLog/Document (crash bundles).
  • Wholphin polls GET /Sessions every few seconds (a ~289-per-4h 404 storm the
    jellyfin-sdk could not deserialize).

Approach

All additive and contract-faithful to the Jellyfin C# server:

  • GET /Items/Filters2 → 200 QueryFilters v2 shape (Genres NameGuidPair[],
    Tags, Audio/SubtitleLanguages NameValuePair[]), all empty arrays.
  • GET /Items/{id}/LocalTrailers (+ /Users/{userId}/Items/{id}/LocalTrailers
    alias) → 200 bare BaseItemDto[] ([]; Silo indexes no local trailers —
    note this is the bare array, not the {Items,…} envelope).
  • GET|HEAD /UserImage?userId= → the same anonymous palette avatar as the legacy
    /Users/{id}/Images/Primary route; HandleUserImage reads the id from the
    query param when the path segment is absent (this is Jellyfin's modern route;
    the path form is [Obsolete]).
  • POST /ClientLog/Document → drains the body (1,000,000-byte cap, matching
    ClientLogController.MaxDocumentSize) and returns 200 {FileName}; 413 over the
    cap. Silo has no client-log store, so the body is discarded.
  • GET /Sessions → 200 contract-shaped SessionInfoDto[], currently empty
    (consistent with the existing compat stub handlers); populating live
    session/now-playing state is a follow-up.

Auth placement mirrors Jellyfin: /Sessions, /ClientLog/Document, /Items/Filters2
and LocalTrailers are [Authorize] (registered inside the session-auth group);
/UserImage is anonymous (Jellyfin's route has no [Authorize] either).

Testing

  • Per-handler unit tests for each endpoint (shapes, 401-without-session, 413).
  • A NewRouter/ServeHTTP router test asserting registration, chi
    static-vs-{id} ordering (/Items/Filters2 reaches the v2 handler, not
    /Items/{id}), and auth placement (group routes 401 unauthenticated; /UserImage
    served anonymously). Mutation-verified (dropping a route turns it RED).
  • gofmt/go vet clean; full internal/jellycompat suite green in the
    libvips-capable container.

Scope note

These are new compat routes, and the v1 scope (docs/architecture/v1-scope.md) is
not yet locked. Filing as Jellyfin-compatibility hardening — parity with the
already-merged jellycompat work (#157–#161) and the existing empty-stub handlers
(HandleItemStub, HandleFiltersStub, …) rather than a new product capability.
Happy to split this into smaller PRs, or hold any individual endpoint, if
preferred.


AI-assisted: the missing endpoints were identified from production jellycompat
request captures; every line reviewed, and the tests run, by me.

…og endpoints

Four endpoints that real Jellyfin clients call were unregistered and fell
through to chi's default 404 (or, for Filters2, were swallowed by /Items/{id}).
All are additive and contract-faithful to the Jellyfin C# server:

- GET /Items/Filters2 -> 200 QueryFilters v2 shape (Genres NameGuidPair[],
  Tags, Audio/SubtitleLanguages), empty arrays. Fladder's filter UI 404'd before.
- GET /Items/{id}/LocalTrailers (+ /Users/{userId}/... alias) -> 200 bare
  BaseItemDto[] ([]); Silo indexes no local trailers. Infuse/Moonfin hit this
  on every item-detail load.
- GET|HEAD /UserImage?userId= -> the same anonymous palette avatar as the
  legacy /Users/{id}/Images/Primary route; HandleUserImage now reads the id
  from the query param when the path segment is absent (modern Jellyfin route).
- POST /ClientLog/Document -> 200 {FileName} after draining/discarding the
  body (Silo has no client-log store); 413 over 1 MiB, matching MaxDocumentSize.

Stops recurring 404 noise and lets clients that depend on these (filter sheets,
avatars, crash-log upload) work. Adds handler unit tests for each.
…ion list

Wholphin and other jellyfin-sdk clients poll GET /Sessions (optionally
?deviceId=) every few seconds during playback; the route was unregistered, so
each poll hit a chi 404 the SDK could not deserialize — a ~289-per-4h 404 storm
in production. Register it under the same [Authorize] group Jellyfin uses and
return a correctly-typed SessionInfoDto[] (currently empty, consistent with the
existing compat stub handlers). This stops the storm and lets clients degrade
cleanly; populating live session/now-playing state from the playback store is a
follow-up.
Use 1,000,000 bytes (Jellyfin's ClientLogController.MaxDocumentSize, decimal)
instead of 1<<20, and fix the comment that wrongly called it 1 MiB. Behavior is
functionally identical (the body is discarded); this is contract-fidelity only.
Review follow-up.
The per-handler tests call handlers directly and never exercise NewRouter, so
route registration, chi static-vs-{id} ordering, and auth-group placement were
untested — the one thing this change is actually about. Add a full
NewRouter/ServeHTTP test asserting the session-auth-group routes (Filters2,
LocalTrailers x2, Sessions, ClientLog/Document) return 401 unauthenticated
(registered + behind auth, not 404 or accidentally anonymous), /UserImage serves
its anonymous palette avatar, and an authenticated Filters2 reaches the v2
filters handler (not shadowed by /Items/{id}) with /Sessions returning [].
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@d3v1l1989, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 11 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bf0ca24f-6f88-4710-8319-7bd77280ce4b

📥 Commits

Reviewing files that changed from the base of the PR and between 203d9be and 5f97696.

📒 Files selected for processing (8)
  • internal/jellycompat/dto.go
  • internal/jellycompat/handlers_clientlog.go
  • internal/jellycompat/handlers_images.go
  • internal/jellycompat/handlers_items.go
  • internal/jellycompat/handlers_missing_endpoints_router_test.go
  • internal/jellycompat/handlers_missing_endpoints_test.go
  • internal/jellycompat/handlers_sessions.go
  • internal/jellycompat/router.go
✨ 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

Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

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

@Quick104
Quick104 merged commit bf1c5cc into Silo-Server:main Jun 16, 2026
1 check passed
Quick104 pushed a commit that referenced this pull request Jun 17, 2026
…and Sessions endpoints (#164)

* feat(jellycompat): add Filters2, LocalTrailers, UserImage and ClientLog endpoints

Four endpoints that real Jellyfin clients call were unregistered and fell
through to chi's default 404 (or, for Filters2, were swallowed by /Items/{id}).
All are additive and contract-faithful to the Jellyfin C# server:

- GET /Items/Filters2 -> 200 QueryFilters v2 shape (Genres NameGuidPair[],
  Tags, Audio/SubtitleLanguages), empty arrays. Fladder's filter UI 404'd before.
- GET /Items/{id}/LocalTrailers (+ /Users/{userId}/... alias) -> 200 bare
  BaseItemDto[] ([]); Silo indexes no local trailers. Infuse/Moonfin hit this
  on every item-detail load.
- GET|HEAD /UserImage?userId= -> the same anonymous palette avatar as the
  legacy /Users/{id}/Images/Primary route; HandleUserImage now reads the id
  from the query param when the path segment is absent (modern Jellyfin route).
- POST /ClientLog/Document -> 200 {FileName} after draining/discarding the
  body (Silo has no client-log store); 413 over 1 MiB, matching MaxDocumentSize.

Stops recurring 404 noise and lets clients that depend on these (filter sheets,
avatars, crash-log upload) work. Adds handler unit tests for each.

* feat(jellycompat): add GET /Sessions returning a contract-shaped session list

Wholphin and other jellyfin-sdk clients poll GET /Sessions (optionally
?deviceId=) every few seconds during playback; the route was unregistered, so
each poll hit a chi 404 the SDK could not deserialize — a ~289-per-4h 404 storm
in production. Register it under the same [Authorize] group Jellyfin uses and
return a correctly-typed SessionInfoDto[] (currently empty, consistent with the
existing compat stub handlers). This stops the storm and lets clients degrade
cleanly; populating live session/now-playing state from the playback store is a
follow-up.

* refactor(jellycompat): match Jellyfin client-log size limit exactly

Use 1,000,000 bytes (Jellyfin's ClientLogController.MaxDocumentSize, decimal)
instead of 1<<20, and fix the comment that wrongly called it 1 MiB. Behavior is
functionally identical (the body is discarded); this is contract-fidelity only.
Review follow-up.

* test(jellycompat): add router-level coverage for the new endpoints

The per-handler tests call handlers directly and never exercise NewRouter, so
route registration, chi static-vs-{id} ordering, and auth-group placement were
untested — the one thing this change is actually about. Add a full
NewRouter/ServeHTTP test asserting the session-auth-group routes (Filters2,
LocalTrailers x2, Sessions, ClientLog/Document) return 401 unauthenticated
(registered + behind auth, not 404 or accidentally anonymous), /UserImage serves
its anonymous palette avatar, and an authenticated Filters2 reaches the v2
filters handler (not shadowed by /Items/{id}) with /Sessions returning [].
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