tracker
All repositories: gitoria
21.1 KB
// lib/franchises.hl — FRANCHISES AND TIMELINES (tracker.worldapi.org#19, mission 066). The creator: "we have franchises, and// timelines, and some franchises have multiple timelines ... make them sortable by timeline or release date at shows the// release date of the last episode counts. in a show or movie page we show a franchise widget with < Prequel | TimelineName// | Sequel > and if the timeline is part of a franchise that franchise is above it and when you click on it you get the// franchise index."//// franchisesTable pk @id index !slug { name, slug, shortId (null: not given out yet), summary, created }// timelinesTable pk @id index !slug { name, slug, franchise (@id | null), order [show @id …], source ('tmdb' |// 'editor' | 'seed'), tmdbCollection (TMDB collection id | null), orderKind// ('in-universe' | 'release' | null: not said, tracker#40), created }// storage/mpackdb/{franchises,timelines}.db (new tables; nothing in shows.db changes; the seed's collectionchecks.db is// collections.hl's, the curated seed's franchiseseed.db franchiseseed.hl's)//// A TITLE MAY BE IN SEVERAL TIMELINES (Star Trek Prime and Kelvin, or a TMDB collection and a hand-made one): `byShow` (show// @id → [timeline @id]) is built once at start (`ensureFranchises`, one scan of the timelines) and kept up to date by every// edit — the show page's widget reads only its own timelines, never all of them.//// THE ORDER of a timeline is its in-world order (`order`, editable). The pages can sort it by RELEASE instead: a movie by its// `release`, a SERIES by the release date of its LAST episode (the newest one already out; none out yet → the newest// announced one; no episode dates at all → the series' own `release`). Titles without any date go last.//// PUBLIC LIKE THE OTHER LISTS (mission 054): the pages and the widget's prequel/sequel links show only titles with// `adult == false` (shows.hl isPublicTitle); the order keeps them, they are just skipped.//// THE SEEDS: TMDB movie collections → timelines (collections.hl); the curated franchises of data/franchises.json, movies AND// series (franchiseseed.hl, tracker#40) — both write through the functions here.//// ONE PROCESS PER STORAGE (hybriel#21): the tables are opened here, in the app's process only.import { MPackDB } from 'hl:mpackdb'import { env } from 'hl:proc'import { now } from 'hl:time'import { storageDir, newId, todayStr, dateOr, firstOf } from './util.hl'import { showById, seasonsOfShow, episodesOfSeason, titleWithYear, posterUrlOf, isPublicTitle, titlePath } from './shows.hl'import { userOfSession } from './users.hl'import { dbSearch } from './search.hl'import { slugBaseOf } from './search-helpers.hl'static franchisesTable = new MPackDB(file = storageDir + '/franchises.db', primaryKey = '@id', indexes = ['!slug'])static timelinesTable = new MPackDB(file = storageDir + '/timelines.db', primaryKey = '@id', indexes = ['!slug'])// a name as typed: trimmed, null when there is none (the editor's names and summaries)static trimmedOr = (&v) => { return v != null && hlTypeName(v) == 'String' && v.trim() != '' ? v.trim() : null }// ---- who may edit: the creator (ident short id az5b2); TRACKER_EDITORS = a comma list of ident ids (the gate sets its own) ----static editorIds = () => {v = env('TRACKER_EDITORS')raw = v != null && v.trim() != '' ? v : 'az5b2'out = []for (p of raw.split(',')) { if (p.trim() != '') { out.push(p.trim()) } }return out}static editors = editorIds()static isEditorSession = (&session) => {if (session == null || hlTypeName(session) != 'Instance') { return false }u = userOfSession(session)return u != null && u.identity != null && editors.includes(u.identity)}// a list's index of x, -1 when it is not in it (hand-written: list helpers beyond includes/push are not trusted, hybriel#1)static posOf = (&list, &x) => {let i = 0while (i < list.length) {if (list[i] == x) { return i }i = i + 1}return -1}// ---- slugs: "Star Trek" → "Star-Trek" (the shows' urlSegment form, search-helpers.hl slugBaseOf; none → 'timeline') -------static freeSlug = (&table, &name) => {base = slugBaseOf(name, 'timeline')// 'edit' is the editor's own address (/franchises/edit)if (firstOf(table.find('slug', base)) == null && base != 'edit') { return base }let n = 2while (firstOf(table.find('slug', base + '-' + n)) != null) { n = n + 1 }return base + '-' + n}static franchiseBySlug = (&slug) => {if (slug == null || hlTypeName(slug) != 'String' || slug == '') { return null }return firstOf(franchisesTable.find('slug', slug))}static timelineBySlug = (&slug) => {if (slug == null || hlTypeName(slug) != 'String' || slug == '') { return null }return firstOf(timelinesTable.find('slug', slug))}static franchiseById = (&id) => { return id == null || hlTypeName(id) != 'String' || id == '' ? null : franchisesTable.fetch(id) }static timelineById = (&id) => { return id == null || hlTypeName(id) != 'String' || id == '' ? null : timelinesTable.fetch(id) }// ---- byShow: show @id → [timeline @id] ------------------------------------------------------------------------------------static byShow = {}static state = { built = false timelines = 0 ms = 0 }static indexAdd = (&showId, &timelineId) => {let l = byShow[showId]if (l == null) { l = [] }if (!l.includes(timelineId)) { l.push(timelineId) }byShow[showId] = lreturn true}static indexRemove = (&showId, &timelineId) => {l = byShow[showId]if (l == null) { return true }out = []for (x of l) { if (x != timelineId) { out.push(x) } }byShow[showId] = outreturn true}static ensureFranchises = () => {if (state.built) { return true }state.built = truet0 = now()let n = 0for (t of timelinesTable.find(null, null)) {n = n + 1if (t.order != null) { for (sid of t.order) { indexAdd(sid, t.id) } }}state.timelines = nstate.ms = now() - t0console.log('franchises: ' + n + ' timelines, ' + franchisesTable.count() + ' franchises (' + state.ms + ' ms)')return true}static timelineIdsOfShow = (&showId) => {ensureFranchises()l = byShow[showId]return l != null ? l : []}// ---- a title as the pages list it ------------------------------------------------------------------------------------------// the date the release sort uses: a movie's release; a series' LAST episode (newest out ≤ today, else newest announced, else// its own release)static releaseKeyOf = (&show) => {if (show.type != 'series') { return dateOr(show.release) }today = todayStr()let lastOut = ''let lastAny = ''for (s of seasonsOfShow(show)) {for (e of episodesOfSeason(s)) {let d = dateOr(e.release)if (d != '') {if (d > lastAny) { lastAny = d }if (d <= today && d > lastOut) { lastOut = d }}}}if (lastOut != '') { return lastOut }if (lastAny != '') { return lastAny }return dateOr(show.release)}static itemOf = (&show, pos) => {series = show.type == 'series'd = releaseKeyOf(show)label = d == '' ? 'no date' : (series ? 'last episode ' + d : d)return { id = show.id pos = pos title = titleWithYear(show) href = titlePath(show) posterUrl = posterUrlOf(show)kind = series ? 'Series' : 'Movie' date = d dateLabel = label }}// the public titles of a timeline, in its order (`pos` = the place in the in-world order, 1-based)static itemsOf = (&t) => {out = []let pos = 0if (t.order == null) { return out }for (sid of t.order) {let s = showById(sid)if (s != null && isPublicTitle(s)) {pos = pos + 1out.push(itemOf(s, pos))}}return out}// release order: oldest first, no date last; equal dates keep the timeline order (a stable insertion)static byReleaseOf = (&items) => {let out = []for (it of items) {let next = []let done = falsefor (x of out) {if (!done && it.date != '' && (x.date == '' || it.date < x.date)) { next.push(it) done = true }next.push(x)}if (!done) { next.push(it) }out = next}return out}// tracker#40: what the timeline's own order is, said beside its count ("23 titles · in-universe order"); none when not knownstatic orderNoteOf = (&t) => {if (t.orderKind == 'in-universe') { return ' · in-universe order' }if (t.orderKind == 'release') { return ' · release order' }return ''}static blockOf = (&t) => {items = itemsOf(t)return { id = t.id name = t.name slug = t.slug href = '/timelines/' + t.slug items = items byRelease = byReleaseOf(items)countText = (items.length == 1 ? '1 title' : items.length + ' titles') + orderNoteOf(t) first = items.length > 0 ? byReleaseOf(items)[0].date : '' }}// ---- the pages -------------------------------------------------------------------------------------------------------------// /franchises: every franchise (name, how many timelines), then the timelines WITHOUT one (TMDB's collections, by name)static byNameOf = (&rows) => {let out = []for (r of rows) {let next = []let done = falselet k = r.sortNamefor (x of out) {if (!done && k < x.sortName) { next.push(r) done = true }next.push(x)}if (!done) { next.push(r) }out = next}return out}static franchiseIndex = () => {counts = {}loose = []for (t of timelinesTable.find(null, null)) {let n = t.order != null ? t.order.length : 0if (t.franchise != null && t.franchise != '') { counts[t.franchise] = (counts[t.franchise] != null ? counts[t.franchise] : 0) + 1 }else if (n > 0) { loose.push({ id = t.id name = t.name href = '/timelines/' + t.slug countText = n == 1 ? '1 title' : n + ' titles' sortName = ('' + t.name).toLowerCase() }) }}fr = []for (f of franchisesTable.find(null, null)) {let c = counts[f.id] != null ? counts[f.id] : 0fr.push({ id = f.id name = f.name href = '/franchises/' + f.slug summary = f.summary != null ? f.summary : ''countText = c == 1 ? '1 timeline' : c + ' timelines' sortName = ('' + f.name).toLowerCase() })}return { franchises = byNameOf(fr) timelines = byNameOf(loose) }}// /franchises/<slug>: the franchise and its timelines (oldest first by their first release) — or nullstatic franchisePage = (slug) => {f = franchiseBySlug(slug)if (f == null) { return null }let blocks = []for (t of timelinesTable.find(null, null)) {if (t.franchise == f.id) {let b = blockOf(t)let next = []let done = falsefor (x of blocks) {if (!done && b.first != '' && (x.first == '' || b.first < x.first)) { next.push(b) done = true }next.push(x)}if (!done) { next.push(b) }blocks = next}}return { kind = 'franchise' name = f.name slug = f.slug summary = f.summary != null ? f.summary : '' franchiseName = '' franchiseHref = '' blocks = blocks editHref = '' }}// /timelines/<slug>: one timeline, its franchise above it — or nullstatic timelinePage = (slug) => {t = timelineBySlug(slug)if (t == null) { return null }f = franchiseById(t.franchise)return { kind = 'timeline' name = t.name slug = t.slug summary = '' franchiseName = f != null ? f.name : '' franchiseHref = f != null ? '/franchises/' + f.slug : ''blocks = [blockOf(t)] editHref = '/timelines/' + t.slug + '/edit' }}// ---- the widget on a show / movie page: one per timeline the title is in ----------------------------------------------------// { id, name, href, hasFranchise, franchiseName, franchiseHref, hasPrev, noPrev, prevHref, prevTitle, hasNext, noNext, … }:// prequel / sequel = the nearest PUBLIC title before / after this one in the timeline's orderstatic widgetsOf = (&showId) => {out = []if (showId == null) { return out }for (tid of timelineIdsOfShow(showId)) {let t = timelinesTable.fetch(tid)if (t != null && t.order != null && t.order.includes(showId)) {let at = posOf(t.order, showId)let prev = nulllet i = at - 1while (prev == null && i >= 0) {let s = showById(t.order[i])if (s != null && isPublicTitle(s)) { prev = s }i = i - 1}let next = nulllet j = at + 1while (next == null && j < t.order.length) {let s = showById(t.order[j])if (s != null && isPublicTitle(s)) { next = s }j = j + 1}let f = franchiseById(t.franchise)out.push({ id = t.id name = t.name href = '/timelines/' + t.slughasFranchise = f != null franchiseName = f != null ? f.name : '' franchiseHref = f != null ? '/franchises/' + f.slug : ''hasPrev = prev != null noPrev = prev == null prevHref = prev != null ? titlePath(prev) : '' prevTitle = prev != null ? titleWithYear(prev) : ''hasNext = next != null noNext = next == null nextHref = next != null ? titlePath(next) : '' nextTitle = next != null ? titleWithYear(next) : '' })}}return out}// ---- the editor (the creator only — every caller checks isEditorSession first) ----------------------------------------------static createFranchise = (name, summary) => {n = trimmedOr(name)if (n == null || n.length > 120) { return { error = 'a franchise needs a name (at most 120 characters)' } }s = trimmedOr(summary)rec = { id = newId() name = n slug = freeSlug(franchisesTable, n) shortId = null summary = s != null ? s : '' created = now() }if (franchisesTable.put(rec) == null) { return { error = 'not stored: ' + franchisesTable.lastError() } }franchisesTable.persist()console.log('franchises: new franchise "' + n + '" /franchises/' + rec.slug)return { ok = true slug = rec.slug id = rec.id }}// a new timeline (the editor's, the collection seed's with its collection id, the curated seed's with its order kind)static putTimeline = (name, &franchiseId, order, source, &collection, &orderKind) => {rec = { id = newId() name = name slug = freeSlug(timelinesTable, name) franchise = franchiseId order = order source = sourcetmdbCollection = collection orderKind = orderKind created = now() }if (timelinesTable.put(rec) == null) { return null }for (sid of order) { indexAdd(sid, rec.id) }return rec}static createTimeline = (&name) => {n = trimmedOr(name)if (n == null || n.length > 120) { return { error = 'a timeline needs a name (at most 120 characters)' } }rec = putTimeline(n, null, [], 'editor', null, null)if (rec == null) { return { error = 'not stored: ' + timelinesTable.lastError() } }timelinesTable.persist()console.log('franchises: new timeline "' + n + '" /timelines/' + rec.slug)return { ok = true slug = rec.slug id = rec.id }}// the editor's view of one timeline: every title in its order (adult ones too — the creator sees what is there)static editRowsOf = (&t) => {out = []if (t == null || t.order == null) { return out }let i = 0last = t.order.length - 1for (sid of t.order) {let s = showById(sid)if (s != null) {out.push({ id = s.id pos = i + 1 title = titleWithYear(s) posterUrl = posterUrlOf(s) typeLabel = s.type == 'series' ? 'Series' : 'Movie'upClass = i == 0 ? 'quiet mv off' : 'quiet mv' downClass = i == last ? 'quiet mv off' : 'quiet mv' })}i = i + 1}return out}static chipsOf = (&t) => {out = [{ id = '' name = 'None' cls = t == null || t.franchise == null || t.franchise == '' ? 'chip on' : 'chip' }]list = []for (f of franchisesTable.find(null, null)) { list.push({ id = f.id name = f.name cls = t != null && t.franchise == f.id ? 'chip on' : 'chip' sortName = ('' + f.name).toLowerCase() }) }for (c of byNameOf(list)) { out.push(c) }return out}static editPageOf = (slug) => {t = timelineBySlug(slug)if (t == null) { return { found = false id = '' name = '' slug = '' viewHref = '' rows = [] chips = [] } }return { found = true id = t.id name = t.name slug = t.slug viewHref = '/timelines/' + t.slug rows = editRowsOf(t) chips = chipsOf(t) }}static storeOrder = (t, order) => {old = t.order != null ? t.order : []rec = trec.order = orderif (timelinesTable.update(rec.id, rec) == null) { return { error = 'not stored: ' + timelinesTable.lastError() } }timelinesTable.persist()for (sid of old) { if (!order.includes(sid)) { indexRemove(sid, rec.id) } }for (sid of order) { indexAdd(sid, rec.id) }return { ok = true rows = editRowsOf(rec) }}// tracker#31 (merge.hl): a duplicate title merged into its keeper — in every timeline that lists it, the keeper takes its place// (once: a timeline that already lists the keeper just drops it) → the number of timelines changedstatic titleMerged = (&fromId, &toId) => {ensureFranchises()let n = 0tids = []if (byShow[fromId] != null) { for (x of byShow[fromId]) { tids.push(x) } }for (tid of tids) {let t = timelinesTable.fetch(tid)if (t != null && t.order != null) {let order = []for (sid of t.order) {let want = sid == fromId ? toId : sidif (!order.includes(want)) { order.push(want) }}let r = storeOrder(t, order)if (r.error != null) { console.log('merge: timeline ' + tid + ': ' + r.error) } else { n = n + 1 }}}return n}static addToTimeline = (&timelineId, &showId) => {t = timelineById(timelineId)if (t == null) { return { error = 'no such timeline' } }if (showById(showId) == null) { return { error = 'no such title' } }order = []for (sid of t.order) { order.push(sid) }if (order.includes(showId)) { return { ok = true rows = editRowsOf(t) } }order.push(showId)return storeOrder(t, order)}static removeFromTimeline = (&timelineId, &showId) => {t = timelineById(timelineId)if (t == null) { return { error = 'no such timeline' } }order = []for (sid of t.order) { if (sid != showId) { order.push(sid) } }return storeOrder(t, order)}// one place up (delta -1) or down (+1); at an end nothing changesstatic moveInTimeline = (&timelineId, &showId, &delta) => {t = timelineById(timelineId)if (t == null) { return { error = 'no such timeline' } }at = posOf(t.order, showId)to = at + (delta < 0 ? -1 : 1)if (at < 0 || to < 0 || to >= t.order.length) { return { ok = true rows = editRowsOf(t) } }order = []let i = 0while (i < t.order.length) {if (i == at) { order.push(t.order[to]) } else if (i == to) { order.push(t.order[at]) } else { order.push(t.order[i]) }i = i + 1}return storeOrder(t, order)}static setTimelineFranchise = (&timelineId, franchiseId) => {t = timelineById(timelineId)if (t == null) { return { error = 'no such timeline' } }let fid = nullif (franchiseId != null && franchiseId != '') {if (franchiseById(franchiseId) == null) { return { error = 'no such franchise' } }fid = franchiseId}rec = trec.franchise = fidif (timelinesTable.update(rec.id, rec) == null) { return { error = 'not stored: ' + timelinesTable.lastError() } }timelinesTable.persist()return { ok = true chips = chipsOf(rec) }}// the editor's title search: our database (search.hl's index), the titles not in the timeline yetstatic editSearch = (&timelineId, text) => {t = timelineById(timelineId)have = t != null && t.order != null ? t.order : []out = []r = dbSearch(text != null ? '' + text : '')for (x of r.titles) {let s = showById(x.id)if (s != null && !have.includes(s.id)) { out.push({ id = s.id title = titleWithYear(s) posterUrl = posterUrlOf(s) typeLabel = s.type == 'series' ? 'Series' : 'Movie' }) }}return { text = text rows = out note = r.tooShort ? 'Type at least 2 letters.' : (out.length == 0 ? 'Nothing found.' : '') }}// the editor's timeline finder: by name, at most 30static findTimelines = (&text) => {q = text != null ? ('' + text).trim().toLowerCase() : ''out = []if (q.length < 2) { return out }for (t of timelinesTable.find(null, null)) {if (out.length < 30 && ('' + t.name).toLowerCase().includes(q)) {let n = t.order != null ? t.order.length : 0out.push({ id = t.id name = t.name href = '/timelines/' + t.slug + '/edit' countText = n == 1 ? '1 title' : n + ' titles' })}}return out}// ---- the curated seed's reads and writes (franchiseseed.hl, tracker#40) ----------------------------------------------------// a franchise / timeline by its name, any case — or null (the creator's own of that name is adopted by the seed, never doubled)static franchiseByName = (&name) => {q = ('' + name).toLowerCase()let hit = nullfor (f of franchisesTable.find(null, null)) { if (hit == null && ('' + f.name).toLowerCase() == q) { hit = f } }return hit}static timelineByName = (&name) => {q = ('' + name).toLowerCase()let hit = nullfor (t of timelinesTable.find(null, null)) { if (hit == null && ('' + t.name).toLowerCase() == q) { hit = t } }return hit}// the timeline the collection seed made from TMDB collection `collection`, or nullstatic timelineOfCollection = (&collection) => {let hit = nullfor (t of timelinesTable.find(null, null)) { if (hit == null && t.tmdbCollection != null && '' + t.tmdbCollection == '' + collection) { hit = t } }return hit}// a seeded timeline rewritten (the data file changed, or titles were imported since): its order and franchise in one updatestatic storeSeeded = (t, order, &franchiseId) => {old = t.order != null ? t.order : []rec = trec.order = orderrec.franchise = franchiseIdif (timelinesTable.update(rec.id, rec) == null) { return { error = 'not stored: ' + timelinesTable.lastError() } }for (sid of old) { if (!order.includes(sid)) { indexRemove(sid, rec.id) } }for (sid of order) { indexAdd(sid, rec.id) }return { ok = true }}static persistFranchises = () => {franchisesTable.persist()timelinesTable.persist()return true}
Branches
- mainmain branch
Latest commits
- 7d4b293dtracker#40: "Franchises" in the main menu (desktop header after People, phone sidebar) → /franchises, marked on franchise and timeline pages; gates 365/0, 32/0, 53/0, 24/0, check-theme 0mre
- 93dfb0batracker#40 (mission 034): the curated franchises — data/franchises.json (17 franchises, 31 timelines, 285 TMDB titles, movies + series, in-universe/release order, 12 TMDB collections attached); lib/franchiseseed.hl + jobs.hl franchiseSeedTick (last start job, imports missing titles via details.hl importWithCredits = the search's Add, one per step paced, then one build; franchiseseed.db: editor changes win, the creator's same-name franchise adopted / timeline left alone, 404 remembered, resumable, idempotent); timeline heads 'N titles · in-universe order' (orderKind) and wrap on a phone; series pages show the widget; new gate tests/franchiseseed.mjs (5th in deploy.sh), the others run with TRACKER_FRANCHISE_SEED=0; gates 365/0, 32/0, 52/0, 24/0, check-theme 0; real copy 196 imported, 0 failed, 7 min, restart unchanged=31mre
- 96ba683adeploy.sh: a gate without a 'passed,' line (check-theme) no longer ends the scriptmre
- eb3b9205tracker: report 031mre
- 9b5d2e89tracker mission 031: README (What it does, Test: four gates + the #32 checks, Files: theme/, new pages), STATUS (real copy, A/B load, how to repeat, open points), LOGmre
- 39950e4ctracker#32 (mission 031): the WorldAPI theme (theme/ vendored verbatim from layouts.worldapi.org 85b5654; styles.hl inherits it: accent green-dark, type colours 1-6; own base/header rules, row lines, genre-pill and inverted-button frames removed, the season foldable keeps its line; check-theme 21 -> 0, 4th deploy gate; main actions class primary) and the #32 header (theme AppHeader/MainMenu/UserMenu/Sidebar/ContentFirst: desktop brand, search, Series|Shows|Movies|Genres|People, user icon with Unwatched..Settings, Logout; signed out the ident selector, phone the iD icon dropdown; phone menu in the sidebar overlay; marked entry by :has); /find -> /search/<q>, /genres, /people(/<letter>), /settings; main { ContentFirst { slot } } works around the hl:web one-line slot bug; gates 365/0, 32/0, 52/0, check-theme 0mre
- a386dc92tracker: reports 029 + 030mre
- 71e0fd7dtracker missions 029 + 030: README (What it does, Files, gate count), STATUS (real-copy numbers, how to repeat, open points), LOGmre
- d36ea6eatracker#34 + #35 (mission 030): Follow directly under the poster, as wide as the poster (show.hl, styles.hl); the status pill next to a series' title — TVmaze's status (new tvmazeStatus, stored by the sync's TVmaze merge) else TMDB's, TVmaze Ended + TMDB Canceled = Canceled, inverted (filled, dark text, no border), green running / yellow pending / red canceled / muted ended (shows.hl statusOf); the daily delta asks TVmaze's status of an unfollowed series TVmaze's change list names (dailysync.hl syncRunStep, sync.hl syncTvmazeStatus); the status backfill after the details repair (backfill.hl, jobs.hl statusTick; resumable, 550 ms per TVmaze request); gates 354/0, 32/0, 52/0mre
- 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