SOURCE_RELATIONS.md
docs/features/SOURCE_RELATIONS.md
1# Source-provided related entries23Source-related browsing is implemented with the platform and bridge limitations4documented below. Related entries are separate from tracker recommendations and5watch-order discovery.67Open a remote title’s overflow menu → **Related entries**. The shared screen keeps8the source’s relation labels and order, opens a result through that same source,9and offers reload/retry. Loading, unsupported, empty and error states are distinct.10Failed refreshes retain usable results; opening an existing saved title preserves11its favourites, notes, credits and progress. Browsing does not add titles to the12library. Only a selected entry is cached, using the normal source-title path.13Requests belong to the screen’s ViewModel and cancel when it is cleared. A removed14source or rebound parent title cannot receive a late response or create an entry.15There is no database fallback that fabricates online relations.1617## Extension contract1819JavaScript extensions can optionally implement:2021```javascript22getRelated(url) {23 return [24 { name: "Sequel", animes: [25 { title: "Next season", url: "/anime/next", thumbnail_url: "/covers/next.jpg" }26 ] }27 ];28}29```3031The common client probes for the method before calling it. `items` is accepted in32place of `animes`; existing listing title/URL/image aliases are supported. Missing33methods are unsupported, and an empty returned array is a supported empty result.34Malformed roots and oversized results surface errors. At most 50 groups and 1,00035rows are accepted. Repeated labels merge in first-seen order, repeated URLs within36a group keep the first item, and invalid rows are skipped. Source links accept web37URLs or relative source paths; file/content/data schemes are rejected. Images use38the shared source HTTP(S) validation and relative resolution.3940The common Mihon client sends `getRelatedAnimeList` with `animeData.url`. It accepts41the upstream relation-array shape, or a bridge wrapper:4243```json44{"supported":true,"groups":[{"name":"Sequel","animes":[{"title":"Next","url":"/next"}]}]}45```4647The bundled Android bridge calls `AnimeSource.supportsRelatedAnime` and48`getRelatedAnimeList`, defaults older sources to unsupported, and forwards grouped49`SAnime` metadata. Other runtime formats default to unsupported until their API50provides relations. Desktop/iOS use a configured external JVM bridge and web uses51its configured HTTP bridge; those binaries must implement the method. Older bridge52errors remain visible and are not counted as an empty success. This change does not53upgrade external binaries or claim full compatibility with every extensions-lib 17 API.5455The pinned upstream contract is56[AnimeSource](https://github.com/Animetailapp/Animetail/blob/d0eab5d6237dd09ebdb21a63fff5b66097c91087/source-api/src/main/kotlin/eu/kanade/tachiyomi/animesource/AnimeSource.kt)57and [AnimeRelation](https://github.com/Animetailapp/Animetail/blob/d0eab5d6237dd09ebdb21a63fff5b66097c91087/source-api/src/main/kotlin/eu/kanade/tachiyomi/animesource/model/AnimeRelation.kt).5859## Verification6061Verification passed 57 desktop checks and 51 Kotlin/Wasm browser tests without62failures/errors/skips; the bundled Android bridge unit suite was up to date and63passing, and Android, iOS simulator ARM64, desktop and web compiled. Tests cover64codec shapes, unsupported vs empty results, bridge errors, source isolation, saved65entry preservation, cancellation and late responses after rebinding, plus a rendered66desktop click on a related row. Compact/wide desktop Compose captures received a67scoped `ship` finish review. Native-device UI/accessibility/frame rate and live68third-party extensions/bridges are unverified.69