gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchv595803cf4f|||PR vendor: Hybriel set-day59 and GC budget 32 MiBmrev59/README.md

67.5 KB

  1. # gitoria.worldapi.org
  2. Git hosting for all projects, written in **Hybriel** (hl:web), login via **ident**. Source of truth: `CONCEPT.md`.
  3. Built so far: repos with their own address (#6), the repo homepage (#8), code browsing (#9), tickets (#10), pull requests (#11) with a Merge button for the owner and the members (#17, #48), releases (#12),
  4. every repo view as its own server-rendered page (#16), push and pull over HTTPS with access tokens and over SSH with keys (#7).
  5. ## Hybriel (vendored)
  6. * V59 (2026-11-11): `bin/hybriel` + `plugins/` = Hybriel **set-day59**, SOURCE commit `436919b2459edb70b0a2d4b236f435489707d090`, from `/media/STORAGE/claude-scratch/anton/set-day59` (all 135 SHA256SUMS entries OK). Binary sha256 `6a19ab3a4b31a8786c5f418634835c434d679908f31f51b35cad3d70deb1824c`. Scheme unchanged from V52: `bin/` (not in git, a real folder) = the set's `bin/hybriel` + its `lib/` contents; plugins core crypto data fetch fs heap http http1 mpackdb proc time web are whole directories from `git archive 436919b2 plugins/<p>` with the set's `.so` on top. The set layout is unchanged; the archive adds `plugins/web/uploads.hl` (lazy upload provider). Changed plugins: http1 (per-listener WebSocket state, abrupt TLS disconnect handling), web (offline recovery/navigation, retained shell notices, row updates, focus, late paints and build warnings). No app .hl changed. `docker-compose.yml` opts BOTH gitoria services into `HL_GC_BUDGET_MB=32` (gitoria#25, hybriel#374, Hybriel `docs/GC-BUDGET.md`); no object budget is set. This caps allocation between normal collections, not live heap or RSS. The PR-page gate selects the app by id and waits for its review-request delivery. The browser gate now scopes the offline heading to its notice: day58 #350 keeps the shell and its own heading. Gates (LC_ALL=C, ports 8720–8739, HL_GC_BUDGET_MB=32): check-theme 86 files/0 problems; create-api 47/0, signin-return 3/0, browser 299/0, security 82/0, private 158/0, ident-access-gitoria 30/0, apps 95/0, pull-numbers 48/0, pull-ssh 20/0, app-token 42/0, reviews 99/0, events 52/0, pr-page 61/0, status 61/0, limits 55/0, status-keyed 13/0, member-merge 82/0, protect-main 41/0, push 46/0, ssh 44/0. Initial browser 298/1 was the old unscoped offline heading assertion; initial PR-page runs 60/1 and 60/1 exposed a gate wait that accepted an unrelated delivery, now waits for review_requested and selects the button by app id. Real data (backup 20261110-0930, copied and deleted): /, /api/repos, repo page, code, branch/commits, one commit, pulls all 200 in both configurations. For 2000 requests of commit 9eff66272de6d0aaf160ebde2d9f6a2d1698afc2: uncapped RSS at 500/1000/2000 = 176804/176168/176360 kB, VmHWM = 207136 kB; budget 32 MiB RSS = 173260/173792/172836 kB, VmHWM = 211292 kB. Runtime diagnostic fixture: byteBudgetCap 0 versus 33554432, objectBudgetCap 0 in both. One shared-host pair is not a throughput or universal peak-memory claim.
  7. Before: V52 (2026-11-08): `bin/hybriel` + `plugins/` = Hybriel **set-day52**, SOURCE commit `77cfca31a6b56cbfe65ade9b31a24d6dd56f6706` (branch day52: day51 1daa47a2 = day50 plus w263 #331 keyed rows; m615 1eb17136 = #335 fault-path leak, the 304 B per failed request; w264 709f779f = #332 #333; w270 96b569e8 = #327), from `/media/STORAGE/claude-scratch/anton/set-day52` (all SHA256SUMS entries OK). Binary sha256 `0a8ed496242cf24e23b319f6646db0b57b2a3a1ee6ad95cc9fdf0e6cd51361a7`. Layout unchanged from day50 (the set ships no .hl-only plugin dirs; it ships `.so` for crypto fetch fs http1 mpackdb proc time plus gui http2 http3 ipc mariadb math smtp which gitoria does not use). Scheme as in V50: `bin/` (not in git, a real folder) = the set's `bin/hybriel` + the set's `lib/` contents; plugins core crypto data fetch fs heap http http1 mpackdb proc time web are whole directories from `git archive 77cfca31 plugins/<p>` with the set's `.so` on top. The `.so` files are byte-identical to day50's (the fix is in the binary); changed .hl/text: `plugins/web` (README.md, WebFramework.hl, client.hl, view.hl), new `plugins/proc/tests/runtime-memory.py`. No .hl of gitoria changed. Gates (LC_ALL=C, ports 8720-8739; port 8700 was held by another process, so the gate ports were set through the GITORIA_GATE_* variables): check-theme 86 files 0 problems, create-api 47/0, signin-return 3/0, browser 269/0, push 46/0, ssh 44/0, security 82/0, private 158/0, ident-access 30/0, apps 95/0, pull-numbers 48/0, pull-ssh 20/0, app-token 42/0, reviews 98/0, events 52/0, pr-page 61/0, status 61/0, limits 53/0, status-keyed 13/0, member-merge 82/0. Real data (backup 20261108-0520, copy, deleted after): `/`, `/api/repos`, repo page, code, a branch (commit list), a commit, pulls, releases, settings: all 200 signed in. Leak (gitoria#25 fault path): 2000 requests of one commit page RSS 146244 kB at 500, 139112 kB at 1000, 137728 kB at 2000; 3500 requests of a 404 path 164832 kB at 500, 164132 kB at 1000, 162992 kB at 3000 (flat).
  8. Before: V50 (2026-11-08): `bin/hybriel` + `plugins/` = Hybriel **set-day50**, SOURCE commit `0ae38232f8516158f354129047019164a02521bd` (branch day50: day49 4a4c9bbc = day48 plus w258 #325; master documentation c52f9982; m610 543e2b40 = #335 hl:proc `run()`/`spawn` release their storage (gitoria#25); m612 206261b7 ephemeral fetch test ports; w262 6c6f44e9 = #328 field retention, #330 online mount state), from `/media/STORAGE/claude-scratch/anton/set-day50` (all SHA256SUMS entries OK). Binary sha256 `d3ef9d1666f3138eff85c014460b45817fd5874cfbab9d5abeba06b171a6ef76`. Layout unchanged from day48 (the set additionally ships `.so` for gui http2 http3 ipc mariadb math smtp, which gitoria does not use). Scheme as in V48: `bin/` (not in git, a real folder) = the set's `bin/hybriel` + the set's `lib/` contents; plugins core crypto data fetch fs heap http http1 mpackdb proc time web are whole directories from `git archive 0ae38232 plugins/<p>` with the set's `.so` on top. Changed since day48: `plugins/proc` (zig + `.so` + tests/memory.py), `plugins/fetch` (zig only), `plugins/web` (new `offline.hl`: the offline code moved out of client.hl and loads only for an app that declares `offline`, which gitoria does, `offline = [ Index ]`; input values are not overwritten while focused). No .hl of gitoria changed. Gates: check-theme 86 files 0 problems, browser 266/0, push 46/0, ssh 44/0, create-api 47/0, signin-return 3/0, security 82/0, private 158/0, ident-access 30/0, apps 95/0, pull-numbers 48/0, pull-ssh 20/0, app-token 42/0, reviews 98/0, events 52/0, pr-page 61/0, status 61/0, limits 53/0, status-keyed 13/0, member-merge 82/0. Leak (gitoria#25): minimal repro, 3000 requests: control flat at 12084 kB, `run()` per request 12008 -> 12616 kB between request 500 and 3000 (about 0.24 KB/request, day48 grew about 8 KB/request) (correction 2026-11-09: that repro used a rejected run() form, so it measured the error path, fixed in day52 m615; the array form gitoria uses does not leak); gitoria on a copy of the 2026-11-07 backup, 2000 requests of one commit page: RSS 182528 kB at 500, 185604 kB at 2000.
  9. Before: V48 (2026-11-07): `bin/hybriel` + `plugins/` = Hybriel **set-day48**, SOURCE commit `b6a8f429768c2d356ccdc97927faa73225fa5b8a` (branch day48, base day47 13bfc547; day46 = m597 #323, m600 projection, m602 SIGTERM watchdog, m599 hl:heap #315, m601; day47 = runtime identity #326, stable module URLs #324; day48 = m607 #334, w259 #272 mount push), from `/media/STORAGE/claude-scratch/anton/set-day48` (all 135 SHA256SUMS entries OK). Binary sha256 `660a9524ce21bf3e3d4d6d7693252392d2e3a362780c382239b718ece2fc6cd0`. Layout: the set has the same tree as set-day39 (bin/hybriel + the symlinks es and hybriel-native, bin/hybriel.inputs.json, lib/, runtime/, plugins/ with .so only); only runtime/heapsnapshot.hl and lib/hlrt/heapsnapshot.hl are new. The app runs `bin/hybriel`; `runtime/` is not needed (the binary carries its runtime, and since #326 it uses a neighbouring `libhlrt.a`/`hlc.o`/`hlrt/` only when their hashes match its own manifest; the set's lib/ matches, a build prints no warning). So the scheme is unchanged: `bin/` (not in git, a real folder) = the set's `bin/hybriel` + the set's `lib/` contents; plugins core crypto data fetch fs heap http http1 mpackdb proc time web are whole directories from `git archive b6a8f429 plugins/<p>` with the set's `.so` on top (byte-identical to the archive's for crypto fetch fs http1 mpackdb proc time; core data heap http web have none). New: `heap` (hl:heap). Changed since day39: fetch (Bytes bodies, redirects drop credentials across origins, address fallback), mpackdb (field projection, index coverage per field: legacy stores rebuild their indexes once on first open, dead-PID lock recovery, Date matching in find), web (WebFramework, client, compile, sessions, viewserver). Call sites checked: `fetch` (lib/users.hl ident exchange: POST json, no redirect), mpackdb `find`/`fetch` (no projection used), `JSON.tryParse`, upsert/remove: no change. One change: the day41+ purity contracts (SPEC: builtin calls need a typed String/Number/Boolean parameter) made `tabOfPath(path)` impure, so components/repo.hl's `tab` stayed on Readme after a client navigation (browser gate 264/2; repro .scratch/V48-route-tab); `lib/repos-helpers.hl` now declares `tabOfPath = (String path)`. Theme: layouts `ce4a0ba` (caller slot styles nested and kept whole; only theme/shell/*.hl changed). Gates (LC_ALL=C, ports 8720-8737), all 0 failed: check-theme 86 files 0 problems, create-api 47, signin-return 3, browser 266, security 82, private 158, ident-access-gitoria 30, apps 95, pull-numbers 48, pull-ssh 20, app-token 42, reviews 98, events 52, pr-page 61, status 61, limits 53, status-keyed 13, member-merge 82, push 46, ssh 44. Real data (backup 20261106-2143, copy): `/`, `/api/repos`, repo page, code, a file, branch, a commit, pulls, a PR page (kunibert-proof #1), releases, settings: all 200 signed in and out.
  10. Before: V39 (2026-11-03): `bin/hybriel` + `plugins/` = Hybriel **set-day39**, SOURCE commit `51e921d7de72ebe3ba4d0febdcc32e9a9084b178` (branch day39, base day38b 1e554d75 + m542 back + m564 wake bells + m562 (m555 stack, hl:web peerMounts fix, #297) + m563 (#296) + w239 (#286) + w243 (#298)), from `/media/STORAGE/claude-scratch/anton/set-day39` (all SHA256SUMS entries OK). Binary sha256 `6b481aa717128a5e2a35f0652606fbeed422227ed7f32c3a6fb26f3d859cd78f`. `bin/` (not in git, a real folder) = the set's `bin/hybriel` + the set's `lib/` contents (`hlc.o`, `libhlrt.a`, `hlrt/`); plugins core crypto data fetch fs http http1 mpackdb proc time web are whole directories from `git archive 51e921d7 plugins/<p>` with the set's `.so` on top (the set's `.so` for crypto fetch fs http1 mpackdb proc time are byte-identical to the archive's; http, data, core, web have none). Changed in the plugins since day37: `plugins/web` (router.hl and more: #286 route query, #296 members a routine writes ship in the seed, #297 navigation adds the new chain's keys to the tab's mounts, #298 control values), new `fetch` client.js/server.js (tryFetch), `fs` tests (exclusive file creation), `mpackdb` tools/check-integrity.mjs and the open-race / compareAndSet changes, `proc` README and wake bells. Day38–39 call sites checked: tryFetch, JSON.tryParse, timingSafeEqual, exclusive create, listDir as an iterator, route.query (gitoria reads `req.query`), a named literal entry hiding an outer name (#292): no change needed; no app code changed. Gates (LC_ALL=C), all 0 failed: check-theme 78 files 0 problems, create-api 47, signin-return 3, browser 266, security 82, private 158, ident-access-gitoria 30, apps 95, pull-numbers 48, pull-ssh 20, app-token 42, reviews 98, events 52, pr-page 61, status 61, limits 53, status-keyed 13. The two V37 reds (#296 'S sees it live', #297 Readme→Code) are fixed in day39: browser passes with the marked tab following every click. Real data (backup 20261102-1646, copy): `/`, `/api/repos`, repo pages, code, commits, pulls, releases, settings all 200.
  11. Before: V37 (2026-11-02): `bin/hybriel` + `plugins/` = Hybriel **set-day37**, SOURCE commit `f6b3d45bc5df9ad9f358a08219541bb1ecc19e26` (branch day37, base day36b 07c13caf + w227 b23673bf + w238 46d5fe3b + the 9279 fixture fix; m534/m537/m538 are NOT in it, so fix 538 = hybriel#277, "a member that reads a field of server data is not re-derived after a handler write", is missing), from `/media/STORAGE/claude-scratch/anton/set-day37` (all SHA256SUMS entries OK). Binary sha256 `52e4036e4f98102e579822bc2df417ad2e10f219e43f971003e9630359bb9652`. `bin/` (not in git, a real folder) = the set's `bin/hybriel` + the set's `lib/` contents (`hlc.o`, `libhlrt.a`, `hlrt/`); plugins core crypto data fetch fs http http1 mpackdb proc time web come from `git archive f6b3d45b plugins/<p>` (the set's `.so` files for crypto fetch fs http1 mpackdb proc time are byte-identical to the ones in that archive). Changed in the plugins since set-day27b: `plugins/web` (WebFramework.hl, client.hl, compile.hl, css.hl, router.hl, sessions.hl, view.hl, new viewserver.hl: split view readers, composed Style validation, server-derived members, @media/@supports/@container in one shape), `core/AST.hl`, new fetch README/tests and `mpackdb/tools/check-index-keys.mjs`. Day29–day37 call sites checked: `upsert` / one-argument `remove(x)` (day26): none (only the `hl:fs` `remove(path)` in lib/sshkeys.hl and lib/transport.hl); the gates cover the rest. `/pulls/:n` dummy component route removed (hybriel#294 is fixed in day37). Gates on this tree (LC_ALL=C, ports 8720-8732): check-theme 78 files 0 problems, create-api 47/0, signin-return 3/0, security 82/0, private 158/0, ident-access-gitoria 30/0, apps 95/0, pull-numbers 48/0, pull-ssh 20/0, app-token 42/0, reviews 98/0, events 52/0, pr-page 61/0, limits 53/0, status 60/1 once then 61/0 (flake), **browser 100/1 (twice; the old day27b tree on the same ports: 266/0): "S sees it live", the signed-out viewer of /tickets does not get `ticketOpened` of components/tickets.hl; status-keyed 12/1 (four of four runs, token unknown after the second restart; the old tree failed 8/1 once and passed 13/0 once)**.
  12. * `bin/hybriel` + `plugins/` = Hybriel **set-day27b** (2026-10-26): binary sha256 `a9712e61…` from `/media/STORAGE/claude-scratch/anton/set-day27b` (`bin/` is the binary plus `hlc.o`, `libhlrt.a`, `hlrt/`), plugins core crypto data fetch fs http http1 mpackdb proc time web from Hybriel master f5ff97bf (the `.so` of fs and mpackdb from the set; only fs and mpackdb changed). Day27b: #234 mpackdb rebuilds old string indexes once on first open, #233 readBytes/stat, #65 a handled startup fault exits 1. `project.hl`'s `on Error` now ends with exit code 1 when `e.phase == 'startup'`. Day26 call sites: none (the only `remove(` calls are `hl:fs` paths). Gates: check-theme 0 problems, signin-return 3/0, readme-cache 19/0, browser 261/0, security 70/0. Before: hybriel **master c1b1010f** (2026-10-25, Hybriel day26; adds W149: a route with `pageKey = (route, host) => text` has its finished page served again without building it; the shell with the login state is still built per request). Built from a read-only `git archive c1b1010f` with `HL_NO_PLUGINS=1 bash native/build.sh`, binary sha256 `df362699…9c49c44`, plugins copied whole; `bin/` (not in git) is the binary plus everything in `native/zig-out/lib` (`hlc.o`, `libhlrt.a`, `hlrt/`, which carries `hl-runtime.js`) — without the `hlrt` folder the app does not start. Day26 changes `list.upsert(record)` and one-argument `list.remove(x)` (they need an `@` property): gitoria has no such call (the only `remove(` calls are `hl:fs` paths in lib/sshkeys.hl and lib/transport.hl). Gates: browser 261/0 twice, security 70/0, signin-return 3/0, readme-cache 19/0, check-theme 0.
  13. * **Caches removed (gitoria#25, GC1, 2026-10-26)**: gitoria keeps no cache that hides how long a page takes to build. Removed: the page-build cache for the Readme route `/` (`lib/pagekey.hl` and the `pageKey` on that route), the render cache of the Markdown component (`cacheKey = textHash`), the finished-homepage cache per commit in `lib/homepage.hl`, the parsed-blocks cache in `lib/markdown.hl`, and the gate `tests/readme-cache.mjs`, which only tested those caches. Why: a cache that makes a slow page look fast is not a fix; the creator's ruling is that gitoria is measured without caches and a slow first load is fixed by shipping less. Hybriel master 652c55f8 dropped both framework caches (W164). Earlier history: Hybriel c09538bb and c1b1010f had added them. Later on 2026-10-26, 90b4f72 restored the homepage cache in `lib/homepage.hl` and the parsed-blocks cache in `lib/markdown.hl`, because they store data under immutable keys; both are on main.
  14. Before: `bin/hybriel` + `plugins/` (same plugin list) = hybriel **master ded47c13** (2026-10-24; adds W145 100428e8: the Firefox start script no longer fails with "error loading dynamically imported module" on a page's first component import; built from a read-only `git archive ded47c13` with `HL_NO_PLUGINS=1 bash native/build.sh`, binary sha256 `0136cb24…8f1d`, plugins copied whole). Before: hybriel **master aaa39e69** (2026-10-24, hl:web batch 20: W135 login emit and `Sessions.mint` back, W136 a tab opened before login follows it, W137 the signed-in cookie wins among several session cookies and is re-issued with the Domain while the stray host-only copy expires, W138 a signed-in cookie is re-issued when its attributes change and otherwise once a day; also W85 faster README render and W124 lazy sessions). Built from a read-only `git archive aaa39e69` with `HL_NO_PLUGINS=1 bash native/build.sh`, binary sha256 `7896caac…b302965`; plugins copied whole from the archive.
  15. Before: `bin/hybriel` + `plugins/` (core crypto data fetch fs http http1 mpackdb proc time web) = hybriel **master 06617221** (2026-10-03,
  16. antcolony mission 074: plugin allocators 3a781359 + 413f60e4 (#126, plugins allocate with malloc via plugin_api.zig), mpackdb
  17. frees per-operation buffers 2cb7ae5e, http1 request owns its parse 773de63e, event order f0ac2d2d (plugin ABI field — bin and
  18. .so must match); no lambda/parameter semantics change. Built from a read-only `git archive 06617221` into `~/scratch-074/src`
  19. (removed), sha256 `21059cc7…d77bdb`; old copy `.scratch/pre-074/` = 190aa11d. Gates 200/0, 46/0, 44/0. Memory proof:
  20. `bash .scratch/w074/curlloop.sh <appDir> / 20 <label>` (tracker README), `node .scratch/w074/memtest.mjs <appDir>
  21. .scratch/w074/real/storage <label> 0mugibaf6fds` (Chrome, port 8760, Chrome 8761–8764) and `bash .scratch/w074/longcurl.sh
  22. <appDir> <label> <N>` (signed-in curl over the 10 memtest pages, RSS every 100) — all need a fresh real-data tar in
  23. `.scratch/w074/real/storage` (deleted after the run).
  24. Before: master 190aa11d (2026-10-02,
  25. antcolony mission 072: #126 GC by bytes + returned closure scopes, #48 lambda params copy (`&p` = reference; audit: nothing in
  26. gitoria needs `&`), #127 big SSR pages flat incl. mountKids by reference (04df4428), fc838894 GC correctness (string index /
  27. plugin error read freed memory); built from a read-only `git archive 190aa11d` into `~/scratch-072/src` (removed), sha256
  28. `860f5e61…0a23626`; old copy `.scratch/pre-072/` = ff51cf46). Tracker README `/` (2.3 MB HTML): 0.56 s per load, RSS flat
  29. ~320 MB over 20 loads (old 9 → 16 s, 4.7–6.2 GB). Memory proof: `node .scratch/w072/memtest.mjs <appDir> <storage copy> <label>
  30. <userId>` (port 8720, Chrome 8721–8724; env MEM_ONLY/MEM_SKIP/LOADS/CLONES), `bash .scratch/w072/curlloop.sh <appDir> <path> N
  31. <label>` (needs a real-data copy in `.scratch/w072/real/storage`, deleted after each run — re-tar it).
  32. Before: master ff51cf46 (2026-10-01, antcolony mission 048: #113 mpackdb unique generated ids, #115/#116 lambda members on faces, #118, client SVG namespace, #111 hl:markdown
  33. (not vendored — gitoria has its own lib/markdown.hl), session sync 0b17f65b/64527baa — see "Lesson" below; built the same way into
  34. `~/scratch-048-gitoria/src`, sha256 `f3b93a53…983588d3`; old copy `.scratch/pre-048/` = 317d4754 + the pre-048 tests/).
  35. Before: master 317d4754 (2026-09-26, mission 038; includes 7cb9f8fc = #107: an emit in flight when its socket closes is carried over, a page being left starts nothing
  36. — fixes the Firefox pull-back that rolled antcolony mission 037 back; also #103/#104, #105 `headers`, #106 `let` per loop pass, #94 files in
  37. emit, #82 reconnect; before: #83 hashed `/__hl/…?v=` URLs + immutable cache, #88–#91 Bytes / chunked bodies / base64 / run stdin,
  38. #95–#97, #100, #101, #45 hl:web, #80 `run()`, #81 `*path`, #44 `sessionDomain`), built from a read-only
  39. `git archive master` (never inside Anton's repo) into `~/scratch-038/src`: `/media/STORAGE/projects/hybriel/native/zig-toolchain/zig
  40. build -Doptimize=ReleaseFast -Dtarget=x86_64-linux-gnu.2.39` in `native/`, binary `native/zig-out/bin/hybriel`, sha256 `fc7481fb…48670a8`.
  41. Older copies: `.scratch/pre-038/` (13ef4f9b bin/ + plugins/ + the pre-038 `browser.mjs`), `.scratch/pre-037/`, `.scratch/pre-035/`, `.scratch/pre-033*/`.
  42. * **No local patch** (`grep -rn "LOCAL PATCH" plugins` finds nothing): a re-vendor is copy binary + plugins, run ALL THREE gates
  43. (browser.mjs, push.mjs, ssh.mjs — deploy.sh only runs browser.mjs).
  44. * **069 round 2: master 1a096ad3 (#127) NOT adopted either**: the Markdown component still grows on big READMEs. Repro:
  45. `.scratch/w069/repro` (big-md variant, `run.sh <bin> <plugins> N`), see STATUS.
  46. * **069 (2026-10-02), master 8efba065 NOT adopted**: the gates were green, but big server-rendered READMEs grow memory and get
  47. slower on every load (tracker README 12 s → 47 s). See STATUS. Memory proof: `node .scratch/w069/memtest.mjs <appDir> <storage copy>
  48. <label> <userId>`. It uses port 8760 and Chrome 8761–8764, does 200 signed-in loads and 20 clones, and prints RSS as JSON.
  49. Lambda audit: `python3 .scratch/w069/lambdas.py` / `lambdas2.py`.
  50. * **Lesson (048, hybriel 64527baa)**: a face that takes `session` answers with a `sync` of every component member derived from
  51. `session` through server code (`tokens`, `keyItems`, `me`, `codeData` …) — the member is ALREADY fresh when the handler goes
  52. on after `emit server`. A handler that adds the returned row must skip a row with the same id (components/tokens.hl, sshkeys.hl,
  53. tickets.hl `addTicket` do), or the row is listed twice.
  54. The session cookie's `Domain` is the manifest setting `sessionDomain` (project.hl).
  55. ## Run (dev, Loreana)
  56. ```bash
  57. cd /media/STORAGE/projects/WorldAPI/gitoria.worldapi.org
  58. GITORIA_PORT=8360 GITORIA_PUBLIC_URL=http://localhost:8360 ./bin/hybriel project.hl
  59. ```
  60. Config (environment, or a `.env` beside `project.hl` — never printed or committed):
  61. | Variable | Default | |
  62. |---|---|---|
  63. | `GITORIA_PUBLIC_URL` | `https://gitoria.worldapi.org` | the main address; a repo lives at `<scheme>://<slug>.<host[:port] of this>` |
  64. | `GITORIA_PORT` | 8360 | |
  65. | `HL_HOST` | 0.0.0.0 | `127.0.0.1` on Byrodin behind nginx |
  66. | `GITORIA_WATCH` | on | `0` = no dev watcher (the container) |
  67. | `GITORIA_STORAGE` | `./storage/mpackdb` | table directory (`repos.db`, `users.db`) |
  68. | `GITORIA_GIT` | `<launch dir>/storage/git` | the bare git repositories, `<slug>.git` each (absolute path; the `git` binary must be installed) |
  69. | `GITORIA_APP_HOSTS` | empty | the HyperConductor bases an app's `hook` / `return` URL may start with, exactly as written, plain `http` and `IP:port` included, separated by commas or spaces (see "Apps"); the same list as tickets' `TICKETS_PUSH_ALLOWED`, today `http://100.77.141.84:8100 http://127.0.0.1:45010 http://100.109.3.10:8100` |
  70. | `GITORIA_TICKETS_URL` | `https://tickets.worldapi.org` | where a repo's tickets live (see "Tickets") |
  71. | `GITORIA_LIMIT_READS` / `GITORIA_LIMIT_WRITES` / `GITORIA_LIMIT_WINDOW_MS` | 300 / 60 / 60000 | the apps API's rate limit per app (see "Apps API"); only a gate sets them |
  72. | `GITORIA_SESSIONS` | `.sessions/` | |
  73. | `GITORIA_COOKIE_DOMAIN` | `.<host of the public url>` | the session cookie's Domain (`-` = host-only; a host without a dot or an IP gets host-only) |
  74. | `IDENT_URL`, `IDENT_EXCHANGE_URL`, `IDENT_API_KEY`, `IDENT_API_SECRET` | as in tickets | login via ident |
  75. ## Files
  76. Code order (antcolony `docs/code-order.md`, mission 002): `project.hl` is the MAP (config, routes, who hears what, an index
  77. comment); the logic is in `lib/`, one file per topic with its central logic, the noise in a `-helpers` file; API routes,
  78. faces and pages are thin wrappers. `let` only where a variable is reassigned (or re-bound in a loop body).
  79. | file | what |
  80. |---|---|
  81. | `project.hl` | the map: PWA settings, routes, audience, session cookie, the server |
  82. | `lib/repos.hl` | the repos table and every write to it: create, rows, owner checks (`ownsRepo`, `mayPush` = the push rule of HTTPS and SSH), main-branch setting, tickets connection |
  83. | `lib/repos-helpers.hl` | slug rules (`slugError`, `reserved`), the row a page shows, `withChange`, tab titles, the Markdown read view |
  84. | `lib/users.hl` | users table, ident exchange (`exchangeCode`, `userOfLoginCode`), display names, session → user, `tagOf` |
  85. | `lib/git.hl` | git on the server: `git()` / `gitRaw()`, branches, default branch, `initRepo`, `isEmptyNow`, `tmpDir` |
  86. | `lib/git-helpers.hl` | path/name/id checks, tab fields, sizes, the `\|\|\|PR` / `\|\|\|RL` subject parsers |
  87. | `lib/homepage.hl` | the repo homepage (README.md / `$docs`) |
  88. | `lib/code.hl` | the code browser (`/code`, `/branch`, `/commit`) and "Make main" (`makeMain`) |
  89. | `lib/pulls.hl` | pull requests, the Merge (`mergePullNow`), the list after a merge (`pullsView`) |
  90. | `lib/releases.hl` | releases |
  91. | `lib/tickets.hl` | a repo's tickets (read, open, comment, state), the connect flow (`finishConnect`), `notifyPush` |
  92. | `lib/tickets-helpers.hl` | `GITORIA_TICKETS_URL`, answer shapes, `#12` references (`refsOf`, `refParts`, `fixedBy`) |
  93. | `lib/transport.hl` / `lib/transport-helpers.hl` | git over HTTPS (`gitTransport`, `callGit`) / Basic password, plain answers, protocol env, pkt-line |
  94. | `lib/tokens.hl`, `lib/sshkeys.hl` | access tokens; ssh keys (+ `keyLine` for the sshd container, `sshUrl`) |
  95. | `lib/api.hl` / `lib/api-helpers.hl` | the function routes (`/api/repos…`, `/login/callback`, `/settings/connect…`, `/__git/keys`, `/__git/access`) / JSON-Markdown-text answers, `goTo`, `sshGuard`, `safeNext` |
  96. | `lib/markdown.hl` | Markdown → blocks (copied from tickets) |
  97. | `lib/util.hl` | env, storage dir, addresses (`publicUrl`, `slugOfHost`, `domainFor`), lists, `newestFirst`, text checks, Vienna time |
  98. | `theme/` | the WorldAPI theme, copied verbatim from layouts.worldapi.org (layouts commit `ce4a0ba` (V48, 2026-11-07; before: `17e0f03`), imported with `git archive ce4a0ba theme`, never edited here): `theme.hl` (inherited by `components/styles.hl`), `shell/*.hl` (AppHeader, MainMenu, UserMenu, Sidebar, ContentFirst — used by `components/main.hl`), `check-theme.mjs` (deploy gate) |
  99. | `components/*.hl` | pages and parts (shell `main.hl`, `list.hl`, `readme.hl`, `code/branch/commit.hl` + `codebrowser.hl`, `pulls`, `releases`, `tickets`, `settings`, `tokens`, `sshkeys`, `repohead`, `markdown`); CSS `components/styles.hl` (inherits `theme/theme.hl`; phone first, one `@media (min-width: 60rem)` block, gitoria#23) |
  100. | `tools/migrate-short-ids.hl` | one-off (mission 039) |
  101. | `lib/orgs.hl` `lib/members.hl` `lib/forwards.hl` | organizations, the member list (repo and organization), forwards of moved repos (GO34) |
  102. | `tools/move-repo.hl` `tools/create-repo.hl` | move a repo into an organization / create an empty org repo with a member (app stopped, absolute GITORIA_STORAGE) |
  103. | `tests/` | gates `browser.mjs`, `push.mjs`, `ssh.mjs`, `private.mjs` (private repos, organizations, move and create tools), `security.mjs`; `mobile-measure.js` (the in-page phone measurement of the gate's "phone first" block); `realdata-baseline.mjs` + `realdata-compare.py` (same output on live data); `letcount.py` |
  104. Imports go one way (Hybriel refuses a cycle): util, git-helpers, markdown ← users ← repos-helpers ← git ← repos ← tickets-helpers ←
  105. homepage / code / pulls / releases ← tickets ← tokens / sshkeys ← transport ← api-helpers ← api ← project.hl.
  106. ## How a repo gets its address
  107. * A repo is one row in `storage/mpackdb/repos.db` (`@id` key, unique index on `slug`): `{ slug, description, owner, created }`.
  108. * **Slug**: unique in the whole system (one table, unique index); 2–40 characters `a–z 0–9 -`, starts and ends with a
  109. letter/digit, no `--`, not one of the reserved names (`lib/repos-helpers.hl` `reserved`: technical host names only — www, api, git, mail, …; app names like ident or tickets are allowed).
  110. * **Address** = `<slug>.gitoria.worldapi.org`. nginx sends `gitoria.worldapi.org` and `*.gitoria.worldapi.org` to this one
  111. app (wildcard vhost, wildcard DNS and certificate: the architect's).
  112. * **Pages (gitoria#16)**: every page component declares `host = null` and hl:web hands it the request's host without port
  113. (hybriel#74) — on the server, on the first load and on every hl:web navigation. `lib/util.hl slugOfHost` → '' (main address)
  114. or the slug. Routes (`project.hl`): `/` → `components/index.hl` (main address: `list.hl`, the repo list + "Create a repository";
  115. repo address: `readme.hl`), `/code` `/code/*` → `code.hl`, `/branch/*` → `branch.hl`, `/commit/*` → `commit.hl` (all three
  116. show `codebrowser.hl`), `/pulls` → `pulls.hl`, `/releases` → `releases.hl`, `/tickets` → `tickets.hl`, `/login/failed` →
  117. `loginfailed.hl`. Every repo page stands under ONE layout level, `repo.hl` (gitoria#22, hl:web D-CHAIN: `parent './repo.hl'`; shell `main.hl` → `repo.hl` → page): the repo head, the tab nav (active tab = `aria-current="page"`) and the page's slot. Switching tabs replaces only the page in the slot; head and nav are the same DOM nodes. Unknown address → only "No such repository" (the page is not even constructed). Another chain (e.g. the main address's repo list is the same `repo.hl` without head; `loginfailed.hl` has `main.hl` directly) = a full page load.
  118. Links inside a repo are hl:web navigations (no page load). Rendered on the server with their content: the repo list,
  119. the repo head, the Readme's address/owner/created, the Tickets list (hl:fetch answers at once).
  120. * **Git on the server**: git is read with hl:proc `run()`, which waits for the program (hybriel#80), so the README, the file
  121. list / file, branches, commits, pulls and releases are in the first HTML and in every hl:web navigation (`lib/homepage.hl`
  122. `homepageNow`, `lib/code.hl browseNow`, `lib/pulls.hl pullsNow`, `lib/releases.hl releasesNow`). No browser script is involved; `/host.js` is gone.
  123. * **The path of `/code/*path`, `/branch/*path`, `/commit/*path`**: hl:web binds the rest of the URL to the page member `path`
  124. (hybriel#81); the pages hand it to `codebrowser.hl`.
  125. * **Login**: ident's login *button* flow (`<ident>/login?key=&return=<main>/login/callback`), the code exchanged server side.
  126. * **Identity selector** (gitoria#14, as in tickets): ident's `<ident-selector>` sits beside the button in the header; choosing an identity
  127. hands its one-time code (`/login.js` → hidden `#identcode` → face `gitoriaLogin`) to the server for the same exchange — no reload, open
  128. tabs of the session follow. ident answers only a registered origin, so the selector shows on the main address only (the shell gives it
  129. the class `onrepo` from the request's host, `components/styles.hl` hides it); the button stays the way in there.
  130. The app is registered in ident with ONE origin, the main address. The session cookie carries `Domain=.gitoria.worldapi.org`
  131. (hl:web `sessionDomain`, hybriel#44), so the login holds on every repo address. A login started at
  132. `<slug>.…` returns through the main address and on to that repo (`?next=`, added by `/login.js` at the click: a path, or a full URL of `<valid-slug>.<host>`;
  133. `lib/api-helpers.hl` `safeNext`). The first login asks for a display name (shown as the repo's owner). A failed login redirects to
  134. `/login/failed` (the reason parked in `session.data.loginError`; since mission 002 also in a browser that already had a session — `&req`, see STATUS "Lessons").
  135. * **Short ids (ident#23, antcolony mission 039)**: `users.identity` holds what ident's exchange answers — since ident#23 the identity's
  136. public 5-character short id (`a68sz`), before that the per-app id (32 hex); `lib/users.hl isIdentId` accepts both (the old
  137. `isHex` check refused short ids). The switch: one-off `tools/migrate-short-ids.hl` (old → short id, idempotent, never
  138. `finish`), gate `node tests/short-id-switch.mjs` (ports 8724/8725, no browser), runbook
  139. `antcolony-docs/docs/short-id-switch.md` (Byrodin: `/CONTAINERS/projects/antcolony/docs/short-id-switch.md` once synced).
  140. * **Create** (web form, face `gitoriaCreate`): any logged-in user with a display name. New repos reach every open list live.
  141. * **API** (public reads): `GET /api/repos`, `GET /api/repos/:slug`; `Accept: text/markdown` gives the Markdown read view.
  142. Create with your user access token (`gtr_`); the token's user owns the repository. Optional `org`, `private`, and `members`
  143. (display names or identity short ids) use the same creation and membership rules as the web form. Unknown members create nothing.
  144. App tokens (`gat_`) cannot create repositories. Success returns 201 with the same JSON as the single-repository GET.
  145. ```bash
  146. curl -X POST https://gitoria.worldapi.org/api/repos \
  147. -H 'Authorization: Bearer gtr_YOUR_ACCESS_TOKEN' \
  148. -H 'Content-Type: application/json' \
  149. -d '{"name":"my-project","description":"My project","private":false,"members":[]}'
  150. ```
  151. * Creating a repo also runs `git init --bare -b main` in `<GITORIA_GIT>/<slug>.git` (`lib/git.hl initRepo`); pushing to it: see "Push and pull".
  152. ## Push and pull (gitoria#7)
  153. Git over **HTTPS**, answered by this app itself with the `git` binary (`lib/transport.hl`; design: `docs/git-backend.md`). SSH: see below.
  154. * **Clone URL**: `https://<slug>.gitoria.worldapi.org/<slug>.git` (on the repo address, so the clone's folder is named like the repo). Paths
  155. `/<slug>.git/info/refs?service=…`, `/<slug>.git/git-upload-pack`, `/<slug>.git/git-receive-pack` (function routes, after the page routes in `project.hl`).
  156. * **Read** (clone, fetch, pull) needs no login: every repo is public. **Write** (push) needs the **access token of the repo's owner** as the
  157. password (any user name); anybody else's token → 403, no/unknown token → 401 with the way to get one. The token check is in `gitTransport`,
  158. before git is started.
  159. * **An ident access key as the password** (`lib/ident-access.hl`, a copy of tickets' one; ident#27): a password that starts with `idt_` is checked with ident on every call
  160. (no cache). The identity's gitoria user is the one its login made (made at the first use, named as ident names it); then `mayRead` / `mayPush` decide as for a token, so a
  161. member key pushes. A `read` key clones and fetches, a push is 403; a bad, revoked or foreign key is 401 (git asks again), ident not answering is 503. `gtr_` tokens work as before.
  162. Gate: `tests/ident-access-gitoria.mjs`.
  163. * **Access tokens** (`lib/tokens.hl`, `components/tokens.hl`, section `#tokens` of the main address for a logged-in user): name → token `gtr_` + 40 hex, shown ONCE;
  164. only its sha256 is stored (`storage/mpackdb/tokens.db`); list, remove (works at once); at most 20 per user. Faces `gitoriaMakeToken`, `gitoriaRemoveToken`.
  165. * **The "Add code to this repository" box** (`components/addcode.hl`, used by code/branch/commit, gitoria#20): plain text (no toggle), only on the
  166. **Code page** of a repo that has no branch yet (`lib/git.hl isEmptyNow`) — never on Readme / Pull requests / Releases /
  167. Tickets / Settings, and never once there is a commit. The clone command, the commands for a new project and for an
  168. existing one, and where the token comes from.
  169. * **How the body gets to git**: hl:proc `run()` has no stdin, so the request body is written to `<GITORIA_GIT>/.tmp/<random>.in` (a String holds raw bytes;
  170. hl:fs writes them exactly) and `sh -c 'git upload-pack|receive-pack --stateless-rpc "$1" < "$2" > "$3"'` (paths as arguments, no user text in the script)
  171. writes the answer to `.out`, which is read back as the response; both files are removed. A gzip request is unpacked first. `Git-Protocol: version=…`
  172. → `GIT_PROTOCOL` (v0, v1 and v2 tested). No hook: pulls and releases are read from the commits.
  173. * **Behind nginx** (the architect's vhost): `client_max_body_size` must allow pushes (say `500m`) and `proxy_request_buffering` stays **on** (default).
  174. git sends a big push chunked; hl:http1 reads chunked request bodies since hybriel#89 (antcolony mission 035: the old 411 hint is gone, a direct
  175. client without proxy pushes too — gate-checked). `proxy_read_timeout` ≥ 300s. The whole body is held in memory (≤ 500 MB).
  176. Kept on purpose (035): the temp files + `sh -c` (hl:proc `run()` could now take `stdin` + `binary`, hybriel#88/#91, but stdin
  177. crosses the plugin ABI as hex = twice the memory for a ≤ 500 MB body, and gzip would still need a second program) and `base64 -d`
  178. for the Basic header (hl:crypto `fromBase64(...).toString()` aborts the request on bytes that are not UTF-8).
  179. * Test: `node tests/push.mjs` (own ident + server + Chrome + the real git client; a small proxy in the gate plays nginx).
  180. Other ports: `GITORIA_GATE_PORT=8750 GITORIA_GATE_IDENT_PORT=8751 GITORIA_GATE_PROXY=8752 GITORIA_GATE_CHROME=8753-8757` (048: 46/0).
  181. ## Git over SSH (gitoria#7)
  182. A small **sshd container** (`docker/sshd`, service `gitoria-sshd` in `docker-compose.yml`) whose only job is `git-upload-pack` / `git-receive-pack`. It keeps no user list:
  183. * **Keys** (`lib/sshkeys.hl`, `components/sshkeys.hl`, section `#sshkeys` of the main address for a logged-in user): paste a PUBLIC key + a name; checked with `ssh-keygen -l`
  184. (ed25519, ecdsa, sk-…, RSA ≥ 2048; a private key, DSA, junk, a second copy of a key are refused); list with fingerprint; remove; ≤ 20 per user. Table `storage/mpackdb/sshkeys.db`.
  185. Faces `gitoria{Add,Remove}Key`. A key works at once and stops at once (sshd asks again on every login).
  186. * **Login**: `AuthorizedKeysCommand` (`gitoria-keys`) → `GET /__git/keys?type&key` (`lib/api.hl gitKeys` → `lib/sshkeys.hl keyLine`) → `restrict,command="gitoria-shell <user id>" <key>`. The forced command
  187. `gitoria-shell` accepts only `git-upload-pack|git-receive-pack '<slug>.git'` (slug validated, no shell, no forwarding, no tty), asks `GET /__git/access?user&slug&write`
  188. and only then runs git on `/repos/<slug>.git`. Same rule as HTTPS: **read = everyone, push = the repo's owner**.
  189. * **The two internal routes** exist only when `GITORIA_SSH_SECRET` is set; every call needs `X-Gitoria-Secret` = that secret, and a call that came through the public proxy
  190. (`X-Forwarded-For` / `X-Real-IP`) is refused. **SSH is offered on the site only when the secret is set** (the keys section and the ssh commands in the "add code" box are hidden otherwise).
  191. * **Deploy (the architect)**: `GITORIA_SSH_SECRET=<long random text>` (and optionally `GITORIA_SSH_PORT`, default 2222) in `.env` beside `docker-compose.yml` (both services read it);
  192. open the port in the firewall (port 22 belongs to the host's sshd, hence 2222: address `ssh://[email protected]:2222/<slug>.git`; with `GITORIA_SSH_PORT=22` the box shows `[email protected]:<slug>.git`);
  193. `gitoria.worldapi.org` (not only the wildcard) must resolve to Byrodin directly — **Cloudflare's proxy does not carry ssh** (use a grey-cloud/DNS-only record for the ssh host or a
  194. separate name; the address in the box uses the site's host name). The Hybriel image needs `openssh-client` (Dockerfile). `./storage/git` is mounted into the sshd container; its `git` account takes
  195. the uid of that folder's owner; host keys live in `storage/sshd-hostkeys/` (clients keep trusting the server). `docker compose up -d --build` builds both.
  196. * Test: `node tests/ssh.mjs` (048: `… GITORIA_GATE_SSH_PORT=8758` + the push ports → 44/0) (builds and starts the REAL sshd container on port 8708 with host networking; real ssh + git: clone, push 3 MB, RSA + ed25519 keys, pull, unknown key, no shell,
  197. path tricks, no forwarding, another user may read not push, removed key stops at once). Needs docker.
  198. ## The repo homepage (`/` of a repo address)
  199. * The repo's **README.md** (root, any case) is shown as a page; if the repo has a **`$docs`** folder, **all Markdown files inside it**
  200. (subfolders too, in path order, at most 30) form the homepage instead and the root README is not shown. Read from the
  201. repo's `HEAD` (the branch setting comes with #9). No commit / no README → "This repository has no README.md yet."
  202. * Reading = the `git` binary via hl:proc (`lib/homepage.hl`: `ls-tree -r`, `cat-file blob HEAD:<path>`, argv list, paths only from git,
  203. 15 s limit, ≤ 5000 lines a file),
  204. read while the page is built on the server (`homepageNow`).
  205. * Markdown → HTML (`lib/markdown.hl` copied from tickets, plus tables, block quotes, rules; `components/markdown.hl`): built as
  206. elements from parsed data, never an HTML string — raw HTML in a README is shown as text, only http(s)/mailto/`/…`/`#…` links
  207. are links. Not rendered: images, nested lists (shown as typed).
  208. ## Browsing code (`/code`, `/branch/<name>`, `/commit/<id>` of a repo address)
  209. * **`/code`** = the repo's main branch at its last commit. Main branch = the owner's setting (repo field `branch`), else `main`,
  210. else the first branch. The owner sets it on the code page: "Make main" beside each other branch (only the owner sees it; the
  211. face checks the owner again). The homepage (README / `$docs`) reads the same main branch.
  212. * **`/branch/<name>`** = that branch at its last commit (a name with slashes works: the longest existing branch name wins).
  213. **`/commit/<id>`** = the whole project at that commit (`<id>` = 4–40 hex characters, resolved to the full id).
  214. * After each of them a path: `/code/src/a.txt`, `/branch/feature/x/src`, `/commit/<id>/src`. A folder shows its entries
  215. (folders first, then files, with size), a file its numbered lines (at most 2000 lines, at most 1 MB). Also on the page: the
  216. crumbs, the latest commit, all branches, the latest 20 commits (each links to `/commit/<id>`).
  217. * Read with the `git` binary (`lib/code.hl` `browse`: `for-each-ref`, `log`, `cat-file`, `ls-tree`, argv lists, `--literal-pathspecs`).
  218. Read on the server while the page is built (`browseNow`). `/code`, `/branch/*`, `/commit/*` are three pages sharing
  219. `codebrowser.hl`; a link inside the app is an hl:web navigation. "Make main" (face `gitoriaSetBranch`) answers with the view again.
  220. * **Only UTF-8 text is shown**: a binary file or one that is not valid UTF-8 says so instead (its bytes would break the
  221. page's socket). Paths with `:`, quotes, backslashes or control characters are not browsable (`lib/git-helpers.hl` `safePath`).
  222. * Not built: the Markdown read view / API of code, a diff of a commit, images, syntax highlighting, downloading a tree.
  223. ## Tickets (`/tickets` of a repo address)
  224. * The tickets are **not stored in gitoria**: they live in tickets.worldapi.org, in a project named `<slug>.<host of GITORIA_PUBLIC_URL>`
  225. (e.g. `myrepo.gitoria.worldapi.org`; a repo slug has no dot, so it never meets another repo's project or the dotted app projects).
  226. Anyone logged in to tickets sees them like any tickets project. `lib/tickets.hl` talks to tickets' public API.
  227. * **List**: `GET <tickets>/api/projects/<project>/tickets` (public), newest update first, at most 200 shown: number, subject (as text), state,
  228. last update; each links to the ticket in tickets (read, comment and change the state there — the list view only is in gitoria).
  229. No project yet (404) → "No ticket yet". Tickets down → "tickets.worldapi.org did not answer". Read when the page is built on
  230. the server (hl:fetch is synchronous): the list is in the first HTML. A ticket opened here shows up live on every open tickets page of that repo.
  231. * **Connect (gitoria#18)**: the repo's **settings** (`/settings`, owner only) has "Tickets: connect". It sends the owner to
  232. `<tickets>/connect?app=gitoria&label=<slug>&return=<repo address>/settings/connected&state=<nonce>` (tickets asks which project they are
  233. admin of); tickets returns `?code&state`; gitoria checks the nonce (parked in the session, bound to the repo), exchanges the code from
  234. the server (`POST /api/connect/exchange`) and stores the key per repo in `repos.db` (`tktKey`, never sent to a page). "Forget the
  235. connection" clears it locally (tickets can also disconnect). Not connected → `/tickets` says so and points to Settings.
  236. `GITORIA_TICKETS_TOKEN` and the auto-created `<slug>.<host>` project are gone (they were the old way).
  237. * **Open a ticket**: any logged-in user with a display name: `POST <api>/tickets` with `Authorization: Bearer <key>` and
  238. `X-Tickets-Identity: <the user's ident id>` — the person is the author in tickets, under the project's roles (they must have logged
  239. in to tickets once).
  240. * **`#N` links both ways**: `#12` in a commit subject (code page, latest commits) or a pull request title links ticket 12. A push
  241. (and the Merge button) runs `notifyPush`: every commit of the last 100 on any branch whose subject names `#N` posts a comment
  242. "Mentioned in commit …" on ticket N (once per commit and ticket, remembered in `ticketlinks.db`), and a **merged** `|||PR` whose
  243. title says `fixes|closes|resolves #N` sets ticket N to state `review` with a comment. Done as the repo's owner. Commits that
  244. exist when the repo is connected are only marked, not announced.
  245. * Not built: showing a ticket's text / comments inside gitoria, editing a ticket from gitoria, a state filter, API of gitoria for tickets.
  246. ## Pull requests (`/pulls` of a repo address)
  247. * Nothing is stored: the list is read from git each time (`lib/pulls.hl` `pulls`). A **pull request is a commit** whose subject starts
  248. `|||PR ` (target = the repo's main branch, i.e. the owner's setting, else `main`) or `|||PR|<branch>] ` (target = `<branch>`).
  249. Anything else (marker not at the start, no space after `]`, an invalid branch name) is a normal commit.
  250. * Title = the text after the marker (empty → the source branch's name). Source = the branch that holds the commit and is not the target
  251. (`for-each-ref --contains`); one request per source branch (its newest marker commit); 50 at most, from the latest 500 commits of all branches.
  252. * State: **merged** when the commit is in the target branch (`merge-base --is-ancestor`), else **open**; a target that does not exist is
  253. shown as "(no such branch)". The Merge button (#17) merges with a merge commit; see "Who merges" below.
  254. * Read on the server while the page is built (`pullsNow`).
  255. * **Who merges (gitoria#48):** the owner or a member with push rights (`lib/repos.hl` `mayPush`, the rule that lets a person push), never an app. The Merge button
  256. on `/pulls` and `/pulls/N` shows for them, and the server checks again on the click. The required checks (#46) must be success. Over the API, with a person's access token (`gtr_…`, Tokens page):
  257. curl -X POST -H 'Authorization: Bearer gtr_XXXXXXXX' -H 'Content-Type: application/json' \
  258. -d '{"head":"<40 hex of the PR head, optional>"}' https://<repo>.gitoria.worldapi.org/api/pulls/<n>/merge
  259. → 200 `{ merged: true, mergeCommit, pull }`; 401 no/unknown token, 403 an app token ("apps cannot merge") or a person without write access, 404 unknown PR,
  260. 409 already merged / branch gone / conflict / a required check not success / `head` is not the current head (nothing merged). The merge commit's author is the person's display name;
  261. the `pull_request` `merged` event goes to the apps with `sender` = that person (`lib/pullmerge.hl`).
  262. ## Refuse direct pushes to the main branch (gitoria#50)
  263. The owner's switch in Settings ("Visibility"), per repo, **off by default**. On: a push over HTTPS or ssh that updates or deletes the main branch (the PR target setting, else `main`) is refused with one line that names the PR way (push a branch with a `|||PR ` commit, merge on `/pulls`). Other branches, tags and the creation of the branch in an empty repo stay allowed; the Merge button and the merge API are not pushes and work. Enforced in the server by `docker/sshd/hooks/pre-receive` (`core.hooksPath`: set in `lib/transport.hl` for HTTPS, in `docker/sshd/gitoria-shell` for ssh, where the hook is copied into the sshd image); `lib/repos.hl` `setProtectMain` stores the flag and writes the branch into `<repo>.git/gitoria-protect` (no file = off; also rewritten by "Make main"). Gate: `tests/protect-main.mjs`.
  264. ## Releases (`/releases` of a repo address)
  265. * Nothing is stored: read from git each time (`lib/releases.hl` `releases`). A **release is a commit on the repo's main branch** whose subject starts
  266. `|||RL ` (patch +1), `|||RL|med ` (minor +1, patch 0), `|||RL|mj ` (major +1, minor and patch 0) or `|||RL|<version> ` (set by hand,
  267. `1.1.1a`: three numbers, then letters/digits/`.`/`-`). `|||RL` alone counts as `|||RL `. Anything else is a normal commit.
  268. * Versions are counted from 0.0.0 over the main branch's history, oldest to newest (first `|||RL ` = 0.0.1); after a hand-set version the count
  269. goes on from its numbers. A hand-set version already released is not a release. Shown newest first (200 at most, latest marked): version, text
  270. after the marker (else the short commit id; links to `/commit/<id>`), author, date. Read on the server while the page is built (`releasesNow`).
  271. * A release is only that: version + commit. No git tag is written, no archive to download (the concept does not say what else it holds).
  272. ## PWA (installable app, antcolony mission 046)
  273. The installable app, the same way calendar.worldapi.org and tracker do it: hl:web's own manifest and service worker from
  274. settings in `project.hl`, no JavaScript of ours.
  275. * `appIcons` (192 + 512 PNG, each `any` and `maskable`), `appTouchIcon` (180 PNG), `appFavicon` (`/icons/favicon.svg`),
  276. `appThemeColor` = token `darker` (the header, rgb(15, 20, 25)), `appBackgroundColor` = token `dark` (rgb(25, 30, 35));
  277. name = `appTitle` "gitoria". hl:web serves `/__hl/manifest.webmanifest` (start_url/scope `/`, display standalone) and
  278. `/__hl/sw.js`, and links manifest, apple-touch-icon and theme-color from every head. `/favicon.ico` is a real icon
  279. (16/32/48). Each icon has its own `file` route in `project.hl`. Every repo address is its own origin: it gets the same
  280. manifest and its own worker (installed from a repo address, the app opens that repo's Readme).
  281. * **Icons** (`icons/`): `icon.svg` is the source (512, hand-written: a git branch — trunk with two commits, a branch
  282. curving off to a third; `#569bd4` on rgb(25,30,35); everything inside the maskable safe zone, a circle of radius 204, so
  283. one image serves `any` and `maskable`); `favicon.svg` is the same drawing, thicker, cropped tight on a rounded tile.
  284. Rendered on Loreana:
  285. ```bash
  286. rsvg-convert -w 192 -h 192 icons/icon.svg -o icons/icon-192.png
  287. rsvg-convert -w 512 -h 512 icons/icon.svg -o icons/icon-512.png
  288. rsvg-convert -w 180 -h 180 icons/icon.svg -o icons/apple-touch-icon.png
  289. for s in 16 32 48; do rsvg-convert -w $s -h $s icons/favicon.svg -o /tmp/fav-$s.png; done
  290. magick /tmp/fav-16.png /tmp/fav-32.png /tmp/fav-48.png icons/favicon.ico
  291. ```
  292. * **Offline**: `offline = [ Index ]` — the worker precaches the shell (runtime, modules, CSS, manifest, icons) and the
  293. document of `/`. Navigations are network-first (an online visit of `/` refreshes the kept copy); without a network `/`
  294. comes from the cache AS LAST SEEN (main address: the repo list; repo address: its Readme) and every other page (code,
  295. branch, commit, pulls, releases, tickets, settings) gets hl:web's "Unavailable offline" page (503). The shell
  296. (`components/main.hl`) shows "You are offline. Repositories and code need the network." while `navigator.onLine` is
  297. false: hl:web gives a page no connection state and no mount hook, so an invisible `netProbe` runs an endless 1 s CSS
  298. animation (`components/styles.hl` `@keyframes gitoria-net-tick`) whose `animationiteration` handler reads `navigator.onLine`.
  299. A server that is down while the device is online shows no note.
  300. ## Test
  301. Deploy gates (deploy.sh `GATES`): `node theme/check-theme.mjs .` (the theme rules: tokens, radii, no borders — 0 problems) and
  302. `node tests/browser.mjs`. Run locally with `LC_ALL=C` (lib/code.hl:13 `git grep -P` under a UTF-8 locale marks non-ASCII files
  303. "not text"; the live container has no locale).
  304. * PHONE FIRST block (gitoria#23, before the selector block): a 20 000-character line is committed on a branch `wide` of alpha, then at
  305. 390 px (mobile Chrome, DPR 2, touch, iPhone UA) `tests/mobile-measure.js` runs on 15 pages (main /, alpha /, /code, /code/src, a file,
  306. the long line, /branch/feature/x, /commit/<first>, /pulls, beta-2 /releases, /tickets, /settings, an unknown address, /login/failed,
  307. main / signed out): scrollWidth ≤ 390 (against a FIXED 390 — a mobile viewport grows with the page, so the older
  308. `scrollWidth <= innerWidth` checks cannot fail), every tap target ≥ 44×44 (links inside a sentence exempt), fields ≥ 16 px, text
  309. ≥ 14 px, header ≤ 52 px, code/table boxes inside the screen; the long line scrolls inside `#lines`; the tab row wraps in its own row;
  310. then real taps open ☰ (main menu, "Repositories" → main address), the user menu (Access tokens, SSH keys, Log out) and, signed out,
  311. the ident dropdown ("Log in with ident"): box inside the screen, targets ≥ 44 px. On the old code (b680c48) the block fails 20 checks.
  312. * The shell's dropdowns: "Log out" is in the user menu, on a phone "Log in with ident" in the ident dropdown — the gates open them
  313. first like a person (`clickInMenu` in browser/push/ssh.mjs).
  314. * Last run (mission 005, ports 8700–8709, LC_ALL=C): browser **221/0** (3 runs; one more run had 1 console error, see
  315. reports/005-mobile-first.md), push 46/0, ssh 44/0; old b680c48 with the same tests: browser 200 passed / 20 failed (all in the
  316. phone block), push 46/0, ssh 44/0.
  317. `node tests/browser.mjs` (221 checks; commits real files into the gate's bare repos) — own gitoria + own ident + own tickets (copies without `.env`, mail sink; `tests/ticketskit.mjs`) + headless Chromes; `*.gitoria.test`
  318. is mapped to 127.0.0.1 inside Chrome (`HL_CHROME_ARGS`, `tests/cdp.mjs`). Ports 8700–8709 (gitoria 8700, ident 8701, tickets 8702, Chromes 8703–8709); another range:
  319. `GITORIA_GATE_PORT=8710 GITORIA_GATE_IDENT_PORT=8711 GITORIA_GATE_TICKETS_PORT=8712 GITORIA_GATE_CHROME=8713-8719 node tests/browser.mjs`. Screenshots in `.scratch/gate-*.png`, server log `.scratch/gate-server.log`.
  320. Last run (mission 002 code order, ports 8750–8759, tickets from a `git archive HEAD` copy because the tickets working tree was
  321. mid-change: `GITORIA_GATE_TICKETS_DIR=$PWD/.scratch/w082/tickets-head GITORIA_GATE_PORT=8750 GITORIA_GATE_IDENT_PORT=8751
  322. GITORIA_GATE_TICKETS_PORT=8752 GITORIA_GATE_FIREFOX=8759 GITORIA_GATE_CHROME=8753-8758` → 200/0; push.mjs (`GITORIA_GATE_PROXY=8752
  323. GITORIA_GATE_CHROME=8753-8757`) 46/0; ssh.mjs (+ `GITORIA_GATE_SSH_PORT=8758`) 44/0.
  324. Before (antcolony mission 074, hybriel 06617221, ports 8760–8769): `GITORIA_GATE_PORT=8760 GITORIA_GATE_IDENT_PORT=8761 GITORIA_GATE_TICKETS_PORT=8762 GITORIA_GATE_FIREFOX=8769 GITORIA_GATE_CHROME=8763-8769` → `200 passed, 0 failed`; push.mjs (`GITORIA_GATE_PROXY=8762`) 46/0, ssh.mjs (`GITORIA_GATE_SSH_PORT=8769 GITORIA_GATE_CHROME=8763-8768`) 44/0. Mission 072 (hybriel 190aa11d): `GITORIA_GATE_PORT=8720 GITORIA_GATE_IDENT_PORT=8721 GITORIA_GATE_TICKETS_PORT=8722 GITORIA_GATE_FIREFOX=8729 GITORIA_GATE_CHROME=8723-8728` → `200 passed, 0 failed`; push.mjs (`GITORIA_GATE_PROXY=8722`) 46/0, ssh.mjs (`GITORIA_GATE_SSH_PORT=8729`) 44/0. Mission 048: ports 8750–8758 → `199 passed, 0 failed`. Before (antcolony mission 046): `GITORIA_GATE_PORT=8720 GITORIA_GATE_IDENT_PORT=8721 GITORIA_GATE_TICKETS_PORT=8722 GITORIA_GATE_CHROME=8723-8727 GITORIA_GATE_FIREFOX=8728 node tests/browser.mjs` → `199 passed, 0 failed` (the Firefox port defaults to 8699 — set it inside your range).
  325. * PWA block (antcolony mission 046, at the END of the gate): manifest + icons over HTTP (real PNG sizes, favicon blue, `/favicon.ico` an
  326. ICO), then the gate's Chromes are CLOSED and one fresh Chrome gets `--unsafely-treat-insecure-origin-as-secure=<main>,<alpha>`
  327. (a service worker needs a secure context; plain-http `*.gitoria.test` is not one — the live https site needs nothing):
  328. Chrome's installability + manifest verdict, worker scope `/` on the main AND a repo address; offline: the tab's network
  329. is cut (the note appears live), the SERVER is stopped (CDP offline does not reach the worker's own fetches), reload of `/`
  330. shows header + note + the list as last seen, alpha's `/` its Readme, `/code` "Unavailable offline"; server restarted,
  331. back online. Screenshots `.scratch/gate-pwa-phone-{online,offline}.png` (390 px).
  332. * gitoria#16 block: `firstHtml(path, host)` fetches the FIRST HTML with a Host header (node's fetch cannot set one) — `/` (README), /code,
  333. /code/src, a file, /branch/main, /branch/feature/x, /commit/<id>, /pulls, /releases, /tickets hold their real content and no "Loading";
  334. the main address the repo list; hybriel#43: a code view in a second tab of the session keeps its elements through a login and a
  335. logout of the other tab; every view of an unknown address "No such repository"; `/host.js` 404; in Chrome every view loads
  336. directly, and Readme → Code → Releases → Tickets → Pulls → Readme plus a folder + Back keep `window.__navMarker` (no page load).
  337. * Re-vendor block: `/__hl/app.css` has the token file's `--dark` in `:root` (hybriel#39); a repo description
  338. `</script><b id="xss">…` stays inside the seed (`\u003c`) and shows as text (hybriel#34); `Domain=.gitoria.test` on the cookie (`sessionDomain`).
  339. * Navigation LOGGED IN (the creator saw full page loads in Firefox): a fresh Chrome logs in with the button on a repo address, then
  340. real clicks Readme → Code → Releases → Pulls → Tickets → Code → a folder keep `window.__navMarker`; the same on an empty repo the user
  341. owns, and with the WebSocket closed (POST fallback). The same two runs in a **real Firefox** (`tests/firefox.mjs`: headless
  342. `/usr/bin/firefox` over WebDriver BiDi, no driver/npm; hosts mapped with the pref `network.dns.localDomains`; BiDi port
  343. `GITORIA_GATE_FIREFOX`, default 8699).
  344. * By hand: `curl -s -H 'Host: <slug>.gitoria.test:8720' http://127.0.0.1:8720/code` against a running dev server.
  345. * Lesson: the views are in the FIRST HTML now, so "content is there" no longer means "page is live" — `await hydrated(page)` before
  346. clicking a button with a handler ("Make main" was clicked on the dead SSR page and flaked).
  347. ### Same output (a cleanup must not change what the app answers; mission 002)
  348. On a COPY of the live data (Byrodin → Loreana, deleted after the run):
  349. ```bash
  350. # on Byrodin:
  351. tar -C /CONTAINERS/projects/gitoria.worldapi.org -cf - storage/mpackdb storage/git | ssh loreana 'mkdir -p /media/STORAGE/projects/WorldAPI/gitoria.worldapi.org/.scratch/realdata && tar -C /media/STORAGE/projects/WorldAPI/gitoria.worldapi.org/.scratch/realdata -xf -'
  352. # on Loreana, in the repo:
  353. git archive <old commit> | (mkdir -p .scratch/old && tar -x -C .scratch/old) && cp -a bin .scratch/old/
  354. GITORIA_REALDATA=.scratch/realdata node tests/realdata-baseline.mjs .scratch/old 8750 .scratch/out-old # app 8750, sshd 8758, fake tickets 8759
  355. GITORIA_REALDATA=.scratch/realdata node tests/realdata-baseline.mjs . 8750 .scratch/out-new
  356. python3 tests/realdata-compare.py .scratch/out-old .scratch/out-new -v # exit 0 = the same
  357. python3 tests/letcount.py . # root .hl files, project.hl lines, lets
  358. ```
  359. `realdata-baseline.mjs` signs in as the creator (az5b2 → users @id `0mugibaf6fds`) with a session file and fetches every page of
  360. every repo (signed in and out: `/`, code, files, folders, branches, commits, pulls, releases, tickets, settings, unknown
  361. addresses), the browser modules, the API (JSON + Markdown), the git refs advertisements, the refusals, the login / connect
  362. routes, the internal ssh routes; then WRITES on its own copy: faces (create, token, key, Make main, Merge, …), clone + push over
  363. HTTPS (token) and over SSH (the real sshd container), removal of key and token, logout. The connected repo's tickets are a
  364. snapshot served locally (nothing reaches live tickets). Two runs of the SAME code compare clean (the masks change nothing alone).
  365. ## Deploy
  366. `./deploy.sh` (gates → backup → rsync → restart → 200). First deploy = the architect's: folder, `.env`, wildcard vhost
  367. (`server_name gitoria.worldapi.org *.gitoria.worldapi.org;`, WebSocket upgrade headers), wildcard DNS + certificate, and the app
  368. registered in ident with origin `https://gitoria.worldapi.org`. Container port 45004 (`docker-compose.yml`).
  369. deploy.sh's rsync does not delete: after the mission-002 move the old root `.hl` files (api, git, users, …) stay on Byrodin
  370. unused (project.hl imports only `lib/`); remove them by hand once if wanted.
  371. ## History and worker briefs
  372. - `LOG.md` — append-only history, one dated line per step (moved here from the antcolony LOG on 2026-10-01).
  373. - `missions/NNN-*.md` — worker briefs for this app; `reports/NNN-*.md` — their reports (same name). Numbered per
  374. project since 2026-10-01 (antcolony#40); older text, code comments and commits use the old antcolony numbers →
  375. map: `/media/STORAGE/projects/antcolony-docs/docs/mission-map.md` (Byrodin: `/CONTAINERS/projects/antcolony/docs/mission-map.md`).
  376. ## Apps (gitoria#41, part of the push API gitoria#38; contract `docs/apps-api.md` §0–§1)
  377. An app is an outside program (the first: a code reviewer) the owner of a repo connects to that ONE repo. `lib/apps.hl` (table `apps.db` keyed by the repo's id, so a moved repo keeps its apps; one row per repo + app name; `appOfKey(key)`; the key is stored as sha256 only, the 64-hex secret is server-only and goes to no page or log; the one-time codes are in `appcodes.db`, sha256 only, 5 minutes), `lib/apps-helpers.hl` (the URL allow-list, shapes).
  378. * **Connect flow A**: `GET <repo address>/settings/apps/connect?app&hook&return&state` (an organization repo: `/<repo>/settings/apps/connect`) checks the URLs, parks the request in the session and goes to Settings, which asks to sign in (the same session goes on after the login) and shows "Connect <app> to <repo>?" to the owner; Yes (a plain form POST with a nonce) → `return?code&state`, No → `return?error=denied&state`. `POST <repo address>/api/apps/exchange {"code"}` → `{key, secret, api, repo, app}`. On an organization address the exchange answers at `/<repo>/api/apps/exchange` and at `/api/<repo>/apps/exchange` (the API base).
  379. * **Manual way B**: Settings → Apps → Add (name and receiver address) shows key and secret once; Remove (row gone, key dead) and Rotate secret (new secret shown once) are in the same list. Owner only.
  380. * **Allowed URLs** (`hook` and `return`; anything else is `400 invalid_url`, no redirect is ever followed): `https://` with host `worldapi.org` or a subdomain (no port, no user name, no IP), or a URL that IS one of the `GITORIA_APP_HOSTS` bases or goes on after it with `/` (`http://100.77.141.84:8100.evil` does not pass).
  381. * `pingAfterConnect` in `lib/apps.hl` raises the `ping` event for the new app (gitoria#43).
  382. ### Events to apps (gitoria#43, docs/apps-api.md §4)
  383. `lib/events.hl` (+ `lib/events-helpers.hl`): `raiseEvent(repo, event, action, extra, senderId)` writes ONE row per connected app of the repo into `deliveries.db` (`extra.exceptApp` = the app that caused it gets nothing); the JSON body is built once at raise time and stored as the exact bytes that are signed and sent, so a retry or a redelivery sends the same bytes and the same `X-Push-Delivery` uuid. `syncAndRaise(slug, userId)` replaces `syncPulls` at the three places a push or a merge lands (HTTPS push, `/__git/pushed after`, the Merge button) and raises `pull_request` opened/reopened/synchronize/closed/merged. A push never waits for a receiver: an `hl:time` `every` timer in `project.hl` calls `sendDue()`, which POSTs the due rows (timeout 10 s, no redirects, 2xx = delivered, retries after 1 min, 5 min, 30 min, 2 h, 6 h, then `failed`; the address is checked with `urlAllowed` again at send time; the app's last status shows in Settings → Apps, next to "Send ping"). HMAC-SHA256 is `hl:crypto` `hkdfExtract(salt = key, ikm = body)` (RFC 5869 §2.2). Two processes share the storage during a deploy: a row is sent by the one whose `mkdir storage/claims/<delivery>.<attempt>` succeeds (atomic in the file system; the table itself has no compare-and-set). Retention: rows older than 7 days go, at most 200 stay per app. `GET {api}/deliveries` and `POST {api}/deliveries/:id/redeliver` use `appOfRequest`.
  384. Test-only environment: `GITORIA_EVENTS_TICK` (seconds between sender runs, default 2) and `GITORIA_EVENTS_RETRY_MS` (comma list replacing the retry waits).
  385. * Gate: `node tests/apps.mjs` (`GITORIA_APPS_PORT` 8730, `GITORIA_APPS_IDENT_PORT` 8731): 95 checks.
  386. ### Reviews, threads and comments for apps (gitoria#44, docs/apps-api.md §5)
  387. `lib/reviews.hl` (+ `lib/reviews-helpers.hl`) is the back-channel for a reviewer app; `lib/api.hl` has the thin wrappers (`appPulls`, `appPull`, `appReviews`, `appThreads`, `appReply`, `appResolve`, `appComments`), `project.hl` lists each route once through `apiPatterns`, and every one starts with `appOfRequest`. Three tables keyed by the repo's id and the PR number (never the slug): `reviews.db`, `threads.db`, `comments.db`. A review is checked before anything is stored: the head must be the PR's current head or any earlier one (`heads` of the PR record), else 409 `stale_head`; every inline comment must stand on a NEW-side line (added or context) of `git diff -M -U3 <merge-base(current target tip, head)> <head>`, else the whole review is 422 `invalid` with `details [{index, path, line, reason}]` (`line_not_in_diff`, or `no_such_file` when the new-side path is not in the diff: a deleted, unchanged or unknown file, or the old name of a rename). A thread's `outdated` is computed (`thread.head != current head`). `comment.seq` grows strictly per repo: the next number is claimed with `mkdir storage/mpackdb/seq/<repo id>/<n>` (atomic across the two processes of a deploy swap). `currentVerdict(repoId, number, appId)` is the app's latest approve or request_changes (a `comment` review does not clear it; with none of those, its latest comment review). Every other `/api/…` path is the contract's JSON 404; its two routes (`/api/*`, `/:orepo/api/*`) stand ABOVE the page routes, because `/api/pulls` also fits the page `/:orepo/pulls`. Gate: `tests/reviews.mjs` (seed `tests/reviews-seed.hl`, probe `tests/reviews-probe.hl`).
  388. ## Apps API (gitoria#38, children #40–#47; the contract is `docs/apps-api.md`, v1.3)
  389. Gitoria lets an outside program (the first: a code reviewer) work on a repo. **What the owner clicks**: Settings → Apps → Add (a name and the receiver address; key and secret are shown once), or the app sends the owner's browser to `/settings/apps/connect?…` and the owner answers Yes. In Settings the owner can also send a ping, rotate the secret, remove the app, and mark contexts as "required before merge". **What an app gets**: a key to trade for one-hour tokens (`POST {api}/apps/token`), signed events to its receiver (PR opened, changed, merged, closed, review requests, replies, comments), read-only git access (`refs/pull/N/head`), and the back-channel: pulls (with their `tickets`, `statuses` and `required`), reviews with inline threads, comments, statuses on a commit (`PUT` its own, `GET` everybody's), and its delivery log. Every route, field and error is in `docs/apps-api.md`; the tables and code are in the three sections above and in `lib/limits.hl`.
  390. Limits (§6): per app, 300 reads (GET) and 60 writes (POST/PUT, the token call included) per minute over every apps API route; over it → `429 rate_limited` with `Retry-After` (seconds). A bad token or a token for another repo costs nothing. The counts live in the process (`lib/limits.hl`, a fixed one-minute window): a restart or a deploy swap starts every app at zero, and two processes at once count apart. A body over 1 MB is `413 too_large`, a body that is not a JSON object `400 invalid_json`. Gate: `tests/limits.mjs` (`GITORIA_LIMITS_PORT` 8734, `GITORIA_LIMITS_IDENT_PORT` 8735; it sets the test-only `GITORIA_LIMIT_READS`, `GITORIA_LIMIT_WRITES`, `GITORIA_LIMIT_WINDOW_MS`).

Branches

Latest commits

  • 5803cf4f|||PR vendor: Hybriel set-day59 and GC budget 32 MiBmre
  • 9eff6627Merge branch 'f2-api-bugs' into mainGitoria
  • 26117255|||PR apps API: review comments on files with spaces in their namemre
  • b8796cecMerge branch 'f1-broken-json' into mainGitoria
  • 2f2959c5|||PR apps API: broken JSON body gives 400 invalid_json, not 500mre
  • f7c6ca07Merge branch 'ident-chooser-selector' into mainGitoria
  • 691abb8e|||PR tests: find ident identity choice without the removed .choose classmre
  • 16a3530fMerge branch 'heap-revert' into mainGitoria
  • 220a80e0|||PR Remove temporary /__heap route and heap helper; logmre
  • 13f0c342Merge branch 'hl25-records' into mainGitoria
  • a002ecb7|||PR records: HL25 report, heap helper, logmre
  • 2492a55cTemporary keyed /__heap route for the live memory snapshotmre
  • fefaedd2log: tracker PR-only, HL25 startedmre
  • 21aa57calog: parkmre
  • e9f950a8reports: G25c soakmre
  • a7783686log: deploy 9f41ffcmre
  • 9f41ffc1log: W30b mergedmre
  • bef635c1Merge branch 'w30b'mre
  • 15b996a5Org list: keyed rows by @id, newest first, concat instead of hand loopmre
  • c4f6d9e3reports: G25c growth huntmre