tracker
All repositories: gitoria
50.7 KB
// lib/shows.hl — title data, page rows and actions for a show's page (tracker.worldapi.org#4): shows, seasons,// episodes, persons, genres (storage/mpackdb/, migrated by tools/migrate.hl, tracker.worldapi.org#2).// Kept apart from watches.hl (the per-user watch state) and from components/show.hl (the page itself)// so /unwatched and /schedule (tickets #5/#6, "reuse, don't copy") can import the same functions.//// Person slug/TMDB indexes are native; title slug maps remain in this module.import { MPackDB } from 'hl:mpackdb'import { warm } from './warm.hl'import { exists } from 'hl:fs'import { storageDir, postersDir, hasId, dayStr, textOr, envOr } from './util.hl'import { isFollowing, toggleFollowed } from './follows.hl'import { watchesOfUser, watchedSetOf, isWatched, watchClassOf, seasonAllWatched, toggleWatched, toggleSeasonWatched } from './watches.hl'import { needsDetails } from './details.hl'import { widgetsOf } from './franchises.hl'import { listOr } from './util.hl'import { dateText } from './people.hl'static genresTable = new MPackDB(file = storageDir + '/genres.db', primaryKey = '@id', indexes = ['!oldId'], compact = false)// tracker#62: first open builds missing indexes from data; compact stays false.static personsTable = new MPackDB(file = storageDir + '/persons.db', primaryKey = '@id', indexes = ['!oldId', 'urlSegment', 'tmdbId'], compact = false)static showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'], compact = false)static seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'], compact = false)static episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'], compact = false)// the show with this urlSegment (slug), or null. tracker#28: by a slug → id map (one scan, at the first call) — the old scan of// every record per call (twice per show page) decoded every title's cast + crew: 82 ms per call on the live copy before the// credits, growing with them. tracker#42 (mission 038): a slug the map does not know is NOT a title — no scan any more (an unknown// slug, a bot's or a typo, cost one scan of every title per lookup and the page does 4: ~9 s on the live copy, the one-request-at-a-// time server blocked). A title added since the build (search import, filmography fill — the only two puts) is in the map through// catalog.hl refreshCatalogShow → refreshTitleCaches → noteSlugsOf, which both call right after the put; merge.hl notes its own.// (Flat static written key by key, like people.hl's maps.)// tracker#31 (mission 026): a MERGED title's slug (a tombstone's, below) and a keeper's former slug (`oldSlugs`) answer the// KEEPER — several records can share one slug (migrated duplicates did), so each slug has a rank: a live record's own slug (3)// beats a live record's former one (2) beats a tombstone's (1).static slugIds = {}static slugRank = {}static slugIdsBuilt = { yes = false }// ---- merged titles (tracker#31, mission 026, merge.hl) ----------------------------------------------------------------------// The old tracker left 68 titles as 2–6 records each (same type + TMDB id). The repair (merge.hl) keeps ONE record (the keeper)// and turns the others into TOMBSTONES — never deleted: `mergedInto` = the keeper's id, `mergedTmdbId` (their `tmdbId` is// null, so nothing looks them up by it), `mergedSeasons` (their `seasons` are empty). Every list skips them (isPublicTitle),// every job skips them, a tombstone's slug and short id lead to the keeper.static isMerged = (&show) => { return show != null && show.mergedInto != null }// the record a page shows for this one: the keeper of a tombstone (a chain is followed, at most 5 steps), else itselfstatic liveShowOf = (&show) => {let s = showlet n = 0while (s != null && s.mergedInto != null && n < 5) {s = showsTable.fetch(s.mergedInto)n = n + 1}return s}static holdsSlug = (&s, &slug) => { return s.urlSegment == slug || (s.oldSlugs != null && s.oldSlugs.includes(slug)) }// this record's slugs into the map (at the build, and by merge.hl after a merge changed a record)static noteSlugsOf = (&s) => {live = s.mergedInto == nullmine = []if (s.urlSegment != null) { mine.push({ slug = s.urlSegment rank = live ? 3 : 1 }) }if (live && s.oldSlugs != null) { for (o of s.oldSlugs) { mine.push({ slug = o rank = 2 }) } }for (m of mine) {cur = slugRank[m.slug]if (cur == null || m.rank >= cur || slugIds[m.slug] == s.id) {slugIds[m.slug] = s.idslugRank[m.slug] = m.rank}}return null}// bootscan.hl streamed every title through noteSlugsOfstatic markSlugIdsBuilt = () => {slugIdsBuilt.yes = truereturn true}static ensureSlugIds = () => {// mission T17: during the progressive start the map is being filled (bootscan.hl) — no blocking full scan hereif (!slugIdsBuilt.yes && !warm.running) {// mission 043: streamed (one title decoded at a time); at boot bootscan.hl fills the map in its own pass over the titlesfor (s of showsTable.iterate(null, null)) { noteSlugsOf(&s) }slugIdsBuilt.yes = true}return true}static showBySlug = (&slug) => {if (slug == null || hlTypeName(slug) != 'String' || slug == '') { return null }ensureSlugIds()id = slugIds[slug]if (id != null) {hit = showsTable.fetch(id)if (hit != null && holdsSlug(&hit, &slug)) { return liveShowOf(&hit) }}return null}// tracker#31/#41 (missions 026, 037b): a slug that is not a live title's own any more (a tombstone's, a keeper's former one) → the// keeper's path, or null (a live title's own slug, an unknown one). Only the slug map (built at boot, kept current by merge.hl// noteSlugsOf), never a scan. No route per such slug (hl:web writes every route into each page's HTML; the moved slugs there// included adult titles'): /movies/<slug> and /series/<slug> render the keeper's page (showBySlug), its head names this path.static movedSlugPath = (&slug) => {ensureSlugIds()rank = slugRank[slug]if (rank == null || rank >= 3) { return null }keeper = liveShowOf(showsTable.fetch(slugIds[slug]))if (keeper == null || keeper.mergedInto != null || keeper.urlSegment == null || keeper.urlSegment == slug) { return null }return titlePath(&keeper)}// how many slugs lead to a keeper now (project.hl's boot log line)static movedSlugCount = () => {ensureSlugIds()let n = 0for (slug of slugRank.keys()) { if (slugRank[slug] < 3 && movedSlugPath(&slug) != null) { n = n + 1 } }return n}static genreById = (&id) => { return id == null ? null : genresTable.fetch(id) }// /genres/<genre> (mission 058): the genre with this urlSegment ('Action', 'Sci-Fi-Fantasy'), exact first, else ignoring case// — a scan of the genres table (27 rows)static genreBySlug = (&slug) => {if (slug == null || hlTypeName(slug) != 'String' || slug == '') { return null }lower = slug.toLowerCase()let loose = nullfor (g of genresTable.find(null, null)) {if (g.urlSegment == slug) { return g }if (loose == null && g.urlSegment != null && ('' + g.urlSegment).toLowerCase() == lower) { loose = g }}return loose}static personById = (&id) => { return id == null ? null : personsTable.fetch(id) }// GC1: the five request caches (personLinkCache, cardCache, episodeRowsCache, episodeKeyCache, creditRowCache) only ever grew: every title// a bot or a visitor opened, every person it linked, stayed in the heap for good and every collection marked it again. Each now holds// at most `cacheLimit` entries; the one that is full is emptied before it takes the next (an entry is a plain recomputation of the// stored record, so a dropped one is read again at its next ask and the page is the same). The limits sit far above what the warm// set needs (the followed titles and their watched episodes, warmed at boot). TRACKER_CACHE_MAX sets all five (a test).static cacheMax = toNumber(envOr('TRACKER_CACHE_MAX', '0'))static cacheLimit = { card = cacheMax > 0 ? cacheMax : 20000 episodeRows = cacheMax > 0 ? cacheMax : 2000 episodeKey = cacheMax > 0 ? cacheMax : 60000 creditRow = cacheMax > 0 ? cacheMax : 20000 personLink = cacheMax > 0 ? cacheMax : 50000 }static cacheCount = { card = 0 episodeRows = 0 episodeKey = 0 creditRow = 0 personLink = 0 }// tracker#42 (mission 038): what a cast / crew row needs of a person — { name, urlSegment } — cached per person: a series page linked// up to 300 cast + crew people by fetching each WHOLE record (their `shows` credits: Saturday Night Live's 303 cast carry 4,761) —// ~49k allocations and 11 ms per render, a third of the page's allocations (every ~3M allocations the GC stops the server for// ~0.8 s on the live copy's heap). A person's name and slug never change once stored (people.hl creates them; the fill, photos and// merge.hl only add data), so the cache is never stale. null = no such person (not remembered: a guest's person can come later).static personLinkCache = {}static personLinkOf = (&personId) => {if (personId == null) { return null }if (personLinkCache[personId] != null) { return personLinkCache[personId] }linkPerson = personsTable.fetch(personId)if (linkPerson == null) { return null }if (cacheCount.personLink >= cacheLimit.personLink) {for (k of personLinkCache.keys()) { delete personLinkCache[k] }cacheCount.personLink = 0}personLinkCache[personId] = { name = linkPerson.name urlSegment = linkPerson.urlSegment }cacheCount.personLink = cacheCount.personLink + 1return personLinkCache[personId]}static seasonById = (&id) => { return id == null ? null : seasonsTable.fetch(id) }static showById = (&id) => { return id == null ? null : showsTable.fetch(id) }static episodeById = (&id) => { return id == null ? null : episodesTable.fetch(id) }// EVERY show / episode as one array — for the tools in tools/ only (the app streams: bootscan.hl, mission 043)static allShows = () => { return showsTable.find(null, null) }static allEpisodes = () => { return episodesTable.find(null, null) }// insertion sort, hand-written (no list sort(), hybriel#1) — a show has a handful of seasons at moststatic insertDesc = (&sorted, &s) => {out = []let inserted = falsefor (x of sorted) {if (!inserted && s.seasonNumber >= x.seasonNumber) { out.push(s) inserted = true }out.push(x)}if (!inserted) { out.push(s) }return out}static insertAsc = (&sorted, &e) => {out = []let inserted = falsefor (x of sorted) {if (!inserted && e.episodeNumber <= x.episodeNumber) { out.push(e) inserted = true }out.push(x)}if (!inserted) { out.push(e) }return out}// a show's seasons, latest (highest seasonNumber) first — creator: "all seasons in reverse order,// latest on top"static seasonsOfShow = (&show) => {let sorted = []for (id of show.seasons) {s = seasonsTable.fetch(id)if (s != null) { sorted = insertDesc(&sorted, &s) }}return sorted}// a season's episodes, in episode-number orderstatic episodesOfSeason = (&season) => {let sorted = []for (id of season.episodes) {e = episodesTable.fetch(id)if (e != null) { sorted = insertAsc(&sorted, &e) }}return sorted}// ---- labels shared by every list (tracker.worldapi.org#8) -------------------------------------static pad2 = (&n) => {let s = '' + nwhile (s.length < 2) { s = '0' + s }return s}// an episode as `S01E01` (creator: "write it like that: S01E01") — /my/shows, /my/unwatched, /my/schedulestatic episodeCode = (&seasonNumber, &episodeNumber) => { return 'S' + pad2(&seasonNumber) + 'E' + pad2(&episodeNumber) }// the show's year: `year`, else the first 4 characters of `release` ('YYYY-MM-DD'; 197 migrated shows have// no year, a few of those an empty release) — null when neither gives onestatic showYear = (&show) => {if (show.year != null) { return '' + show.year }if (show.release != null && hlTypeName(show.release) == 'String' && show.release.length >= 4) { return show.release.slice(0, 4) }return null}// a show's title as every list shows it: `Doctor Who (2005)` (creator: so same-named shows can be told apart)static titleWithYear = (&show) => {y = showYear(&show)return y != null ? show.title + ' (' + y + ')' : show.title}// ---- the description (tracker#18) ---------------------------------------------------------------// creator: "i put the summary in an own field for tmdb because some summaries i wanted to rewrite ... in that case the summary// has priority over maze or tmdb" — `summary` (the creator's own text, never written by the sync), else TMDB's `tmdbSummary`,// else TVmaze's `tvmazeSummary` (HTML stripped); '' when nonestatic hasText = (&v) => { return v != null && hlTypeName(v) == 'String' && v.trim() != '' }static summaryOf = (&show) => {if (show == null) { return '' }if (hasText(&show.summary)) { return show.summary }if (hasText(&show.tmdbSummary)) { return show.tmdbSummary }if (hasText(&show.tvmazeSummary)) { return show.tvmazeSummary }return ''}// ---- a series' status (tracker#35, mission 030) -----------------------------------------------------------------------// The page's status pill (components/show.hl) next to a series' or show's title: TVmaze's `tvmazeStatus` (Running, Ended, To Be// Determined, In Development — stored by the sync and backfill.hl's status backfill) when there is one — creator: "this was also// something tvmaze was better updated about" — else TMDB's `status` (Returning Series, In Production, Planned, Pilot, Ended,// Canceled). TVmaze has no "canceled": its Ended + TMDB's Canceled shows Canceled (the same state, TMDB's word says more).// tracker#35 follow-up (mission 033): TVmaze's "Running" reads stale to the creator (Twisted Metal between seasons) — its LABEL// is "Returning", or "Airing" while an episode of the series aired in the last 7 days or airs in the next 7 (the stored episodes'// `release`, `isAiring`). Only the label: the stored tvmazeStatus stays "Running"; every other word (Ended, Canceled, To Be// Determined, TMDB's) is shown as before.// { text, tone } — tone running | pending | ended | canceled | other (the pill's colour, styles.hl); text '' = no pill (a movie,// or no status known).static statusTones = { 'Running' = 'running' 'Returning Series' = 'running' 'To Be Determined' = 'pending' 'In Development' = 'pending''In Production' = 'pending' 'Planned' = 'pending' 'Pilot' = 'pending' 'Ended' = 'ended' 'Canceled' = 'canceled' }static statusOf = (&show) => {if (show == null || show.type == 'movie') { return { text = '' tone = '' } }let word = hasText(&show.tvmazeStatus) ? show.tvmazeStatus : (hasText(&show.status) ? show.status : '')if (word == 'Ended' && show.status == 'Canceled') { word = 'Canceled' }if (word == '') { return { text = '' tone = '' } }tone = statusTones[word]let text = word == 'Returning Series' ? 'Returning' : wordif (word == 'Running') { text = isAiring(&show) ? 'Airing' : 'Returning' }return { text = text tone = tone != null ? tone : 'other' }}// an episode released today-7 … today+7 (UTC days, both ends included); only the two newest numbered seasons are looked at (an// airing episode is in one of them — The Simpsons has 36 seasons). Specials (season 0; the sync keeps them only for a show that// already has one) do not count: Family Guy's special of 2026-10-05 between S24 and S25 is no "Airing".static isAiring = (&show) => {firstDay = dayStr(-7)lastDay = dayStr(7)seasons = []for (se of seasonsOfShow(&show)) { if (se.seasonNumber != 0 && seasons.length < 2) { seasons.push(se) } }let k = 0while (k < seasons.length) {for (id of seasons[k].episodes) {e = episodesTable.fetch(id)if (e != null && hasText(&e.release)) {d = e.release.slice(0, 10)if (d >= firstDay && d <= lastDay) { return true }}}k = k + 1}return false}// ---- adult titles (mission 054) -----------------------------------------------------------------// `adult` on every title: true / false from TMDB, null = not known yet (the migrated rows; the app's backfill, backfill.hl// `backfillTitle`, asks TMDB). The PUBLIC lists (catalog.hl: homepage rows, /movies, /shows) and the search (search.hl) show// ONLY a title TMDB says is not adult — unknown counts as hidden. A title the user follows stays on /my/* and its page.// A merged tombstone (tracker#31) is never public.static isPublicTitle = (&show) => { return show != null && show.adult == false && show.mergedInto == null }// ---- incomplete titles (tracker.worldapi.org#26; details.hl completes them, credits.hl and dailysync.hl skip them) ------------// COMPLETE = TMDB's details answer went through this app once: completed (`detailsAt`, details.hl) or synced (`tmdbSync`, the// last step of sync.hl's sync — the daily run, a search import) — or given up on (`detailsCheck`: TMDB 404 / adult).// INCOMPLETE = every other title with a TMDB id: a filmography title (`minimal`, #26) until it is completed, an import whose// sync never finished, and (tracker#33, mission 029) the old tracker's MIGRATED rows that were never synced — #26 only looked// at `minimal`/`imported`, so they passed: live copy 2026-10-03, 5,697 non-adult titles (4,206 movies, 1,491 series), 691// series without a single season, 209 + 84 without a poster, 389 + 120 without genres (tools/count-incomplete.hl). Also a// movie with a TV answer's leftovers (below). What a title still lacks that a page shows: `missingParts`.static isIncomplete = (&s) => {return s != null && s.tmdbId != null && s.detailsCheck == null&& ((s.detailsAt == null && (s.minimal == true || s.tmdbSync == null)) || hasTvLeftovers(&s))}// tracker#33: what a title's page would miss — the parts a complete record has when TMDB has them: 'poster', 'summary',// 'genres', 'cast', 'ids' (no IMDb id), 'release', 'seasons' (a series without any). The repair does these titles first// (details.hl detailsRepairQueue); tools/count-incomplete.hl counts them. A complete title can still miss one — TMDB has none// (The Remaining, a 7-minute Finnish short: no poster, no IMDb id on TMDB).static missingParts = (&s) => {out = []if (s.image == null || s.image == '') { out.push('poster') }if (summaryOf(&s) == '') { out.push('summary') }if (s.genres == null || s.genres.length == 0) { out.push('genres') }if (s.cast == null || s.cast.length == 0) { out.push('cast') }if (s.imdbId == null) { out.push('ids') }if (s.release == null || s.release == '') { out.push('release') }if (s.type != 'movie' && (s.seasons == null || s.seasons.length == 0)) { out.push('seasons') }return out}// mission 025 (report 021's "wrong TMDB id"): the #9 sync once asked TMDB for every followed title as `/tv/<tmdbId>` — a movie's// id is ANOTHER title there (fixed in mission 006: movies go to /movie/) and the TV title's overview, status and season/episode// counts were stored on the movie. On the real data only Star Trek: First Contact: its tmdbId 199 IS the movie (/movie/199),// tmdbSummary was TV 199's ("Kabuhayang Swak na Swak …"), status 'Ended', seasonsCount/episodesCount 0. The movie path never// writes the counts, so a movie that has them is such a record: the repair asks /movie/<id> again (withDetailsFields: overview →// tmdbSummary, status, …) and firstStep drops the counts — repaired once, then it no longer matches.static hasTvLeftovers = (&s) => { return s.type == 'movie' && (s.seasonsCount != null || s.episodesCount != null) }// ---- the kind of a title (tracker.worldapi.org#21, mission 068; #43, mission 037) ------------------------------------------// A TV title (`type = 'series'`) is either a SERIES (TMDB's TV type Scripted, Miniseries, Documentary) or a SHOW (Reality,// Talk Show, News, Video — or one of our genres Reality / Talk / News, whatever the type — or, #43, TVmaze's type Variety, Talk// Show, Reality, Game Show, News, Panel Show, Award Show, Sports: TMDB calls Saturday Night Live UK "Scripted", TVmaze// "Variety"; TVmaze's type is stored as `tvmazeType` by the sync and the TVmaze status backfill). Stored on the title as `kind`// ('series' | 'show') and TMDB's type as `tmdbType`: by the kind backfill (backfill.hl `kindTitle`, one TMDB request per// title without a show genre), the daily sync and the search import. Until a title has `kind`, its genres decide (no// type known yet = series). Movies are `type = 'movie'` and have no kind.static showTmdbTypes = ['Reality', 'Talk Show', 'News', 'Video']static showGenreNames = ['Reality', 'Talk', 'News']// #43 (mission 037): TVmaze's show types that are SHOWS ("all that game show and reality and talkshow stuff", #21); its others —// Scripted, Animation, Documentary — are series. '' = TVmaze was asked and gave nonestatic showTvmazeTypes = ['Variety', 'Talk Show', 'Reality', 'Game Show', 'News', 'Panel Show', 'Award Show', 'Sports']static showGenreIdsOf = () => {out = {}for (g of genresTable.find(null, null)) { if (g.name != null && showGenreNames.includes('' + g.name)) { out[g.id] = true } }return out}// the genre ids that make a title a show — read once (the genres table never changes while the app runs)static showGenreIds = showGenreIdsOf()static hasShowGenre = (&genres) => {if (genres == null) { return false }for (g of genres) { if (showGenreIds[g] == true) { return true } }return false}// 'show' | 'series' from TMDB's type, the title's genre ids and TVmaze's type (#43; null = not known)static kindOfTitle = (&tmdbType, &genres, &tvmazeType) => {if (hasShowGenre(&genres)) { return 'show' }if (tmdbType != null && showTmdbTypes.includes('' + tmdbType)) { return 'show' }if (tvmazeType != null && showTvmazeTypes.includes('' + tvmazeType)) { return 'show' }return 'series'}// #43: the kind to STORE after TVmaze's type came in — the rule once TMDB's or TVmaze's type is known, else the stored one (null:// the genres decide until the kind backfill asks TMDB, which it does only for a title without a stored kind)static kindWithTvmaze = (&show) => {known = (show.tmdbType != null && '' + show.tmdbType != '') || (show.tvmazeType != null && showTvmazeTypes.includes('' + show.tvmazeType))return known ? kindOfTitle(&show.tmdbType, &show.genres, &show.tvmazeType) : show.kind}// 'movie' | 'series' | 'show' of a stored titlestatic titleKind = (&show) => {if (show.type == 'movie') { return 'movie' }if (show.kind == 'show' || show.kind == 'series') { return show.kind }return kindOfTitle(&show.tmdbType, &show.genres, &show.tvmazeType)}// a title's own page: /movies/<slug>, /series/<slug>, /shows/<slug> (the old /shows/<slug> of a movie or series answers 301,// project.hl showsRoute)static titlePath = (&show) => {k = titleKind(&show)return (k == 'movie' ? '/movies/' : (k == 'show' ? '/shows/' : '/series/')) + show.urlSegment}// `/shows/<slug>` (#21, mission 068; project.hl showsRoute): since the split only the game / reality / talk / news SHOWS live// there — the page a series or a movie answers with a 301 instead (its own page), as does a merged duplicate's slug or a// keeper's former one (tracker#31: the keeper's page); null = render the title page here (a show, or an unknown slug)static showsMovedPath = (&slug) => {show = showBySlug(&slug)return show != null && (titleKind(&show) != 'show' || show.urlSegment != slug) ? titlePath(&show) : null}// tracker.worldapi.org#20: the type word of a page heading / list label and its colour class (styles.hl `type-*`)static kindWord = (&kind) => { return kind == 'movie' ? 'Movie' : (kind == 'show' ? 'Show' : 'Series') }static typeWordOf = (&show) => { return kindWord(titleKind(&show)) }// the theme's pill classes of a kind (layouts "Type colours and pills": Movie = type-1, Series = type-2, Show = type-3) — the kind label of a list rowstatic pillClassOfWord = (&word) => { return word == 'Movie' ? 'pill type-1' : (word == 'Show' ? 'pill type-3' : 'pill type-2') }static typeClassOf = (&show) => { return pillClassOfWord(typeWordOf(&show)) }// the poster file name (oldId + the migrated extension) — null when either is missing; served at// /posters/<name> (images.hl), which falls back to a placeholder when the file itself isn't there// yet (the real poster files are not part of the mongo export, see the report's `open`)static posterName = (&show) => {if (show.oldId == null || show.image == null || show.image == '') { return null }return show.oldId + '.' + show.image}// the poster's URL for a LIST (/my/shows, tracker.worldapi.org#8): `/posters/<name>` only when the file really// is in storage/mpackdb/posters/ (images.hl serves the same folder), else the ONE placeholder URL// `/posters/none` — the real data has no poster files yet, and 128 different URLs all answering the same// placeholder were 128 requests per page load (the browser can't cache them as one)static posterUrlOf = (&show) => { return posterUrlOfName(posterName(&show)) }static posterUrlOfName = (&name) => { return name != null && exists(postersDir + '/' + name) ? '/posters/' + name : '/posters/none' }// ---- slim per-title caches for the lists (tracker.worldapi.org#30, mission 025) ------------------------------------// /my/series took 4.4 s on a process that had run the first-start jobs (0.4 s fresh): every load fetched each followed title's// WHOLE record (cast + crew, up to 300 entries) and one episode per watch (11.7k fetches); /my/unwatched every season and// episode of every followed title. Each fetch decodes a new object, and with a big live heap (after the jobs) every byte// allocated feeds the byte-triggered GC. Now a list reads two small cached things per title:// - `cardOf(id)`: { id type kind title year titleYear href posterName } — what a row shows;// - `episodeRowsOf(id)`: every episode of the title as { id s e title release }, seasons latest first, episodes in order// (the same order as seasonsOfShow/episodesOfSeason);// - `episodeKeyOf(id)`: one episode as { show s e } — /my/series' last watched episode goes by the WATCHED episode's own// `show` (as before): migrated episodes the sync left outside the title's seasons (a duplicate season, e.g. Reacher S03 on// the real data) still count. project.hl warms every watched episode at boot.// Filled at the first ask (project.hl warms the followed titles at boot) and kept in sync by catalog.hl `refreshCatalogShow`,// which every writer of a title already calls after it changed one (daily sync, repair, kinds, adult backfill, imports):// it calls `refreshTitleCaches(show)`, which rebuilds the entries that exist. Cached values are only ever RETURNED from a// function (a `let x = map[k]` deep-copies the value; a return does not — measured: 3.7 ms per 20k-row copy).static cardCache = {}static episodeRowsCache = {}static episodeKeyCache = {}static cardFrom = (&show) => {y = showYear(&show)return {id = show.id type = show.type kind = titleKind(&show) title = show.title year = y != null ? y : ''titleYear = titleWithYear(&show) href = titlePath(&show) posterName = posterName(&show)}}// tracker#46 (mission 046): what the PERSON page needs of a title, per title id — { id mergedInto public title year release href// posterName typeLabel typeClass }. The person page used to fetch every credit's WHOLE title record (cast + crew, up to 300// entries each: 311 decoded records for Tom Hanks) on every request — the allocation fed the byte-triggered GC (a 6 s+ pause// on the live heap). Filled at the first ask, rebuilt by `refreshTitleCaches` (every writer of a title calls it); returned, never copied.static creditRowCache = {}static creditRowFrom = (&show) => {y = showYear(&show)return { id = show.id mergedInto = show.mergedInto public = isPublicTitle(&show) title = show.title year = y != null ? y : ''release = textOr(&show.release) href = titlePath(&show) posterName = posterName(&show) typeLabel = typeWordOf(&show) typeClass = typeClassOf(&show) }}static creditRowOf = (&id) => {if (id == null) { return null }if (creditRowCache[id] != null) { return creditRowCache[id] }show = showsTable.fetch(id)if (show == null) { return null }if (cacheCount.creditRow >= cacheLimit.creditRow) {for (k of creditRowCache.keys()) { delete creditRowCache[k] }cacheCount.creditRow = 0}creditRowCache[id] = creditRowFrom(&show)cacheCount.creditRow = cacheCount.creditRow + 1return creditRowCache[id]}// the row of the title a page shows for this id: the keeper of a merged tombstone (chain followed, at most 5 steps, like liveShowOf)static creditRowLive = (&id) => {let r = creditRowOf(&id)let n = 0while (r != null && r.mergedInto != null && n < 5) {r = creditRowOf(&r.mergedInto)n = n + 1}return r}// GC1 measurement (TRACKER_QSTATS=1, jobs.hl): how many entries the request caches holdstatic cacheSizes = () => {return { card = cardCache.keys().length episodeRows = episodeRowsCache.keys().length episodeKey = episodeKeyCache.keys().length creditRow = creditRowCache.keys().length personLink = personLinkCache.keys().length }}static cardOf = (&id) => {if (id == null) { return null }if (cardCache[id] != null) { return cardCache[id] }show = showsTable.fetch(id)if (show == null) { return null }if (cacheCount.card >= cacheLimit.card) {for (k of cardCache.keys()) { delete cardCache[k] }cacheCount.card = 0}cardCache[id] = cardFrom(&show)cacheCount.card = cacheCount.card + 1return cardCache[id]}static episodeRowsFrom = (&show) => {out = []if (show.seasons == null) { return out }// loop names apart from the row's own `s`/`e` keys: inside an object literal a key set earlier shadows the variablefor (sn of seasonsOfShow(&show)) {for (ep of episodesOfSeason(&sn)) {out.push({ id = ep.id s = ep.seasonNumber e = ep.episodeNumber title = ep.title != null ? ep.title : '' release = ep.release })}}return out}static episodeRowsOf = (&id) => {if (id == null) { return [] }if (episodeRowsCache[id] != null) { return episodeRowsCache[id] }show = showsTable.fetch(id)if (show == null) { return [] }if (cacheCount.episodeRows >= cacheLimit.episodeRows) {for (k of episodeRowsCache.keys()) { delete episodeRowsCache[k] }cacheCount.episodeRows = 0}episodeRowsCache[id] = episodeRowsFrom(&show)cacheCount.episodeRows = cacheCount.episodeRows + 1return episodeRowsCache[id]}// an episode that is not stored is { show = null } (never fetched again)static episodeKeyOf = (&id) => {if (id == null) { return { show = null s = null e = null } }if (episodeKeyCache[id] != null) { return episodeKeyCache[id] }ep = episodesTable.fetch(id)if (cacheCount.episodeKey >= cacheLimit.episodeKey) {for (k of episodeKeyCache.keys()) { delete episodeKeyCache[k] }cacheCount.episodeKey = 0}cacheCount.episodeKey = cacheCount.episodeKey + 1episodeKeyCache[id] = ep != null ? { show = ep.show s = ep.seasonNumber e = ep.episodeNumber } : { show = null s = null e = null }return episodeKeyCache[id]}// a title changed (catalog.hl refreshCatalogShow): its cached entries again from the stored record; the episode keys of its// episodes from the new rows (numbers the sync changed). Keys of a title nobody follows (no rows cached) are not refreshed —// /my/series only reads followed titles, and warmTitleCaches covers every followed one at boot.static refreshTitleCaches = (&show) => {// tracker#42: its slugs into the slug map (a new title's page is found without a scan)noteSlugsOf(&show)if (cardCache[show.id] != null) { cardCache[show.id] = cardFrom(&show) }if (creditRowCache[show.id] != null) { creditRowCache[show.id] = creditRowFrom(&show) }if (episodeRowsCache[show.id] != null) {episodeRowsCache[show.id] = episodeRowsFrom(&show)sid = show.idfor (r of episodeRowsOf(&sid)) {if (episodeKeyCache[r.id] != null) { episodeKeyCache[r.id] = { show = sid s = r.s e = r.e } }}}return null}// project.hl at boot: the titles anyone follows and every watched episode, so the first /my/ load after a start is not the one// that fills themstatic warmTitleCaches = (&ids) => {let n = 0for (id of ids) {if (cardOf(&id) != null) { episodeRowsOf(&id) n = n + 1 }}return n}static warmEpisodeKeys = (&ids) => {for (id of ids) { episodeKeyOf(&id) }return ids.length}// merge.hl (tracker#31): an episode that moved to another title — its key is read again at the next askstatic forgetEpisodeKey = (&id) => {episodeKeyCache[id] = nullreturn null}// ---- the show on other sites (tracker.worldapi.org#12) ------------------------------------------// the header's link icons: TMDB, IMDb, TheTVDB, TVmaze — ONLY for the ids the show has; a movie (`type = 'movie'`)// gets TMDB + IMDb. TheTVDB's id form is `/dereferrer/series/<id>` (checked 2026-10-01: it and the old// `?tab=series&id=` both 301 to the slug page); the others are the sites' own id URLs (they too 301 to a slug).static externalLinksOf = (&show) => {out = []movie = show.type == 'movie'if (hasId(&show.tmdbId)) { out.push({ site = 'tmdb' label = 'TMDB' title = 'On TMDB' href = 'https://www.themoviedb.org/' + (movie ? 'movie/' : 'tv/') + show.tmdbId }) }if (hasId(&show.imdbId)) { out.push({ site = 'imdb' label = 'IMDb' title = 'On IMDb' href = 'https://www.imdb.com/title/' + show.imdbId + '/' }) }if (!movie && hasId(&show.tvdbId)) { out.push({ site = 'tvdb' label = 'TVDB' title = 'On TheTVDB' href = 'https://thetvdb.com/dereferrer/series/' + show.tvdbId }) }if (!movie && hasId(&show.tvmzId)) { out.push({ site = 'tvmaze' label = 'TVmaze' title = 'On TVmaze' href = 'https://www.tvmaze.com/shows/' + show.tvmzId }) }return out}// ---- title page rows and actions (tracker#59; moved from components/show.hl) --------------------static initialCollapsed = (&seasons) => {m = {}let i = 0while (i < seasons.length) {// mobile audit MK: a season of more than 150 episodes starts closed too (a soap whose 1,175 episodes are ONE season made a 69,000 px page// of 1,200 tap targets); a tap on its header opens itif (i > 0 || seasons[i].episodes.length > 150) { m[seasons[i].id] = true }i = i + 1}return m}static genreRowsOf = (&show) => {out = []for (gid of show.genres) {g = genreById(&gid)if (g != null) { out.push({ id = g.id name = g.name href = '/genres/' + g.urlSegment }) }}return out}// tracker#28: how many names show before "Show all" (cast; per crew job)static castShown = 20static crewShown = 6// the cast as flat rows (no nested for, see THE ROWS above; tracker#42: people by shows.hl personLinkOf, not whole records): `isPerson` rows { name, href, roleText (' (Character)' or ''),// itemClass } and before the first guest one `isLabel` row "Guest stars". itemClass: `more` = hidden until "Show all", `end` =// no comma after it (the last of a group), `cut` = the last one shown while collapsed (no comma then)static castRowsOf = (show) => {people = []for (c of listOr(&show.cast)) {p = c != null && c.person != null ? personLinkOf(&c.person) : null// mission 062: a guest without a person record — the link creates it on the first open (project.hl guestRoute)if (p != null) { people.push({ name = c.actor != null ? c.actor : p.name href = '/person/' + p.urlSegment role = c.character != null ? c.character : '' guest = c.guest == true }) }else if (c != null && c.person == null && c.tmdbId != null && c.actor != null) { people.push({ name = c.actor href = '/person/tmdb/' + c.tmdbId + '?show=' + show.id role = c.character != null ? c.character : '' guest = true }) }}out = []let k = 0let guests = falsewhile (k < people.length) {let c = people[k]if (c.guest && !guests && k > 0) {guests = trueout.push({ isLabel = true isPerson = false text = 'Guest stars' name = '' href = '' roleText = '' itemClass = k >= castShown ? 'more' : '' })}last = k == people.length - 1 || (people[k + 1].guest && !c.guest)cls = (k >= castShown ? ' more' : '') + (last ? ' end' : '') + (k == castShown - 1 ? ' cut' : '')out.push({ isLabel = false isPerson = true text = '' name = c.name href = c.href roleText = c.role != '' ? ' (' + c.role + ')' : '' itemClass = 'artist-link' + cls })k = k + 1}return out}static castCountOf = (&rows) => {let n = 0for (r of rows) { if (r.isPerson) { n = n + 1 } }return n}static crewLabels = { creator = 'Created by' director = 'Directed by' writer = 'Written by' screenplay = 'Screenplay' story = 'Story' composer = 'Music' }// the crew as flat rows: per job (in stored order) an `isLabel` row, then its people (itemClass as for the cast, `more` after// the first crewShown of a job)static crewRowsOf = (&show) => {people = []for (c of listOr(&show.crew)) {p = c != null ? personLinkOf(&c.person) : nullif (p != null && crewLabels[c.job] != null) { people.push({ name = c.name != null ? c.name : p.name href = '/person/' + p.urlSegment job = c.job }) }}out = []let k = 0let inJob = 0while (k < people.length) {let c = people[k]if (k == 0 || people[k - 1].job != c.job) {inJob = 0out.push({ isLabel = true isPerson = false text = crewLabels[c.job] name = '' href = '' itemClass = '' })}last = k == people.length - 1 || people[k + 1].job != c.jobout.push({ isLabel = false isPerson = true text = '' name = c.name href = c.href itemClass = 'crew-link' + (inJob >= crewShown ? ' more' : '') + (last ? ' end' : '') + (inJob == crewShown - 1 ? ' cut' : '') })inJob = inJob + 1k = k + 1}return out}// how many crew names are hidden while collapsed (0 = no toggle) and how many there arestatic crewHiddenOf = (&rows) => {let n = 0for (r of rows) { if (r.isPerson && r.itemClass.includes(' more')) { n = n + 1 } }return n}static crewCountOf = (&rows) => {let n = 0for (r of rows) { if (r.isPerson) { n = n + 1 } }return n}// a View attribute must be a literal, a member or a field path — never an inline expression — so// every ternary (watched -> icon class, collapsed -> row class) is resolved HERE, once, into a// plain field the View just reads (row.watchClass, row.rowClass); `watchClassOf` itself lives in// watches.hl (shared with /unwatched and /schedule, "reuse, don't copy")// #22: an episode's air date as the lists show it ('YYYY-MM-DD'), '' when it has nonestatic airDateOf = (&e) => { return e.release != null && hlTypeName(e.release) == 'String' ? e.release : '' }static buildRows = (&show, &uid, collapsed) => {// GC1: the user's kept watched set (watches.hl watchedSetOf, rebuilt after their next write), not a new one built from a by-value copy of// every watch row (12,866 rows on the creator's data) on every page and every check clickwatched = uid != null ? watchedSetOf(&uid) : {}out = []for (s of seasonsOfShow(&show)) {isCollapsed = collapsed[s.id] == truelabel = s.title != null && s.title != '' ? s.title : 'Season ' + s.seasonNumberseasonWatched = seasonAllWatched(&s, &watched)out.push({ kind = 'season' isSeason = true isEpisode = false isSkeleton = false @id = s.id id = s.id skeletonCount = s.episodes.length < 8 ? s.episodes.length : 8 label = label episodeCountText = s.episodes.length == 1 ? '1 episode' : s.episodes.length + ' episodes' watched = seasonWatched watchClass = watchClassOf(&seasonWatched) collapsed = isCollapsed rowClass = isCollapsed ? 'collapsed' : 'expanded' })if (!isCollapsed) {for (e of episodesOfSeason(&s)) {epWatched = watched['episode:' + e.id] == trueout.push({ kind = 'episode' isSeason = false isEpisode = true isSkeleton = false id = e.id seasonId = s.id episodeNumber = e.episodeNumber title = e.title != null ? e.title : '' airDate = airDateOf(&e) watched = epWatched watchClass = watchClassOf(&epWatched) })}}}return out}// what the client marks the rows of a season it opens with (tracker#17) — only this show's, never the user's whole watch// list (every member is shipped to the browser). Per season with a watched episode: `{ all, except }` — `all` = most of// it is watched, then `except` holds the UNwatched ids, else the watched ones (a fully watched 142-episode season is// `{ all = true except = {} }`, not 142 ids). No entry = nothing watched.static watchedEpisodesOf = (&show, &uid) => {m = {}if (uid == null) { return m }watched = watchedSetOf(&uid)for (s of seasonsOfShow(&show)) {yes = {}no = {}let n = 0for (eid of s.episodes) {if (watched['episode:' + eid] == true) { yes[eid] = true n = n + 1 } else { no[eid] = true }}if (n > 0) { m[s.id] = n * 2 > s.episodes.length ? { all = true except = no } : { all = false except = yes } }}return m}// is this episode watched, by that per-season shape (client-side, pure)static watchedIn = (&entry, &episodeId) => {if (entry == null) { return false }listed = entry.except[episodeId] == truereturn entry.all ? !listed : listed}// ---- the rows as the CLIENT changes them (tracker#17) — pure: no import is reached, so they run in the browser ----------// (`watchClassOf` is an import of the mpackdb-backed watches.hl, so `filledRows` writes its two classes itself)static seasonRowAs = (&row, &isCollapsed) => {return { kind = 'season' isSeason = true isEpisode = false isSkeleton = false @id = row.id id = row.id skeletonCount = row.skeletonCount label = row.label episodeCountText = row.episodeCountText watched = row.watched watchClass = row.watchClass collapsed = isCollapsed rowClass = isCollapsed ? 'collapsed' : 'expanded' }}// the season opened: its caret up at once, `skeletonCount` placeholder rows under itstatic openingRows = (&rows, seasonId) => {out = []for (row of rows) {if (row.isSeason && row.id == seasonId) {out.push(seasonRowAs(&row, false))let i = 0while (i < row.skeletonCount) {out.push({ kind = 'skeleton' isSeason = false isEpisode = false isSkeleton = true id = seasonId + '-skeleton-' + i seasonId = seasonId })i = i + 1}} else { out.push(row) }}return out}// the season closed (rows are keyed records: `id` is the key, `@id` marks the lookup of upsert/remove, hybriel#331): its caret// down = ONE upsert of its row; its episode (and skeleton) rows = one `remove(id = …)` each. The other rows are not touched.static closeSeasonRows = (&rows, &seasonId) => {gone = []let season = nullfor (row of rows) {if (row.isSeason && row.id == seasonId) { season = seasonRowAs(&row, true) }else if (!row.isSeason && row.seasonId == seasonId) { gone.push(row.id) }}if (season != null) { rows.upsert(season) }for (g of gone) { rows.remove(id = g) }}// the episodes arrived: they replace the season's skeleton rows. No skeleton of it left (closed meanwhile, or a watch face// already rebuilt every row) → the rows stay as they are (no double rows)static filledRows = (&rows, seasonId, &episodes, watched) => {out = []let done = falsefor (row of rows) {if (row.isSkeleton && row.seasonId == seasonId) {if (!done) {for (e of episodes) {w = watchedIn(&watched[seasonId], &e.id)out.push({ kind = 'episode' isSeason = false isEpisode = true isSkeleton = false id = e.id seasonId = seasonId episodeNumber = e.episodeNumber title = e.title airDate = e.airDate watched = w watchClass = w ? 'checkicon solid' : 'checkicon regular' })}done = true}} else { out.push(row) }}return out}// a LOCAL static like buildRows (an imported mpackdb helper called straight from a member's initializer came back false// after a client-side navigation to the page — the gate's follow check)static followingOf = (&show, &uid) => { return uid != null && isFollowing(&uid, &show.id) }// #24: has this user watched this movie (a watch `movie:<title id>`)?static movieWatchedOf = (&show, &uid) => {if (uid == null) { return false }rows = watchesOfUser(&uid)return isWatched(&rows, 'movie', &show.id)}// mission 056: an ADULT title's page (TMDB's flag `adult == true`, mission 054) is "Not found" for everyone who does not// follow it (signed out too); a follower sees it as before. Unknown (`null`) is not hidden here — only in the lists.// With hybriel ≥ 73267707 (#121/#122) `showRow`/`found` are server sites re-derived after every session face with the page's// slug, so an Unfollow on the page hides it at once (the gate proves it; the old build left the page up until a reload).// Mission 054's try (`found = … && !adultHiddenFor(showRow, me)`, `collapsed`/`rows` from `found`) broke the checks.static adultHiddenFor = (&show, &uid) => { return show.adult == true && !followingOf(&show, &uid) }// the page's show — null when there is none OR it is hidden for this user: every member is shipped to the browser, so the// row of a hidden title must never be onestatic visibleShow = (&slug, &uid) => {s = showBySlug(&slug)return s != null && adultHiddenFor(&s, &uid) ? null : s}// tracker.worldapi.org#19 (mission 066): the franchise widget(s), one per timeline the title is in (components/franchisewidget.hl)static franchiseWidgetsOf = (&show) => { return widgetsOf(&show.id) }// tracker#33 (mission 032): a movie's release date and runtime under its title — "17 September 2026 · 7 min", "… · 2 h 15 min";// what is missing is left out ('' = no line)static runtimeText = (&m) => {if (m == null || hlTypeName(m) != 'Number' || m <= 0) { return '' }mins = m % 60hours = (m - mins) / 60if (hours == 0) { return mins + ' min' }return mins == 0 ? hours + ' h' : hours + ' h ' + mins + ' min'}static movieFactsOf = (&s) => {if (s.type != 'movie') { return '' }parts = []d = dateText(&s.release)if (d != null) { parts.push(d) }r = runtimeText(&s.runtime)if (r != '') { parts.push(r) }return parts.join(' · ')}// mission 062: what the page shows of the title, as a SMALL object — `showRow` reads the session, so hl:web ships it with the page// AND re-sends it after every watch/follow click (SESSION SYNC below): the whole record was ~1 MB on The Simpsons (300 cast + crew// entries). null = not found / hidden.static pageShowOf = (&slug, &uid) => {s = visibleShow(&slug, &uid)if (s == null) { return null }movie = s.type == 'movie'st = statusOf(&s)return { id = s.id title = s.title summary = summaryOf(&s) type = s.type adult = s.adult == true shortId = s.shortId != null ? '' + s.shortId : '' statusText = st.text statusTone = st.toneposter = posterName(&s) genreRows = genreRowsOf(&s) linkRows = externalLinksOf(&s) completing = completingOf(&s) following = followingOf(&s, &uid)movieWatched = movie ? movieWatchedOf(&s, &uid) : false facts = movieFactsOf(&s) }}// the seasons/episodes rows and the per-season watch state by the slug (the record itself stays on the server)static rowsOfSlug = (&slug, &uid, &collapsed) => {s = showBySlug(&slug)return s != null ? buildRows(&s, &uid, collapsed) : []}static watchedEpisodesOfSlug = (&slug, &uid) => {s = showBySlug(&slug)return s != null ? watchedEpisodesOf(&s, &uid) : {}}// the initial open/closed seasons and the title's kind (tracker#20/#21: the heading's type word) from the SLUG alone (not from// `showRow`, which reads the session — see `collapsed`) — one slug lookup for bothstatic slugInfoOf = (&slug) => {s = showBySlug(&slug)return s != null ? { collapsed = initialCollapsed(seasonsOfShow(&s)) kind = titleKind(&s) canonical = titlePath(&s) } : { collapsed = {} kind = 'series' canonical = '' }}// mission 062: the cast and crew rows by the SLUG alone (not from `showRow`, which reads the session — see `castRows`). An// ADULT title (its page only for its followers) shows none: every member is shipped to the browser, and adult titles never get// credits anyway (details.hl skips them; at most a migrated cast)static publicShowOf = (&slug) => {s = showBySlug(&slug)return s != null && s.adult != true ? s : null}static castOfSlug = (&slug) => {s = publicShowOf(&slug)return s != null ? castRowsOf(s) : []}static crewOfSlug = (&slug) => {s = publicShowOf(&slug)return s != null ? crewRowsOf(&s) : []}static completingOf = (&show) => { return needsDetails(&show) }static showRowsOf = (slug, collapsed, uid) => {show = showBySlug(&slug)if (show == null || adultHiddenFor(&show, &uid)) { return { error = 'no such show' } }return { ok = true rows = buildRows(&show, &uid, collapsed) }}static showSeasonEpisodesOf = (seasonId) => {if (seasonId == null || hlTypeName(seasonId) != 'String') { return { error = 'no such season' } }season = seasonById(&seasonId)if (season == null) { return { error = 'no such season' } }show = showById(&season.show)if (show == null || show.adult == true) { return { error = 'no such season' } }out = []for (e of episodesOfSeason(&season)) { out.push({ id = e.id episodeNumber = e.episodeNumber title = e.title != null ? e.title : '' airDate = airDateOf(&e) }) }return { ok = true episodes = out }}static showToggleEpisodeOf = (slug, episodeId, collapsed, withRows, uid) => {show = showBySlug(&slug)if (show == null) { return { error = 'no such show' } }if (uid == null) { return { error = 'you are not signed in' } }if (adultHiddenFor(&show, &uid)) { return { error = 'no such show' } }// mission SK: only an episode OF THIS SHOW — the id is the peer's (any text became a watch row before)ep = episodeId != null && hlTypeName(episodeId) == 'String' ? episodeById(&episodeId) : nullif (ep == null || ep.show != show.id) { return { error = 'no such episode' } }if (toggleWatched(&uid, 'episode', &episodeId) == null) { return { error = 'could not save the watch' } }return withRows == true ? { ok = true rows = buildRows(&show, &uid, collapsed) } : { ok = true }}static showToggleSeasonOf = (slug, seasonId, collapsed, withRows, uid) => {show = showBySlug(&slug)if (show == null) { return { error = 'no such show' } }if (uid == null) { return { error = 'you are not signed in' } }if (adultHiddenFor(&show, &uid)) { return { error = 'no such show' } }season = seasonId != null && hlTypeName(seasonId) == 'String' ? seasonById(&seasonId) : nullif (season == null || season.show != show.id) { return { error = 'no such season' } }// #23: not all episodes watched → watch them all; all watched → unwatch them all (lib/watches.hl)if (toggleSeasonWatched(&uid, &season) == null) { return { error = 'could not save the watch' } }return withRows == true ? { ok = true rows = buildRows(&show, &uid, collapsed) } : { ok = true }}static showToggleMovieOf = (slug, uid) => {show = showBySlug(&slug)if (show == null || show.type != 'movie') { return { error = 'no such movie' } }if (uid == null) { return { error = 'you are not signed in' } }if (adultHiddenFor(&show, &uid)) { return { error = 'no such movie' } }watched = toggleWatched(&uid, 'movie', &show.id)if (watched == null) { return { error = 'could not save the watch' } }return { ok = true watched = watched }}static showToggleFollowOf = (slug, uid) => {show = showBySlug(&slug)if (show == null) { return { error = 'no such show' } }if (uid == null) { return { error = 'you are not signed in' } }// mission SK: an adult title is its followers' only — nobody else may start following it (that opened its page to anyone who// guessed the slug); a follower may still stopif (adultHiddenFor(&show, &uid)) { return { error = 'no such show' } }follow = toggleFollowed(&uid, &show.id)if (follow == null) { return { error = 'could not save the follow' } }return { ok = true following = follow }}
Branches
Latest commits
- 6bb7c20estatus: window 2026-11-09mre
- 5db84974Log: Apollo window GO, AP56b started, BS1 copy removedmre
- e84586a7Mission AP56bmre
- 15917f03Record PR workflow rule (gitoria#50)mre
- 942ac995status: paused workers statemre
- 44b934e5log: respawn cleanupmre
- 03a80097Log: Anton GC A/Bmre
- c7cdef62Log: Apollo STOP, workers pausedmre
- d0c083fbLog: usage stopmre
- c6d464e5Log: Apollo GO backlog, AP56 and BS1 startedmre
- 1eb6f1a1Missions AP56, BS1mre
- 4871f8adLog: AP52 live on day52, browser gate greenmre
- d9bf2988Merge ap52: day52, tracker#58 server argument, #51 modal close rule, #56 keyed season rowsmre
- c4a60ef2Log: RT52 retest passed, AP52 startedmre
- 83760a55Browser gate: search results belong to the address form of the typed text (tracker#52 navigate replace)mre
- 6e951d91AP52: show-page rows are keyed records; closing a season is one upsert and removes (tracker#56, hybriel#331)mre
- 3bb4ccddAP52: modal close button refers to its nested rule with Style.buttonModalX (tracker#51, hybriel#333)mre
- ba16933fAP52: login callback and title route are static handlers taking the server as third argument (tracker#58, hybriel#332)mre
- 85153900AP52: re-vendor Hybriel set day52 (source 77cfca31, bin 0a8ed496)mre
- 7c051eddLog: hybriel#338 answermre