gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit44b7d9f944b7d9f9tracker#6: /schedule — upcoming episodes of followed shows, soonest firstmre44b7d9f9/README.md

16.7 KB

  1. # tracker.worldapi.org
  2. The new tracker: a Hybriel app that will track the TV shows (and later movies) the creator
  3. follows and watches. **`CONCEPT.md` (the creator's) is the source of truth** — read it first;
  4. nothing is built that it does not describe. Built step by step, one ticket per step
  5. (tracker.worldapi.org#1, #2, …).
  6. **Built so far — step 1 (ticket #1)**: the shell. The header carries the ident login (an
  7. identity selector, like calendar/gitoria) and sign-out; the homepage itself stays empty. No
  8. design carried over from the old app.
  9. **Step 2 (ticket #2)**: the old tracker's MongoDB export is now in `storage/mpackdb/` (new
  10. mpackdb ids, every reference re-pointed) — see "Data" and `STATUS.md`. Nothing is shown in the
  11. UI yet; the homepage still renders empty. That is a later step, from the creator.
  12. **Step 4 (ticket #4)**: the show page, `/shows/:slug` (`components/show.hl`) — poster, title,
  13. genre pills, plot, cast (as described in "What it does (step 4)" below), every season with its
  14. episodes, and the watch check (episode and season, season bulk-toggles its episodes).
  15. **Step 5 (ticket #5)**: `/unwatched` (`components/unwatched.hl`) — every already-released,
  16. unwatched episode of a show the signed-in user follows, newest release first (see "What it does
  17. (step 5)" below).
  18. **Step 6 (ticket #6)**: `/schedule` (`components/schedule.hl`) — every not-yet-released episode
  19. of a show the signed-in user follows, soonest first, no check icons (see "What it does (step 6)"
  20. below). The homepage itself is still empty.
  21. Written in **Hybriel** on **hl:web**, same stack and conventions as `ident.worldapi.org`
  22. (vendored plugins/binary copied from there, see "Vendored Hybriel").
  23. ## Run (dev, Loreana)
  24. ```bash
  25. cd /media/STORAGE/projects/tracker.worldapi.org
  26. TRACKER_PORT=8700 setsid nohup ./bin/hybriel project.hl > server.log 2>&1 < /dev/null & echo $! > server.pid
  27. # stop: kill $(cat server.pid)
  28. ```
  29. * Config (env; the real environment outranks nothing here — there is no `.env` reader in
  30. project.hl, unlike ident's SMTP settings — set these in the shell or `docker-compose.yml`):
  31. | Variable | Default | |
  32. |---|---|---|
  33. | `TRACKER_PORT` | 45008 | |
  34. | `TRACKER_URL` | `http://127.0.0.1:<port>` | this app's own origin — the ident login button's `return=` is built from it |
  35. | `IDENT_URL` | `https://ident.worldapi.org` | |
  36. | `TRACKER_KEY` / `TRACKER_SECRET` | `''` | this app's API key + secret, from ident's `/apps` (register once, origin = `TRACKER_URL`) — **not set yet on Byrodin**: the first deploy (architect) registers the app in the live ident and puts these in `.env` next to `docker-compose.yml`, exactly like ident's own `.env` holds its SMTP settings |
  37. | `TRACKER_WATCH` | on | `0` = no dev watcher (the container) |
  38. | `TRACKER_STORAGE` | `./storage/mpackdb` | the `usersTable` directory |
  39. | `TRACKER_SESSIONS` | `./.sessions` (hl:web's own default) | this app's own session store |
  40. | `HL_HOST` (or `HOST`) | 0.0.0.0 | interface to bind; `127.0.0.1` on Byrodin |
  41. Without `TRACKER_KEY`/`TRACKER_SECRET`, `/` still renders (signed out, the selector and "Log
  42. in with ident" show in the header); a login attempt answers `'login is not set up on this
  43. server (TRACKER_KEY / TRACKER_SECRET missing)'` instead of exchanging a code — so the app is
  44. never a dead 500 while waiting for that one-time setup.
  45. ## What it does (step 1)
  46. * **Login, copied unchanged from calendar.worldapi.org** (rejected once for a centered
  47. sign-in and no header selector — architect, 2026-09-27): ident only, no own passwords
  48. (ident's login button flow, ident.worldapi.org README "How apps use ident"), the identity
  49. selector (`<ident-selector>`, ident's `/selector.js`) sits in the header
  50. (`components/main.hl`, `userBox`), a plain "Log in with ident" link beside it when signed
  51. out. Choosing an identity in the selector fires `ident-login` (one-time code); `login.js`
  52. (an external-component bridge, allowed per the creator: "login.js is correct, as thats for
  53. externals in general") hands the code to a hidden input, whose `change` calls the server
  54. face `trackerLogin` (`users.hl` `exchangeCode`, `POST <ident>/api/exchange` — nothing else:
  55. ident does not hand over a display name yet, ident#23 done / ident#11 on hold), which makes
  56. or finds this app's own user record (`usersTable`, `storage/mpackdb/users.db`) and sets
  57. `session.user = { id }`. `/login/callback` is the same exchange as a plain redirect (the
  58. login button's return URL) for a client that has no socket yet. "Log out" in the header
  59. calls `trackerLogOut`; ident's own login is untouched. This app's own session cookie is
  60. `trackersid` (cookies ignore ports, an own name keeps it apart from ident's `identsid` on
  61. the same dev host, hybriel#10/#17).
  62. * **The empty homepage** (`/`, `components/home.hl`): no content at all, signed in or out —
  63. the header alone carries the login state. Nothing else.
  64. * **One mpackdb table**: `storage/mpackdb/users.db` (`identity` → this app's user id — no
  65. display name, no other per-user data yet). Step 2 (tracker.worldapi.org#2, open) brings the
  66. old tracker's data across.
  67. ## What it does (step 4)
  68. `/shows/:slug` (`components/show.hl`, slug = the migrated `urlSegment`), read-only data from
  69. `shows.hl`, per-user watch state from `watches.hl` (both reused as-is by `/unwatched` and
  70. `/schedule`, tickets #5/#6 — "reuse, don't copy"):
  71. * **Header**: poster on the left (`/posters/<name>`, `project.hl` `posterRoute` — served from
  72. `storage/mpackdb/posters/`; the real poster files were never in the Mongo backup, see
  73. `DECISIONS.md` "tracker concept" — a placeholder SVG shows until a later TMDB step brings
  74. real ones back), title, genre pills (blue, link to `/genre/<slug>`) and the plot summary to
  75. its right, the cast below as comma-separated red links to `/person/<slug>`.
  76. * **Seasons**, latest first, the latest expanded and every other one collapsed to start; each
  77. row: a round check icon (a disc with a check, drawn in SVG/CSS, no icon font), the season
  78. title/number, its episode count. Its episodes (number + title, and their own check icon)
  79. show once expanded (click the row to toggle).
  80. * **The watch check** (signed-in only — signed out, no check icons show at all): clicking an
  81. episode's check toggles that one watch; clicking a season's check toggles the season's own
  82. watch AND every one of its episodes at once (`watches.hl` `setSeasonWatched`). Every click is
  83. a server round trip (`emit server showToggleEpisode` / `showToggleSeason` / `showRows` for
  84. collapse/expand) that rebuilds the row list server-side and reassigns it whole — a season has
  85. at most a few dozen episodes, cheap. A **Hybriel gap found here** (filed as hybriel#115,
  86. reported after this ticket's first attempt): a plain per-instance member function that calls
  87. an hl:mpackdb-backed import comes back `null` when called from inside an `on server` face,
  88. even though the very same call works as a member's own top-level initializer — the fix is to
  89. declare such helpers `static` (the same shape calendar.worldapi.org's `soonOf` already uses).
  90. `components/show.hl`'s own helpers (`buildRows`, `genreRowsOf`, …) are `static` for exactly
  91. this reason.
  92. * **Data fix**: `tools/relink-episode-seasons.hl`, a one-off idempotent tool that links every
  93. episode whose `season` was still null in the migrated data (36,194 of them, ticket #2) to its
  94. season by matching `(show, seasonNumber)` — never touches an episode whose season is already
  95. set, never runs `update()` on the live table (hybriel#113; it rebuilds a fresh episodes table
  96. and swaps the files over, the same rule `tools/migrate.hl` follows). Not run against the live
  97. data yet — the architect runs it (stop the container first, `storage/mpackdb` is not shared
  98. across processes, hybriel#21).
  99. ## What it does (step 5)
  100. `/unwatched` (`components/unwatched.hl`): every episode of a show the signed-in user follows
  101. (`follows.hl`, new) that is already released (`release` ≤ today) and not yet watched
  102. (`watches.hl` `isWatched`), newest release first. Creator: "/unwatched lists all unwatched
  103. episodes of shows followed in release date desc order"; "check icon is a disc with a check in
  104. it" — the SAME icon/class (`watches.hl` `watchClassOf`, moved there from `components/show.hl` so
  105. both pages share one definition instead of each declaring its own) and the same
  106. `setWatched`/`isWatched` watch logic as the show page (step 4), not copied.
  107. * Each row: check icon, the show's title (linking to `/shows/:slug`), "Ep `<number>` ·
  108. `<title>`", the release date.
  109. * A row only ever shows an unwatched episode, so a click always marks it watched (never toggles
  110. back, unlike the show page's checks) — the row leaves the list. Signed out: no rows, a
  111. "Sign in to see the shows you follow." message instead.
  112. * `follows.hl` (new): read-only per-user follow data (`followedShowIds`), kept apart from
  113. `shows.hl`/`watches.hl` the same way, for `/schedule` (ticket #6) to reuse.
  114. ## What it does (step 6)
  115. `/schedule` (`components/schedule.hl`): every episode of a show the signed-in user follows
  116. (`follows.hl`) that is NOT yet released (`release` > today), soonest first. Creator: "/schedule
  117. has a similar list without check icons for the upcoming episodes of shows followed" — same row
  118. layout as `/unwatched` (show title linking to `/shows/:slug`, "Ep `<number>` · `<title>`", the
  119. release date), minus the check icon and minus any click handling: the page is read-only, so it
  120. needs no `on server` face at all. Signed out: no rows, the same "Sign in to see the shows you
  121. follow." message as `/unwatched`.
  122. ## Test
  123. ```bash
  124. node tests/browser.mjs # THE GATE: this app's own server + its OWN ident (a copy of
  125. # ident's code without .env, codes to a mail sink — no live
  126. # ident, no real mail; tests/identkit.mjs, same as calendar's
  127. # gate) + a real headless Chrome: signed out (header shows the
  128. # selector + "Log in with ident", the page itself is empty) ->
  129. # sign in -> header shows "Log out", page still empty -> sign
  130. # out -> signed out again -> a reload stays signed out. Also
  131. # checks the header has no bottom border and filled buttons
  132. # (incl. the ident selector's) have none, while inverted ones
  133. # ("Log out") keep theirs.
  134. # tracker.worldapi.org#4: a fixture show (tests/seed-show.hl,
  135. # written into the gate's own storage before the server starts)
  136. # proves /shows/:slug — header renders, no checks signed out;
  137. # signed in, click an episode check (turns solid), click a
  138. # season check (itself AND its episodes turn solid, proven
  139. # after a reload — server-side, not just client state).
  140. # tracker.worldapi.org#5: the same fixture (now followed by the
  141. # test user) proves /unwatched — signed out, no rows; signed in,
  142. # only the two already-released episodes show, newest first, the
  143. # far-future one excluded; click a check, the row disappears
  144. # (proven server-side after a reload).
  145. # tracker.worldapi.org#6: the same fixture proves /schedule —
  146. # signed out, no rows; signed in, only the far-future episode
  147. # shows (the two already-released ones excluded), no check icons
  148. # at all, unaffected by any watch toggle on the other pages.
  149. # 38 checks. Own servers :8700 (this app) / :8701 (ident copy);
  150. # own storage .scratch/gate-store; Chrome on 8702-8709.
  151. ps -eo pid,args | grep [h]l-browser-tier # must print nothing afterwards
  152. ```
  153. ## Deploy (Byrodin)
  154. Target: `/CONTAINERS/projects/tracker.worldapi.org` on Byrodin, container
  155. `tracker.worldapi.org` (`docker-compose.yml`: debian:12-slim, host network,
  156. `HL_HOST=127.0.0.1`, `TRACKER_PORT=45008`, `TRACKER_WATCH=0`, the folder mounted at
  157. `/home/tracker`, `./bin/hybriel project.hl`), public https://tracker.worldapi.org/ via
  158. nginx (TLS ends there; no baseUrl/tls in the app, like ident/notes).
  159. * **First deploy: done by the architect** (folder, nginx vhost with WebSocket Upgrade
  160. headers, cert, DNS, **and registering this app in the live ident** — `/apps` → name +
  161. origin `https://tracker.worldapi.org` → the API key + secret go into `.env` next to
  162. `docker-compose.yml`, `TRACKER_KEY=… TRACKER_SECRET=…`).
  163. * **Later: `./deploy.sh`** on Loreana, in this folder: runs the gate (refuses on a failure;
  164. `--skip-tests` skips it LOUDLY), rsyncs the code to
  165. `[email protected]:/CONTAINERS/projects/tracker.worldapi.org` (never `storage/`,
  166. `.sessions/`, `.env`, `.scratch/`, `server.*`, logs — the preview is checked for them; no
  167. `--delete`), `docker compose up -d && docker compose restart` over `ssh -F /dev/null`,
  168. then waits for https://tracker.worldapi.org/ to answer 200.
  169. * `./deploy.sh --dry-run` = the gate + `rsync -n` + the commands it would run (no restart, no
  170. URL check). `--target DIR|HOST:DIR` and `--url URL` point it elsewhere (tested against a
  171. local directory, see STATUS.md).
  172. ## Data
  173. `storage/mpackdb/`: `users.db` (`identity` → this app's own user id, `users.hl`) plus, since
  174. step 2, the old tracker's data — `genres.db` (27), `persons.db` (15157), `shows.db` (9453),
  175. `seasons.db` (6430), `episodes.db` (231584), `follows.db` (128), `watches.db` (11692), all with
  176. fresh mpackdb ids and every reference re-pointed (`tools/migrate.hl`); the one old user is this
  177. app's user for ident short id `az5b2`. Counts and the referential-integrity proof:
  178. `STATUS.md` "ticket #2". Nothing of this is shown in the UI yet.
  179. ## Files
  180. | File | |
  181. |---|---|
  182. | `CONCEPT.md` | the creator's concept — do not edit |
  183. | `project.hl` | manifest: routes (`/login/callback`, `/login/failed`, `/login.js`, `/` component Home), the app's own session cookie |
  184. | `users.hl` | the ident exchange + the `usersTable`, copied from calendar.worldapi.org's `users.hl` |
  185. | `login.js` | bridge between `<ident-selector>`'s `ident-login` event and the shell, copied verbatim from calendar.worldapi.org |
  186. | `components/home.hl` | `/`: the empty homepage — no content, signed in or out |
  187. | `components/main.hl` | the shell (header: brand, `<ident-selector>`, log in / log out) |
  188. | `components/loginfailed.hl` | `/login/failed`: why a login didn't work |
  189. | `components/show.hl` | `/shows/:slug`: the show page (header, seasons, episodes, watch check) |
  190. | `components/unwatched.hl` | `/unwatched`: unwatched, already-released episodes of followed shows, newest first |
  191. | `components/schedule.hl` | `/schedule`: not-yet-released episodes of followed shows, soonest first, no checks |
  192. | `shows.hl` | read-only data access (shows/seasons/episodes/genres/persons), reused by `/unwatched`/`/schedule` |
  193. | `follows.hl` | read-only per-user follow data (`followedShowIds`), reused by `/unwatched`/`/schedule` |
  194. | `watches.hl` | per-user watch state (episode/season checks, the shared check-icon class `watchClassOf`), reused by `/unwatched`/`/schedule` |
  195. | `styles.hl` | all CSS (imports the tokens from `shared/tokens.hl`; accent green `#4ec9b0`) |
  196. | `shared/tokens.hl` | the WorldAPI tokens, vendored verbatim from `ident.worldapi.org/shared/tokens.hl` |
  197. | `tests/browser.mjs` | the gate (above) |
  198. | `tests/seed-show.hl` | writes the gate's fixture show (two seasons, three episodes) and, since ticket #5, a follow of it for the test user, before the server starts |
  199. | `tests/identkit.mjs` | starts a throwaway ident copy for the gate, copied from calendar.worldapi.org's `tests/` |
  200. | `tests/cdp.mjs`, `tests/ports.mjs` | the CDP browser driver, copied from `ident.worldapi.org/tests/` |
  201. | `docker-compose.yml`, `Dockerfile`, `deploy.sh` | Byrodin container; the deploy from Loreana (section "Deploy") |
  202. | `tools/migrate.hl` | one-off: old MongoDB export → `storage/mpackdb/` (step 2, idempotent, see `STATUS.md`) |
  203. | `tools/verify.hl` | one-off: proves the migrated data against a COPY of `storage/mpackdb/` (counts, zero dangling references, one show end to end) |
  204. | `tools/relink-episode-seasons.hl` | one-off: links episodes with no `season` (step 2 leftovers) by `(show, seasonNumber)` — not run against the live data yet, see "What it does (step 4)" |
  205. ## Vendored Hybriel
  206. `bin/hybriel` + `plugins/` copied verbatim from `ident.worldapi.org` (2026-09-27), sha256
  207. `9e5e95b33680eb68a016e9e48a76c9f92193fd2ffdbdf437c1aab1bda2731a0d` — hybriel master
  208. 837fe120 (ident's mission 036), the newest vendored+gated build available locally. No local
  209. patch. Re-vendor the same way: copy `bin/hybriel` + `plugins/` from a current worldapi app,
  210. run the gate.

Branches

Latest commits

  • 44b7d9f9tracker#6: /schedule — upcoming episodes of followed shows, soonest firstmre
  • 91c9fc8ctracker#5: /unwatched — unwatched released episodes of followed shows, newest firstmre
  • a97c0295tracker#4: show page /shows/:slug (header, seasons, episodes, watch checks) + tools/relink-episode-seasons.hlmre
  • 05f407c5tracker: no border on any button except inverted ones (Log out, ident status and identities too); header brand weight 100mre
  • 17375427tracker#2: tools/migrate.hl + tools/verify.hl — old MongoDB data into mpackdb with new idsmre
  • 31aac936tracker#3: no border on the header and on filled buttons; inverted buttons keep theirsmre
  • 2ad9d29ctracker#1: login exactly like calendar (identity selector in the header, empty homepage)mre
  • 3691e176tracker#1: empty tracker with the ident login (state of 2026-09-27)mre