ADR-0039: Single source of truth for metadata across *arr, Stash, Jellyfin and SnatchArr¶
- Status: Proposed (design questions
OQ-0039-1toOQ-0039-6answered 2026-10-26, ledger idssnatcharr-oq-0039-1tosnatcharr-oq-0039-6; scope questionsOQ-0039-7toOQ-0039-10answered 2026-10-26, ledger idssnatcharr-oq-0039-7tosnatcharr-oq-0039-10) - Date: 2026-10-26
- Deciders: lusoris
- Related:
- ADR-0006: Download-client backpressure via the *arr Queue API
- ADR-0018: SnatchArr as the product front door
- ADR-0026: Accounts, roles, Jellyfin sign-in and per-user views
- ADR-0027: Optional adult module — Whisparr v2/v3, multi-stash-box favourites and image sets
- ADR-0028: Jellyfin companion plugin for adult scene and image-set metadata
- ADR-0031: Creator content catalogued in FansDB inside the adult module
- ADR-0032: Stash in the adult stack — integrate for inventory and hand-off, do not re-implement
- ADR-0033: Normalized adult identity and metadata model
- ADR-0034: Probabilistic matching engine, field reconciliation and outbound model connection for the adult catalog
- ADR-0036: Community requests and voting across every library
- ADR-0037 (proposed): Numbered and studio-scoped performer identities
Context¶
Self-hosted media stacks combine multiple specialized services that touch the same underlying media items:
- SnatchArr (
/ˈsnætʃ.ɑːr/, from English snatch — to grab missing or cutoff-unmet releases — and the-*arrmedia-automation suffix): the rate-budgeted wanted-search scheduler and library-policy control plane (api/,worker/,web/). - Whisparr (
/ˈwɪs.pɑːr/, from English whisper and the-*arrsuffix): the adult video manager across two active lineages — Whisparr v2 (a Sonarr-derived site-and-episode hierarchy) and Whisparr v3, code-named Eros (/ˈɪər.ɒs/, after the Greek deity of attraction; a Radarr-derived scene-and-movie model). - Stash (
/stæʃ/, from English stash — a private store or collection; also referred to as StashApp/ˈstæʃ.æp/): the self-hosted local organizer and GraphQL server for adult video scenes, image galleries, performers, and file fingerprints. - stash-box (
/ˈstæʃ.bɒks/, a compound of Stash and box denoting a community metadata repository): the open-source GraphQL metadata engine powering community adult catalogs such as StashDB (/ˈstæʃ.diː.biː/, Stash Database) and creator-content instances (ADR-0031: Creator content catalogued in FansDB inside the adult module). - ThePornDB (
/ðə ˈpɔːrn.diː.biː/, abbreviated TPDB/ˌtiː.piː.diːˈbiː/, named by analogy with TheMovieDB and TheTVDB): the community REST and stash-box-compatible metadata directory for adult scenes, movies, sites, and performers. - Jellyfin (
/ˈdʒɛl.i.fɪn/, from jellyfish and fin, originated as the community free-software fork of Emby/ˈɛm.biː/, itself named from Media Browser): the media server that renders libraries to end users and tracks per-user playback state. - Sonarr (
/ˈsoʊ.nɑːr/, blending sonar and-*arr, formerly NzbDrone): the television series manager backed by TheTVDB (/ðə ˌtiː.viː.diːˈbiː/, The Television Database, abbreviated TVDb) and TMDb (/ˌtiː.ɛm.diːˈbiː/, The Movie Database). - Radarr (
/ˈreɪ.dɑːr/, blending radar and-*arr, forked from Sonarr for cinema): the feature-film manager backed by TMDb and IMDb (/ˌaɪ.ɛm.diːˈbiː/, Internet Movie Database). - Lidarr (
/ˈlaɪ.dɑːr/, blending lidar and-*arr): the music collection manager backed by MusicBrainz (/ˌmjuː.zɪkˈbreɪnz/, an open music encyclopedia combining music and brain). - Readarr (
/ˈriː.dɑːr/, blending read and-*arr) and its maintained Readarr-class book-management forks Chaptarr (/ˈtʃæp.tɑːr/, from chapter and-*arr) and Bookshelf (/ˈbʊk.ʃɛlf/, a literal compound of book and shelf): book and audiobook managers backed by Goodreads (/ˈɡʊd.riːdz/), OpenLibrary (/ˈoʊ.pən ˌlaɪ.brɛr.i/), and Hardcover (/ˈhɑːrd.kʌv.ər/). - Seerr (
/ˈsiː.ər/, from English seer — one who looks ahead — unifying Overseerr/ˌoʊ.vərˈsiː.ər/and Jellyseerr/ˈdʒɛl.i.siː.ər/): the request-management front door. - Prowlarr (
/ˈpraʊ.lɑːr/, from prowl and-*arr): the indexer proxy and search aggregator. - Configarr (
/kənˈfɪɡ.ɑːr/, from configure and-*arr): the declarative synchronizer for*arrquality profiles and custom formats. - golusoris (
/ˌɡoʊ.luːˈsɔːr.ɪs/, from Go and Latin lusoris, genitive of lusor — "of the player/maker"), goenvoy (/ˌɡoʊˈɛn.vɔɪ/, from Go and envoy — a diplomatic messenger between services), and sveltesentio (/ˌsvɛltˈsɛn.ti.oʊ/, from Svelte/svɛlt/— slender — and Latin sentio — "I perceive"): the shared Go application framework (github.com/golusoris/golusoris), multi-service API client monorepo (github.com/golusoris/goenvoy), and accessible frontend toolkit (@sveltesentio/*) used by SnatchArr.
The multi-refresh overwrite problem¶
Today, each service refreshes metadata on its own schedule from its own upstream provider or local .nfo (/ˌɛn.ɛfˈoʊ/, from info sidecar) files and overwrites fields that another service or the operator has already curated:
- Adult metadata clobbering across Whisparr, Stash, Jellyfin, and SnatchArr: Whisparr v3 (
whisparr_v3) refreshes scene records from a single configured stash-box or TPDB endpoint; Stash runs its own stash-box and scraper passes over the same video files; Jellyfin runs its own metadata providers or reads sidecar.nfofiles written by Whisparr. When an operator splits a false-merged performer in Stash, fixes a studio code in SnatchArr, or locks a title in Jellyfin, the next scheduled refresh in a sibling tool overwrites the correction or re-writes the sidecar file. - General media drift across
*arr, Seerr, and Jellyfin: Sonarr and Radarr own file naming, monitoring, and TMDb/TVDb acquisition metadata, while Jellyfin owns per-user playback progress (UserData) and local presentation overrides (LockedFields). When both*arrand Jellyfin write.nfofiles or refresh artwork without a clear ownership boundary, custom posters, sort titles, or tags revert on rescan. - Shipped baseline vs planned architecture in SnatchArr:
- Shipped in code today:
*arrinstance registry and afterglow memory ininstancesandprocessed_items(api/internal/store/migrations/postgres/000001_init.up.sql:8-69).- Seerr request cache and TMDb/TVDb-to-
*arrentity resolution inseerr_requests(000004_seerr.up.sql:5-31,api/internal/seerr/sync.go:153-185,api/internal/arrclient/resolve.go:26-63). - Jellyfin/Emby watch-state ingestion and TVDb-keyed season gating in
watchaware_sources,watchaware_item_watches, andwatchaware_gate_series(000029_watchaware.up.sql:5-33,000031_watchaware_gate.up.sql:9-23,000034_watchaware_tvdb.up.sql:4,api/internal/watchaware/module.go:47-55). - Jellyfin and proxy user identity mapping in
users.external_idanduser_identities(000026_user_external_id.up.sql:5,000037_user_identities.up.sql:5-14). - Adult module baseline (
000036_adult_module.up.sql:6-71,000038_adult_favorite_urls.up.sql:5-9,000039_adult_image_items_unique.up.sql:7-16): stash-box endpoint registry (adult_stashbox_instances), favourite performers and studios with cross-endpoint foreign ID links (adult_favorite_performers,adult_performer_links,adult_favorite_studios,adult_studio_links), deterministic URL/ID merger (api/internal/adult/merge.go:39-145), periodic stash-box link sync (api/internal/adult/sync.go:46-210), and filesystem image-set scanner with SHA-256 item checksums (adult_image_sets,adult_image_items,api/internal/adult/scan.go:45-463).
- Planned (not yet shipped in code):
- Normalized adult catalog (
adult_performers,adult_studios,adult_scenes,adult_movie_scenes,adult_tags,adult_external_refs,adult_scene_fingerprints,adult_field_provenance,adult_identity_events,adult_identity_exclusions,adult_identity_suggestions) in ADR-0033. - Fellegi-Sunter probabilistic matching engine, per-field reconciliation (
ignore,merge,overwrite), audit workbench, and privacy-fenced model connection in ADR-0034. - Jellyfin companion plugin (
jellysin/plugin-snatcharr) and/api/v1/adult/jellyfin/*//api/v1/adult/metadata/scenedelivery endpoints in ADR-0028. - Stash inventory integration and
.stashignorehand-off in ADR-0032. - Cross-library community requests and voting (
requeststable) in ADR-0036. - Numbered and studio-scoped performer identities in ADR-0037 (proposed).
- Normalized adult catalog (
This ADR defines the single-source-of-truth contract across all of these systems: which system owns each field, which external IDs join records across boundaries, how synchronization runs and defaults to read-only, how conflicts and user locks resolve, how duplicates merge without ever matching on name alone, and how the stack degrades when Stash or Whisparr is absent.
Decision¶
1. Field ownership¶
Every metadata and state attribute has exactly one owning system (the canonical authority where the reconciled truth lives), an explicit set of readers, and a restricted set of writers. Adult module rows (ADR-0027, ADR-0031, ADR-0032, ADR-0033, ADR-0034) are separated from general media rows (sonarr, radarr, lidarr, readarr, seerr, jellyfin) because SnatchArr acts as the normalizing metadata hub for adult entities (ADR-0033), whereas for general media the respective *arr instance and its upstream catalog (TMDb, TVDb, MusicBrainz, book providers) remain canonical for catalog metadata while SnatchArr owns only request routing, rate budgets, and watch-aware monitoring policy.
1a. Adult module field ownership (whisparr_v2, whisparr_v3, stash, stash-box, theporndb, jellyfin, snatcharr)¶
| Domain & Field | Canonical Table / Struct | Owning System | Who May Read | Who May Write | Status |
|---|---|---|---|---|---|
Scenes & Movies: canonical title, synopsis (details), release date, production date, duration, director, studio code (code), item_kind (scene | movie | jav), movie-to-scene track list |
adult_scenes, adult_movie_scenes + adult_field_provenance (ADR-0033) |
SnatchArr (reconciled from stash-box, theporndb, whisparr, stash per priority & locks) |
SnatchArr UI, Jellyfin via jellysin/plugin-snatcharr (ADR-0028), Stash/Whisparr (if write-back opt-in enabled, OQ-0039-2) |
SnatchArr adult.Ticker sync + matching engine (ADR-0034), SnatchArr admin via audit workbench (locked_by_user = TRUE) |
Planned (ADR-0033, ADR-0034) |
| Scenes & Movies: wanted/monitored flag, quality profile, root folder, release grab history | whisparr.Movie (Monitored, QualityProfileID, RootFolderPath) / whisparr.Series & whisparr.Episode (github.com/golusoris/goenvoy/arr/whisparr) |
Whisparr (whisparr_v2 / whisparr_v3) |
SnatchArr worker (LeaseRun), SnatchArr API (arrclient) |
Operator in Whisparr, Configarr (quality profiles), SnatchArr (search trigger & AddMovie / AddSeries on favourite auto-add) |
Shipped (search dispatch); auto-add planned (ADR-0027) |
| Scenes & Movies: interactive scene markers, chapter timecodes, sprite sheets, multi-scene single-file cut points | Stash SceneMarker / Scene GraphQL schema (ADR-0032) |
Stash | Stash UI, operator | Stash local scanner / Stash user edits (SnatchArr never parses video timecodes) | Stash-owned (ADR-0032) |
Performers: canonical name, disambiguation, aliases, gender, birthdate, deathdate, country, ethnicity, physical attributes, career years, tattoos, piercings, per-scene credited_as |
adult_favorite_performers (000036_adult_module.up.sql:19-28, shipped); adult_performers, adult_scene_performers, adult_field_provenance (ADR-0033, planned) |
SnatchArr (reconciled from prioritized stash-box instances and theporndb) |
SnatchArr UI, Jellyfin companion plugin (ADR-0028) | SnatchArr adult.Ticker (api/internal/adult/sync.go:75-114, shipped for favourites), matching engine & admin audit queue (ADR-0034, planned) |
Favourites shipped; full bio planned (ADR-0033) |
| Performers: favourite / auto-snatch subscription flag | adult_favorite_performers (000036_adult_module.up.sql:19-28) |
SnatchArr | SnatchArr planner, Whisparr sync, community request voter view (ADR-0036) | SnatchArr admin (POST /api/v1/adult/favorites/performers), promoted community requests (ADR-0036) |
Shipped (api/internal/adult/service.go) |
Studios & Networks: canonical name, parent studio (parent_studio_id), top-level network (network_studio_id), aliases, URLs |
adult_favorite_studios (000036_adult_module.up.sql:39-47, shipped); adult_studios (ADR-0033, planned) |
SnatchArr (reconciled from stash-box Studio.Parent and theporndb Site.ParentID / NetworkID) |
SnatchArr UI, Jellyfin companion plugin (ADR-0028) | SnatchArr adult.Ticker (api/internal/adult/sync.go:116-154, shipped for favourites), matching engine & admin audit queue (ADR-0034, planned) |
Favourites shipped; hierarchy planned (ADR-0033) |
| Tags & Taxonomy: normalized tag name, aliases, category, parent-child tag hierarchy, entity-tag assignments | adult_tags, adult_entity_tags (ADR-0033) |
SnatchArr (reconciled via merge or overwrite strategy in ADR-0034) |
SnatchArr UI, Jellyfin companion plugin (ADR-0028) | SnatchArr sync loop, admin tag normalizer | Planned (ADR-0033, ADR-0034) |
Images (Image-set galleries): filesystem image-set folders, image dimensions, byte size, sha256_checksum, file_mtime |
adult_image_sets, adult_image_items (000036_adult_module.up.sql:49-71, 000039_adult_image_items_unique.up.sql:7-16) |
SnatchArr (adult.ScanTicker, api/internal/adult/scan.go:45-463) |
SnatchArr UI, Jellyfin companion plugin (/api/v1/adult/jellyfin/image-items/{id}/content, ADR-0028) |
SnatchArr adult.ScanTicker reading image_set_dir (read-only on filesystem; writes .stashignore only when opted in per ADR-0032) |
Scanner shipped; Jellyfin delivery planned (ADR-0028) |
| Images (Scene covers, performer portraits, studio logos): upstream image URLs and served artwork | stashbox.Scene.Images, stashbox.Performer.Images, whisparr.Movie.Images, Jellyfin BaseItemDto.ImageTags (OQ-0039-1) |
SnatchArr for adult performer portraits (answer OQ-0039-1, ledger snatcharr-oq-0039-1): canonical choice and provenance, served to Jellyfin through the SnatchArr plugin with caching; Jellyfin and the *arr apps keep their own people images for general media |
SnatchArr UI, Jellyfin server & clients | SnatchArr metadata reconciler; Jellyfin image fetcher via IahRemoteImageProvider (ADR-0028) |
Planned (ADR-0028, OQ-0039-1) |
Play State: per-user watched boolean, play count, resume position (PlaybackPositionTicks), PlayedPercentage, LastPlayedDate |
Jellyfin UserItemDataDto (github.com/golusoris/goenvoy/mediaserver/jellyfin/v3) -> watchaware_item_watches (000029_watchaware.up.sql:15-31) |
Jellyfin (or Emby; Stash play_count / resume_time is secondary in degraded playback setups) |
SnatchArr watchaware.Ticker (api/internal/watchaware/jellyfin.go:40-72), Jellyfin clients |
Jellyfin playback sessions and user mark-played actions | Shipped (api/internal/watchaware) |
| File Facts (Video path & size): on-disk video file path, relative path, byte size, release group, languages | whisparr.MovieFile / whisparr.EpisodeFile (Path, RelativePath, Size) and Stash SceneFile |
Whisparr (for Whisparr-managed library roots) / Stash (for Stash-indexed folders not in Whisparr) | SnatchArr, Jellyfin, Stash | Whisparr import/rename engine; Stash scanner on Stash-owned roots | Whisparr probe shipped; Stash probe planned (ADR-0032) |
File Facts (Video hashes): OSHASH (OpenSubtitles 64-bit hash), PHASH (64-bit DCT perceptual hash), MD5 |
Stash SceneFile.fingerprints -> adult_scene_fingerprints (ADR-0033) |
Stash (computes hashes from local video streams) & stash-box (crowd-submitted fingerprint consensus with submissions and reports) |
SnatchArr matching engine (ADR-0034) | Stash local file scanner; stash-box community submissions (ingested read-only by SnatchArr) | Planned (ADR-0032, ADR-0033, ADR-0034) |
1b. General media field ownership (sonarr, radarr, lidarr, readarr, seerr, jellyfin, snatcharr)¶
| Domain & Field | Canonical Table / Struct | Owning System | Who May Read | Who May Write | Status |
|---|---|---|---|---|---|
| Episodes, Series, Movies, Albums, Books: canonical title, sort title, overview, air/release date, runtime/duration/page count, status, certification | sonarr.Series, sonarr.Episode, radarr.Movie, lidarr.Artist, lidarr.Album, readarr.Author, readarr.Book (github.com/golusoris/goenvoy/arr/*) |
Respective *arr instance (backed by TMDb, TVDb, MusicBrainz, Goodreads/OpenLibrary/Hardcover), except fields explicitly locked by operator in Jellyfin (LockedFields) |
SnatchArr worker & API, Jellyfin (via library scan / .nfo), Seerr |
*arr metadata refresh; operator in Jellyfin when LockedFields / LockData is set (OQ-0039-5, OQ-0039-6) |
Shipped (worker/crates/arr-client, api/internal/arrclient) |
| People (Cast, Crew, Recording Artists, Book Authors): person name, role/character, artist/author biography, disambiguation, member links | radarr.Movie credits, sonarr.Series, lidarr.Artist (ArtistName, Disambiguation, Members), readarr.Author (AuthorName, Disambiguation), Jellyfin BaseItemDto |
Upstream provider via *arr / Jellyfin (TMDb/TVDb for video cast; Lidarr/MusicBrainz for artists; Readarr-class app for authors) |
Jellyfin UI, Seerr UI (seerr.PersonResult), SnatchArr request resolver (ADR-0036) |
*arr refresh; Jellyfin metadata provider (OQ-0039-1 for person images) |
Shipped in *arr / Seerr; SnatchArr request metadata planned (ADR-0036) |
| Studios, Networks, Record Labels, Publishers: studio name, TV broadcast network, label, book publisher | radarr.Movie.Studio, sonarr.Series.Network, lidarr.Album.Releases, readarr.Book.Editions |
Respective *arr instance |
Jellyfin, Seerr (seerr.ProductionCompany), SnatchArr |
*arr metadata refresh |
Shipped in *arr |
Tags, Genres & Collections: genres, box-set collections (radarr.MovieCollection), operational *arr tags (arr.Tag), gate exemption tag (snatcharr-no-gate) |
*arr Genres and Tags (sonarr.Series.Tags, radarr.Movie.Tags); Jellyfin BaseItemDto.Genres and Collection |
*arr for genres and operational tags (snatcharr-no-gate, api/internal/watchaware/gate.go:37); Jellyfin for user presentation collections (jellyfin.Client.CreateCollection) |
SnatchArr watchaware gate (api/internal/watchaware/gate.go:19-64), Jellyfin, *arr |
Operator in *arr (tags); *arr refresh (genres); operator in Jellyfin (collections & locked genres) |
Gate tag check shipped (api/internal/watchaware) |
| Images (Posters, Backdrops, Banners, Album Covers, Book Covers): artwork URLs and cached image files | radarr.Movie.Images, sonarr.Series.Images, lidarr.Album.Images, readarr.Book.Images, Jellyfin BaseItemDto.ImageTags & BackdropImageTags |
*arr (library folder artwork) and Jellyfin (when custom image is uploaded or locked in Jellyfin; see OQ-0039-1 & OQ-0039-6) |
Jellyfin clients, Seerr, SnatchArr | *arr media management; operator in Jellyfin |
Shipped in *arr / Jellyfin |
Play State & Watch-Aware Season Gate: per-user Played, PlayedPercentage, PlaybackPositionTicks, LastPlayedDate; season gate state (gated, released, exempt_tag, before_gate, files_beyond_gate) |
watchaware_item_watches (000029_watchaware.up.sql:15-31), watchaware_gate_series, watchaware_gate_events (000031_watchaware_gate.up.sql:9-37) |
Jellyfin / Emby owns raw watch progress; SnatchArr owns watchaware_gate_series state and season promotion decisions |
SnatchArr watchaware.Service, SnatchArr UI, Sonarr (receives Monitored season updates in act mode) |
Jellyfin/Emby playback (raw watch state); SnatchArr watchaware.Ticker and admin release actions (gate state & Sonarr season Monitored flag via NewGoenvoySeasonWriter, api/internal/watchaware/module.go:50) |
Shipped (api/internal/watchaware) |
File Facts (Path, Size, Quality, MediaInfo): on-disk path, byte size (SizeOnDisk), quality profile match, audio/video stream info |
radarr.MovieFile, sonarr.EpisodeFile, lidarr.TrackFile, readarr.BookFile |
Respective *arr instance |
SnatchArr (arrclient, queue file-score checks in api/internal/arrclient/queue.go), Jellyfin |
*arr import and rename pipeline |
Shipped (api/internal/arrclient) |
Requests, Votes & Snatch Budget State: user media requests, vote tallies, hourly search budget buckets, processed afterglow memory (expires_at) |
seerr_requests (000004_seerr.up.sql:14-27), processed_items (000001_init.up.sql:61-69), rate_buckets, and planned requests / request_votes (ADR-0036) |
SnatchArr (for processed_items, rate_buckets, and native requests); Seerr (for external seerr_requests mirrored into SnatchArr) |
SnatchArr planner, worker, and UI | SnatchArr API (seerr.Ticker mirrors seerr_requests; worker AcquireBudget / ReportEvents updates processed_items and rate_buckets) |
seerr_requests & processed_items shipped; native requests planned (ADR-0036) |
2. External IDs as the join key¶
Cross-system joins never rely on display titles or person names. Every join uses a typed external identifier or content hash. The table below maps each identifier family across systems and cites where SnatchArr stores or resolves it today versus in planned migrations.
| External ID / Key Family | Systems Joined | Upstream / goenvoy Struct Field (github.com/golusoris/goenvoy/...) |
Where SnatchArr Stores or Resolves It | Status |
|---|---|---|---|---|
stash-box UUID scoped by endpoint (endpoint, foreign_id) (StashDB, creator-content stash-box in ADR-0031, regional stash-boxes) |
stash-box <-> SnatchArr <-> Whisparr v3 <-> Stash <-> Jellyfin |
stashbox.Scene.ID, stashbox.Performer.ID, stashbox.Studio.ID, stashbox.Tag.ID (metadata/adult/stashbox/v2); whisparr.Movie.ForeignID & StashID, whisparr.Performer.ForeignID & StashID, whisparr.Studio.ForeignID & StashID, whisparr.Credit.PerformerForeignID (arr/whisparr); Stash stash_ids { endpoint, stash_id } |
Shipped: adult_stashbox_instances(id, endpoint, priority) (000036_adult_module.up.sql:6-17), adult_performer_links(favorite_id, instance_id, foreign_id) (000036_adult_module.up.sql:30-37), adult_studio_links(favorite_id, instance_id, foreign_id) (000036_adult_module.up.sql:49-56), adult_image_sets.whisparr_scene_foreign_id (000036_adult_module.up.sql:62), joined in api/internal/adult/merge.go:39-145 and api/internal/adult/sync.go:75-154. Planned: adult_external_refs(entity_kind, entity_id, source_kind, instance_id, endpoint, foreign_id) and adult_scenes.whisparr_foreign_id (ADR-0033); Jellyfin BaseItemDto.ProviderIDs["StashArrScene"] & ProviderIDs["StashId"] (ADR-0028). |
Performer/studio favourite links & image-set scene foreign ID shipped; unified adult_external_refs planned (ADR-0033) |
ThePornDB (TPDB) UUID & numeric _id (foreign_id + secondary_id) |
ThePornDB <-> Whisparr v2 <-> Whisparr v3 <-> Stash <-> SnatchArr |
whisparr.Series.TvdbID (stores numeric TPDB site _id in Whisparr v2), whisparr.Actor.TpdbID (arr/whisparr); TPDB REST Scene.ID (UUID) & Scene.NumericID (_id), Performer.ID & _id, Site.ID & _id (ADR-0033) |
Planned: adult_external_refs.foreign_id (TPDB UUID) + adult_external_refs.secondary_id (TPDB numeric _id string) with source_kind = 'theporndb' (ADR-0033), bridging Whisparr v2 integer IDs to TPDB and stash-box UUIDs. |
Planned (ADR-0033) |
Canonical normalized URLs (https:// scheme, lowercase host, stripped www. and trailing /) |
stash-box <-> ThePornDB <-> Stash <-> SnatchArr |
stashbox.Performer.URLs, stashbox.Studio.URLs, stashbox.Scene.URLs (metadata/adult/stashbox/v2); whisparr.Studio.Website (arr/whisparr) |
Shipped: adult_favorite_performers.urls TEXT[] and adult_favorite_studios.urls TEXT[] (000038_adult_favorite_urls.up.sql:5-9), normalized by NormalizeURL (api/internal/adult/merge.go:19-37) and matched across stash-box endpoints in api/internal/adult/sync.go:156-195. Planned: adult_performers.urls, adult_studios.urls, adult_scenes.urls (ADR-0033). |
Favourite URLs shipped; scene URLs planned (ADR-0033) |
TMDb ID (tmdb_id) & IMDb ID (imdb_id) |
Seerr <-> Radarr <-> Sonarr <-> Whisparr v3 <-> Jellyfin <-> SnatchArr |
radarr.Movie.TmdbID (int) & ImdbID (string) (arr/radarr); sonarr.Series.TmdbID & ImdbID (arr/sonarr); seerr.MediaInfo.TmdbID & seerr.MovieDetails.ImdbID (arr/seerr); whisparr.ClientV3.LookupMovieByTMDB & LookupMovieByIMDB (arr/whisparr); jellyfin.BaseItemDto.ProviderIDs["Tmdb"] & ["Imdb"] (mediaserver/jellyfin/v3) |
Shipped: seerr_requests.tmdb_id INTEGER (000004_seerr.up.sql:19, api/internal/domain/seerr.go:70), resolved to instances + entity_id via arrclient.GoenvoyProber.EntityByExternalID (GET /api/v3/movie?tmdbId=%d, api/internal/arrclient/resolve.go:26-54) in api/internal/seerr/sync.go:153-185 and api/internal/seerr/resolve.go:34-70. Planned: requests(external_source, external_id) for movie and series (ADR-0036). |
seerr_requests.tmdb_id & Radarr/Whisparr v3 lookup shipped; native requests planned (ADR-0036) |
TVDb ID (tvdb_id) |
Seerr <-> Sonarr <-> Whisparr v2 <-> Jellyfin / Emby <-> SnatchArr |
sonarr.Series.TvdbID (arr/sonarr); whisparr.Series.TvdbID (arr/whisparr); seerr.MediaInfo.TvdbID (arr/seerr); jellyfin.BaseItemDto.ProviderIDs["Tvdb"] (mediaserver/jellyfin/v3) |
Shipped: seerr_requests.tvdb_id INTEGER (000004_seerr.up.sql:20), resolved via GET /api/v3/series?tvdbId=%d (api/internal/arrclient/resolve.go:54-58); watchaware_gate_series.tvdb_id INTEGER (000031_watchaware_gate.up.sql:13); watchaware_item_watches.provider_tvdb_id TEXT (000034_watchaware_tvdb.up.sql:4), extracted from BaseItemDto.ProviderIDs by extractTvdbID (api/internal/watchaware/source.go:89-96) and joined to Sonarr series in api/internal/watchaware/gatepass.go. |
Shipped (api/internal/seerr, api/internal/watchaware) |
MusicBrainz MBID (foreignArtistId, foreignAlbumId) |
MusicBrainz <-> Lidarr <-> Jellyfin <-> SnatchArr |
lidarr.Artist.ForeignArtistID & MBID, lidarr.Album.ForeignAlbumID (arr/lidarr); jellyfin.BaseItemDto.ProviderIDs["MusicBrainzArtist"] & ["MusicBrainzAlbum"] (mediaserver/jellyfin/v3) |
Planned: requests(external_source = 'musicbrainz', external_id = <MBID UUID>, target_instance_id, target_entity_id) (ADR-0036). Shipped processed_items tracks Lidarr searches by (instance_id, entity_type, entity_id) (000001_init.up.sql:61-69). |
processed_items shipped; MBID request resolution planned (ADR-0036) |
Book Work & Edition IDs (foreignAuthorId, foreignBookId, foreignEditionId) |
Goodreads / OpenLibrary / Hardcover <-> Readarr / Chaptarr / Bookshelf <-> SnatchArr |
readarr.Author.ForeignAuthorID, readarr.Book.ForeignBookID, readarr.Book.ForeignEditionID (arr/readarr) |
Planned: requests(external_source IN ('openlibrary', 'hardcover', 'goodreads'), external_id, target_instance_id, target_entity_id) (ADR-0036). Shipped processed_items tracks Readarr-class searches by (instance_id, entity_type, entity_id) (000001_init.up.sql:61-69). |
processed_items shipped; book external ID resolution planned (ADR-0036) |
| Jellyfin / Emby User, Item & Series IDs | Jellyfin / Emby <-> SnatchArr <-> Seerr |
jellyfin.UserDto.ID, jellyfin.BaseItemDto.ID, jellyfin.BaseItemDto.SeriesID (mediaserver/jellyfin/v3); seerr.User.JellyfinUserID (arr/seerr) |
Shipped: users.external_id TEXT UNIQUE (000026_user_external_id.up.sql:5), user_identities(provider, subject, user_id) with provider IN ('jellyfin', 'proxy') (000037_user_identities.up.sql:5-14, api/internal/domain/user.go:55-72); watchaware_item_watches(source_id, user_id, item_id, series_id, season_number, episode_number) (000029_watchaware.up.sql:15-33). |
Shipped (api/internal/auth, api/internal/watchaware) |
*arr Internal Entity ID scoped by (instance_id UUID, entity_id BIGINT) |
Sonarr / Radarr / Lidarr / Readarr / Whisparr <-> SnatchArr |
sonarr.Series.ID, sonarr.Episode.ID, radarr.Movie.ID, lidarr.Artist.ID, lidarr.Album.ID, readarr.Author.ID, readarr.Book.ID, whisparr.Movie.ID, whisparr.Series.ID, whisparr.Episode.ID |
Shipped: processed_items(instance_id, kind, entity_type, entity_id) (000001_init.up.sql:61-69, api/internal/domain/domain.go:196-206), seerr_requests(instance_id, entity_id) (000004_seerr.up.sql:22-23), watchaware_gate_series(instance_id, series_id) (000031_watchaware_gate.up.sql:11-12). |
Shipped |
File Cryptographic & Perceptual Hashes (SHA-256, OSHASH, PHASH, MD5) |
Local filesystem / Stash <-> SnatchArr <-> stash-box <-> Jellyfin |
stashbox.Fingerprint (Algorithm, Hash, Duration, Submissions, Reports in metadata/adult/stashbox/v2); Stash SceneFile.fingerprints |
Shipped: adult_image_items.sha256_checksum CHAR(64) (000036_adult_module.up.sql:65, computed in api/internal/adult/scan.go:456-463). Planned: adult_scene_fingerprints(scene_id, algorithm, hash_hex, hash_int64, duration_seconds, submissions, reports) with algorithm IN ('OSHASH', 'PHASH', 'MD5') (ADR-0033). |
Image SHA-256 shipped; video OSHASH/PHASH/MD5 planned (ADR-0033) |
3. Sync direction and timing¶
All background synchronization in SnatchArr runs on the elected PostgreSQL leader replica inside the leader_loops dependency-injection group via gate.Provide[*T]() (github.com/golusoris/golusoris/leader/gate, AGENTS.md:129).
Default posture: Every metadata integration is read-only pull by default. SnatchArr pulls upstream state into PostgreSQL on bounded leader-loop ticks (HISS-02), reconciles it against adult_field_provenance or watchaware / seerr state tables, and exposes the result over HTTP/OpenAPI and the Jellyfin companion plugin (ADR-0028). Every write path to an external system is explicitly named below and requires an operator opt-in mode (mode = "act" or an explicit write-back setting).
| Source System | Target System | Direction | Trigger & Period | leader_loops Runner (gate.Provide[*T]()) |
Default Mode & Named Write Paths | Status |
|---|---|---|---|---|---|---|
stash-box instances (StashDB, creator-content stash-box in ADR-0031, others) |
SnatchArr (adult_performer_links, adult_studio_links shipped; adult_performers, adult_studios, adult_scenes, adult_external_refs planned) |
Pull (SnatchArr queries GraphQL via stashbox/v2) |
Periodic check every 1 min (checkPeriod); executes pass when sync_interval_minutes elapsed (default 360 min, range 15..10080 min, or manual POST /api/v1/adult/stashboxes/sync) |
adult.Ticker (api/internal/adult/ticker.go:19-45, registered at api/internal/adult/module.go:23) |
Read-only pull. Zero writes to any stash-box endpoint. |
Favourite performer/studio sync shipped (api/internal/adult/sync.go); scene/bio catalog sync planned (ADR-0033) |
ThePornDB REST API |
SnatchArr (adult_scenes, adult_performers, adult_studios, adult_external_refs) |
Pull (SnatchArr queries TPDB REST via goenvoy/metadata/adult/theporndb) |
Piggybacks on adult.Ticker pass (sync_interval_minutes, default 360 min) and on-demand scene/performer resolution |
adult.Ticker (api/internal/adult/module.go:23) |
Read-only pull. Zero writes to ThePornDB. | Planned (ADR-0033, ADR-0034) |
Local image_set_dir filesystem |
SnatchArr (adult_image_sets, adult_image_items) & optional .stashignore |
Pull (filesystem walk + file_mtime delta check + SHA-256) |
Periodic every 15 min (scanPeriod) or manual POST /api/v1/adult/image-sets/scan |
adult.ScanTicker (api/internal/adult/ticker.go:47-63, registered at api/internal/adult/module.go:24) |
Read-only on media files. Named write path: optional .stashignore file in image_set_dir when Stash hand-off opt-in is enabled (ADR-0032). |
Scanner shipped (api/internal/adult/scan.go); .stashignore writer planned (ADR-0032) |
Whisparr v2 / Whisparr v3 |
SnatchArr (adult_scenes, adult_external_refs, wanted queue) |
Pull (inventory & wanted pages) + Bounded Push (search commands & favourite auto-add) | Wanted poll via snatch.Ticker (api/internal/snatch/module.go:73) + worker gRPC lease; adult scene inventory sync via adult.Ticker (OQ-0039-4 for webhook trigger) |
snatch.Ticker & snatch.StateTicker (api/internal/snatch/module.go:73); adult.Ticker (api/internal/adult/module.go:23) |
Read-only on existing metadata by default. Named write paths: (1) SendCommand search dispatch within hourly rate budget (worker/crates/arr-client); (2) DeleteQueueItemWithOptions when queue management is in act mode (api/internal/queue/module.go:42); (3) planned AddMovie / AddSeries when favourite performer/studio auto-add is enabled (ADR-0027); (4) optional metadata write-back gated by OQ-0039-2. |
Wanted search & queue shipped; favourite auto-add & inventory sync planned (ADR-0027, ADR-0033) |
Stash GraphQL server |
SnatchArr (adult_scenes, adult_scene_fingerprints, adult_external_refs, processed_items cross-instance dedup) |
Pull (SnatchArr queries Stash GraphQL for local scenes, stash_ids, and OSHASH/PHASH/MD5 fingerprints) |
Periodic poll on adult.Ticker + pre-snatch inventory check before dispatching a Whisparr search (ADR-0032; OQ-0039-4 for webhook trigger) |
adult.Ticker (api/internal/adult/module.go:23) |
Read-only pull by default (ADR-0032). Decided write path: a confirmed performer split writes back to a connected Stash automatically (snatcharr-oq-0037-2, ADR-0037 (proposed)). Any further Stash scene or performer mutation via GraphQL (sceneUpdate, performerUpdate) is an open fork (OQ-0039-2). |
Planned (ADR-0032, ADR-0033) |
SnatchArr (/api/v1/adult/metadata/scene, /api/v1/adult/jellyfin/*) |
Jellyfin (via jellysin/plugin-snatcharr, ADR-0028) |
Pull by Jellyfin (Jellyfin plugin queries SnatchArr HTTP API during library scan or metadata refresh) | Triggered by Jellyfin library scan, item refresh, or scheduled Jellyfin image-set sync task (ADR-0028) | Served by SnatchArr HTTP API (api/internal/httpapi); no push loop in SnatchArr unless OQ-0039-2 selects direct Jellyfin REST push |
Read-only HTTP responses from SnatchArr. Jellyfin applies returned metadata only to fields not listed in BaseItemDto.LockedFields. |
Planned (ADR-0028) |
Jellyfin / Emby |
SnatchArr (watchaware_item_watches, watchaware_gate_series) -> Sonarr |
Pull from Jellyfin/Emby (GetUsers, GetItems); Conditional Push to Sonarr (UpdateSeries season monitoring) |
Base tick every 1 min (BaseTickPeriod); executes pass when sync_interval_minutes elapsed (default 15 min, range 5..1440 min, api/internal/watchaware/module.go:29-34,188-203) |
watchaware.Ticker (api/internal/watchaware/module.go:37-55); auth.JellyfinRevalidateTicker (api/internal/auth/module.go:61 for session revalidation) |
Read-only on Jellyfin/Emby. For Sonarr: defaults to mode = "observe" (GateModeObserve, api/internal/watchaware/gate.go:31-35,87-97); named write path NewGoenvoySeasonWriter updates sonarr.Series.Seasons[].Monitored only when gate.enabled = true and gate.mode = "act". |
Shipped (api/internal/watchaware) |
Seerr (Overseerr / Jellyseerr) |
SnatchArr (seerr_requests) <-> Radarr / Sonarr |
Pull (SnatchArr fetches /api/v1/request and resolves tmdbId/tvdbId against Radarr/Sonarr) |
Periodic every 5 min (SyncInterval, api/internal/seerr/module.go:21) |
seerr.Ticker (api/internal/seerr/module.go:24-43) |
Read-only pull from Seerr and *arr lookup endpoints (GET /api/v3/movie?tmdbId=, GET /api/v3/series?tvdbId=). Zero writes to Seerr. |
Shipped (api/internal/seerr) |
Configarr YAML files |
SnatchArr (instances with source = 'configarr') & *arr instances |
Pull (SnatchArr watches/polls Configarr config file and syncs instance definitions) | Periodic leader loop pass | configarr.Service (api/internal/configarr/service.go:441) |
Read-only in SnatchArr UI except snatch policy (AGENTS.md:130); source = 'configarr' rows re-import on file change. |
Shipped (api/internal/configarr) |
Sonarr, Radarr, Lidarr, Readarr |
SnatchArr (processed_items, rate_buckets, queue state) |
Pull (wanted lists & queues) + Bounded Push (search commands & queue cleanup) | Periodic planner & queue ticks + worker gRPC lease (LeaseRun -> FilterCandidates -> AcquireBudget -> ReportEvents -> CompleteRun) |
snatch.Ticker, snatch.StateTicker (api/internal/snatch/module.go:73), queue.Ticker (api/internal/queue/module.go:42), instances.Ticker (api/internal/instances/module.go:35) |
Read-only on *arr catalog metadata. Named write paths: (1) indexer search command dispatch within hourly cap; (2) queue item removal/blocklist via *arr Queue API only when queue mode is act (ADR-0006). |
Shipped (api/internal/snatch, api/internal/queue, worker/) |
4. Conflict rule, field-level provenance, and preserving user edits¶
When two or more sources provide values for the same entity and field, deterministic conflict resolution prevents oscillation and protects human edits.
4a. Field-level provenance and lock model (Adult catalog, planned in ADR-0033 and ADR-0034)¶
Every reconcilable scalar and array field on adult_performers, adult_studios, and adult_scenes has a row in adult_field_provenance (ADR-0033) keyed by (entity_kind, entity_id, field_name):
winning_source_ref_id UUID REFERENCES adult_external_refs(id): the external source whose value currently populates the canonical column (orNULLwhen set directly by an operator).value_sha256 CHAR(64): SHA-256 digest of the canonical normalized value currently stored.candidate_values_json JSONB: map of{ "<external_ref_id>": { "value": ..., "observed_at": ..., "priority": ... } }recording what every linked source most recently reported, so the UI can show diffs and revert without re-querying upstream.locked_by_user BOOLEAN NOT NULL DEFAULT FALSE: hard lock flag.decided_by VARCHAR(16) NOT NULL:'priority'|'merge'|'user'|'model'.
4b. Precedence ladder and per-field reconciliation strategies¶
On every sync pass (adult.Ticker), each field (entity_kind, entity_id, field_name) is evaluated in strict precedence order (answer OQ-0039-3, ledger snatcharr-oq-0039-3: ordered source priority, non-empty fallback, a per-field strategy that overwrites scalars, unions aliases, URLs and tags or fills only, and hard user locks):
- Rule 1 — User lock wins unconditionally (
locked_by_user = TRUE): Iflocked_by_user = TRUE, the canonical column onadult_performers,adult_studios, oradult_scenesis never modified by any automated sync pass, regardless of source priority or upstream timestamps. The incoming upstream value is recorded only insidecandidate_values_jsonso the operator can inspect upstream drift in the audit workbench (ADR-0034). - Rule 2 — Non-empty guard (null/blank never clobbers populated data):
An upstream
NULL, empty string"", empty array[], or zero integer0never overwrites a non-empty canonical value, even if the empty value comes from a higher-priority source (ADR-0033, ADR-0034). - Rule 3 — Strategy-specific resolution for unlocked fields (
locked_by_user = FALSE) (ADR-0034): ignore(fill-only): If the canonical field is already non-empty, keep the existing value and record the new candidate incandidate_values_json. If the canonical field is empty, populate it from the highest-priority source that supplies a non-empty value.merge(set union for multi-value fields): Used by default foraliases,urls,tags,external_refs, andfingerprints. Values from all linked sources are normalized (case-folded/trimmed strings;NormalizeURLinapi/internal/adult/merge.go:19-37for URLs) and merged via set union. Deletions made by an operator are recorded as tombstones incandidate_values_jsonwithlocked_by_user = TRUEso a subsequentmergepass does not re-insert a removed alias or tag.overwrite(ordered source priority list): Used by default for scalar fields (title,details,release_date,duration,code,studio_id,birthdate,country, physical attributes). Each source has an integer priority (adult_stashbox_instances.priorityin000036_adult_module.up.sql:10, extended to TPDB, Whisparr, and Stash in ADR-0033; lower number = higher priority, e.g., priority10beats priority20). The non-empty value from the lowest-numbered priority source wins, updateswinning_source_ref_idandvalue_sha256, and writes the canonical column.
4c. How a user edit in Jellyfin, Stash, or SnatchArr survives the next refresh¶
- User edit in SnatchArr:
Editing any field or accepting a value in the SnatchArr UI / audit workbench sets
locked_by_user = TRUEanddecided_by = 'user'inadult_field_provenance. All futureadult.Tickerrefreshes leave the field untouched (Rule 1). - User edit in Jellyfin:
When a user edits an item in the Jellyfin UI (for example, changing a movie/scene
Name,Overview,Genres,Tags,Studios, orPeople), Jellyfin appends the modified field name toBaseItemDto.LockedFields(or setsBaseItemDto.LockData = truewhen locking the entire item). - Adult items served by
jellysin/plugin-snatcharr(ADR-0028): Jellyfin's metadata refresh pipeline checksLockedFieldsandLockDatabefore applying fields returned by the plugin'sIRemoteMetadataProvider<Movie, MovieInfo>implementation (ADR-0028). In addition, the companion plugin inspectsItemUpdateType/LockedFieldsbefore writing any field or image so locked fields in Jellyfin are never overwritten on refresh. - General media items (
sonarr,radarr,lidarr,readarr): Jellyfin'sLockedFieldsis the only barrier during Jellyfin library scans (answerOQ-0039-5, ledgersnatcharr-oq-0039-5); SnatchArr never writes general-media metadata in Jellyfin or an *arr app, apart from Sonarr monitored flags in watchaware act mode. - User edit in Stash: When Stash is integrated as an inventory and fingerprint source (ADR-0032, ADR-0033):
- One write path is already decided: a confirmed performer split writes back to a connected Stash automatically (ledger
snatcharr-oq-0037-2, ADR-0037 (proposed)). AnswerOQ-0039-2(ledgersnatcharr-oq-0039-2): SnatchArr stays read-only beyond that split write-back, and reaches Jellyfin only through the plugin, so an operator's manual edit inside Stash is not overwritten. A later opt-in Stash write-back phase is a new operator question, not pre-approved. - When SnatchArr ingests Stash scene/performer records into
adult_external_refs, if Stash reports anupdated_attimestamp newer than the last ingestedpayload_sha256and the field in SnatchArr is unlocked (locked_by_user = FALSE), SnatchArr detects that the local Stash record diverged from the upstream stash-box value matching Stash'sstash_ids. Under the source priority list (or if Stash local edits are given priority above remote scrapers), SnatchArr promotes the Stash user edit or surfaces it inadult_identity_suggestions/candidate_values_jsonwithout clobbering it.
5. Merging duplicates¶
Duplicate entity resolution across all libraries obeys one universal invariant:
Invariant: Never merge two entities on name or title alone. Display names (
Jane,Alex,The Office,Greatest Hits) are ambiguous across both adult and general media catalogs. Every automated merge requires either an exact shared external identifier / normalized URL or a multi-signal composite score above the auto-merge threshold with zero hard conflict blockers.
5a. Shipped adult favourite merger (api/internal/adult/merge.go)¶
Today, SnatchArr merges favourite performers (MergePerformers, api/internal/adult/merge.go:39-78) and studios (MergeStudios, api/internal/adult/merge.go:80-115) using deterministic union-find (unionFind in api/internal/adult/merge.go:180-209):
- Two candidate records merge if and only if they share an exact
(endpoint, foreign_id)pair (byLinkmap, lines 53-62) or a canonical normalized URL (byURLmap viaNormalizeURL, lines 64-73). - Candidates that share the same
CanonicalNamewithout a shared(endpoint, foreign_id)or normalized URL are kept as distinct rows, andDisambiguateNames(api/internal/adult/merge.go:118-145) appends(Disambiguation)or the first linked(endpoint)to prevent UI ambiguity.
5b. Planned probabilistic matching engine, audit queue, and reversible splits (ADR-0033, ADR-0034)¶
ADR-0033 and ADR-0034 extend duplicate resolution to the full adult catalog (adult_performers, adult_studios, adult_scenes) using a Fellegi-Sunter log-likelihood scorer $S(a, b) \in [0, 100]$:
- Three confidence bands:
- Auto-link ($S \ge 85$ and zero hard conflicts): Automatically links the incoming external reference to the existing canonical UUID and logs an
'auto_merge'row inadult_identity_events(before_state_json,after_state_json,signals_json). - Human audit queue ($60 \le S \le 84$): Creates a distinct canonical entity and inserts a
'pending'row intoadult_identity_suggestions(ADR-0033) with the per-signal breakdown (signals_json) for operator review in the audit workbench (ADR-0034). If the optional privacy-fenced outbound model connection (ADR-0034) is enabled, the model may rank and explain $60 \le S \le 84$ candidates (decided_by = 'model'), but may never auto-execute a merge — every model recommendation stays inadult_identity_suggestionsuntil an operator approves or rejects it. - Auto-reject ($S < 60$ or any hard conflict): Keeps entities separate without queuing a suggestion.
- Hard conflict blockers (veto auto-merge regardless of score):
- Explicit pair in
adult_identity_exclusions(created whenever an operator rejects a suggestion or splits a previously merged entity). - Both records carry non-null
birthdatevalues that differ on year, month, and day (and are not a single-axis month/day transposition). - Both records carry non-null
countryISO codes that differ. - Both records already link to different
foreign_idvalues on the same stash-boxendpoint. - For scenes: duration difference $> 30\text{ s}$ (prevents trailer-to-full-scene merges) or
PHASHfingerprint withreports > 0(fingerprint poisoning guard, ADR-0034). - Scene perceptual hash (
PHASH) thresholds: - Hamming distance $d(\text{phash}_a, \text{phash}_b) \le 4$ plus duration within $\pm 5\text{ s}$ plus
reports == 0: eligible for auto-merge ($S \ge 85$). - Hamming distance $5 \le d \le 8$ with duration within $\pm 15\text{ s}$: routed to
adult_identity_suggestions($60 \le S \le 84$) for human review. - Hamming distance $d > 8$: ignored ($0$ points).
- Reversible split / undo:
- Every merge is recorded in
adult_identity_events. Splitting an entity reverses the pointer reassignments frombefore_state_json, restores field values fromadult_field_provenance, and inserts a permanent exclusion pair intoadult_identity_exclusionsso subsequent sync passes never re-merge the pair (ADR-0033).
5c. Numbered and studio-scoped performer identities (ADR-0037 (proposed))¶
Some studios and regional catalogs credit performers using studio-scoped or numbered identifiers (for example, a performer credited as a studio serial number or site-specific pseudonym on one studio's releases while holding a cross-studio canonical identity on StashDB or ThePornDB PerformerSite.parent). Per ADR-0033 and ADR-0037 (proposed):
adult_scene_performers.credited_asstores the per-scene or studio-scoped credit string verbatim without pollutingadult_performers.canonical_name.- Studio-scoped or numbered performer records are never merged solely because two studios use the same number or short given name; linking a studio-scoped performer to a global
adult_performersrow requires either an explicit upstream parent link (ThePornDBPerformerSite.parent, stash-box URL/ID link), a composite score $S \ge 85$ with corroborating scene co-appearances, or operator confirmation in theadult_identity_suggestionsaudit queue (ADR-0037 (proposed)).
5d. General media duplicate prevention¶
For general media (sonarr, radarr, lidarr, readarr, seerr, jellyfin):
- Series and movies join strictly on
tvdb_id(api/internal/arrclient/resolve.go:54-58,api/internal/watchaware/source.go:89-96) ortmdb_id(api/internal/arrclient/resolve.go:49-53), never on series or movie title. - Music artists and albums in Lidarr and community requests (ADR-0036) join on MusicBrainz
MBID(lidarr.Artist.ForeignArtistID,lidarr.Album.ForeignAlbumID), usinglidarr.Artist.Disambiguationwhen displaying homonymous artists. - Book authors and works in Readarr-class managers join on
ForeignAuthorIDandForeignBookID(readarr.Author,readarr.Book).
6. Degraded modes: what an adopter without Stash or without Whisparr gets¶
Both Stash and Whisparr are optional in SnatchArr (ADR-0027, ADR-0032). When an adopter omits one or both systems, every field domain cleanly transfers to a deterministic fallback owner with no broken foreign keys or failing leader loops.
| Field / Capability Domain | Full Adult Stack (Whisparr + Stash + SnatchArr + Jellyfin) |
Degraded Mode A: Without Stash (Whisparr + SnatchArr + Jellyfin) |
Degraded Mode B: Without Whisparr (Stash + SnatchArr + Jellyfin) |
Degraded Mode C1: Without Stash & Without Whisparr (SnatchArr + stash-box/TPDB + Jellyfin) |
Degraded Mode C2: General Media Only (adult module disabled) |
|---|---|---|---|---|---|
Canonical scene, performer, studio & tag metadata (adult_scenes, adult_performers, adult_studios, adult_tags) |
SnatchArr (reconciling stash-box, theporndb, whisparr, stash) |
SnatchArr (reconciling stash-box, theporndb, and whisparr via adult.Ticker) |
SnatchArr (reconciling stash-box, theporndb, and stash via adult.Ticker) |
SnatchArr (reconciling stash-box and theporndb via adult.Ticker) |
N/A (*arr instances own general media catalog metadata) |
| Video file facts: on-disk path, byte size & library presence | Whisparr (for Whisparr roots) + Stash (for Stash roots) | Whisparr (whisparr.MovieFile / whisparr.EpisodeFile via github.com/golusoris/goenvoy/arr/whisparr) replaces Stash for all video file facts |
Stash (SceneFile GraphQL query) replaces Whisparr for all video file facts and local library inventory |
Jellyfin (BaseItemDto path/media streams) owns local video file facts; SnatchArr matches scenes by ProviderIDs, studio code, or filename |
Respective *arr instance (radarr.MovieFile, sonarr.EpisodeFile, lidarr, readarr) |
Video perceptual & file hashes (OSHASH, PHASH, MD5) |
Stash (local video hashing) + stash-box (upstream hash catalog) | Upstream stash-box only (crowd-submitted fingerprints on matched scenes; no local PHASH/OSHASH video computation occurs since SnatchArr does not run ffmpeg, ADR-0032) |
Stash (full local OSHASH/PHASH/MD5 computation + stash-box fingerprint lookup) |
None for local video (adult_image_items.sha256_checksum still runs for image sets via api/internal/adult/scan.go) |
None (*arr file size and media info only) |
| Duplicate scene detection before snatch | SnatchArr (processed_items + Whisparr HasFile + Stash stash_ids / OSHASH / PHASH inventory probe) |
SnatchArr + Whisparr (processed_items afterglow memory + Whisparr HasFile + adult_external_refs on (endpoint, foreign_id) and studio code) |
Stash + SnatchArr (Stash fingerprint and stash_ids deduplication in adult_scenes; no automated Whisparr release grabbing) |
SnatchArr (adult_external_refs ID/URL deduplication for metadata and sha256_checksum for adult_image_items) |
SnatchArr + *arr (processed_items afterglow memory + *arr HasFile / EntityByExternalID) |
| Wanted-list release searching & indexer rate budgeting | SnatchArr + Whisparr (worker leases runs, pages Whisparr wanted lists, dispatches searches under hourly cap) | SnatchArr + Whisparr (100% functional; Stash is not needed for release searching) | Inactive for adult video (no adult *arr instance to dispatch indexer searches; SnatchArr still tracks favourite performers/studios and community requests in ADR-0036) |
Inactive for adult video (image-set scanning and Jellyfin metadata serving remain active) | SnatchArr + sonarr/radarr/lidarr/readarr (full rate-budgeted wanted searching) |
Filesystem image-set galleries (adult_image_sets, adult_image_items) |
SnatchArr (adult.ScanTicker scans image_set_dir, writes .stashignore if Stash shares root) |
SnatchArr (adult.ScanTicker scans image_set_dir, links to whisparr_scene_foreign_id and performer_id; .stashignore is a no-op) |
SnatchArr (adult.ScanTicker scans image_set_dir, links to performer_id and Stash/stash-box scene IDs, writes .stashignore if opted in) |
SnatchArr (adult.ScanTicker scans image_set_dir and serves galleries to Jellyfin via ADR-0028) |
Disabled (adult.ScanTicker skips tick when adult module is disabled, api/internal/adult/scan.go:47-55) |
| Interactive scene markers, sprite sheets & multi-scene file cuts | Stash (ADR-0032) | Not available (Jellyfin provides standard chapter/trickplay playback; multi-scene file decomposition is absent) | Stash (full scene markers, sprite sheets, and multi-scene file timecode support) | Not available (Jellyfin standard playback only) | Jellyfin standard chapter/trickplay playback |
| Play state & watch-aware automation | Jellyfin (watchaware_item_watches) |
Jellyfin (watchaware_item_watches) |
Jellyfin (or Stash play count if Jellyfin is not used for adult playback) | Jellyfin (watchaware_item_watches) |
Jellyfin / Emby (watchaware_item_watches + Sonarr season gate) |
Evidence mapping¶
The table below maps the 15 public pain themes synthesized in .workingdir/evidence/stash-pain-research-20261026.md (incorporating the owner corrections in its Judge notes section: 10 themes assessed for SnatchArr, 3 for Stash, 1 split, 1 out of scope) to the sections of this ADR and companion ADRs. Every SnatchArr capability is explicitly marked shipped (with code path) or planned (with target ADR).
The owner column started as an assessment from the research judge notes. Each scope assignment the research made for SnatchArr (10 themes), the out-of-scope scraper breakage theme and the multi-version split is an operator question with a ledger answer: OQ-0039-7 to OQ-0039-10 below (answered), OQ-0033-1 to OQ-0033-6 in ADR-0033, and OQ-0037-4 and OQ-0037-5 in ADR-0037.
Theme Name (.workingdir/evidence/stash-pain-research-20261026.md) |
Weight | Owner (assessed; see answered questions) | How This ADR & Companion ADRs Address It (Shipped vs Planned) |
|---|---|---|---|
| Metadata overwrite on refresh & authority conflicts | 1395 | SnatchArr must cover it | Planned in Decision §1, §3, §4 of this ADR and ADR-0033 / ADR-0034: adult_field_provenance tracks per-field winning_source_ref_id, value_sha256, candidate_values_json, and locked_by_user. Unlocked fields follow deterministic per-field strategies (ignore, merge, overwrite), null/empty upstream values never clobber populated fields, and locked_by_user = TRUE (plus Jellyfin LockedFields) blocks overwrite on every subsequent refresh. |
| Multi-version & edition release grouping | 1021 | Split (Jellyfin owns general media version grouping; SnatchArr covers adult scene vs movie edition model) | Split: General movie/episode multi-version grouping in Jellyfin belongs to Jellyfin's native version-grouping engine and *arr file management. For the adult catalog, SnatchArr covers it (planned) via adult_scenes.item_kind ('scene' | 'movie' | 'jav') and adult_movie_scenes(movie_id, scene_id, scene_number) in ADR-0033 and Decision §1a, preventing full-length anthologies from colliding with individual scene cuts. |
| Scraper breakage & upstream anti-bot/layout changes | 730 | Out of scope (CommunityScrapers owns HTML scraper breakage) |
Out of scope for HTML scraping: SnatchArr runs zero HTML scrapers (ADR-0032). SnatchArr's boundary is limited to structured API clients (github.com/golusoris/goenvoy/metadata/adult/stashbox/v2 shipped in api/internal/adult/sync.go, and theporndb / stash planned in ADR-0032 and ADR-0033) that fail closed with a typed error without corrupting stored provenance. |
| Tag sprawl, taxonomy normalization & tag hierarchy | 450 | SnatchArr must cover it | Planned in Decision §1a, §4b of this ADR and ADR-0033 / ADR-0034: adult_tags and adult_entity_tags normalize tag names, aliases, and parent-child hierarchies across stash-box endpoints and TPDB, applying the merge or overwrite strategy with tombstone locks so deleted tags do not reappear on rescan. |
| Performer identity disambiguation & collision on identical names | 415 | SnatchArr must cover it | Shipped baseline in api/internal/adult/merge.go:39-145: MergePerformers merges favourites strictly on shared (endpoint, foreign_id) or normalized URL, never on CanonicalName alone, and DisambiguateNames suffixes (disambiguation) or (endpoint) when names collide. Planned full catalog disambiguation in Decision §5 and ADR-0033 / ADR-0034: Fellegi-Sunter scoring ($S \ge 85$ auto-merge, $60 \le S \le 84$ audit queue, $S < 60$ reject), hard conflict blockers (birthdate, country, same-endpoint different UUID), adult_identity_exclusions, and reversible splits via adult_identity_events. |
| Performer & people imagery delivery & enrichment | 296 | SnatchArr must cover it | Planned in Decision §1a, §1b, OQ-0039-1, ADR-0028, and ADR-0033: SnatchArr reconciles performer portrait URLs across prioritized stash-box instances and TPDB in adult_performers / adult_field_provenance and serves them to Jellyfin via jellysin/plugin-snatcharr (IahRemoteImageProvider). |
| Duplicate release detection & library deduplication | 280 | SnatchArr must cover it | Shipped baseline in processed_items (000001_init.up.sql:61-69, api/internal/domain/domain.go:196-206) preventing repeated searches within the afterglow window. Planned cross-system deduplication in Decision §2, §3, §5, §6 and ADR-0032 / ADR-0033 / ADR-0034: pre-snatch inventory check against Stash (stash_ids, OSHASH, PHASH) and Whisparr (whisparr_foreign_id) so SnatchArr skips releases already present in either tool. |
| File renaming, path reorganization & watch-state preservation | 256 | Stash covers it (for adult local files; *arr and Jellyfin cover general media) |
Stash / *arr / Jellyfin: Per Decision §1a, §1b, Stash owns file renaming on Stash-managed folders, *arr instances own renaming on *arr roots, and Jellyfin owns watch state (watchaware_item_watches, shipped in 000029_watchaware.up.sql:15-31). Because SnatchArr joins on external IDs (tvdb_id, tmdb_id, stash-box UUID, OSHASH/PHASH in Decision §2) rather than file paths, path renames do not break SnatchArr's identity links or watch-aware season gates (000034_watchaware_tvdb.up.sql:4, shipped). |
| Gallery & image-set identification & matching | 137 | SnatchArr must cover it | Shipped baseline in adult_image_sets and adult_image_items (000036_adult_module.up.sql:58-71, 000039_adult_image_items_unique.up.sql:7-16, api/internal/adult/scan.go:45-463): bounded filesystem walk, file_mtime incremental skip, image dimension decoding, and sha256_checksum. Planned in Decision §1a, §2 and ADR-0028 / ADR-0031 / ADR-0033: matching image sets to adult_scenes, adult_performers, and adult_studios via folder naming, sidecars, and stash-box / TPDB metadata, plus delivery to Jellyfin as PhotoAlbum items. |
| Cross-instance ID federation & multi-stashbox resolution | 113 | SnatchArr must cover it | Shipped baseline in adult_stashbox_instances, adult_performer_links, adult_studio_links (000036_adult_module.up.sql:6-56, 000038_adult_favorite_urls.up.sql:5-9, api/internal/adult/sync.go:46-210) federating performer and studio IDs across multiple configured stash-box endpoints by priority and normalized URLs. Planned in Decision §2 and ADR-0033: adult_external_refs unifying stash-box UUIDs, TPDB UUID + numeric _id, Whisparr IDs, and Stash IDs across scenes, performers, and studios. |
| Perceptual hash (phash) false matches & fingerprint poisoning | 81 | SnatchArr must cover it | Planned in Decision §5b and ADR-0033 / ADR-0034: adult_scene_fingerprints stores submissions and reports; any fingerprint with reports > 0 or duration delta $> 30\text{ s}$ is blocked from auto-merging; $d \le 4$ auto-merges only with duration within $\pm 5\text{ s}$; $5 \le d \le 8$ routes to adult_identity_suggestions for human review; false merges split cleanly via adult_identity_events and adult_identity_exclusions. |
| Numbered or studio-scoped performer identities | 51 | SnatchArr must cover it | Planned in Decision §5c, ADR-0033 (adult_scene_performers.credited_as, TPDB PerformerSite.parent), and ADR-0037 (proposed): studio-scoped or numbered performer credits are stored per appearance in credited_as and never auto-merged on number or short name alone without an explicit parent link, multi-signal match ($S \ge 85$), or operator approval in adult_identity_suggestions. |
| Studio hierarchy, parent-child inheritance & studio codes | 41 | SnatchArr must cover it | Planned in Decision §1a and ADR-0033: adult_studios models three-level studio hierarchy (parent_studio_id, network_studio_id) reconciled from stashbox.Studio.Parent and TPDB Site.ParentID / NetworkID, and adult_scenes.code stores normalized studio catalog codes used as a high-weight matching signal in ADR-0034. |
| Performer role, scene part & multi-scene file decomposition | 41 | Stash covers it | Stash covers multi-scene file decomposition (ADR-0032, Decision §1a, §6): Stash owns single-file multi-scene timecode markers and chapters. SnatchArr models only catalog-level anthology-to-scene links (adult_movie_scenes in ADR-0033) and per-scene credit text (adult_scene_performers.credited_as). |
| Library scanning scalability & large catalog performance | 25 | Stash covers it | Stash covers video filesystem scanning (ADR-0032, Decision §1a, §3): Stash indexes local video files; SnatchArr scans only image_set_dir with hard HISS-02 scalar bounds (MaxSetsPerScan = 10000, MaxItemsPerSet = 5000, MaxScanDepth = 3, file_mtime unchanged-file fast path in api/internal/adult/scan.go:25-33,195-215, shipped). |
Answered questions¶
The operator answered the design questions OQ-0039-1 to OQ-0039-6 and the scope questions OQ-0039-7 to OQ-0039-10 on 2026-10-26. Each answer is recorded in the decision ledger under the id shown; the wording is a paraphrase. Where an answer differs from the recommendation in the question list that follows, the answer binds.
| ID | Answer | Ledger id |
|---|---|---|
OQ-0039-1 |
a: SnatchArr owns canonical portrait choice and provenance for adult performers, served to Jellyfin through the SnatchArr plugin with caching; Jellyfin and the *arr apps keep their own people images for general media. | snatcharr-oq-0039-1 |
OQ-0039-2 |
a: read-only beyond the decided split write-back; Jellyfin through the plugin. A later opt-in Stash write-back phase is a new operator question. | snatcharr-oq-0039-2 |
OQ-0039-3 |
a: ordered source priority, non-empty fallback, per-field strategy (overwrite scalars; union aliases, URLs and tags; fill-only), hard user locks. | snatcharr-oq-0039-3 |
OQ-0039-4 |
b: polling baseline plus opt-in inbound webhooks (*arr, Stash) that enqueue a coalesced, rate-bounded refresh of the affected entity. | snatcharr-oq-0039-4 |
OQ-0039-5 |
a: Jellyfin LockedFields is the only barrier; SnatchArr never writes general-media metadata in Jellyfin or an *arr app (only Sonarr monitored flags in watchaware act mode). |
snatcharr-oq-0039-5 |
OQ-0039-6 |
a: no .nfo writers in the adult stack; Jellyfin reads adult metadata from SnatchArr through the SnatchArr Jellyfin plugin. |
snatcharr-oq-0039-6 |
OQ-0039-7 |
a: SnatchArr covers metadata authority: per-field ownership, value provenance and user locks; a refresh never overwrites a locked or hand-edited field. | snatcharr-oq-0039-7 |
OQ-0039-8 |
a: out of scope. SnatchArr runs no scrapers; its API clients fail closed with a named error (ADR-0032). | snatcharr-oq-0039-8 |
OQ-0039-9 |
a: SnatchArr covers people imagery: it fetches and chooses images from its metadata sources and hands them to Jellyfin. | snatcharr-oq-0039-9 |
OQ-0039-10 |
a: SnatchArr covers cross-source and cross-instance ID mapping, tied to the metadata-authority work of OQ-0039-7. |
snatcharr-oq-0039-10 |
Options considered for the resolved questions¶
The list keeps the options and risks the answers above chose from; every question in it is answered:
OQ-0039-1 | Who owns performer and people portrait images across stash-box, ThePornDB, Stash, Whisparr, TMDb, and Jellyfin? | a) SnatchArr owns canonical portrait selection and provenance for adult performers (serving images to Jellyfin via jellysin/plugin-snatcharr) while Jellyfin and *arr keep TMDb/MusicBrainz person images for general media (risk: SnatchArr must proxy or cache upstream adult performer images so Jellyfin scans do not hit stash-box rate limits) b) Jellyfin and Stash each fetch and store performer/people images directly from upstream providers without SnatchArr mediating image URLs (risk: Jellyfin and Stash display different portraits for the same performer and overwrite custom portrait selections on refresh) c) SnatchArr proxies and caches person/performer images for both adult and general media libraries (risk: duplicates TMDb person image handling that Jellyfin and Radarr/Sonarr already perform natively) | recommended: aOQ-0039-2 | Beyond the decided automatic Stash write-back of confirmed performer splits (snatcharr-oq-0037-2), should SnatchArr write reconciled metadata back into Stash, Jellyfin, or an *arr instance, and with which opt-in? | a) Strictly read-only pull into SnatchArr plus pull-based delivery to Jellyfin via the companion plugin (ADR-0028); zero further metadata mutation calls to Stash GraphQL or *arr PUT endpoints beyond the split write-back (risk: operators who browse inside Stash or Whisparr UIs instead of Jellyfin/SnatchArr do not see SnatchArr's reconciled titles or split performers inside Stash/Whisparr) b) Read-only by default, with per-target opt-in write-back (mode = "observe" default, mode = "act" per instance and field group) pushing reconciled scenes/performers/studios to Stash GraphQL (sceneUpdate/performerUpdate) and Whisparr v3 (UpdateMovie/UpdatePerformer) (risk: bidirectional write loops if Stash or Whisparr also runs scheduled upstream scrapes without respecting field locks) c) Full automatic push to Stash, Jellyfin REST API, and Whisparr whenever SnatchArr reconciles a change (risk: violates read-only default safety and can clobber local state in downstream tools on misconfiguration) | recommended: a (with b as a gated Phase 2 opt-in only for Stash when Stash auto-scrape is disabled)OQ-0039-3 | What is the default conflict resolution rule for unlocked fields when two linked sources disagree? | a) Ordered source priority list (adult_stashbox_instances.priority + provider rank) with non-empty fallback and per-field strategy (overwrite for scalars, merge union for aliases/URLs/tags, ignore for fill-only), plus hard user locks (locked_by_user = TRUE) (risk: operator must order source priorities once when configuring multiple endpoints) b) Last-writer-wins by upstream updated timestamp across all linked sources (risk: a low-quality or automated touch on a secondary scraper overwrites curated StashDB metadata simply because its timestamp is newer) c) Automatic field lock on first observation (every field defaults to ignore/locked after initial import unless manually unlocked) (risk: upstream typos or incomplete early scene entries never self-heal when StashDB later completes the record) | recommended: aOQ-0039-4 | What is the default synchronization timing model between SnatchArr, *arr, Stash, and Jellyfin? | a) Periodic leader_loops polling only (adult.Ticker 360 min default, adult.ScanTicker 15 min, watchaware.Ticker 15 min, seerr.Ticker 5 min) plus manual trigger endpoints (risk: newly imported scenes in Whisparr or Stash wait up to one poll interval before appearing in SnatchArr's reconciled catalog unless triggered manually) b) Periodic leader_loops polling as the baseline, plus opt-in inbound webhook endpoints (/api/v1/webhooks/arr, /api/v1/webhooks/stash) that enqueue a coalesced, rate-bounded leader refresh for the affected entity (risk: adds webhook authentication and deduplication surface in httpapi) c) Webhook-only event-driven sync with periodic polling disabled by default (risk: missed webhooks during container restarts leave metadata permanently stale until manual resync) | recommended: bOQ-0039-5 | How should user metadata edits in Jellyfin (BaseItemDto.LockedFields) interact with general media *arr instances? | a) Jellyfin's native LockedFields / LockData is the sole barrier in general media; SnatchArr never mutates general media metadata in Jellyfin or *arr and only writes Sonarr season Monitored flags when watchaware gate mode = "act" (risk: if an operator configures *arr to overwrite .nfo files and configures Jellyfin to re-read .nfo files without locking fields in Jellyfin, *arr rescans will overwrite un-locked Jellyfin edits) b) SnatchArr polls Jellyfin LockedFields during watchaware.Ticker passes and warns in SnatchArr health checks when an *arr instance has .nfo overwrite enabled on a shared library (risk: extra fields requested on Jellyfin GetItems calls and additional *arr media-management config reads) | recommended: aOQ-0039-6 | Which system is allowed to write .nfo sidecar files when Whisparr, Stash, and Jellyfin share a media root? | a) Zero .nfo writers in the adult stack: Whisparr and Stash .nfo export disabled; Jellyfin reads adult metadata exclusively from SnatchArr's HTTP API via jellysin/plugin-snatcharr (ADR-0028) (risk: requires the Jellyfin companion plugin to be installed for Jellyfin to display adult metadata) b) SnatchArr generates and writes locked .nfo sidecar files onto the media filesystem alongside .stashignore (risk: widens SnatchArr's filesystem write surface beyond .stashignore and risks permission conflicts on read-only media mounts) | recommended: aOQ-0039-7 | Scope owner for the research theme "Metadata overwrite on refresh and authority conflicts" (weight 1395, 81 rows): who covers it? | a) SnatchArr covers it in ADR-0039 scope (field ownership, provenance and user locks) (risk: build and maintenance cost; overlap with upstream work) b) upstream (Stash, *arr, Jellyfin) owns it; SnatchArr only reads its result (risk: the pain stays for adopters who run SnatchArr) c) out of scope, no SnatchArr work (risk: theme stays unaddressed; research weight 1395) | recommended: aOQ-0039-8 | Scope owner for the research theme "Scraper breakage and upstream anti-bot or layout changes" (weight 730, 29 rows): who covers it? | a) out of scope: SnatchArr runs no scrapers; its API clients fail closed with a named error (risk: adopters still meet site breakage through Stash scrapers) b) SnatchArr covers it with its own scrapers (risk: anti-bot maintenance load; contradicts ADR-0032 integrate-not-own) | recommended: aOQ-0039-9 | Scope owner for the research theme "Performer and people imagery delivery and enrichment" (weight 296, 12 rows): who covers it? | a) SnatchArr covers it in ADR-0039 scope (portrait selection and delivery to Jellyfin) (risk: build and maintenance cost; overlap with upstream work) b) upstream (Stash, Jellyfin) owns it; SnatchArr only reads its result (risk: the pain stays for adopters who run SnatchArr) c) out of scope, no SnatchArr work (risk: theme stays unaddressed; research weight 296) | recommended: aOQ-0039-10 | Scope owner for the research theme "Cross-instance ID federation and multi-stash-box resolution" (weight 113, 13 rows): who covers it? | a) SnatchArr covers it in ADR-0039 scope (external refs across stash-box instances and providers) (risk: build and maintenance cost; overlap with upstream work) b) upstream (Stash) owns it; SnatchArr only reads its result (risk: the pain stays for adopters who run SnatchArr) c) out of scope, no SnatchArr work (risk: theme stays unaddressed; research weight 113) | recommended: a
Consequences¶
Positive¶
- Zero refresh oscillation: Every field has one canonical owner (Decision §1) and a deterministic precedence rule (Decision §4). A refresh from a secondary scraper or a null upstream field can never erase a curated title, studio code, or user-locked attribute.
- Path-independent identity joins: Joining across systems via
(endpoint, foreign_id), TPDB(UUID, _id),tvdb_id,tmdb_id,MBID, andOSHASH/PHASH/SHA-256(Decision §2) means file renames in*arror Stash never orphan watch history, season gates, or audit exclusions. - Safe read-only defaults: All background sync loops run on the elected leader via
gate.Provide[*T]()and default to read-only pull (Decision §3), matching SnatchArr's existingobserve-first contract inwatchawareandqueue. - Clean degradation: Adopters running without Stash, without Whisparr, or with the
adultmodule disabled get a well-defined ownership table (Decision §6) with zero dead dependencies.
Negative¶
- Provenance storage overhead: Tracking
adult_field_provenance(candidate_values_json,value_sha256,locked_by_user) per field increases PostgreSQL storage and write amplification duringadult.Tickersync passes compared to stateless overwrite. - Explicit operator review for ambiguous identities: Prohibiting name-only merges (Decision §5) means homonymous performers or scenes in the $60 \le S \le 84$ grey zone remain separate until the operator approves or rejects them in
adult_identity_suggestions.
Alternatives considered¶
- Make Stash the single source of truth for all adult metadata and require Whisparr and Jellyfin to read from Stash:
- Rejected: Stash is optional in SnatchArr (ADR-0027, ADR-0032); adopters running only Whisparr + Jellyfin would have no metadata hub. Furthermore, Stash's own schema stores a single value per field without multi-source
candidate_values_jsonprovenance or a Fellegi-Sunter audit queue (ADR-0033, ADR-0034). - Make Whisparr v3 the single source of truth and sync Stash and Jellyfin from Whisparr:
- Rejected: Whisparr v2 and v3 have incompatible internal schemas (
whisparr.Series/Episodevswhisparr.Movie), neither tracksOSHASH/PHASHfingerprints or filesystem image sets (adult_image_sets), and Whisparr's metadata refresh overwrites local edits from a single upstream feed. - Synchronize metadata across tools by having every tool read and write shared
.nfosidecar files on disk: - Rejected:
.nfosidecars lack field-level provenance (winning_source_ref_id,candidate_values_json), cannot represent multi-endpointstash_idsoradult_identity_exclusions, require read-write media mounts across every container, and are the primary vector for multi-tool overwrite loops today. - Auto-merge performers and people whenever normalized display names match:
- Rejected: Directly causes the 415-weight performer collision failure mode in
.workingdir/evidence/stash-pain-research-20261026.md, corrupting performer filmographies and triggering unwanted auto-snatches across unrelated performers who share a mononym.
Verification plan¶
Every ownership and conflict rule in this ADR is verified by unit, property, and PostgreSQL integration tests under HISS-15 (positive, negative, and boundary cases) and HISS-20 (replayable fixtures that fail when the guard is removed):
- Planted conflicting refresh against a locked field (HISS-20 negative fixture):
- Setup: Seed an
adult_scenesrow (oradult_performersrow) withtitle = "Curated Scene Title",adult_field_provenance.locked_by_user = TRUE,decided_by = 'user', linked to a priority-10stash-boxinstance. - Planted conflicting refresh: Replay an upstream
stash-boxsync payload where the priority-10source returnstitle = "Upstream Overwrite Title". - Expected assertion:
adult_scenes.titleremains"Curated Scene Title",adult_field_provenance.locked_by_userremainsTRUE, and"Upstream Overwrite Title"is recorded only inadult_field_provenance.candidate_values_json. - Two-way replay proof: Commenting out the
locked_by_userguard in the reconciler causes the test to fail red (titleoverwritten); restoring the guard passes green. - Non-empty guard boundary test:
- Replay a sync pass where a priority-
10source returnsdetails = ""(empty) andduration = nil, while a priority-20source previously populateddetails = "Full synopsis"andduration = 1800. Assert that neither field is overwritten by the higher-priority empty values. - Priority ordering positive & negative tests:
- With
locked_by_user = FALSEand strategyoverwrite, replay conflicting non-empty values from priority20and priority10in both arrival orders (10then20, and20then10). Assert that both orders converge to the identical canonical value (priority 10) and identicalvalue_sha256. - Never-merge-on-name-alone & exclusion-blocklist tests:
- Replay two performers with identical
canonical_name = "Performer A"anddisambiguation = ""on different endpoints with no shared URL or external ID (S = 15). Assert two distinct UUIDs are created andDisambiguateNamessuffixes their endpoint labels (api/internal/adult/merge_test.go). - Replay a split on a merged entity via
adult_identity_events, then re-run the sync pass with identical upstream payloads; assertadult_identity_exclusionsblocks re-merging ($S$ vetoed). - Jellyfin
LockedFieldspreservation test: - In the
/api/v1/adult/jellyfin/*and companion plugin contract tests (ADR-0028), pass a fixture withLockedFields = ["Name", "Overview"]and verify that only unlocked fields (Genres,People,Studios,ProviderIds) are updated. - Degraded-mode matrix tests:
- Run the
adult.Tickerand Jellyfin metadata handler integration suite under three configurations: (a) Whisparr configured, zero Stash instances; (b) Stash configured, zero Whisparr instances; (c)adultmodule disabled (IsEnabled(ctx, domain.ModuleAdult) == false). Assert zero errors and verify that the fallback owner in Decision §6 serves each field.
Follow-up slices and milestones¶
Per docs/roadmap.md, follow-up implementation work is split across 0.9 (general media rows) and 0.10 (adult module rows):
Why general rows land in 0.9 and adult rows land in 0.10¶
- Milestone
0.9 — Requests & voting(docs/roadmap.md:107-118, ADR-0036) already introduces cross-library external ID resolution (requests(external_source, external_id, target_instance_id, target_entity_id)) across movies (TMDb), series (TVDb), music (MusicBrainz), and books (OpenLibrary/Hardcover/Goodreads) alongside existingseerrandwatchawareloops. Completing the general-media external ID join contract and read-only boundary in0.9avoids introducing a second general-media lookup layer later. - Milestone
0.10 — Adult module completion(docs/roadmap.md:121-131, ADR-0027, ADR-0028, ADR-0031, ADR-0032, ADR-0033, ADR-0034) is the dedicated milestone ondocs/roadmap.mdfor Whisparr wanted/snatch integration, multi-stash-box catalog normalization, filesystem image-set matching, Stash inventory hand-off, and the Jellyfin companion plugin. Grouping alladult_*schema migrations (000040,000041), provenance reconciliation, and degraded-mode adult handlers in0.10keeps the optional adult module self-contained behind its feature gate.
Slice table¶
| Slice | Scope | Target Milestone | Dependencies |
|---|---|---|---|
| Slice 1 — General media external ID resolver & request join keys | Extend api/internal/arrclient/resolve.go and requests store (ADR-0036) to resolve MusicBrainz (lidarr) and book external IDs (readarr) alongside shipped tmdb_id and tvdb_id; verify read-only general-media metadata boundary. |
0.9 | ADR-0036 |
Slice 2 — Normalized adult schema & adult_field_provenance |
Land migration 000040_adult_normalized_model (adult_performers, adult_studios, adult_scenes, adult_movie_scenes, adult_tags, adult_external_refs, adult_scene_fingerprints, adult_field_provenance, adult_identity_events, adult_identity_exclusions, adult_identity_suggestions). |
0.10 | ADR-0033 |
| Slice 3 — Reconciler, field locks & Fellegi-Sunter matching engine | Implement per-field ignore/merge/overwrite reconciler with locked_by_user guard, non-empty guard, Fellegi-Sunter scorer, PHASH poison guard, and studio-scoped credit handling (ADR-0037 (proposed)). |
0.10 | Slice 2, ADR-0034, ADR-0037 (proposed) |
Slice 4 — Multi-source adult sync (stash-box, theporndb, whisparr, stash) & degraded modes |
Extend adult.Ticker to ingest scene/performer/studio records and fingerprints across all enabled sources and verify Degraded Modes A, B, and C (Decision §6). |
0.10 | Slice 3, ADR-0031, ADR-0032 |
| Slice 5 — Jellyfin metadata & image-set delivery endpoints | Implement /api/v1/adult/metadata/scene and /api/v1/adult/jellyfin/* endpoints respecting Jellyfin LockedFields and OQ-0039-1 image ownership. |
0.10 | Slice 3, ADR-0028 |