tracker
All repositories: gitoria
19.3 KB
# tracker.worldapi.orgThe new tracker: a Hybriel app that will track the TV shows (and later movies) the creatorfollows and watches. **`CONCEPT.md` (the creator's) is the source of truth** — read it first;nothing is built that it does not describe. Built step by step, one ticket per step(tracker.worldapi.org#1, #2, …).**Built so far — step 1 (ticket #1)**: the shell. The header carries the ident login (anidentity selector, like calendar/gitoria) and sign-out; the homepage itself stays empty. Nodesign carried over from the old app.**Step 2 (ticket #2)**: the old tracker's MongoDB export is now in `storage/mpackdb/` (newmpackdb ids, every reference re-pointed) — see "Data" and `STATUS.md`. Nothing is shown in theUI yet; the homepage still renders empty. That is a later step, from the creator.**Step 4 (ticket #4)**: the show page, `/shows/:slug` (`components/show.hl`) — poster, title,genre pills, plot, cast (as described in "What it does (step 4)" below), every season with itsepisodes, and the watch check (episode and season, season bulk-toggles its episodes).**Step 5 (ticket #5)**: `/unwatched` (`components/unwatched.hl`) — every already-released,unwatched episode of a show the signed-in user follows, newest release first (see "What it does(step 5)" below).**Step 6 (ticket #6)**: `/schedule` (`components/schedule.hl`) — every not-yet-released episodeof a show the signed-in user follows, soonest first, no check icons (see "What it does (step 6)"below).**Step 7 (ticket #7)**: `/my/shows` (`components/myshows.hl`) — every show the signed-in userfollows, newest follow first: small poster, title, last watched episode (`S08E35`) (see "What itdoes (step 7)" below). The homepage itself is still empty.Written in **Hybriel** on **hl:web**, same stack and conventions as `ident.worldapi.org`(vendored plugins/binary copied from there, see "Vendored Hybriel").## Run (dev, Loreana)```bashcd /media/STORAGE/projects/tracker.worldapi.orgTRACKER_PORT=8700 setsid nohup ./bin/hybriel project.hl > server.log 2>&1 < /dev/null & echo $! > server.pid# stop: kill $(cat server.pid)```* Config (env; the real environment outranks nothing here — there is no `.env` reader inproject.hl, unlike ident's SMTP settings — set these in the shell or `docker-compose.yml`):| Variable | Default | ||---|---|---|| `TRACKER_PORT` | 45008 | || `TRACKER_URL` | `http://127.0.0.1:<port>` | this app's own origin — the ident login button's `return=` is built from it || `IDENT_URL` | `https://ident.worldapi.org` | || `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 || `TRACKER_WATCH` | on | `0` = no dev watcher (the container) || `TRACKER_STORAGE` | `./storage/mpackdb` | the `usersTable` directory || `TRACKER_SESSIONS` | `./.sessions` (hl:web's own default) | this app's own session store || `HL_HOST` (or `HOST`) | 0.0.0.0 | interface to bind; `127.0.0.1` on Byrodin |Without `TRACKER_KEY`/`TRACKER_SECRET`, `/` still renders (signed out, the selector and "Login with ident" show in the header); a login attempt answers `'login is not set up on thisserver (TRACKER_KEY / TRACKER_SECRET missing)'` instead of exchanging a code — so the app isnever a dead 500 while waiting for that one-time setup.## What it does (step 1)* **Login, copied unchanged from calendar.worldapi.org** (rejected once for a centeredsign-in and no header selector — architect, 2026-09-27): ident only, no own passwords(ident's login button flow, ident.worldapi.org README "How apps use ident"), the identityselector (`<ident-selector>`, ident's `/selector.js`) sits in the header(`components/main.hl`, `userBox`), a plain "Log in with ident" link beside it when signedout. Choosing an identity in the selector fires `ident-login` (one-time code); `login.js`(an external-component bridge, allowed per the creator: "login.js is correct, as thats forexternals in general") hands the code to a hidden input, whose `change` calls the serverface `trackerLogin` (`users.hl` `exchangeCode`, `POST <ident>/api/exchange` — nothing else:ident does not hand over a display name yet, ident#23 done / ident#11 on hold), which makesor finds this app's own user record (`usersTable`, `storage/mpackdb/users.db`) and sets`session.user = { id }`. `/login/callback` is the same exchange as a plain redirect (thelogin button's return URL) for a client that has no socket yet. "Log out" in the headercalls `trackerLogOut`; ident's own login is untouched. This app's own session cookie is`trackersid` (cookies ignore ports, an own name keeps it apart from ident's `identsid` onthe same dev host, hybriel#10/#17).* **The empty homepage** (`/`, `components/home.hl`): no content at all, signed in or out —the header alone carries the login state. Nothing else.* **One mpackdb table**: `storage/mpackdb/users.db` (`identity` → this app's user id — nodisplay name, no other per-user data yet). Step 2 (tracker.worldapi.org#2, open) brings theold tracker's data across.## What it does (step 4)`/shows/:slug` (`components/show.hl`, slug = the migrated `urlSegment`), read-only data from`shows.hl`, per-user watch state from `watches.hl` (both reused as-is by `/unwatched` and`/schedule`, tickets #5/#6 — "reuse, don't copy"):* **Header**: poster on the left (`/posters/<name>`, `project.hl` `posterRoute` — served from`storage/mpackdb/posters/`; the real poster files were never in the Mongo backup, see`DECISIONS.md` "tracker concept" — a placeholder SVG shows until a later TMDB step bringsreal ones back), title, genre pills (blue, link to `/genre/<slug>`) and the plot summary toits right, the cast below as comma-separated red links to `/person/<slug>`.* **Seasons**, latest first, the latest expanded and every other one collapsed to start; eachrow: a round check icon (a disc with a check, drawn in SVG/CSS, no icon font), the seasontitle/number, its episode count. Its episodes (number + title, and their own check icon)show once expanded (click the row to toggle).* **The watch check** (signed-in only — signed out, no check icons show at all): clicking anepisode's check toggles that one watch; clicking a season's check toggles the season's ownwatch AND every one of its episodes at once (`watches.hl` `setSeasonWatched`). Every click isa server round trip (`emit server showToggleEpisode` / `showToggleSeason` / `showRows` forcollapse/expand) that rebuilds the row list server-side and reassigns it whole — a season hasat most a few dozen episodes, cheap. A **Hybriel gap found here** (filed as hybriel#115,reported after this ticket's first attempt): a plain per-instance member function that callsan hl:mpackdb-backed import comes back `null` when called from inside an `on server` face,even though the very same call works as a member's own top-level initializer — the fix is todeclare such helpers `static` (the same shape calendar.worldapi.org's `soonOf` already uses).`components/show.hl`'s own helpers (`buildRows`, `genreRowsOf`, …) are `static` for exactlythis reason.* **Data fix**: `tools/relink-episode-seasons.hl`, a one-off idempotent tool that links everyepisode whose `season` was still null in the migrated data (36,194 of them, ticket #2) to itsseason by matching `(show, seasonNumber)` — never touches an episode whose season is alreadyset, never runs `update()` on the live table (hybriel#113; it rebuilds a fresh episodes tableand swaps the files over, the same rule `tools/migrate.hl` follows). Not run against the livedata yet — the architect runs it (stop the container first, `storage/mpackdb` is not sharedacross processes, hybriel#21).## What it does (step 5)`/unwatched` (`components/unwatched.hl`): every episode of a show the signed-in user follows(`follows.hl`, new) that is already released (`release` ≤ today) and not yet watched(`watches.hl` `isWatched`), newest release first. Creator: "/unwatched lists all unwatchedepisodes of shows followed in release date desc order"; "check icon is a disc with a check init" — the SAME icon/class (`watches.hl` `watchClassOf`, moved there from `components/show.hl` soboth pages share one definition instead of each declaring its own) and the same`setWatched`/`isWatched` watch logic as the show page (step 4), not copied.* Each row: check icon, the show's title (linking to `/shows/:slug`), "Ep `<number>` ·`<title>`", the release date.* A row only ever shows an unwatched episode, so a click always marks it watched (never togglesback, unlike the show page's checks) — the row leaves the list. Signed out: no rows, a"Sign in to see the shows you follow." message instead.* `follows.hl` (new): read-only per-user follow data (`followedShowIds`), kept apart from`shows.hl`/`watches.hl` the same way, for `/schedule` (ticket #6) to reuse.## What it does (step 6)`/schedule` (`components/schedule.hl`): every episode of a show the signed-in user follows(`follows.hl`) that is NOT yet released (`release` > today), soonest first. Creator: "/schedulehas a similar list without check icons for the upcoming episodes of shows followed" — same rowlayout as `/unwatched` (show title linking to `/shows/:slug`, "Ep `<number>` · `<title>`", therelease date), minus the check icon and minus any click handling: the page is read-only, so itneeds no `on server` face at all. Signed out: no rows, the same "Sign in to see the shows youfollow." message as `/unwatched`.## What it does (step 7)`/my/shows` (`components/myshows.hl`): every show the signed-in user follows, ordered by thefollow's `at` (epoch ms), newest first. Creator: "trackers /my/shows that just ists the shows indesc order i followed them, small poster, title, last episode like s08e35". Read-only, no `onserver` face (like `/schedule`).* Each row: a small poster (2.5rem wide, the same `/posters/<name>` route + placeholder as the showpage; a show with no poster name at all gets `/posters/none`, i.e. the route's placeholder), thetitle linking to `/shows/<slug>`, and the **last watched episode** as `SxxEyy` (zero-padded totwo digits) = the HIGHEST season/episode number the user has an episode watch for (architect'sreading, in the ticket) — not the most recently watched one; season watches alone don't count.Nothing watched → no episode element at all.* Signed out: no rows, the same "Sign in to see the shows you follow." as `/unwatched`.* Cost: touches only the user's follows + episode watches (one `episodeById` fetch per watch),never all episodes of a followed show — 128 rows in ~0.2 s on a copy of the real data (STATUS.md).* Reuse: `follows.hl` `followsOfUser` (new — the whole follow record, `followedShowIds` nowbuilds on it), `shows.hl` `episodeById` (new, one line), `showById`, `posterName`, `watches.hl``watchesOfUser`.## Test```bashnode tests/browser.mjs # THE GATE: this app's own server + its OWN ident (a copy of# ident's code without .env, codes to a mail sink — no live# ident, no real mail; tests/identkit.mjs, same as calendar's# gate) + a real headless Chrome: signed out (header shows the# selector + "Log in with ident", the page itself is empty) -># sign in -> header shows "Log out", page still empty -> sign# out -> signed out again -> a reload stays signed out. Also# checks the header has no bottom border and filled buttons# (incl. the ident selector's) have none, while inverted ones# ("Log out") keep theirs.# tracker.worldapi.org#4: a fixture show (tests/seed-show.hl,# written into the gate's own storage before the server starts)# proves /shows/:slug — header renders, no checks signed out;# signed in, click an episode check (turns solid), click a# season check (itself AND its episodes turn solid, proven# after a reload — server-side, not just client state).# tracker.worldapi.org#5: the same fixture (now followed by the# test user) proves /unwatched — signed out, no rows; signed in,# only the two already-released episodes show, newest first, the# far-future one excluded; click a check, the row disappears# (proven server-side after a reload).# tracker.worldapi.org#6: the same fixture proves /schedule —# signed out, no rows; signed in, only the far-future episode# shows (the two already-released ones excluded), no check icons# at all, unaffected by any watch toggle on the other pages.# tracker.worldapi.org#7: the fixture now has a 2nd followed# show (followed later, no poster name, never watched) and# proves /my/shows — signed out, the sign-in message; signed# in, newest follow first, title links, loaded posters (the# placeholder), S01E02 after /unwatched's click, then S02E01# (highest, not most recent) after the show-page checks; the# unwatched show shows no episode.# 45 checks. Own servers :8700 (this app) / :8701 (ident copy);# own storage .scratch/gate-store; Chrome on 8702-8709.# Other ports (workers get 8720-8739):# TRACKER_GATE_PORT=8720 TRACKER_GATE_IDENT_PORT=8721 TRACKER_GATE_CHROME=8722-8726 node tests/browser.mjsps -eo pid,args | grep [h]l-browser-tier # must print nothing afterwards```## Deploy (Byrodin)Target: `/CONTAINERS/projects/tracker.worldapi.org` on Byrodin, container`tracker.worldapi.org` (`docker-compose.yml`: debian:12-slim, host network,`HL_HOST=127.0.0.1`, `TRACKER_PORT=45008`, `TRACKER_WATCH=0`, the folder mounted at`/home/tracker`, `./bin/hybriel project.hl`), public https://tracker.worldapi.org/ vianginx (TLS ends there; no baseUrl/tls in the app, like ident/notes).* **First deploy: done by the architect** (folder, nginx vhost with WebSocket Upgradeheaders, cert, DNS, **and registering this app in the live ident** — `/apps` → name +origin `https://tracker.worldapi.org` → the API key + secret go into `.env` next to`docker-compose.yml`, `TRACKER_KEY=… TRACKER_SECRET=…`).* **Later: `./deploy.sh`** on Loreana, in this folder: runs the gate (refuses on a failure;`--skip-tests` skips it LOUDLY), rsyncs the code to`[email protected]:/CONTAINERS/projects/tracker.worldapi.org` (never `storage/`,`.sessions/`, `.env`, `.scratch/`, `server.*`, logs — the preview is checked for them; no`--delete`), `docker compose up -d && docker compose restart` over `ssh -F /dev/null`,then waits for https://tracker.worldapi.org/ to answer 200.* `./deploy.sh --dry-run` = the gate + `rsync -n` + the commands it would run (no restart, noURL check). `--target DIR|HOST:DIR` and `--url URL` point it elsewhere (tested against alocal directory, see STATUS.md).## Data`storage/mpackdb/`: `users.db` (`identity` → this app's own user id, `users.hl`) plus, sincestep 2, the old tracker's data — `genres.db` (27), `persons.db` (15157), `shows.db` (9453),`seasons.db` (6430), `episodes.db` (231584), `follows.db` (128), `watches.db` (11692), all withfresh mpackdb ids and every reference re-pointed (`tools/migrate.hl`); the one old user is thisapp's user for ident short id `az5b2`. Counts and the referential-integrity proof:`STATUS.md` "ticket #2". Nothing of this is shown in the UI yet.## Files| File | ||---|---|| `CONCEPT.md` | the creator's concept — do not edit || `project.hl` | manifest: routes (`/login/callback`, `/login/failed`, `/login.js`, `/posters/:name`, `/shows/:slug`, `/unwatched`, `/schedule`, `/my/shows`, `/` component Home), the app's own session cookie || `users.hl` | the ident exchange + the `usersTable`, copied from calendar.worldapi.org's `users.hl` || `login.js` | bridge between `<ident-selector>`'s `ident-login` event and the shell, copied verbatim from calendar.worldapi.org || `components/home.hl` | `/`: the empty homepage — no content, signed in or out || `components/main.hl` | the shell (header: brand, `<ident-selector>`, log in / log out) || `components/loginfailed.hl` | `/login/failed`: why a login didn't work || `components/show.hl` | `/shows/:slug`: the show page (header, seasons, episodes, watch check) || `components/unwatched.hl` | `/unwatched`: unwatched, already-released episodes of followed shows, newest first || `components/schedule.hl` | `/schedule`: not-yet-released episodes of followed shows, soonest first, no checks || `components/myshows.hl` | `/my/shows`: followed shows, newest follow first — small poster, title, last watched `SxxEyy` || `shows.hl` | read-only data access (shows/seasons/episodes/genres/persons), reused by `/unwatched`/`/schedule`/`/my/shows` || `follows.hl` | read-only per-user follow data (`followsOfUser`, `followedShowIds`), reused by `/unwatched`/`/schedule`/`/my/shows` || `watches.hl` | per-user watch state (episode/season checks, the shared check-icon class `watchClassOf`), reused by `/unwatched`/`/schedule`/`/my/shows` || `styles.hl` | all CSS (imports the tokens from `shared/tokens.hl`; accent green `#4ec9b0`) || `shared/tokens.hl` | the WorldAPI tokens, vendored verbatim from `ident.worldapi.org/shared/tokens.hl` || `tests/browser.mjs` | the gate (above) || `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 (#7: plus a 2nd, later-followed, never-watched show), before the server starts || `tests/identkit.mjs` | starts a throwaway ident copy for the gate, copied from calendar.worldapi.org's `tests/` || `tests/cdp.mjs`, `tests/ports.mjs` | the CDP browser driver, copied from `ident.worldapi.org/tests/` || `docker-compose.yml`, `Dockerfile`, `deploy.sh` | Byrodin container; the deploy from Loreana (section "Deploy") || `tools/migrate.hl` | one-off: old MongoDB export → `storage/mpackdb/` (step 2, idempotent, see `STATUS.md`) || `tools/verify.hl` | one-off: proves the migrated data against a COPY of `storage/mpackdb/` (counts, zero dangling references, one show end to end) || `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)" |## Vendored Hybriel`bin/hybriel` + `plugins/` copied verbatim from `ident.worldapi.org` (2026-09-27), sha256`9e5e95b33680eb68a016e9e48a76c9f92193fd2ffdbdf437c1aab1bda2731a0d` — hybriel master837fe120 (ident's mission 036), the newest vendored+gated build available locally. No localpatch. Re-vendor the same way: copy `bin/hybriel` + `plugins/` from a current worldapi app,run the gate.
Branches
- mainmain branch
Latest commits
- 3251488atracker#7: /my/shows (followed shows, newest follow first, poster, title, last watched SxxEyy); gate can take screenshots (TRACKER_GATE_SHOTS)mre
- 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