Repository navigation
feat(catalog): show an advisory age on item detail, behind a profile setting - #1417
Conversation
|
Warning Review limit reachedNext included review available in 7 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (49)
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. Comment |
There was a problem hiding this comment.
Quick104 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87d993ad69
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <SettingRow | ||
| label="Show advisory age" | ||
| description="Show a suggested minimum viewer age, such as Common Sense Media's, on item detail. This is advice for you, not a restriction: it never changes what anyone can watch." | ||
| control={(id) => ( | ||
| <Switch | ||
| id={id} | ||
| checked={read<boolean>(SETTING_KEYS.CATALOG_SHOW_ADVISORY_AGE)} |
There was a problem hiding this comment.
Hide the toggle until the server advertises it
When this web client connects to a server with a pre-revision-10 settings manifest, the page already knows from useSettingsCapabilities that catalog.show_advisory_age is unsupported, but it still renders an enabled switch and includes the key in the effective-settings request. Reads silently omit unknown keys, so the control misleadingly displays the local default; changing it then attempts a write that the older server refuses. Gate both the row and requested key with settingsCapabilitiesSupportKey, as the detail-page hook already does.
AGENTS.md reference: AGENTS.md:L231-L232
Useful? React with 👍 / 👎.
| // Resolved once here rather than in each content component: the badge is a | ||
| // display choice, and a leaf component should not have to fetch to render. | ||
| // Items without an advisory skip the lookup, which is most of them. | ||
| const showAdvisoryAge = useShowAdvisoryAge(item?.advisory_age != null); |
There was a problem hiding this comment.
Propagate advisory ages to episode detail
For an episode whose parent series has an advisory, this hook can never enable a badge: buildEpisodeDetail does not copy the parent series' AdvisoryAge or AdvisorySource into the returned detail, and the episode branch passes no preference to EpisodeContent, whose MetadataBadges receives only duration. This conflicts with the new episode catalog propagation and means opted-in profiles see the badge on the series but lose it after opening an episode; populate the episode detail from its parent and render it through the same preference.
Useful? React with 👍 / 👎.
…setting MDBList reports a Common Sense Media advisory age alongside the release certification. Silo dropped it. Store it, serve it on /api/v2, and render it on item detail for profiles that ask for it. The advisory is display only and never reaches a parental control. It does not feed content_rating_age or ApplyContentRatingCeiling, and it has no index, because the provider that supplies it spends one request per title against a 1000/day free tier: on a real library it enriches an arbitrary slice and goes quiet until the next day. That is fine for a badge and unacceptable for a ceiling, where titles would tighten or not for reasons no admin can predict or reproduce, changing daily. The age and its source move together everywhere — through the plugin Struct, the provider merge, and the storage boundary — so the UI never shows a number it cannot attribute. models.AdvisoryColumns enforces that on write, including on the COPY-based bulk import, which cannot use a NULLIF in SQL. /api/v1 is frozen, so the new fields ride the shared Go structs with json:"-" and only /api/v2 emits them, the way ItemDetail already carries OriginalLanguage. The bundle record does carry them: unlike content_rating_age they cannot be re-derived, and a restore that dropped them would need a fresh enrichment pass against that same rate limit. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
87d993a to
c9418de
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9418de856
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func AdvisoryColumns(age *int, source string) (*int, *string) { | ||
| if age == nil || *age <= 0 || source == "" { | ||
| return nil, nil | ||
| } | ||
| return age, &source |
There was a problem hiding this comment.
Reject invalid advisory values during catalog import
When an administrator imports a format-v2 catalog seed, every import path passes the decoded pair through this helper, but it accepts any positive integer and any nonempty source. A bundle containing advisory_age: 99 and advisory_source: "unknown" is therefore persisted and later emitted outside the v2 source enum and the 1–21 range enforced for plugin metadata; an age above the smallint limit instead aborts the entire import. Validate the recognized sources and age range here, or reject the bundle before writing it.
Useful? React with 👍 / 👎.
Silo-Server#1417 took settings revision 10 for catalog.show_advisory_age, and every manifest change bumps the revision. Move the theme music keys to revision 11 so a client pinned to 10 does not expect them, and regenerate the bindings. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* feat(catalog): add opt-in local theme music * fix(web): stop theme music before opening trailers * fix(scanner): bound theme directory ancestor traversal * fix(scanner): isolate theme failures and reconcile ownership * fix(catalog): align theme audio delivery and API conventions * fix(settings): gate theme controls on server capabilities * fix(scanner): reject malformed theme directory paths * fix(settings): wait for effective theme values before editing * fix(contracts): preserve theme settings revision after rebase * test(web): account for theme settings in series request budget * chore(contracts): regenerate the v2 contract digest after rebasing onto main Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(catalog): carry the unrated-content decision into theme grant rechecks The theme audio route rebuilt the viewer's catalog filter field by field and missed AllowUnratedContent, added to the access scope by #1359. With access.unrated_content allowing unrated titles, a ceilinged profile could see an unrated title's theme and mint a grant that the audio request then refused. Build the filter through one scope mapping shared with AccessFilterFromContext. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * feat(catalog): negotiate theme delivery and serve themes from signed paths Themes gain a delivery: the original bytes, or a progressive AAC conversion for clients that cannot decode the original. Negotiate picks one from the formats a client reports; a client that reports none keeps the original. Grant minting no longer opens the file, so an API node without media mounts can authorize a theme a worker serves. Converted grants use their own audience, so an API that predates conversion refuses them instead of serving the original. ServeFile and ServeConverted serve a theme from a signed path on any node, and IsActiveTheme lets transcode nodes approve a theme input by id and exact path. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * feat(playback): add theme audio token methods, worker markers and bounded recipes Theme tokens get their own play methods, which workers that predate them reject, and claims that pin the theme file's id, size and modification time. Two transport features let route planning skip proxies and transcode nodes that cannot serve themes. PutTTL lets a transport with no session lifecycle store its recipe for no longer than its token lives. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * feat(playback): route theme audio through the video routing policy Add a theme router that resolves original theme bytes as direct play and AAC conversions as progressive remux through noderouting, so themes follow the same egress and execution policy as video: a proxy serves the bytes by default, and a conversion runs on a transcode node relayed by a proxy, with the same ranked fallbacks and proxy_only/worker_only boundaries. Workers are eligible only when their stored capability report advertises theme support, so an older proxy or transcode node is skipped instead of handed a token it cannot serve. Each authorization reserves capacity under a fresh theme identity; the reservation and the transcode recipe expire with the short-lived token. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * feat(proxy): serve routed theme audio on /stream/theme Proxies serve theme tokens on their own route: original files with ranges after a size and modification-time check, progressive AAC conversions run on the proxy, or conversions relayed from the transcode node the API reserved. Theme tokens are refused on every video route and video tokens here. Theme traffic is a transfer, not a playback session, so it neither counts toward nor is refused by stream caps; node session reports label it theme_audio, as downloads are labeled download. Proxies advertise theme_audio_egress_v1. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * feat(transcodenode): convert approved theme audio on /remux Transcode nodes accept theme_aac_v1 recipes on the progressive remux route. Theme files are not media_files rows, so a separate theme authority approves the input by theme id and exact path in an enabled library, and checks that the file is the one the token described; video tokens still go through the media-file catalog only. Nodes advertise theme_audio_execution_v1 only when that authority is wired, and report theme conversions as theme_audio transfers rather than playback sessions. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * feat(catalog): authorize routed and converted theme playback createThemeSongPlayback accepts the formats a client decodes and answers with where to play the theme: a proxy URL when routing sends the bytes through a worker, or this node's grant route otherwise. The response names the delivery and content type; a client that decodes neither the original nor the AAC conversion gets 406, and a policy no route satisfies gets 503. A request without formats keeps receiving the original, as before. Converted grants on this node's audio route stream the AAC conversion. The capability reports routed delivery and whether conversion and cluster routing are available. The proxy theme route joins the migration ledger. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * feat(jellycompat): route and convert theme audio like compatibility video Jellyfin theme audio follows the playback routing policy: a routed theme is a 307 to the reserved proxy, as compatibility video is, and a policy with no legal route answers 503 instead of serving from the API. When the original does not fit the request, a request that names an MP4 target and accepts AAC gets the progressive AAC conversion, seeked by StartTimeTicks; HLS theme transcoding and requests that name no target stay refused. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * feat(web): request playable theme formats and replay converted themes The detail page reports which theme formats the browser decodes, probed once with canPlayType, so the server can send the original or its AAC conversion. A browser that reports nothing keeps receiving the original. A converted theme streams without byte ranges, so looping replays it with a fresh grant on ended instead of relying on the element's loop. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs: describe routed and converted theme audio Document theme format negotiation, routing through the playback policy, the proxy and transcode-node theme contracts, the Jellyfin conversion rules, and the token-only authorization of proxy theme URLs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(catalog): tighten theme conversion availability and replay Offer a conversion only when a route could run it: a transcode node counts only behind a proxy that serves themes and relays progressive remux, with the recipe store enabled; otherwise the client gets 406 (400 on the Jellyfin routes) instead of a retryable 503. A policy that admits no theme route is no longer marked retryable. The capability reports local_direct_play without a worker pool. Node capability reports are parsed before the planner lock is taken. The web player replays a converted theme only after it played, so a conversion that ends empty cannot loop forever. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(settings): introduce the theme music settings in revision 11 #1417 took settings revision 10 for catalog.show_advisory_age, and every manifest change bumps the revision. Move the theme music keys to revision 11 so a client pinned to 10 does not expect them, and regenerate the bindings. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * chore(contracts): regenerate the v2 contract digest after rebasing onto main Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Quick104 <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…up IDs (#1428) A metadata plugin provider only ran when the item carried an ID of the provider's own. The MDBList plugin never identifies titles, so no item ever had an "mdblist" ID and Silo never called it: the advisory age from #1417 and MDBList's ratings stayed empty on every library. A capability can now declare lookup_provider_ids in its manifest metadata, a list of provider-ID keys it can look an item up by. Silo calls GetMetadata when the item carries any one of them, with an empty ProviderId. Images, seasons and episodes stay gated on the provider's own ID, since those address the provider's own catalog. The key is new rather than a reuse of required_external_ids, which the markers capability reads as "all of these are required". Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
* feat(access): limit a profile by advisory age Household managers could restrict a profile by content rating only. The advisory age from #1417 (Common Sense Media's "13+", or MDBList's own estimate) was a badge, although it separates titles that one rating tier lumps together, which is how many parents already decide. A profile now carries max_advisory_age (1..21, null for none). A title is hidden when its advisory age is above the limit, ANDed with the content-rating ceiling. A title with no advisory age is never hidden by it: coverage comes from a rate-limited provider, so a missing age means "not fetched yet", and the ceiling alone decides it. The limit can only tighten what a profile sees, never widen it. Enforcement goes through the one SQL point the ceiling already uses, renamed ApplyMaturityLimits. The ceiling, the unrated-content flag and the new limit now travel as one access.MaturityLimits value, embedded in access.Scope and every catalog filter. The ~25 sites that rebuild a narrowed filter copy it whole, so a later limit cannot be dropped the way the unrated flag once was. episode_catalog_entries gains advisory_age, maintained by the series trigger, so episode listings apply the limit too. Profile storage (Postgres and SQLite), the scope policy (Rego, with an override that can only lower the limit), both resolvers, cache keys and the cursor digest carry it. Changing it bumps access_policy_revision like the ceiling does. /api/v1 is frozen, so the field rides the shared structs with json:"-"; /api/v2 profiles expose it with max_advisory_age_supported as the feature flag, and the admin dashboard stats report advisory_titles so an admin can see the coverage the limit acts on. The web profile editor gains the control and the docs drop the display-only wording. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(access): keep the advisory-age limit off book libraries and older servers Review follow-ups on the advisory-age limit. Only movies and series carry an advisory age now: the plugin provider drops one reported for any other item type, so the profile limit can never hide an audiobook or ebook in the beta book libraries. The Audiobookshelf author list keeps its precomputed-count path when only an advisory limit is set, since that limit cannot hide a book. The web profile editor honors max_advisory_age_supported: it shows the control and sends max_advisory_age only when listProfiles reports the server supports it. An older server rejects unknown members, so a frontend pointed at one would otherwise fail every profile save. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(access): clear stored book advisory ages and offer every limit Review follow-ups on the advisory-age limit. The migration clears advisory ages on rows that are not movies or series. The host now drops such ages on intake, but a refresh never clears a stored one, so an age a book picked up earlier would have kept it under the limit. The provider that supplies advisory ages only answers for movies and series, so this normally matches nothing. The web editor offers every limit the server accepts, 1 through 21, so a profile set to any valid limit by another client opens on a matching option. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(catalog): store advisory ages for movies and series only A catalog-bundle import could still write an advisory age onto an audiobook or ebook row after the migration cleared them, which would bring the book back under a profile's advisory-age limit. models.AdvisoryColumns, the one function every advisory write goes through (item upserts and every catalog-bundle import path), now takes the item type and stores NULL for anything but a movie or series. The plugin provider uses the same models.AdvisoryAgeApplies rule. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * chore(models): name the advisory item types Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Problem
MDBList returns a Common Sense Media advisory age next to the release certification — for Jaws,
certification: "PG"withage_rating: 13. Silo discarded it. A household parent deciding what a child may watch has the certification and nothing else, even when a better-targeted recommendation was already in the provider response.An advisory age is not a certification. "PG" is what a rating board issued; "Common Sense suggests 10+" is advice aimed at a parent. The two disagree often, and the second one is the one a parent actually wants.
Solution
Store the advisory age and its source on
media_items, serve both on/api/v2, and render a badge on item detail for profiles that turn on the newcatalog.show_advisory_agesetting (profile-scoped, default off).The advisory never reaches a parental control. It does not feed
content_rating_ageorApplyContentRatingCeiling, and it gets no index, because enforcement would be actively harmful here. The plugin that supplies it spends one MDBList request per title against a 1000/day free tier, so on any real library it enriches an arbitrary slice and goes quiet until the next day. That is fine when the consequence is "some titles show a badge and others do not". As a ceiling input it would mean titles tightening or not for reasons no administrator can see, predict, or reproduce, changing daily — the exact unpredictability #1359 was written to remove.Storing the column now also makes the enforcement question cheap to answer later: it becomes a query change decided against measured coverage on a real library, rather than a re-scan decided in the abstract.
Three decisions worth review:
models.AdvisoryColumnscollapses any half-populated pair to NULL on write — including on the COPY-based bulk import, which cannot lean on aNULLIFin SQL./api/v1is untouched.SectionItemViewandCollectionItemVieware type aliases to the frozen v1 response structs, so the new fields carryjson:"-"and only/api/v2emits them.catalog.ItemDetaildoes the same, matching how it already carriesOriginalLanguage. A test asserts the v1 bodies stay clean.content_rating_ageit cannot be re-derived from anything else in a bundle, so a restore that dropped it would need a fresh enrichment pass against that same daily limit.Plugin input is treated as hostile:
advisory_agemust be a whole number in range,advisory_sourceis allow-listed tocommonsenseormdblist, and anything else is dropped rather than rounded or stored.No jellycompat work: Jellyfin has
OfficialRatingandCustomRatingand no advisory concept, so there is nothing to map. No new capability endpoint: the settings contract capabilities document already reports the key from its manifest revision, which is how every other setting is detected.Validation
Full gate green: Go build,
gofmt,go vet,make lint-changed(0 issues),make test-go,make test-web(5078 passing), web lint/format/build/budget, every generated-artifact and fixture gate, andmake test-db-pins(19/19). The OpenAPI diff is 54 changes, all additive optional properties, none breaking.Exercised by hand on an isolated sandbox with seeded advisory data:
/api/v2item detail and card listings carry both fields; items without an advisory omit both./api/v1catalog and item-detail bodies return the same items withcontent_ratingand zero advisory keys.falsefromdefault, thentruefromprofileafter a write, and the settings toggle round-trips through the UI.Two bugs the sandbox run caught that unit tests and local typechecking missed, both now covered by tests: the web
ItemDetailtype is hand-maintained rather than generated, andcatalogItemDetailFromV2maps field by field, so a field the server sends but the mapper does not copy is dropped silently.Not validated: the live plugin path. The advisory data was seeded directly, so everything from the plugin's MDBList call through
GetMetadatainto the column is proven only by unit tests, not against the real provider.silo-plugin-metadata-mdblistalready emits both keys onmainbut is not in thesilo-pluginscatalog, so publishing it is separate work.Risk and follow-up
The main risk is breadth rather than depth: the shared item column lists and scans in
item_repo,browse, andsectionsall gained two columns, and a scan that drifted from its select list would fail loudly at runtime. The repository's ownTestEpisodeCatalogSelectBodyExposesQualifiedColumnsguard caught exactly that during development, and the added round-trip tests cover the rest.One open question before this reaches users: MDBList's
commonsenseflag is read as "this age came from Common Sense Media". The plugin's own tests treat it that way and a captured fixture agrees, but that is one fixture, not documentation. Worth confirming before the badge carries that label.Follow-ups to file for the clients: badge plus toggle on
silo-appleandsilo-android, andmake apiv2-fixtures-syncfor the moved contract digest.Related issue: N/A
Validation tasks: changes #199 (Detail metadata criterion), #1252 C2 (series detail metadata); no change to content-rating enforcement on #197, #198, #1250
AI disclosure
Written by Claude Opus 5 (model identifier
claude-opus-5[1m]) running in Claude Code as the agent harness, driven interactively by the maintainer. No other AI tooling was used. The maintainer directed the approach, chose where the fields land on the v2 contract, and reviewed the result; the hand validation above was run against a disposable sandbox.🤖 Generated with Claude Code