tracker
All repositories: gitoria
24.0 KB
// lib/sync.hl — THE TMDB SYNC OF ONE TITLE (tracker.worldapi.org#9; tmdbsync.hl before mission 028 — its requests are in tmdb.hl,// its small helpers in sync-helpers.hl, the backfills in backfill.hl): for every show SOMEONE follows, fetch the show's// details, seasons and episodes from TMDB and bring storage/mpackdb/ up to date, plus the show's poster.// Used by BOTH runners: the daily run inside the app (jobs.hl `syncTick`, one show per step) and the// command-line tool (tools/sync-tmdb.hl). Reference for the API use: the old tracker's// crates/sync/commands/sync.js (read-only).//// GET <TMDB_BASE_URL>/tv/<tmdbId>?append_to_response=external_ids,aggregate_credits the details (status,// counts, overview, poster_path, seasons[])// + external_ids (imdb_id, tvdb_id) + the cast/crew// of every season (tracker#28: the answer goes back// as `res.details`, the caller stores the credits —// credits.hl applyCredits; no extra request)// GET <TMDB_BASE_URL>/tv/<tmdbId>?append_to_response=season/1,season/2… up to 20 seasons with their// episodes in ONE request// GET <TMDB_IMAGE_URL>/w342<poster_path> the poster → storage/mpackdb/posters/// Authorization: Bearer $TMDB_READ_TOKEN// GET <TVMAZE_BASE_URL>/lookup/shows?imdb=tt… (else ?thetvdb=<id>) the TVmaze id, ONLY when the show// has none (301 → /shows/<id>, 404 = unknown)// GET <TVMAZE_BASE_URL>/shows/<tvmzId>?embed=episodes a SERIES on TVmaze with its episodes (#15), see// below; its summary → `tvmazeSummary` (tracker#18)// A MOVIE (`type = 'movie'`, 7814 of the migrated rows, 1 followed): only// GET <TMDB_BASE_URL>/movie/<tmdbId>?append_to_response=external_ids,credits its imdb id + poster (+ credits); no seasons,// status, overview (it is no TV show)//// EXTERNAL IDS (tracker.worldapi.org#12, the show page's link icons): a MISSING imdbId/tvdbId is filled from TMDB's// external_ids, a missing tvmzId from TVmaze's lookup — an id the show already has is NEVER overwritten.// RULES (ticket): new seasons/episodes are ADDED, existing ones UPDATED (title, summary, release) —// matched by tmdbId, never duplicated; NOTHING is deleted. An episode without a tmdbId (161 migrated ones)// is matched by its S/E number instead and gets the tmdbId. A season (no tmdbId in the migrated data) is// matched by (show, seasonNumber). A TMDB value that is empty/null never overwrites a stored one.// Season 0 ("Specials") is only synced for a show that already has a season 0 (else every followed show// would suddenly flood /my/unwatched with specials); a TMDB season with no episodes is not created.//// TVMAZE MERGE (tracker.worldapi.org#15): AFTER TMDB, a series with a tvmzId gets TVmaze's episode list (one request)// and TVmaze FILLS GAPS only — matched by season/episode number: a missing episode (and its season) is ADDED, an empty// title or air date of an existing one is FILLED; a value TMDB gave is never overwritten. A placeholder title// ("Episode 4", "TBA") counts as empty — and TMDB's own placeholder never overwrites a real title either (else the// two would flip it every day). When TMDB later lists the episode, the TMDB step adopts it by number (it has no tmdbId)// and TMDB's values win. TVmaze specials (no episode number) are skipped, season 0 only if the show has one. SAFETY:// when the two number a show differently (fewer than 80 % of the episodes both know air within a day of each other or// share the title — `numberingAgrees`), TVmaze is ignored for that show (`tvmazeSkipped`). Summaries are not taken// (TVmaze's are HTML; the ticket asks for episodes, air dates, titles). The SHOW's TVmaze summary is kept, HTML stripped, as// `tvmazeSummary` (tracker#18; the page shows summary > tmdbSummary > tvmazeSummary, shows.hl summaryOf).//// WHICH TITLES, WHEN (tracker#18): the daily run asks TMDB's and TVmaze's change lists first and syncs only the titles of ours// that changed — dailysync.hl. THE SHOW RECORD (title, tagline, homepage, status, genres …) is refreshed from the same details// answer by details.hl `applySynced`.//// IDS ARE SELF-ASSIGNED (randomBytes, like watches.hl): hl:mpackdb's own generated @id can repeat within// one millisecond, which is what made update() lose rows (hybriel#113, fixed upstream, not in the vendored// build) — a table holding only unique ids is safe to update().//// ONE PROCESS PER STORAGE: hl:mpackdb does not coordinate two processes (hybriel#21) — the in-app run uses// the app's own open tables (imported from shows.hl); the tool only ever runs against a stopped app or a copy.import { now } from 'hl:time'import { newId, textOr } from './util.hl'import { showsTable, seasonsTable, episodesTable, kindOfTitle } from './shows.hl'import { tmdbGet, numIdOr, externalIdsFor, tvmazeEpisodes, syncPoster, adultOf } from './tmdb.hl'import { isPlaceholderTitle, numberingAgrees, wantedSeasonNumbers, batchesOf, changedText, isMigratedRow } from './sync-helpers.hl'// Merge TVmaze's episodes of a series into what we have AFTER the TMDB step (gaps only, rules at the top).// `seasonsByNumber` / `epByNumber` = the show's seasons by number and episodes by '<s>x<e>', as the TMDB step left them.// Answers { tvmazeRequests, newSeasons, newEpisodes, filledEpisodes, skipped, errors, error, showSeasons }.static mergeTvmaze = (title, &showKey, tvmzId, seasonsIn, episodesIn, &showSeasonsIn) => {seasonsByNumber = seasonsInepByNumber = episodesInout = { tvmazeRequests = 1 newSeasons = 0 newEpisodes = 0 filledEpisodes = 0 skipped = 0 errors = 0 error = '' showSeasons = showSeasonsIn summary = null }got = tvmazeEpisodes(tvmzId)if (got.failed != null) { out.errors = 1 out.error = title + ': ' + got.failed return out }out.summary = got.summary// the numbered episodes TVmaze has in seasons we take (no specials; season 0 only when the show has one)list = []for (te of got.list) {if (numIdOr(te.season) != null && numIdOr(te.number) != null) { list.push(te) }else if (te.season == 0 && numIdOr(te.number) != null && seasonsByNumber['0'] != null) { list.push(te) }}if (!numberingAgrees(epByNumber, list).ok) { out.skipped = 1 return out }added = {}addedFirstDate = {}for (te of list) {let key = te.season + 'x' + te.numberlet e = epByNumber[key]if (e == null) {let seasonKey = seasonsByNumber['' + te.season] != null ? seasonsByNumber['' + te.season].id : nullif (seasonKey == null) {if (added['' + te.season] == null) { added['' + te.season] = [] addedFirstDate['' + te.season] = textOr(te.airdate) seasonsByNumber['' + te.season] = { id = newId() isNew = true } }seasonKey = seasonsByNumber['' + te.season].id}let fresh = { id = newId() episodeNumber = te.number seasonNumber = te.seasontitle = textOr(te.name) summary = '' release = textOr(te.airdate)show = showKey season = seasonKey tmdbId = null tvmzId = te.id oldId = 'tvmaze-episode:' + te.id }if (episodesTable.put(fresh) == null) {out.errors = out.errors + 1out.error = title + ': TVmaze episode ' + te.id + ' not stored: ' + episodesTable.lastError()} else {if (added['' + te.season] == null) { added['' + te.season] = [] }let l = added['' + te.season]l.push(fresh.id)added['' + te.season] = lepByNumber[key] = freshout.newEpisodes = out.newEpisodes + 1}} else {let changed = falseif (isPlaceholderTitle(e.title) && !isPlaceholderTitle(te.name)) { e.title = te.name changed = true }if (textOr(e.release) == null && textOr(te.airdate) != null) { e.release = te.airdate changed = true }if (changed) {if (episodesTable.update(e.id, e) == null) {out.errors = out.errors + 1out.error = title + ': episode ' + e.id + ' not filled from TVmaze: ' + episodesTable.lastError()} else {epByNumber[key] = eout.filledEpisodes = out.filledEpisodes + 1}}}}// the seasons that got episodes: an existing one is updated, a new one stored and linked to the showshowSeasons = []for (sid of showSeasonsIn) { showSeasons.push(sid) }for (n of added.keys()) {let ids = added[n]let s = seasonsByNumber[n]if (ids.length > 0 && s.isNew == true) {let season = { id = s.id seasonNumber = toNumber(n) title = 'Season ' + n release = addedFirstDate[n] summary = ''show = showKey episodes = ids oldId = 'tvmaze-season:' + tvmzId + ':' + n }if (seasonsTable.put(season) == null) {out.errors = out.errors + 1out.error = title + ': TVmaze season ' + n + ' not stored: ' + seasonsTable.lastError()} else {showSeasons.push(season.id)out.newSeasons = out.newSeasons + 1}} else if (ids.length > 0) {let season = seasonsTable.fetch(s.id)let eps = []for (eid of season.episodes) { eps.push(eid) }for (eid of ids) { eps.push(eid) }season.episodes = epsif (seasonsTable.update(season.id, season) == null) {out.errors = out.errors + 1out.error = title + ': season ' + season.id + ' not updated: ' + seasonsTable.lastError()}}}out.showSeasons = showSeasonsreturn out}// a MOVIE: one request — its imdb id (if missing) and its poster; nothing else of the record is touched. `pre` = that// request's answer when the caller already made it (details.hl firstStep, tracker#26), else nullstatic syncMovie = (show, res, &pre) => {out = resout.requests = 1details = pre != null ? pre : tmdbGet('/movie/' + show.tmdbId + '?append_to_response=external_ids,credits')if (details.failed != null) { out.errors = 1 out.error = show.title + ': ' + details.failed return out }if (pre == null) { out.details = details }ids = externalIdsFor(show, details.external_ids, false, false)out.ids = ids.filledposter = syncPoster(show, details.poster_path)out.requests = out.requests + poster.requestsout.posters = poster.savedif (poster.failed != null) { out.errors = out.errors + 1 out.error = show.title + ': ' + poster.failed }m = showm.imdbId = ids.imdbIdm.image = poster.imagem.tmdbPoster = poster.tmdbPosterif (adultOf(details) != null) { m.adult = adultOf(details) }m.tmdbSync = now()if (showsTable.update(m.id, m) == null) { out.errors = out.errors + 1 out.error = show.title + ': movie not updated: ' + showsTable.lastError() }return out}// Sync ONE show (by our id). Answers counts: { requests, tvmazeRequests, newSeasons, newEpisodes, updatedEpisodes,// updatedSeasons, posters, ids, tvmazeEpisodes, tvmazeSeasons, tvmazeFilled, tvmazeSkipped, errors, error } + `details` (the// details answer with its credits when this call asked for it, else null — tracker#28: the caller stores the credits). Never throws for a TMDB failure — it is counted and the show left as is.static syncShow = (&showId) => { return syncShowPart(showId, null, null) }// the same with the details request (`/tv|movie/<id>?append_to_response=external_ids…`) already answered — `pre`, counted as// this show's first request — so details.hl (tracker#26) asks TMDB once for details, ids AND the caststatic syncShowWith = (&showId, &pre) => { return syncShowPart(showId, pre, null) }// ONE PART of a series' sync (tracker#26: a talk show with 4,000 episodes took 10 s in one step, blocking every request):// `only` = { seasons (the TMDB season numbers of this part), finish (false: only those seasons — new ones linked to the show,// nothing else; true: the ids, TVmaze, poster and the show record), tvmaze (false: no TVmaze lookup/merge — tracker#18's light// step) }; null = everything at once. `pre` is required with `only` (its request is the caller's: a part counts only its own// requests).static emptyResult = () => { return { requests = 0 tvmazeRequests = 0 newSeasons = 0 newEpisodes = 0 updatedEpisodes = 0 updatedSeasons = 0 posters = 0 ids = 0 tvmazeEpisodes = 0 tvmazeSeasons = 0 tvmazeFilled = 0 tvmazeSkipped = 0 errors = 0 error = '' details = null } }static syncShowPart = (&showId, &pre, &only) => {let res = emptyResult()show = showsTable.fetch(showId)if (show == null) { res.errors = 1 res.error = 'no show ' + showId return res }if (show.tmdbId == null) { res.errors = 1 res.error = show.title + ': no tmdbId' return res }if (show.type == 'movie') { return syncMovie(show, res, pre) }res.requests = only != null ? 0 : 1details = pre != null ? pre : tmdbGet('/tv/' + show.tmdbId + '?append_to_response=external_ids,aggregate_credits')if (details.failed != null) { res.errors = 1 res.error = show.title + ': ' + details.failed return res }if (pre == null) { res.details = details }// what we have: seasons by number, episodes by tmdbId and by S/E number// (tracker#18: a part reads only ITS seasons' episodes, unless it finishes with the TVmaze merge, which compares them all —// Today, 15,716 episodes, read them all for a one-season change: 20 s and GBs of memory)tvmazeToo = only == null || only.tvmaze != falseallEpisodes = only == null || (only.finish && tvmazeToo)seasonsByNumber = {}epByTmdb = {}epByNumber = {}for (sid of show.seasons) {let s = seasonsTable.fetch(sid)if (s != null) {seasonsByNumber['' + s.seasonNumber] = slet epIds = allEpisodes || only.seasons.includes(s.seasonNumber) ? s.episodes : []for (eid of epIds) {let e = episodesTable.fetch(eid)if (e != null) {if (e.tmdbId != null) { epByTmdb['' + e.tmdbId] = e }epByNumber[e.seasonNumber + 'x' + e.episodeNumber] = e}}}}// plain locals for the record literals below: inside a literal, an entry named `show`/`season` would shadow// the variable for every later entry (SPEC "A literal's entries are evaluated in order")showKey = show.idshowTmdb = show.tmdbIdlet showSeasons = []for (sid of show.seasons) { showSeasons.push(sid) }let showChanged = falselet wanted = wantedSeasonNumbers(details, seasonsByNumber)if (only != null) {part = []for (n of wanted) { if (only.seasons.includes(n)) { part.push(n) } }wanted = part}for (batch of batchesOf(wanted, 20)) {let names = []for (n of batch) { names.push('season/' + n) }res.requests = res.requests + 1let withSeasons = tmdbGet('/tv/' + show.tmdbId + '?append_to_response=' + names.join(','))if (withSeasons.failed != null) {res.errors = res.errors + 1res.error = show.title + ': ' + withSeasons.failed} else {for (n of batch) {let ts = withSeasons['season/' + n]if (ts != null && ts.episodes != null) {let season = seasonsByNumber['' + n]let seasonIsNew = season == nulllet seasonChanged = falseif (seasonIsNew) {season = { id = newId() seasonNumber = n title = textOr(ts.name) != null ? ts.name : 'Season ' + nrelease = textOr(ts.air_date) summary = textOr(ts.overview) != null ? ts.overview : ''show = showKey episodes = [] oldId = 'tmdb-season:' + showTmdb + ':' + n }} else {let seasonMigrated = isMigratedRow(season)if (changedText(season.title, textOr(ts.name))) {if (seasonMigrated && season.migratedTitle == null && textOr(season.title) != null) { season.migratedTitle = season.title }season.title = ts.name seasonChanged = true}if (changedText(season.summary, textOr(ts.overview))) {if (seasonMigrated && season.migratedSummary == null && textOr(season.summary) != null) { season.migratedSummary = season.summary }season.summary = ts.overview seasonChanged = true}if (changedText(season.release, textOr(ts.air_date))) { season.release = ts.air_date seasonChanged = true }}let seasonKey = season.idlet seasonEpisodes = []for (eid of season.episodes) { seasonEpisodes.push(eid) }for (te of ts.episodes) {if (te.id != null && te.episode_number != null) {let e = epByTmdb['' + te.id]if (e == null) {let byNum = epByNumber[n + 'x' + te.episode_number]if (byNum != null && byNum.tmdbId == null) { e = byNum }}if (e == null) {let fresh = { id = newId() episodeNumber = te.episode_number seasonNumber = ntitle = textOr(te.name) summary = textOr(te.overview) != null ? te.overview : '' release = textOr(te.air_date)show = showKey season = seasonKey tmdbId = te.id oldId = 'tmdb-episode:' + te.id }let putId = episodesTable.put(fresh)if (putId == null) {res.errors = res.errors + 1res.error = show.title + ': episode ' + te.id + ' not stored: ' + episodesTable.lastError()} else {seasonEpisodes.push(fresh.id)epByTmdb['' + te.id] = freshepByNumber[n + 'x' + te.episode_number] = freshres.newEpisodes = res.newEpisodes + 1seasonChanged = true}} else {let changed = falseif (e.tmdbId == null) { e.tmdbId = te.id changed = true }// #15: TMDB's "Episode 4" never replaces a real title (one TVmaze filled, or the migrated one)let epMigrated = isMigratedRow(e)if (changedText(e.title, textOr(te.name)) && !(isPlaceholderTitle(te.name) && !isPlaceholderTitle(e.title))) {if (epMigrated && e.migratedTitle == null && textOr(e.title) != null) { e.migratedTitle = e.title }e.title = te.name changed = true}if (changedText(e.summary, textOr(te.overview))) {if (epMigrated && e.migratedSummary == null && textOr(e.summary) != null) { e.migratedSummary = e.summary }e.summary = te.overview changed = true}if (changedText(e.release, textOr(te.air_date))) { e.release = te.air_date changed = true }if (changed) {if (episodesTable.update(e.id, e) == null) {res.errors = res.errors + 1res.error = show.title + ': episode ' + e.id + ' not updated: ' + episodesTable.lastError()} else {epByTmdb['' + e.tmdbId] = eepByNumber[e.seasonNumber + 'x' + e.episodeNumber] = eres.updatedEpisodes = res.updatedEpisodes + 1}}}}}season.episodes = seasonEpisodesif (seasonIsNew) {if (seasonsTable.put(season) == null) {res.errors = res.errors + 1res.error = show.title + ': season ' + n + ' not stored: ' + seasonsTable.lastError()} else {seasonsByNumber['' + n] = seasonshowSeasons.push(season.id)showChanged = trueres.newSeasons = res.newSeasons + 1}} else if (seasonChanged) {if (seasonsTable.update(season.id, season) == null) {res.errors = res.errors + 1res.error = show.title + ': season ' + season.id + ' not updated: ' + seasonsTable.lastError()} else {res.updatedSeasons = res.updatedSeasons + 1}}}}}}// a part that is not the last: only the new seasons are linked to the show (the next part reads them)if (only != null && !only.finish) {if (showChanged) {show.seasons = showSeasonsif (showsTable.update(show.id, show) == null) { res.errors = res.errors + 1 res.error = show.title + ': show not updated: ' + showsTable.lastError() }}return res}// the external ids (tracker.worldapi.org#12): missing ones from TMDB's external_ids, a missing TVmaze id from TVmazeids = externalIdsFor(show, details.external_ids, true, tvmazeToo)res.ids = ids.filledres.tvmazeRequests = ids.tvmazeRequestsif (ids.failed != null) { res.errors = res.errors + 1 res.error = show.title + ': ' + ids.failed }// tracker.worldapi.org#15: what TVmaze has and TMDB not yet (new episodes/seasons, empty titles and air dates)let tvmazeSummary = nullif (numIdOr(ids.tvmzId) != null && tvmazeToo) {tvm = mergeTvmaze(show.title, showKey, ids.tvmzId, seasonsByNumber, epByNumber, showSeasons)res.tvmazeRequests = res.tvmazeRequests + tvm.tvmazeRequestsres.tvmazeEpisodes = tvm.newEpisodesres.tvmazeSeasons = tvm.newSeasonsres.tvmazeFilled = tvm.filledEpisodesres.tvmazeSkipped = tvm.skippedif (tvm.errors > 0) { res.errors = res.errors + tvm.errors res.error = tvm.error }showSeasons = tvm.showSeasonstvmazeSummary = tvm.summary}// the show itself: status, counts, TMDB's overview, the poster, when it was syncedposter = syncPoster(show, details.poster_path)res.requests = res.requests + poster.requestsres.posters = poster.savedif (poster.failed != null) { res.errors = res.errors + 1 res.error = show.title + ': ' + poster.failed }show.seasons = showSeasonsif (textOr(details.status) != null) { show.status = details.status }if (details.number_of_seasons != null) { show.seasonsCount = details.number_of_seasons }if (details.number_of_episodes != null) { show.episodesCount = details.number_of_episodes }// tracker#18: TMDB's text → tmdbSummary, TVmaze's → tvmazeSummary; `summary` is the creator's own text, never written hereif (textOr(details.overview) != null) { show.tmdbSummary = details.overview }if (tvmazeSummary != null) { show.tvmazeSummary = tvmazeSummary }show.image = poster.imageshow.tmdbPoster = poster.tmdbPostershow.imdbId = ids.imdbIdshow.tvdbId = ids.tvdbIdshow.tvmzId = ids.tvmzIdif (adultOf(details) != null) { show.adult = adultOf(details) }if (textOr(details.type) != null) { show.tmdbType = details.type show.kind = kindOfTitle(details.type, show.genres) }show.tmdbSync = now()if (showsTable.update(show.id, show) == null) { res.errors = res.errors + 1 res.error = show.title + ': show not updated: ' + showsTable.lastError() }return res}// ---- the LIGHT step of the daily delta run (tracker#18) ---------------------------------------------------------------// A changed title NOBODY follows (dailysync.hl): its details (+ ids + credits: the record, applySynced) and only the seasons// that can have changed — the ones we don't have, the ones where TMDB counts MORE episodes than we have (fewer: TVmaze's// extras, nothing to fetch), and the newest one (new or renamed episodes land there). No TVmaze (its merge only matters for the followed shows' lists; their full step still does// it). Real data (2026-10-01): Today (67 seasons / 15,716 episodes) and EastEnders (43 / 7,349) change every day; their full// sync blocked the server 20.8 s each and grew the process by ~5 GB each.static changedSeasonNumbers = (&details, &show) => {ours = {}for (sid of show.seasons) {let s = seasonsTable.fetch(sid)if (s != null) { ours['' + s.seasonNumber] = s.episodes.length }}let latest = -1for (x of (details.seasons != null ? details.seasons : [])) {if (x != null && x.season_number != null && x.season_number > latest && (x.episode_count == null || x.episode_count > 0)) { latest = x.season_number }}out = []for (x of (details.seasons != null ? details.seasons : [])) {if (x != null && x.season_number != null) {let n = x.season_numberif (n == latest || ours['' + n] == null || (x.episode_count != null && x.episode_count > ours['' + n])) { out.push(n) }}}return out}static syncShowDelta = (&showId) => {show = showsTable.fetch(showId)if (show == null || show.tmdbId == null || show.type == 'movie') { return syncShow(showId) }details = tmdbGet('/tv/' + show.tmdbId + '?append_to_response=external_ids,aggregate_credits')if (details.failed != null) {let res = emptyResult()res.requests = 1res.errors = 1res.error = show.title + ': ' + details.failedreturn res}r = syncShowPart(showId, details, { seasons = changedSeasonNumbers(details, show) finish = true tvmaze = false })r.requests = r.requests + 1r.details = detailsreturn r}// flush the three tables' index/meta state to disk (after a run, and every few shows)static persistSync = () => {showsTable.persist()seasonsTable.persist()episodesTable.persist()return true}
Branches
- mainmain branch
Latest commits
- 7d7d4487tracker#33 (mission 029): reduced titles — every title TMDB's details never went through this app (no detailsAt, no tmdbSync) is incomplete (shows.hl isIncomplete; the old tracker's migrated rows passed #26's test: 5,697 non-adult on the live copy, 691 series without seasons); the repair job does the visibly reduced first (shows.hl missingParts), the page completes one on open; a title TMDB has no poster for (The Remaining) shows the placeholder; tools/count-incomplete.hl; gate fixtures stand for synced titles (tmdbSync), tests/seed-reduced.hl + #33 checks; gates 347/0, 32/0, 52/0mre
- 661c2592tracker: report 028mre
- 27c916fatracker mission 028: README ("Code order", the new file map), STATUS (counts before/after, tests, how to repeat, open), LOGmre
- d924f398tracker mission 028: comments name the new files (sync.hl, dailysync.hl, backfill.hl, credits.hl, jobs.hl, images.hl …); tools/ref-params.py + tools/lambda-audit.py also scan lib/ (they globbed the root only), lambda-audit counts a plain `x = p` alias like `let x = p`mre
- 2e89b968tracker mission 028 (code order) 5/5 let: `let` only where a variable is reassigned — 667 never-reassigned lets became plain declarations (project.hl, lib/, components/, tools/, tests/); kept: 264 in loop bodies (a plain declaration there is 'Cannot reassign' on the 2nd pass), 234 reassigned, 27 whose name is also a member/outer/free name (a plain write would rebind it); tools/let-audit.py decides and fixes (README 'Code order'); tests/realdata-m028.{sh,mjs} = the page-output diff on a real copy; gates 342/0, 32/0, 52/0, real-copy pages identicalmre
- 54796ff2tracker mission 028 (code order) 4/5 thin faces + last copies: the show page's check/follow faces call lib/watches.hl toggleWatched / toggleSeasonWatched (seasonAllWatched moved there) and lib/follows.hl toggleFollowed; both logins (header selector face, /login/callback) share lib/users.hl userOfCode; todayStr/listOf copies in components and the export readers copied into tools/migrate.hl + tools/old-short-ids.hl now once (lib/util.hl, lib/export.hl); gates 342/0, 32/0, 52/0; old-short-ids output byte-identical, migrate output identicalmre
- 06b078e3tracker mission 028 (code order) 3/5 project.hl is the map: config, routes, wiring and a feature → file index (914 → 258 lines); the background jobs (daily sync run, backfills, details repair, credits job, merge, short ids, collection seed) moved unchanged into lib/jobs.hl (a class: their state is reassigned every step, a static cannot be; one instance made after the server), the login callback into lib/users.hl, poster/photo serving into lib/images.hl, the /shows/<slug> rule into lib/shows.hl showsMovedPath; route handlers are thin wrappers; gates 342/0, 32/0, 52/0, real-copy pages identicalmre
- 94716fd2tracker mission 028 (code order) 2/5 util + topics: lib/util.hl holds envOr, storageDir, postersDir, profilesDir, newId, hexDigits, todayStr, dateOr, textOr, hasId, listOr, firstOf, sortDesc once (were copied into up to 5 files); tmdbsync.hl split into tmdb.hl (TMDB/TVmaze requests), sync.hl (one title's sync), sync-helpers.hl, backfill.hl; details.hl split into details.hl, credits.hl, credits-helpers.hl (isIncomplete to shows.hl); search-helpers.hl (words, query, ranking, slugs); collections.hl (the TMDB collection seed, out of franchises.hl); deltasync.hl renamed dailysync.hl; no behaviour change: gates 342/0, 32/0, 52/0, real-copy pages identicalmre
- 186079b0tracker mission 028 (code order) 1/5 move: every root .hl except project.hl into lib/ (styles.hl into components/), import paths only; gates 342/0, 32/0, 52/0; real-copy pages identicalmre
- 4f47f181tracker: report 027mre
- dc1d4be4tracker mission 027: Hybriel master 06617221 vendored (plugin allocator fixes 3a781359 + 413f60e4); real copy RSS through first-start jobs + 400 loads flat ~2.55 GB (190aa11d 2.3 -> 5.6 GB), page times <= 1.1x; gates 342/0, 32/0, 52/0mre
- 84e1b3e1tracker: reports 025 + 026mre
- dc40d859tracker#31 (mission 026): duplicate titles merged — the 68 type+tmdbId pairs held by 157 records were the old tracker's (all migrated); merge.hl repair job (own clock, before the TMDB jobs) keeps one keeper per title (follows/watches > old short id > oldest), moves follows, watches, seasons, cast, credits, timelines, tombstones the rest (mergedInto, never deleted), slugs + short ids 301 to the keeper; stray seasons merged into their listed twin (Reacher S3 watches) or linked when watched; search import re-checks before its put; deploy.sh waits up to 90 s for 200; real copy 68 -> 0 dup ids, az5b2 follows/watches equal; gates 342/0, 32/0, 52/0mre
- 2667da05tracker#30 (mission 025): /my/ pages from slim cached title cards, episode rows and watch sets (after the jobs /my/series 1.8 s -> 0.06 s, /my/unwatched 4.1 -> 0.18 s); timeline page shows its name once; franchise widget under the poster/title; movies with TV leftovers (First Contact) go through the details repair; tools/count-tmdb-ids.hl; gates 327/0, 52/0, 32/0mre
- 3909810dantcolony#40: mission references in README/STATUS/docs point to the moved missionsmre
- e63b1d28antcolony#40: history (LOG.md), worker briefs (missions/) and reports moved here from antcolony, numbered per project; old numbers in antcolony docs/mission-map.mdmre
- 1cda451dtracker: Hybriel master 190aa11d (#127 both shapes, GC correctness fc838894) — conductor adopts despite /my/series 2.4x after jobs (memory 8.0 → 1.7 GB boot); see reports/071mre
- c1fa2f2etracker (mission 071): Hybriel master 190aa11d measured on the real copy vs the live binary 8590df63 — NOT adopted (after the first-start jobs /my/series 2.4x slower, /series 1.6x, RSS swings 7.4-12.2 GB; fresh it is flat at 1.7-2.2 GB and /my/unwatched faster), vendor stays 8efba065, candidate kept in .scratch/w071/vendor-190aa11d; tests/kinds.mjs: collection seed off (its TMDB request broke check 1 in 1 of 4 runs); tests/realdata-071.sh + realdata-071-bench.mjs + tools/realdata-071-table.py; README + STATUS (numbers, how to repeat); gates 325/0, 32/0, 50/0mre
- 8081350atracker docs (mission 070): README (summary, Config HL_GC_BYTES — kept at Hybriel's default, the 256 MiB setting is taken out of docker-compose.yml again: the jobs grew to 12+ GB with it too, see STATUS), Test (three gates), Deploy (first start ~50 min: kinds then seed, restart once after collections done, memory numbers), Vendored Hybriel 8efba065 + #48 audit, Files; STATUS mission 070 entry (merges, migrated counts, lambda audit, gates, RSS old vs new, how to repeat, open points); docs/kinds.md + docs/franchises.md job order; tests/realdata-070-*.sh, tools/count-migrated.hl, tools/ref-params.py, tools/lambda-audit.pymre
- 1ad19c8ctracker: re-vendor Hybriel master 8efba065 (#126 GC by bytes, #48 lambda parameters copy) (mission 070): bin/hybriel sha256 50361e95…, plugins core crypto data fetch fs http http1 mpackdb proc smtp time web; lambda audit: 13 lambdas change a passed record/list (11 through a local alias), no caller relies on it — unchanged; 319 read-only lambda parameters get & (no copy per call: /my/schedule 2.35 → 0.46 s, /my/unwatched 13.7 → 5.7 s on the real copy); /my/unwatched one merge sort instead of n² inserts; docker-compose HL_GC_BYTES=268435456; deploy.sh runs kinds.mjs + franchises.mjs too (default ports 8700–8710); tests/realdata-070.mjs; gates browser 325/0, kinds 32/0, franchises 50/0mre