gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitb10f00c8b10f00c8tracker#39: double episodes — migrated episodes whose TMDB id TMDB replaced are adopted by their number in the sync (old id -> migratedTmdbId); merge.hl step 3 merges each season's doubles at start (keeper: most watches > synced > first; watches moved/parked; tombstones into mergedEpisodes, nothing deleted); tools/count-duplicate-episodes.hl; gate fixture + paths-m039; live copy 850 -> 0 in 64 s; gates 373/0, 32/0, 52/0mreb10f00c8/lib/franchises.hl

18.8 KB

  1. // lib/franchises.hl — FRANCHISES AND TIMELINES (tracker.worldapi.org#19, mission 066). The creator: "we have franchises, and
  2. // timelines, and some franchises have multiple timelines ... make them sortable by timeline or release date at shows the
  3. // release date of the last episode counts. in a show or movie page we show a franchise widget with < Prequel | TimelineName
  4. // | Sequel > and if the timeline is part of a franchise that franchise is above it and when you click on it you get the
  5. // franchise index."
  6. //
  7. // franchisesTable pk @id index !slug { name, slug, shortId (null: not given out yet), summary, created }
  8. // timelinesTable pk @id index !slug { name, slug, franchise (@id | null), order [show @id …], source ('tmdb' |
  9. // 'editor'), tmdbCollection (TMDB collection id | null), created }
  10. // storage/mpackdb/{franchises,timelines}.db (new tables; nothing in shows.db changes; the seed's collectionchecks.db is
  11. // collections.hl's)
  12. //
  13. // A TITLE MAY BE IN SEVERAL TIMELINES (Star Trek Prime and Kelvin, or a TMDB collection and a hand-made one): `byShow` (show
  14. // @id → [timeline @id]) is built once at start (`ensureFranchises`, one scan of the timelines) and kept up to date by every
  15. // edit — the show page's widget reads only its own timelines, never all of them.
  16. //
  17. // THE ORDER of a timeline is its in-world order (`order`, editable). The pages can sort it by RELEASE instead: a movie by its
  18. // `release`, a SERIES by the release date of its LAST episode (the newest one already out; none out yet → the newest
  19. // announced one; no episode dates at all → the series' own `release`). Titles without any date go last.
  20. //
  21. // PUBLIC LIKE THE OTHER LISTS (mission 054): the pages and the widget's prequel/sequel links show only titles with
  22. // `adult == false` (shows.hl isPublicTitle); the order keeps them, they are just skipped.
  23. //
  24. // THE SEED (TMDB movie collections → timelines): collections.hl.
  25. //
  26. // ONE PROCESS PER STORAGE (hybriel#21): the tables are opened here, in the app's process only.
  27. import { MPackDB } from 'hl:mpackdb'
  28. import { env } from 'hl:proc'
  29. import { now } from 'hl:time'
  30. import { storageDir, newId, todayStr, dateOr, firstOf } from './util.hl'
  31. import { showById, seasonsOfShow, episodesOfSeason, titleWithYear, posterUrlOf, isPublicTitle, titlePath } from './shows.hl'
  32. import { userOfSession } from './users.hl'
  33. import { dbSearch } from './search.hl'
  34. import { slugBaseOf } from './search-helpers.hl'
  35. static franchisesTable = new MPackDB(file = storageDir + '/franchises.db', primaryKey = '@id', indexes = ['!slug'])
  36. static timelinesTable = new MPackDB(file = storageDir + '/timelines.db', primaryKey = '@id', indexes = ['!slug'])
  37. // a name as typed: trimmed, null when there is none (the editor's names and summaries)
  38. static trimmedOr = (&v) => { return v != null && hlTypeName(v) == 'String' && v.trim() != '' ? v.trim() : null }
  39. // ---- who may edit: the creator (ident short id az5b2); TRACKER_EDITORS = a comma list of ident ids (the gate sets its own) ----
  40. static editorIds = () => {
  41. v = env('TRACKER_EDITORS')
  42. raw = v != null && v.trim() != '' ? v : 'az5b2'
  43. out = []
  44. for (p of raw.split(',')) { if (p.trim() != '') { out.push(p.trim()) } }
  45. return out
  46. }
  47. static editors = editorIds()
  48. static isEditorSession = (&session) => {
  49. if (session == null || hlTypeName(session) != 'Instance') { return false }
  50. u = userOfSession(session)
  51. return u != null && u.identity != null && editors.includes(u.identity)
  52. }
  53. // 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)
  54. static posOf = (&list, &x) => {
  55. let i = 0
  56. while (i < list.length) {
  57. if (list[i] == x) { return i }
  58. i = i + 1
  59. }
  60. return -1
  61. }
  62. // ---- slugs: "Star Trek" → "Star-Trek" (the shows' urlSegment form, search-helpers.hl slugBaseOf; none → 'timeline') -------
  63. static freeSlug = (&table, &name) => {
  64. base = slugBaseOf(name, 'timeline')
  65. // 'edit' is the editor's own address (/franchises/edit)
  66. if (firstOf(table.find('slug', base)) == null && base != 'edit') { return base }
  67. let n = 2
  68. while (firstOf(table.find('slug', base + '-' + n)) != null) { n = n + 1 }
  69. return base + '-' + n
  70. }
  71. static franchiseBySlug = (&slug) => {
  72. if (slug == null || hlTypeName(slug) != 'String' || slug == '') { return null }
  73. return firstOf(franchisesTable.find('slug', slug))
  74. }
  75. static timelineBySlug = (&slug) => {
  76. if (slug == null || hlTypeName(slug) != 'String' || slug == '') { return null }
  77. return firstOf(timelinesTable.find('slug', slug))
  78. }
  79. static franchiseById = (&id) => { return id == null || hlTypeName(id) != 'String' || id == '' ? null : franchisesTable.fetch(id) }
  80. static timelineById = (&id) => { return id == null || hlTypeName(id) != 'String' || id == '' ? null : timelinesTable.fetch(id) }
  81. // ---- byShow: show @id → [timeline @id] ------------------------------------------------------------------------------------
  82. static byShow = {}
  83. static state = { built = false timelines = 0 ms = 0 }
  84. static indexAdd = (&showId, &timelineId) => {
  85. let l = byShow[showId]
  86. if (l == null) { l = [] }
  87. if (!l.includes(timelineId)) { l.push(timelineId) }
  88. byShow[showId] = l
  89. return true
  90. }
  91. static indexRemove = (&showId, &timelineId) => {
  92. l = byShow[showId]
  93. if (l == null) { return true }
  94. out = []
  95. for (x of l) { if (x != timelineId) { out.push(x) } }
  96. byShow[showId] = out
  97. return true
  98. }
  99. static ensureFranchises = () => {
  100. if (state.built) { return true }
  101. state.built = true
  102. t0 = now()
  103. let n = 0
  104. for (t of timelinesTable.find(null, null)) {
  105. n = n + 1
  106. if (t.order != null) { for (sid of t.order) { indexAdd(sid, t.id) } }
  107. }
  108. state.timelines = n
  109. state.ms = now() - t0
  110. console.log('franchises: ' + n + ' timelines, ' + franchisesTable.count() + ' franchises (' + state.ms + ' ms)')
  111. return true
  112. }
  113. static timelineIdsOfShow = (&showId) => {
  114. ensureFranchises()
  115. l = byShow[showId]
  116. return l != null ? l : []
  117. }
  118. // ---- a title as the pages list it ------------------------------------------------------------------------------------------
  119. // the date the release sort uses: a movie's release; a series' LAST episode (newest out ≤ today, else newest announced, else
  120. // its own release)
  121. static releaseKeyOf = (&show) => {
  122. if (show.type != 'series') { return dateOr(show.release) }
  123. today = todayStr()
  124. let lastOut = ''
  125. let lastAny = ''
  126. for (s of seasonsOfShow(show)) {
  127. for (e of episodesOfSeason(s)) {
  128. let d = dateOr(e.release)
  129. if (d != '') {
  130. if (d > lastAny) { lastAny = d }
  131. if (d <= today && d > lastOut) { lastOut = d }
  132. }
  133. }
  134. }
  135. if (lastOut != '') { return lastOut }
  136. if (lastAny != '') { return lastAny }
  137. return dateOr(show.release)
  138. }
  139. static itemOf = (&show, pos) => {
  140. series = show.type == 'series'
  141. d = releaseKeyOf(show)
  142. label = d == '' ? 'no date' : (series ? 'last episode ' + d : d)
  143. return { id = show.id pos = pos title = titleWithYear(show) href = titlePath(show) posterUrl = posterUrlOf(show)
  144. kind = series ? 'Series' : 'Movie' date = d dateLabel = label }
  145. }
  146. // the public titles of a timeline, in its order (`pos` = the place in the in-world order, 1-based)
  147. static itemsOf = (&t) => {
  148. out = []
  149. let pos = 0
  150. if (t.order == null) { return out }
  151. for (sid of t.order) {
  152. let s = showById(sid)
  153. if (s != null && isPublicTitle(s)) {
  154. pos = pos + 1
  155. out.push(itemOf(s, pos))
  156. }
  157. }
  158. return out
  159. }
  160. // release order: oldest first, no date last; equal dates keep the timeline order (a stable insertion)
  161. static byReleaseOf = (&items) => {
  162. let out = []
  163. for (it of items) {
  164. let next = []
  165. let done = false
  166. for (x of out) {
  167. if (!done && it.date != '' && (x.date == '' || it.date < x.date)) { next.push(it) done = true }
  168. next.push(x)
  169. }
  170. if (!done) { next.push(it) }
  171. out = next
  172. }
  173. return out
  174. }
  175. static blockOf = (&t) => {
  176. items = itemsOf(t)
  177. return { id = t.id name = t.name slug = t.slug href = '/timelines/' + t.slug items = items byRelease = byReleaseOf(items)
  178. countText = items.length == 1 ? '1 title' : items.length + ' titles' first = items.length > 0 ? byReleaseOf(items)[0].date : '' }
  179. }
  180. // ---- the pages -------------------------------------------------------------------------------------------------------------
  181. // /franchises: every franchise (name, how many timelines), then the timelines WITHOUT one (TMDB's collections, by name)
  182. static byNameOf = (&rows) => {
  183. let out = []
  184. for (r of rows) {
  185. let next = []
  186. let done = false
  187. let k = r.sortName
  188. for (x of out) {
  189. if (!done && k < x.sortName) { next.push(r) done = true }
  190. next.push(x)
  191. }
  192. if (!done) { next.push(r) }
  193. out = next
  194. }
  195. return out
  196. }
  197. static franchiseIndex = () => {
  198. counts = {}
  199. loose = []
  200. for (t of timelinesTable.find(null, null)) {
  201. let n = t.order != null ? t.order.length : 0
  202. if (t.franchise != null && t.franchise != '') { counts[t.franchise] = (counts[t.franchise] != null ? counts[t.franchise] : 0) + 1 }
  203. 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() }) }
  204. }
  205. fr = []
  206. for (f of franchisesTable.find(null, null)) {
  207. let c = counts[f.id] != null ? counts[f.id] : 0
  208. fr.push({ id = f.id name = f.name href = '/franchises/' + f.slug summary = f.summary != null ? f.summary : ''
  209. countText = c == 1 ? '1 timeline' : c + ' timelines' sortName = ('' + f.name).toLowerCase() })
  210. }
  211. return { franchises = byNameOf(fr) timelines = byNameOf(loose) }
  212. }
  213. // /franchises/<slug>: the franchise and its timelines (oldest first by their first release) — or null
  214. static franchisePage = (slug) => {
  215. f = franchiseBySlug(slug)
  216. if (f == null) { return null }
  217. let blocks = []
  218. for (t of timelinesTable.find(null, null)) {
  219. if (t.franchise == f.id) {
  220. let b = blockOf(t)
  221. let next = []
  222. let done = false
  223. for (x of blocks) {
  224. if (!done && b.first != '' && (x.first == '' || b.first < x.first)) { next.push(b) done = true }
  225. next.push(x)
  226. }
  227. if (!done) { next.push(b) }
  228. blocks = next
  229. }
  230. }
  231. return { kind = 'franchise' name = f.name slug = f.slug summary = f.summary != null ? f.summary : '' franchiseName = '' franchiseHref = '' blocks = blocks editHref = '' }
  232. }
  233. // /timelines/<slug>: one timeline, its franchise above it — or null
  234. static timelinePage = (slug) => {
  235. t = timelineBySlug(slug)
  236. if (t == null) { return null }
  237. f = franchiseById(t.franchise)
  238. return { kind = 'timeline' name = t.name slug = t.slug summary = '' franchiseName = f != null ? f.name : '' franchiseHref = f != null ? '/franchises/' + f.slug : ''
  239. blocks = [blockOf(t)] editHref = '/timelines/' + t.slug + '/edit' }
  240. }
  241. // ---- the widget on a show / movie page: one per timeline the title is in ----------------------------------------------------
  242. // { id, name, href, hasFranchise, franchiseName, franchiseHref, hasPrev, noPrev, prevHref, prevTitle, hasNext, noNext, … }:
  243. // prequel / sequel = the nearest PUBLIC title before / after this one in the timeline's order
  244. static widgetsOf = (&showId) => {
  245. out = []
  246. if (showId == null) { return out }
  247. for (tid of timelineIdsOfShow(showId)) {
  248. let t = timelinesTable.fetch(tid)
  249. if (t != null && t.order != null && t.order.includes(showId)) {
  250. let at = posOf(t.order, showId)
  251. let prev = null
  252. let i = at - 1
  253. while (prev == null && i >= 0) {
  254. let s = showById(t.order[i])
  255. if (s != null && isPublicTitle(s)) { prev = s }
  256. i = i - 1
  257. }
  258. let next = null
  259. let j = at + 1
  260. while (next == null && j < t.order.length) {
  261. let s = showById(t.order[j])
  262. if (s != null && isPublicTitle(s)) { next = s }
  263. j = j + 1
  264. }
  265. let f = franchiseById(t.franchise)
  266. out.push({ id = t.id name = t.name href = '/timelines/' + t.slug
  267. hasFranchise = f != null franchiseName = f != null ? f.name : '' franchiseHref = f != null ? '/franchises/' + f.slug : ''
  268. hasPrev = prev != null noPrev = prev == null prevHref = prev != null ? titlePath(prev) : '' prevTitle = prev != null ? titleWithYear(prev) : ''
  269. hasNext = next != null noNext = next == null nextHref = next != null ? titlePath(next) : '' nextTitle = next != null ? titleWithYear(next) : '' })
  270. }
  271. }
  272. return out
  273. }
  274. // ---- the editor (the creator only — every caller checks isEditorSession first) ----------------------------------------------
  275. static createFranchise = (name, summary) => {
  276. n = trimmedOr(name)
  277. if (n == null || n.length > 120) { return { error = 'a franchise needs a name (at most 120 characters)' } }
  278. s = trimmedOr(summary)
  279. rec = { id = newId() name = n slug = freeSlug(franchisesTable, n) shortId = null summary = s != null ? s : '' created = now() }
  280. if (franchisesTable.put(rec) == null) { return { error = 'not stored: ' + franchisesTable.lastError() } }
  281. franchisesTable.persist()
  282. console.log('franchises: new franchise "' + n + '" /franchises/' + rec.slug)
  283. return { ok = true slug = rec.slug id = rec.id }
  284. }
  285. // a new timeline (the editor's, or the seed's with its collection id)
  286. static putTimeline = (name, &franchiseId, order, source, &collection) => {
  287. rec = { id = newId() name = name slug = freeSlug(timelinesTable, name) franchise = franchiseId order = order source = source
  288. tmdbCollection = collection created = now() }
  289. if (timelinesTable.put(rec) == null) { return null }
  290. for (sid of order) { indexAdd(sid, rec.id) }
  291. return rec
  292. }
  293. static createTimeline = (&name) => {
  294. n = trimmedOr(name)
  295. if (n == null || n.length > 120) { return { error = 'a timeline needs a name (at most 120 characters)' } }
  296. rec = putTimeline(n, null, [], 'editor', null)
  297. if (rec == null) { return { error = 'not stored: ' + timelinesTable.lastError() } }
  298. timelinesTable.persist()
  299. console.log('franchises: new timeline "' + n + '" /timelines/' + rec.slug)
  300. return { ok = true slug = rec.slug id = rec.id }
  301. }
  302. // the editor's view of one timeline: every title in its order (adult ones too — the creator sees what is there)
  303. static editRowsOf = (&t) => {
  304. out = []
  305. if (t == null || t.order == null) { return out }
  306. let i = 0
  307. last = t.order.length - 1
  308. for (sid of t.order) {
  309. let s = showById(sid)
  310. if (s != null) {
  311. out.push({ id = s.id pos = i + 1 title = titleWithYear(s) posterUrl = posterUrlOf(s) typeLabel = s.type == 'series' ? 'Series' : 'Movie'
  312. upClass = i == 0 ? 'quiet mv off' : 'quiet mv' downClass = i == last ? 'quiet mv off' : 'quiet mv' })
  313. }
  314. i = i + 1
  315. }
  316. return out
  317. }
  318. static chipsOf = (&t) => {
  319. out = [{ id = '' name = 'None' cls = t == null || t.franchise == null || t.franchise == '' ? 'chip on' : 'chip' }]
  320. list = []
  321. 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() }) }
  322. for (c of byNameOf(list)) { out.push(c) }
  323. return out
  324. }
  325. static editPageOf = (slug) => {
  326. t = timelineBySlug(slug)
  327. if (t == null) { return { found = false id = '' name = '' slug = '' viewHref = '' rows = [] chips = [] } }
  328. return { found = true id = t.id name = t.name slug = t.slug viewHref = '/timelines/' + t.slug rows = editRowsOf(t) chips = chipsOf(t) }
  329. }
  330. static storeOrder = (t, order) => {
  331. old = t.order != null ? t.order : []
  332. rec = t
  333. rec.order = order
  334. if (timelinesTable.update(rec.id, rec) == null) { return { error = 'not stored: ' + timelinesTable.lastError() } }
  335. timelinesTable.persist()
  336. for (sid of old) { if (!order.includes(sid)) { indexRemove(sid, rec.id) } }
  337. for (sid of order) { indexAdd(sid, rec.id) }
  338. return { ok = true rows = editRowsOf(rec) }
  339. }
  340. // tracker#31 (merge.hl): a duplicate title merged into its keeper — in every timeline that lists it, the keeper takes its place
  341. // (once: a timeline that already lists the keeper just drops it) → the number of timelines changed
  342. static titleMerged = (&fromId, &toId) => {
  343. ensureFranchises()
  344. let n = 0
  345. tids = []
  346. if (byShow[fromId] != null) { for (x of byShow[fromId]) { tids.push(x) } }
  347. for (tid of tids) {
  348. let t = timelinesTable.fetch(tid)
  349. if (t != null && t.order != null) {
  350. let order = []
  351. for (sid of t.order) {
  352. let want = sid == fromId ? toId : sid
  353. if (!order.includes(want)) { order.push(want) }
  354. }
  355. let r = storeOrder(t, order)
  356. if (r.error != null) { console.log('merge: timeline ' + tid + ': ' + r.error) } else { n = n + 1 }
  357. }
  358. }
  359. return n
  360. }
  361. static addToTimeline = (&timelineId, &showId) => {
  362. t = timelineById(timelineId)
  363. if (t == null) { return { error = 'no such timeline' } }
  364. if (showById(showId) == null) { return { error = 'no such title' } }
  365. order = []
  366. for (sid of t.order) { order.push(sid) }
  367. if (order.includes(showId)) { return { ok = true rows = editRowsOf(t) } }
  368. order.push(showId)
  369. return storeOrder(t, order)
  370. }
  371. static removeFromTimeline = (&timelineId, &showId) => {
  372. t = timelineById(timelineId)
  373. if (t == null) { return { error = 'no such timeline' } }
  374. order = []
  375. for (sid of t.order) { if (sid != showId) { order.push(sid) } }
  376. return storeOrder(t, order)
  377. }
  378. // one place up (delta -1) or down (+1); at an end nothing changes
  379. static moveInTimeline = (&timelineId, &showId, &delta) => {
  380. t = timelineById(timelineId)
  381. if (t == null) { return { error = 'no such timeline' } }
  382. at = posOf(t.order, showId)
  383. to = at + (delta < 0 ? -1 : 1)
  384. if (at < 0 || to < 0 || to >= t.order.length) { return { ok = true rows = editRowsOf(t) } }
  385. order = []
  386. let i = 0
  387. while (i < t.order.length) {
  388. if (i == at) { order.push(t.order[to]) } else if (i == to) { order.push(t.order[at]) } else { order.push(t.order[i]) }
  389. i = i + 1
  390. }
  391. return storeOrder(t, order)
  392. }
  393. static setTimelineFranchise = (&timelineId, franchiseId) => {
  394. t = timelineById(timelineId)
  395. if (t == null) { return { error = 'no such timeline' } }
  396. let fid = null
  397. if (franchiseId != null && franchiseId != '') {
  398. if (franchiseById(franchiseId) == null) { return { error = 'no such franchise' } }
  399. fid = franchiseId
  400. }
  401. rec = t
  402. rec.franchise = fid
  403. if (timelinesTable.update(rec.id, rec) == null) { return { error = 'not stored: ' + timelinesTable.lastError() } }
  404. timelinesTable.persist()
  405. return { ok = true chips = chipsOf(rec) }
  406. }
  407. // the editor's title search: our database (search.hl's index), the titles not in the timeline yet
  408. static editSearch = (&timelineId, text) => {
  409. t = timelineById(timelineId)
  410. have = t != null && t.order != null ? t.order : []
  411. out = []
  412. r = dbSearch(text != null ? '' + text : '')
  413. for (x of r.titles) {
  414. let s = showById(x.id)
  415. if (s != null && !have.includes(s.id)) { out.push({ id = s.id title = titleWithYear(s) posterUrl = posterUrlOf(s) typeLabel = s.type == 'series' ? 'Series' : 'Movie' }) }
  416. }
  417. return { text = text rows = out note = r.tooShort ? 'Type at least 2 letters.' : (out.length == 0 ? 'Nothing found.' : '') }
  418. }
  419. // the editor's timeline finder: by name, at most 30
  420. static findTimelines = (&text) => {
  421. q = text != null ? ('' + text).trim().toLowerCase() : ''
  422. out = []
  423. if (q.length < 2) { return out }
  424. for (t of timelinesTable.find(null, null)) {
  425. if (out.length < 30 && ('' + t.name).toLowerCase().includes(q)) {
  426. let n = t.order != null ? t.order.length : 0
  427. out.push({ id = t.id name = t.name href = '/timelines/' + t.slug + '/edit' countText = n == 1 ? '1 title' : n + ' titles' })
  428. }
  429. }
  430. return out
  431. }

Branches

Latest commits

  • b10f00c8tracker#39: double episodes — migrated episodes whose TMDB id TMDB replaced are adopted by their number in the sync (old id -> migratedTmdbId); merge.hl step 3 merges each season's doubles at start (keeper: most watches > synced > first; watches moved/parked; tombstones into mergedEpisodes, nothing deleted); tools/count-duplicate-episodes.hl; gate fixture + paths-m039; live copy 850 -> 0 in 64 s; gates 373/0, 32/0, 52/0mre
  • 8751adb8tracker: report 032mre
  • 9bce1f65tracker mission 032: STATUS gate files + the hour-boundary flakemre
  • 718bfb89tracker#37 (mission 032): /people = everyone, last updated first (updatedAt stamped by the person fill; view built at boot, touched people first at once), photo + name tiles (person colour) with the /movies pagination, /people/<letter> removed; photo = our file, tmdbProfile, a cast/crew entry's profile (in-memory map at boot), else the new 'no photo' placeholder; new cast/crew/created_by people keep tmdbProfile; search people rows with the photo; /settings = the heading only; util.hl sortDesc starts from sorted runs (same result, 105k: 1.6 s -> 0.15 s); gates 369/0, 32/0, 52/0, check-theme 0; README/STATUS/LOGmre
  • 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