tracker
All repositories: gitoria
12.2 KB
// tests/seed-show.hl — GATE FIXTURE for tracker.worldapi.org#4/#5: one small show with two seasons and// three episodes, written directly into a fresh storage/mpackdb/ (given as TRACKER_STORAGE) before the// gate server starts. Not the real migrated data (tests/browser.mjs does not run the real migration —// too slow for a gate) — just enough to drive the show page's and /unwatched's own checks.//// tracker.worldapi.org#5: episode 1 and 2 carry a PAST release date (so /unwatched shows them),// episode 3 a FAR FUTURE one (so /unwatched proves it excludes not-yet-released episodes). If// TRACKER_SEED_IDENTITY is set (the gate learns it from a throwaway ident exchange, since the real// login flow's `ensureUser` matches an EXISTING users.db row by `identity`, reusing its id rather than// minting a new one), a fixed user + a follow of this show for that user are seeded too — that is the// only way to give /unwatched a known, pre-followed show before the browser ever signs in.//// IDS ARE SELF-ASSIGNED (fixed literals, one put() per record — never update()), the same rule// tools/migrate.hl follows for its real two-way references (Show.seasons/Season.show, Episode.show/// season): hl:mpackdb's update() can lose rows across a reopen in a fresh process (hybriel#113) — and// the gate DOES reopen this same storage dir in a fresh process right after this script exits.import { MPackDB } from 'hl:mpackdb'import { env } from 'hl:proc'import { now } from 'hl:time'storageDir = env('TRACKER_STORAGE')if (storageDir == null || !storageDir.startsWith('/')) { hlError('set TRACKER_STORAGE, absolute') }genresTable = new MPackDB(file = storageDir + '/genres.db', primaryKey = '@id', indexes = ['!oldId'])personsTable = new MPackDB(file = storageDir + '/persons.db', primaryKey = '@id', indexes = ['!oldId'])showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'])seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'])episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'])watchesTable = new MPackDB(file = storageDir + '/watches.db', primaryKey = '@id', indexes = ['!oldId'])usersTable = new MPackDB(file = storageDir + '/users.db', primaryKey = '@id', indexes = ['!identity'])followsTable = new MPackDB(file = storageDir + '/follows.db', primaryKey = '@id', indexes = ['!oldId'])genreId = 'g0000000000000g1'personId = 'p0000000000000p1'showId = 'sh00000000000sh1'season1Id = 'se000000000se0s1'season2Id = 'se000000000se0s2'ep1Id = 'ep0000000000ep0e1'ep2Id = 'ep0000000000ep0e2'ep3Id = 'ep0000000000ep0e3'genresTable.put({ id = genreId name = 'Drama' urlSegment = 'Drama' tmdbId = 18 oldId = 'g1' })// mission 058 (tracker#25, /genres/Action): the 30 Pager Movies, Pager Future Movie, Pager Older Series (a SERIES, newest released// episode 2021-01-01) and Hidden Action Film (ADULT: never listed) are Action → 32 public titles = 2 pages of 24actionId = 'g0000000000000g2'genresTable.put({ id = actionId name = 'Action' urlSegment = 'Action' tmdbId = 28 oldId = 'g2' })// tracker.worldapi.org#16: Test Actor (the cast link of show 1) has a tmdbId → its page fetches the filmography from the fake TMDBpersonsTable.put({ id = personId name = 'Test Actor' urlSegment = 'Test-Actor' tmdbId = 3002 oldId = 'p1' })seasonsTable.put({ id = season1Id seasonNumber = 1 title = null release = null summary = null show = showId episodes = [ep1Id, ep2Id] oldId = 's1' })seasonsTable.put({ id = season2Id seasonNumber = 2 title = null release = null summary = null show = showId episodes = [ep3Id] oldId = 's2' })episodesTable.put({ id = ep1Id episodeNumber = 1 seasonNumber = 1 title = 'Pilot' summary = null release = '2020-01-01' show = showId season = season1Id oldId = 'ep1' })episodesTable.put({ id = ep2Id episodeNumber = 2 seasonNumber = 1 title = 'Second' summary = null release = '2020-06-15' show = showId season = season1Id oldId = 'ep2' })episodesTable.put({ id = ep3Id episodeNumber = 1 seasonNumber = 2 title = 'Season Two Opener' summary = null release = '2099-01-01' show = showId season = season2Id oldId = 'ep3' })showsTable.put({adult = false id = showId title = 'Gate Test Show' summary = 'a fixture show for the gate' tmdbSummary = null tmdbId = 1001language = 'en' type = 'series' release = null year = 2024 image = 'png' urlSegment = 'gate-test-show'episodesCount = 3 homepage = null imdbId = 'tt0000001' seasonsCount = 2 status = 'Ended' tagline = nulltvdbId = null tvmzId = null genres = [genreId] cast = [{ person = personId character = 'Someone' actor = 'Test Actor' }]seasons = [season1Id, season2Id] oldId = 'sh1'})show2Id = 'sh00000000000sh2'showsTable.put({adult = false id = show2Id title = 'Unwatched Gate Show' summary = null tmdbSummary = null tmdbId = 1002language = 'en' type = 'series' release = '2025-03-01' year = null image = null urlSegment = 'unwatched-gate-show'episodesCount = 0 homepage = null imdbId = null seasonsCount = 0 status = 'Ended' tagline = nulltvdbId = 4002 tvmzId = null genres = [] cast = [] seasons = [] oldId = 'sh2'})// tracker.worldapi.org#12 (link icons, external ids): show 1 has an imdbId only, show 2 a tvdbId only — the sync must fill// the missing ones (TMDB external_ids, TVmaze lookup) and never overwrite these. A MOVIE (tmdbId 1003, no imdbId):// TMDB + IMDb icons only, synced via /movie/, never /tv/ — followed by ANOTHER user (below), so alice's lists stay as they are.// tracker.worldapi.org#18: its `summary` is a COPY of tmdbSummary (as the migration made them) — cleared at the first startshow3Id = 'sh00000000000sh3'showsTable.put({adult = false id = show3Id title = 'Gate Test Movie' summary = 'a fixture movie' tmdbSummary = 'a fixture movie' tmdbId = 1003language = 'en' type = 'movie' release = '1996-11-18' year = 1996 image = null urlSegment = 'gate-test-movie'episodesCount = null homepage = null imdbId = null seasonsCount = null status = 'Released' tagline = nulltvdbId = null tvmzId = null genres = [] cast = [] seasons = [] oldId = 'sh3'})// tracker.worldapi.org#13 (the homepage rows, /movies, /shows): 32 more movies, never followed — 'Pager Movie 01'…'30'// (released 2001-01-01 … 2001-01-30), 'Pager Future Movie' (2099-06-01: first on /movies, never in the homepage's "latest// released") and 'Pager Undated Movie' (no release: last) → 33 movies with the one above = 2 pages of 24. And a series// whose newest released episode (2021-01-01) is newer than show 1's (2020-06-15) but older than the S3E1 (2021-05-05) the// TMDB sync brings show 1 — so /shows reorders after the sync.// (Named 'Pager …', not 'Gate …', since the #13/#14 merge: the search checks (#14) expect exactly the 'gate' titles.)let mi = 1while (mi <= 30) {let nn = mi < 10 ? '0' + mi : '' + mishowsTable.put({adult = false id = 'mv00000000000m' + nn title = 'Pager Movie ' + nn summary = null tmdbSummary = null tmdbId = nulllanguage = 'en' type = 'movie' release = '2001-01-' + nn year = 2001 image = null urlSegment = 'pager-movie-' + nnepisodesCount = null homepage = null imdbId = null seasonsCount = null status = null tagline = nulltvdbId = null tvmzId = null genres = [actionId] cast = [] seasons = [] oldId = 'mv' + nn})mi = mi + 1}showsTable.put({adult = false id = 'mv00000000000mfu' title = 'Pager Future Movie' summary = null tmdbSummary = null tmdbId = nulllanguage = 'en' type = 'movie' release = '2099-06-01' year = 2099 image = null urlSegment = 'pager-future-movie'episodesCount = null homepage = null imdbId = null seasonsCount = null status = null tagline = nulltvdbId = null tvmzId = null genres = [actionId] cast = [] seasons = [] oldId = 'mvfu'})showsTable.put({adult = true id = 'mv00000000000mha' title = 'Hidden Action Film' summary = null tmdbSummary = null tmdbId = nulllanguage = 'en' type = 'movie' release = '2050-01-01' year = 2050 image = null urlSegment = 'hidden-action-film'episodesCount = null homepage = null imdbId = null seasonsCount = null status = null tagline = nulltvdbId = null tvmzId = null genres = [actionId] cast = [] seasons = [] oldId = 'mvha'})showsTable.put({adult = false id = 'mv00000000000mun' title = 'Pager Undated Movie' summary = null tmdbSummary = null tmdbId = nulllanguage = 'en' type = 'movie' release = null year = null image = null urlSegment = 'pager-undated-movie'episodesCount = null homepage = null imdbId = null seasonsCount = null status = null tagline = nulltvdbId = null tvmzId = null genres = [] cast = [] seasons = [] oldId = 'mvun'})show4Id = 'sh00000000000sh4'season4Id = 'se000000000se0s4'ep4Id = 'ep0000000000ep0e4'seasonsTable.put({ id = season4Id seasonNumber = 1 title = null release = null summary = null show = show4Id episodes = [ep4Id] oldId = 's4' })episodesTable.put({ id = ep4Id episodeNumber = 1 seasonNumber = 1 title = 'Older Pilot' summary = null release = '2021-01-01' show = show4Id season = season4Id oldId = 'ep4' })showsTable.put({adult = false id = show4Id title = 'Pager Older Series' summary = null tmdbSummary = null tmdbId = nulllanguage = 'en' type = 'series' release = '2019-01-01' year = 2019 image = null urlSegment = 'pager-older-series'episodesCount = 1 homepage = null imdbId = null seasonsCount = 1 status = 'Ended' tagline = nulltvdbId = null tvmzId = null genres = [actionId] cast = [] seasons = [season4Id] oldId = 'sh4'})// mission 054: every fixture title above is KNOWN non-adult (`adult = false`) — unknown or adult titles are hidden from the// public lists and the search; the adult block of the gate adds those itself (tests/seed-adult.hl)// tracker.worldapi.org#16 (person pages): a COMPLETE person (filmographyAt set: shown at once, TMDB never asked) with two credits// and the facts; a second INCOMPLETE one whose TMDB credits are titles the first fill (Test Actor) adds → linked, nothing addedpersonsTable.put({ id = 'p0000000000000p2' name = 'Complete Person' urlSegment = 'Complete-Person' tmdbId = 3001 gender = 1birthDate = '1950-02-03' birthPlace = 'Gate City' deathDate = '2020-01-01' biography = 'A fixture person who is complete.' image = nullshows = [{ show = showId character = 'Old Role' }, { show = show3Id character = 'Movie Role' }] filmographyAt = now() oldId = 'p2' })personsTable.put({ id = 'p0000000000000p3' name = 'Second Actor' urlSegment = 'Second-Actor' tmdbId = 3003 shows = [] oldId = 'p3' })// tracker.worldapi.org#9: both shows carry a tmdbId (1001, 1002) — the gate's fake TMDB (tests/faketmdb.mjs)// answers for exactly these two; the fixture episodes have no tmdbId, so the sync must match them by S/E number// tracker.worldapi.org#8: show 1 has a poster FILE (the gate writes posters/sh1.png) and a `year`; show 2 has// neither — its year comes from `release` (shows.hl showYear), its poster is the placeholder URL /posters/noneidentity = env('TRACKER_SEED_IDENTITY')userId = 'gateu0000000000u1'if (identity != null && identity != '') {usersTable.put({ id = userId identity = identity created = now() })// tracker.worldapi.org#7 (/my/shows, newest follow first): the fixture show was followed a day ago, a// second show (no seasons, no poster name, never watched) just now — stored AFTER it, so the page's// order has to come from `at`, not from the table's own orderfollowsTable.put({ id = 'gatef000000000f1' show = showId user = userId at = now() - 86400000 oldId = 'gate-follow-1' })followsTable.put({ id = 'gatef000000000f2' show = show2Id user = userId at = now() oldId = 'gate-follow-2' })followsTable.put({ id = 'gatef000000000f3' show = show3Id user = 'gateu0000000000u2' at = now() oldId = 'gate-follow-3' })}genresTable.persist()personsTable.persist()showsTable.persist()seasonsTable.persist()episodesTable.persist()watchesTable.persist()usersTable.persist()followsTable.persist()console.log('seed: show ' + showId + ' (gate-test-show), seasons ' + season1Id + ',' + season2Id + ', episodes ' + ep1Id + ',' + ep2Id + ',' + ep3Id + (identity != null && identity != '' ? ', user ' + userId + ' follows it (and ' + show2Id + ')' : ', no follow (no identity given)'))
Branches
- mainmain branch
Latest commits
- 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
- 46b21389tracker (mission 070, conductor): the sync never destroys migrated data — the one-time summary step MOVES a copied summary to migratedSummary (marker summaries-moved.txt) instead of clearing it; a migrated record's first title/genres/homepage/tagline TMDB replaces → migratedTitle/migratedGenres/migratedHomepage/migratedTagline, a migrated season's/episode's title/summary → migratedTitle/migratedSummary (set once); tests/peek-shows.hl prints them; gate 325/0mre
- 749019b0Merge t19 (tracker#19 franchises + timelines) into main (mission 070): conflicts README/STATUS/show.hl/project.hl/browser.mjs/faketmdb.mjs, both sides kept; franchise/timeline pages get #20's typed heading (Franchise | …, Timeline | …), their title links via titlePath (/movies|/series|/shows); the collection seed waits for repair, kinds and credits too; franchises.mjs URLs + 2 new checks; gates browser 323/0, kinds 32/0, franchises 50/0mre
- daf49feaMerge t20 (tracker#20 typed headings + #21 series/shows split) into main (mission 070): conflicts README/STATUS/show.hl/project.hl/search.hl/components/search.hl/browser.mjs/faketmdb.mjs, both sides kept; clock order backfill → repair → kinds → credits; withDetailsFields stores tmdbType + kind; gates: browser.mjs URLs → /series|/movies, typed h1 selectors; kinds.mjs repair/credits off, fixture name = seed name; browser 323/0, kinds 32/0mre
- 20e09d89Merge t18 (tracker#18 delta sync) into main (mission 070): conflicts README/STATUS/show.hl/project.hl/browser.mjs, both sides kept; pageShowOf summary = summaryOfmre
- f83571c3tracker#18 (mission 067): daily sync by change lists — TMDB /tv|movie/changes (since the stored day, paged) + TVmaze /updates/shows → only our changed titles (followed: full step, unfollowed: light step — changed seasons, no TVmaze), full walk on first run / gap > 14 days / failed list; show record refreshed (title, tmdbSummary, tagline, status, genres …; renamed titles re-indexed); summary = the creator's own text (page: summary > tmdbSummary > tvmazeSummary), one-time clear of copied summaries (9,647 on the live copy); gate 261, tests/realdata-018*.mjs, README + STATUSmre
- 1ed5457etracker#20 + #21 (mission 068): typed headings "<Type> | <name>" in type colours; TV titles split into Series (/series) and Shows (/shows) by TMDB type + Reality/Talk/News genres — kind stored by sync/import/adult backfill + new kind backfill (resumes), /movies/<slug>, /shows/<slug> of a series/movie → 301, /my/series + /my/shows, home 5 tiles + 3 rows, search/filmography labels; gates kinds 32 + browser 266, tests/realdata-068.mjs, tools/count-kinds.hl, docs/kinds.md, README + STATUSmre
- f2b00674Merge t26 (tracker#26 + #28) into main (mission 062): short ids for every new person (castPersonId, guest route), guest stars stored on the title and created as people only when opened (/person/tmdb/<id>?show=<id> → 302), lean watch/follow clicks (showRow a small object, cast/crew from the slug, watches cached per user, face rows only after a season toggle); gate 311, tests/realdata-062.mjs, README + STATUSmre
- 0553b51ftracker#19 (mission 066): franchises and timelines — tables, /franchises, /franchises/<slug>, /timelines/<slug> (Timeline | Release sort, series by last episode), the Prequel | Timeline | Sequel widget with the franchise above, the creator's editor, TMDB collection seed in the app (resumes, paced); gate tests/franchises.mjs 48/0 + browser.mjs 266/0, tests/realdata-066.mjs, docs/franchises.md, README + STATUSmre
- fa1f9dfatracker#29 (mission 063): unwatched check muted grey outline + check (accent only on hover), watched stays solid — no code regression, the accent outline read as ticked; gate checks real checks visibly (computed style + screenshot pixel) on /my/unwatched, show, movie, /my/movies; gate 266, tests/realdata-063.mjs, README + STATUSmre
- 10bb3f93tracker#28 (mission 061): full cast (all seasons, main cast by episodes, guest stars) + crew (created by, directed by, written by, screenplay, story, music) — stored by the details completion, the daily sync, the search import (one details request) and a background credits job (resumes, RSS limit); show page collapsed after 20 with client-side Show all; showBySlug via a slug map; gate 249, tests/realdata-028.mjs, README + STATUSmre
- d8b12d67tracker#27 (mission 060): short ids for movies, series and persons — old 702 kept (data/old-short-ids.json), new random [a-z0-9]{5} unique across both, claimed at creation, background backfill (resumes), shown under poster/photo, /<shortId> → 301; gate 259, tests/realdata-060*, README + STATUSmre
- 25a50bc4tracker#26 (mission 059): titles from a filmography are completed — on open (skeleton, step-wise face showComplete, no reload) and by the in-app details repair (resumes, TMDB-paced, series in parts); cast from TMDB credits; gate 231, tests/realdata-026.mjs, README + STATUSmre
- f14db671tracker#22-#25 (mission 058): episode air dates, season check = all episodes watched, movie watched check (+ /my/movies count), /genres/<genre> pages (movies + series, newest first, paginated); gate 238, tests/realdata-058.mjs, README + STATUSmre
- 1704ec45tracker#17 (mission 057): season caret down/up, skeleton rows while a season loads, sessionless showSeasonEpisodes face (no page re-mount), client-only close; gate 214, tests/realdata-057.mjs, README + STATUSmre
- f2fe3e36mission 056: README + STATUS (merge, fixes, Hybriel 8590df63, real-data check), tests/realdata-056.mjs, tools/check-public-slugs.hlmre
- f40c250emission 056: re-vendor hybriel master 8590df63 (#121, #122); an adult title's page is Not found for non-followers; gate: leave the page before stopping the servermre