gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commita18957faa18957falog: evening re-measure after CBmrea18957fa/tests/seed-dupes.hl

10.8 KB

  1. // tests/seed-dupes.hl — GATE FIXTURE for mission 026 (tracker#31, duplicate titles): written by tests/browser.mjs into the gate's
  2. // storage while the app is STOPPED (one process per storage, hybriel#21), late in the gate. Self-assigned ids, one put() each.
  3. // Shaped like the live data's migrated duplicates (Mongo-like oldIds in creation order, shared slugs):
  4. // Dupe Gate Series (tv 1301) ×3:
  5. // A oldest, slug Dupe-Gate-Series, short id dupa1: S1 (E1, E2) + S3 (E1 — B has no S3 → moved), cast Dupe Cast A
  6. // B slug Dupe-Gate-Series-2, short id dupb1: alice FOLLOWS it, watched S1E1 → the keeper; S1 (E1, E2) + S2 (E1), cast Dupe Cast B
  7. // C slug Dupe-Gate-Series-2 (shared, like Archive 81), short id dupc1: S1 (E1, E2, E3 — B has no E3 → moved), alice watched
  8. // S1E2 there (→ B's E2); a person's credit (Dupe Credit Person) and a timeline (Dupe Gate Line) name C
  9. // Dupe Gate Movie (movie 1303) ×2: M1 older (slug Dupe-Gate-Movie, dupm1), M2 (slug Dupe-Gate-Movie-2, dupm2) alice watched → keeper
  10. // Stray Gate Series (tv 1302), one record: listed S1 (E1, E2, the sync's kind: tmdb-season oldId); stray seasons naming it but
  11. // not listed — S1' (E1, E2: alice watched both + checked the season) → merged into S1; S2' (E1: alice watched) → linked;
  12. // S3' (E1, nobody watched) → stays as it is
  13. // Double Episode Series (tv 1305, tracker#39), one record, alice follows it: listed S1 holds DOUBLE EPISODES like the live data —
  14. // migrated E1 (TMDB id 9001, TMDB has replaced it; alice watched it) + E2 (9002), and the sync's E1 (tmdb-episode:9101) + E2
  15. // (9102); listed S2 a migrated E1 with a stale TMDB id (9201; the fake TMDB lists 9301) for the sync's number match
  16. // (tests/paths-m039.hl)
  17. import { MPackDB } from 'hl:mpackdb'
  18. import { env } from 'hl:proc'
  19. import { now } from 'hl:time'
  20. storageDir = env('TRACKER_STORAGE')
  21. if (storageDir == null || !storageDir.startsWith('/')) { hlError('set TRACKER_STORAGE, absolute') }
  22. userId = env('TRACKER_SEED_USER')
  23. if (userId == null || userId == '') { hlError('set TRACKER_SEED_USER') }
  24. showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'])
  25. seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'])
  26. episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'])
  27. followsTable = new MPackDB(file = storageDir + '/follows.db', primaryKey = '@id', indexes = ['!oldId'])
  28. watchesTable = new MPackDB(file = storageDir + '/watches.db', primaryKey = '@id', indexes = ['!oldId'])
  29. personsTable = new MPackDB(file = storageDir + '/persons.db', primaryKey = '@id', indexes = ['!oldId'])
  30. timelinesTable = new MPackDB(file = storageDir + '/timelines.db', primaryKey = '@id', indexes = ['!slug'])
  31. title = (id, tmdbId, type, name, slug, sid, oldId, seasons, cast) => {
  32. showsTable.put({ adult = false id = id title = name summary = null tmdbSummary = 'a duplicate' tmdbId = tmdbId
  33. language = 'en' type = type release = '2019-04-04' year = 2019 image = null urlSegment = slug
  34. episodesCount = null homepage = null imdbId = null seasonsCount = null status = 'Ended' tagline = null
  35. tvdbId = null tvmzId = null genres = [] cast = cast seasons = seasons oldId = oldId shortId = sid kind = type == 'series' ? 'series' : null
  36. creditsAt = 1 detailsAt = 1 })
  37. return true
  38. }
  39. season = (id, show, n, eps, oldId) => {
  40. seasonsTable.put({ id = id seasonNumber = n title = 'Season ' + n release = '2019-04-04' summary = '' show = show episodes = eps oldId = oldId })
  41. return true
  42. }
  43. episode = (id, show, seasonId, n, e, name) => {
  44. episodesTable.put({ id = id episodeNumber = e seasonNumber = n title = name summary = '' release = '2019-04-0' + e show = show season = seasonId oldId = 'o' + id })
  45. return true
  46. }
  47. watch = (id, type, target) => {
  48. watchesTable.put({ id = id targetType = type target = target user = userId at = now() oldId = 'gw-' + id })
  49. return true
  50. }
  51. // Dupe Gate Series
  52. episode('dpae000000000a11', 'dpa000000000000a', 'dpas00000000000a', 1, 1, 'Pilot A')
  53. episode('dpae000000000a12', 'dpa000000000000a', 'dpas00000000000a', 1, 2, 'Second A')
  54. season('dpas00000000000a', 'dpa000000000000a', 1, ['dpae000000000a11', 'dpae000000000a12'], '5f00000000000000000000a1')
  55. episode('dpae000000000a31', 'dpa000000000000a', 'dpas0000000000a3', 3, 1, 'Third Season Start')
  56. season('dpas0000000000a3', 'dpa000000000000a', 3, ['dpae000000000a31'], '5f00000000000000000000a3')
  57. title('dpa000000000000a', 1301, 'series', 'Dupe Gate Series', 'Dupe-Gate-Series', 'dupa1', '5f0000000000000000000001', ['dpas00000000000a', 'dpas0000000000a3'],
  58. [{ person = 'dpp000000000000a' character = 'Role A' actor = 'Dupe Cast A' }])
  59. episode('dpbe000000000b11', 'dpb000000000000b', 'dpbs00000000000b', 1, 1, 'Pilot')
  60. episode('dpbe000000000b12', 'dpb000000000000b', 'dpbs00000000000b', 1, 2, 'Second')
  61. season('dpbs00000000000b', 'dpb000000000000b', 1, ['dpbe000000000b11', 'dpbe000000000b12'], '5f00000000000000000000b1')
  62. episode('dpbe000000000b21', 'dpb000000000000b', 'dpbs0000000000b2', 2, 1, 'Second Season Start')
  63. season('dpbs0000000000b2', 'dpb000000000000b', 2, ['dpbe000000000b21'], '5f00000000000000000000b2')
  64. title('dpb000000000000b', 1301, 'series', 'Dupe Gate Series', 'Dupe-Gate-Series-2', 'dupb1', '5f0000000000000000000002', ['dpbs00000000000b', 'dpbs0000000000b2'],
  65. [{ person = 'dpp000000000000b' character = 'Role B' actor = 'Dupe Cast B' }])
  66. episode('dpce000000000c11', 'dpc000000000000c', 'dpcs00000000000c', 1, 1, 'Pilot C')
  67. episode('dpce000000000c12', 'dpc000000000000c', 'dpcs00000000000c', 1, 2, 'Second C')
  68. episode('dpce000000000c13', 'dpc000000000000c', 'dpcs00000000000c', 1, 3, 'Only In C')
  69. season('dpcs00000000000c', 'dpc000000000000c', 1, ['dpce000000000c11', 'dpce000000000c12', 'dpce000000000c13'], '5f00000000000000000000c1')
  70. title('dpc000000000000c', 1301, 'series', 'Dupe Gate Series', 'Dupe-Gate-Series-2', 'dupc1', '5f0000000000000000000003', ['dpcs00000000000c'], [])
  71. personsTable.put({ id = 'dpp000000000000a' name = 'Dupe Cast A' urlSegment = 'Dupe-Cast-A' tmdbId = null oldId = 'dpp-a' shortId = 'dupp1' filmographyAt = 1
  72. shows = [{ show = 'dpa000000000000a' character = 'Role A' }] })
  73. personsTable.put({ id = 'dpp000000000000b' name = 'Dupe Cast B' urlSegment = 'Dupe-Cast-B' tmdbId = null oldId = 'dpp-b' shortId = 'dupp2' filmographyAt = 1
  74. shows = [{ show = 'dpb000000000000b' character = 'Role B' }] })
  75. personsTable.put({ id = 'dpp000000000000c' name = 'Dupe Credit Person' urlSegment = 'Dupe-Credit-Person' tmdbId = null oldId = 'dpp-c' shortId = 'dupp3' filmographyAt = 1
  76. shows = [{ show = 'dpc000000000000c' character = 'Guest In C' }] })
  77. // tests/paths-m026.hl: a person whose filmography is not fetched yet (fake TMDB person 3301: tv 1301, movie 1303, NEW movie 1304)
  78. personsTable.put({ id = 'dpp000000000000d' name = 'Dupe Fill Person' urlSegment = 'Dupe-Fill-Person' tmdbId = 3301 oldId = 'dpp-d' shortId = 'dupp4' })
  79. followsTable.put({ id = 'dpf00000000000f1' show = 'dpb000000000000b' user = userId at = now() oldId = 'gate-follow-dupe' })
  80. watch('dpw00000000000w1', 'episode', 'dpbe000000000b11')
  81. watch('dpw00000000000w2', 'episode', 'dpce000000000c12')
  82. timelinesTable.put({ id = 'dpt00000000000t1' name = 'Dupe Gate Line' slug = 'dupe-gate-line' franchise = null order = ['dpc000000000000c', 'dpm00000000000m2'] source = 'editor'
  83. tmdbCollection = null created = now() })
  84. // Dupe Gate Movie
  85. title('dpm00000000000m1', 1303, 'movie', 'Dupe Gate Movie', 'Dupe-Gate-Movie', 'dupm1', '5f0000000000000000000011', [], [])
  86. title('dpm00000000000m2', 1303, 'movie', 'Dupe Gate Movie', 'Dupe-Gate-Movie-2', 'dupm2', '5f0000000000000000000012', [], [])
  87. watch('dpw00000000000w3', 'movie', 'dpm00000000000m2')
  88. // Stray Gate Series
  89. episode('dpse000000000s11', 'dps000000000000s', 'dpss00000000000s', 1, 1, 'Stray Pilot')
  90. episode('dpse000000000s12', 'dps000000000000s', 'dpss00000000000s', 1, 2, 'Stray Second')
  91. season('dpss00000000000s', 'dps000000000000s', 1, ['dpse000000000s11', 'dpse000000000s12'], 'tmdb-season:1302:1')
  92. episode('dpse00000000x111', 'dps000000000000s', 'dpss0000000000x1', 1, 1, 'Old Stray Pilot')
  93. episode('dpse00000000x112', 'dps000000000000s', 'dpss0000000000x1', 1, 2, 'Old Stray Second')
  94. season('dpss0000000000x1', 'dps000000000000s', 1, ['dpse00000000x111', 'dpse00000000x112'], '5f00000000000000000000x1')
  95. episode('dpse00000000x211', 'dps000000000000s', 'dpss0000000000x2', 2, 1, 'Watched Special')
  96. season('dpss0000000000x2', 'dps000000000000s', 2, ['dpse00000000x211'], '5f00000000000000000000x2')
  97. episode('dpse00000000x311', 'dps000000000000s', 'dpss0000000000x3', 3, 1, 'Nobody Watched')
  98. season('dpss0000000000x3', 'dps000000000000s', 3, ['dpse00000000x311'], '5f00000000000000000000x3')
  99. title('dps000000000000s', 1302, 'series', 'Stray Gate Series', 'Stray-Gate-Series', 'dups1', '5f0000000000000000000021', ['dpss00000000000s'], [])
  100. followsTable.put({ id = 'dpf00000000000f2' show = 'dps000000000000s' user = userId at = now() - 1000 oldId = 'gate-follow-stray' })
  101. watch('dpw00000000000w4', 'episode', 'dpse00000000x111')
  102. watch('dpw00000000000w5', 'episode', 'dpse00000000x112')
  103. watch('dpw00000000000w6', 'season', 'dpss0000000000x1')
  104. watch('dpw00000000000w7', 'episode', 'dpse00000000x211')
  105. // Double Episode Series (tracker#39)
  106. ep39 = (id, n, e, tmdbId, oldId, name) => {
  107. episodesTable.put({ id = id episodeNumber = e seasonNumber = n title = name summary = '' release = '2018-0' + n + '-0' + e show = 'dde000000000000d'
  108. season = n == 1 ? 'dds00000000000s1' : 'dds00000000000s2' tmdbId = tmdbId oldId = oldId })
  109. return true
  110. }
  111. ep39('dde0000000000e11', 1, 1, 9001, '5f00000000000000000000e1', 'Old Pilot')
  112. ep39('dde0000000000e12', 1, 2, 9002, '5f00000000000000000000e2', 'Old Second')
  113. ep39('dde0000000000t11', 1, 1, 9101, 'tmdb-episode:9101', 'Pilot')
  114. ep39('dde0000000000t12', 1, 2, 9102, 'tmdb-episode:9102', 'Second')
  115. ep39('dde0000000000e21', 2, 1, 9201, '5f00000000000000000000e3', 'Old Two One')
  116. season('dds00000000000s1', 'dde000000000000d', 1, ['dde0000000000e11', 'dde0000000000e12', 'dde0000000000t11', 'dde0000000000t12'], '5f00000000000000000000d1')
  117. season('dds00000000000s2', 'dde000000000000d', 2, ['dde0000000000e21'], '5f00000000000000000000d2')
  118. title('dde000000000000d', 1305, 'series', 'Double Episode Series', 'Double-Episode-Series', 'dupd1', '5f0000000000000000000031', ['dds00000000000s1', 'dds00000000000s2'], [])
  119. followsTable.put({ id = 'dpf00000000000f3' show = 'dde000000000000d' user = userId at = now() - 2000 oldId = 'gate-follow-double' })
  120. watch('dpw00000000000w8', 'episode', 'dde0000000000e11')
  121. showsTable.persist()
  122. seasonsTable.persist()
  123. episodesTable.persist()
  124. followsTable.persist()
  125. watchesTable.persist()
  126. personsTable.persist()
  127. timelinesTable.persist()
  128. console.log('seed-dupes: Dupe Gate Series ×3, Dupe Gate Movie ×2, Stray Gate Series with 3 stray seasons, Double Episode Series; ' + userId + ' follows 3, 8 watches')

Branches

Latest commits

  • a18957falog: evening re-measure after CBmre
  • aac9a98dlog: evening re-measure startmre
  • 45163bd4log: person/tmdb error hypothesismre
  • cb38de2blog: swap 503 causemre
  • fd10c3d5log: CB livemre
  • 7557c025log: CB deploy try 2mre
  • 06a7534aMerge branch 'cb'mre
  • 2f8030d6log: CB gates greenmre
  • 498bf644log: CB gates startmre
  • f59c2847gc1: bound the five request caches (shows.hl cacheLimit)mre
  • 6ea2c6d6log: morning re-measure 11-04mre
  • 446290f0log: GC1 livemre
  • 8e6aa91dlog: GC1 deploy retrymre
  • 87ad2dc1log: GC1 deployingmre
  • 53f10fb8Merge branch 'gc1-deploy'mre
  • 7fcbf1d2log: GC1 deploy GOmre
  • 1fb6664bcompose: TRACKER_QSTATS=1 (GC1 measurement)mre
  • 6576c1cdgc1: release the people-view scan lists once the view is builtmre
  • 94f8a373gc1: back out the kept episode-id set (no measurable gain on /my/unwatched: 4.69 -> 4.61 GB per 150 loads)mre
  • a1a88bd4gc1: search skips the stale-key string while no entry is stale; /my/unwatched asks a kept id set instead of building a key string per episode rowmre