gitoria
All repositories: gitoria
30.3 KB
# E38 — Evaluation: a push API for outside apps (gitoria#38)Ticket: https://tickets.worldapi.org/gitoria.worldapi.org/38to interact with gitoria. first use case being a code reviewer. The external reviewer built the reference reviewer over the past two weeks, a code rabbitreplacement for github. basically we want the external reviewer now to build a similar tool with gitoria and hybriel."This is an evaluation. No code was written. Read: WORKER-RULES, CONCEPT, DECISIONS, README, project.hl, docs/git-backend.md,fetch/crypto/time plugin READMEs. Not read: lib/code.hl and the commit page (see "not checked").## 0. Short answerRecommendation: **Option B** — per-repo "apps" registered by the repo owner with the tickets-style connect flow, onesigned HTTP POST per event, and a small token-checked back-channel (read diff, post comment, set a verdict). It costsabout 10 work steps (medium). Gitoria today has NO diff, NO PR comments, NO PR verdict and NO event hook, so most ofthe work is the back-channel and the diff, not the push itself. Build the diff first: it is useful for gitoria's own UI too.Follow-up goal (section 9): the apps become reviewer AND deployer (a review container per PR). Option B still fits, with threeadditions that are now required, not optional: a stable PR number, a "preview" link/status on the PR, and event delivery thatcovers closed-without-merge. The deployer is a second app of the same kind and needs the same token/secret/back-channel.## 1. What gitoria has today, and what a reviewer still needsHas (all verified in code):- **A PR is a commit.** lib/pulls.hl: a commit whose subject starts `|||PR ` (target = repo main branch) or `|||PR|<branch>] `."Nothing is stored: the list is read from git each time" (`pulls()`, scans the last 500 commits, max 50 PRs, one per sourcebranch). State is only `open` or `merged` (merged = the PR commit is an ancestor of the target). A PR has no id other thanthe 40-hex sha of its `|||PR` commit (`mergePullNow` finds it again by that sha). The sha changes if the PR commit isrewritten; there is no stable PR number.- **Merge** exists: `mergePullNow` (owner only, `merge-tree --write-tree` + `commit-tree` + `update-ref` with old value).Note: DECISIONS.md (2026-09-25, gitoria#13) says "no, the final button click comes from the dev" — it reads as "gitoriadoes not merge"; the code since gitoria#17 has a Merge button the owner clicks. Both fit "the dev clicks", but a reviewerapp must never merge: the back-channel below does not offer merge.- **Users, tokens**: lib/tokens.hl — `gtr_` + 40 hex, per USER, only the sha256 stored, shown once, max 20, no scopes. A tokenacts as that user for git over HTTPS only (transport.hl `userOfToken`). `idt_` ident access keys (read/write) also work there.- **Rights**: lib/repos.hl `mayRead`, `mayPush` (= `isInside`: owner, repo member, org owner/org member), `ownsRepo(slug, session)`;private repos answer as "no such repository" (GO34, #34). Private means a push webhook payload and any diff are secrets.- **Function routes**: lib/api.hl + project.hl `routes` (`{ pattern function = (route, req) => … }`). Today's API is read-only:`GET /api/repos`, `GET /api/repos/:slug` (+ Markdown view). No write route exists except the connect flow and `/__git/*`.- **An "app registers with app" flow already exists** (tickets.hl `finishConnect`, see section 2).- **Git reading helpers**: `git()`/`gitRaw()` in lib/git.hl run the git binary in the bare repo; docs/git-backend.md lists`diff a...b`, `show`, `diff-tree -p --numstat` as "yes (#11)" — meaning feasible, not built.Missing for a reviewer:1. **No diff.** README line 218: "Not built: … a diff of a commit". No PR diff either. (I did not open lib/code.hl; the README isthe source.) The reviewer needs `git diff <target>...<source>` (three dots = what the PR adds) as unified text + a file list.2. **No comments on a PR (or on anything).** Searched README, CONCEPT, pulls.hl: no comment store, no line comment. The only"comments" are posted TO tickets by notifyPush. A review result needs a place to live: either a new table in gitoria(`reviewsTable`: slug, pr-sha, app, file, line, text, created) or comments pushed into the linked ticket (see option C).3. **No status/verdict** on a PR (e.g. "reviewed: 3 notes", "approved", "changes requested").4. **No event hook.** transport.hl says "No hook: pull requests and releases are read from the commits when their page is built."docs/git-backend.md planned `post-receive → /__git/pushed` and "Webhooks / CI triggers: fan-out from post-receive — later";it is not built. The only hook-like point is `notifyPush(slug, false)` in transport.hl after a receive-pack answer, and inthe Merge button (README ~line 238).5. **No new-commit detection per PR.** The PR is a commit on a branch; "a new commit on the PR branch" is a ref moving, whichgitoria never records. notifyPush de-duplicates with `seenTable` (key `slug commit sha n`) — the same trick can store thelast seen tip per PR branch.6. **Server-side event raising has no old/new ids** (the push body goes straight to `git receive-pack`; gitoria does not parsethe ref updates). Two ways: parse the pkt-line commands at the start of the request body (before calling git), or compare`for-each-ref` snapshots before and after the call (simple, costs two git calls per push).7. **No outgoing-app registry** and no hook for the owner to list or remove apps.## 2. RegistrationFacts: tickets' connect flow (antcolony-docs/docs/tickets-connect-apps.md, gitoria tickets.hl/api.hl):1. owner clicks Connect in the repo's settings → `/settings/connect` parks a nonce in the session (bound to the repo, owner onlyvia `ownsRepo`) and redirects the browser to the other app's `/connect?app&label&return&state`;2. the other app logs the person in (ident), asks for confirmation, redirects back to `return?code=&state=`; code valid 5 min, once;3. gitoria's SERVER exchanges the code (`POST /api/connect/exchange {code}` → `{key, project, title, api}`), stores the key per repo(never shown to a page); every write carries `Authorization: Bearer <key>` + `X-Tickets-Identity`;4. the admin on the tickets side can disconnect (key dies); a re-connect of the same app+label replaces the key.The tickets flow runs in the direction "gitoria is the CLIENT of tickets". For a reviewer app the roles reverse: **gitoria is theSERVER, the reviewer is the client.** The pattern still fits (browser redirect, one-time code, server-side exchange, key shownonce) with gitoria playing tickets' role. Where it fits and where it does not:- Fits: owner-confirmed, no secret in a URL, no copy-paste, code is one-time, state is a nonce, `return` restricted to`worldapi.org` and subdomains (tickets does this; reuse the same rule — it also blunts SSRF and open redirect).- Does not fit as is: gitoria's `tktKey` is stored per repo in `repos.db` as a single connection; a repo may need severalapps (reviewer, CI, ...). So a new table `appsTable` (not extra fields in `repos.db`): `{ repo, name, label, hookUrl, secretHash/secret,tokenHash, rights, createdBy, created, lastDelivery, lastStatus }`.Three registration shapes:- **R1 per repo, by its owner, connect flow (recommended).** Owner opens Settings → "Apps" → Add; the app's start URL`https://<app>/connect-gitoria?repo=<slug>&return=…&state=…`. Permission = owner (`ownsRepo`), same as the tickets connect.Exchange returns `{ token (gap_… 40 hex), secret (webhook signing key), api: https://<slug>.gitoria…/api/… }`.- R2 per user (the user makes an app token like `gtr_` tokens). Simple but a user token reaches ALL the user's repos, includingprivate ones (#34). Too much for a reviewer. Reject for apps; keep for scripts.- R3 manual form: owner types a hook URL and gets a secret + token shown once (GitHub/Gitea webhook style). No second app isinvolved, so no confirmation roundtrip. Cheapest; good fallback when the app is not a WorldAPI app.What the app gets: an **app token** of its own kind (`gap_` + 40 hex; store sha256 only, as tokens.hl does) bound to ONE repoand a list of rights: `read` (diff, files, PR list), `comment` (post review comments), `status` (set a verdict). No `push`,no `merge`, no `settings`, no other repo, no tickets key. Token check = a new `appOfToken(secret)` next to `userOfToken` in a newlib/apps.hl; the route additionally compares the token's repo to the URL's repo. Private repo: the token's repo is the only oneit sees, so GO34 holds. Do NOT reuse `gtr_` user tokens for the back-channel: they carry the owner's full rights.Posting identity: comments are authored "app: <name>" (a bot), not as the owner (unlike notifyPush, which acts as the owner).Removal: Settings → Apps → Remove deletes the row: token and secret die at once; pending deliveries are dropped. Also "Rotatesecret". An app can remove itself with `DELETE /api/repos/:slug/apps/self`. The ident id of the owner stays in the row for audit.Who may register: the repo owner only (DECISIONS: "owner"); members are not asked; an org repo → its org owner (open question 5).## 3. Push (events out)Events (names after GitHub's `X-GitHub-Event` for easy porting):| event | when | raised where ||---|---|---|| `push` | any ref moved (branch created/updated/deleted), includes push to main | transport.hl, in the `git-receive-pack` branch where `notifyPush(slug, false)` is called today || `pull_request` `opened` | a `|||PR` commit appears on a branch that had none | same place; diff the PR list (`pullsNow`) before/after || `pull_request` `synchronize` | the PR's source branch got new commits | same place; compare branch tip to last seen tip (store in a table like `seenTable`) || `pull_request` `closed` + `merged:true` | Merge button, or `git merge` + push | api/components merge face (`mergePullNow` returns ok) and the push path || `ping` | right after registration | the exchange step |Payload (JSON, small; the app reads details through the back-channel, not from the payload):```{ "event":"pull_request", "action":"opened", "delivery":"<uuid>", "time":"2026-10-31T12:00:00Z","repo":{"slug":"reviewer","private":false,"api":"https://reviewer.gitoria.worldapi.org/api"},"pull":{"id":"<sha of the |||PR commit>","title":"…","source":"feature-x","target":"main","head":"<tip sha>","base":"<merge-base sha>"},"sender":{"name":"<display name of pusher>"} }```For `push`: `{ref, before, after, commits:[{id, subject, author}] (max 20)}`. No file contents in a payload (size, secrets).The PR id problem (section 1): use the `|||PR` commit sha as `pull.id` for now; a stable number is an open question.Delivery:- HTTP POST, `Content-Type: application/json`, headers `X-Gitoria-Event`, `X-Gitoria-Delivery` (uuid, same on redelivery),`X-Gitoria-Signature-256: sha256=<hex HMAC-SHA256(secret, raw body)>`, `User-Agent: gitoria`. Same shape as GitHub's(GitHub docs: delivery id header guards replay; secret should be high entropy; 2xx within 10 s else counted as failed;GitHub does NOT retry automatically, redelivery is manual or by script — checked on docs.github.com 2026-10-31).- **Timeout 10 s, no redirects followed** (fetch has `maxRedirects`; 0 returns the 3xx as the response — plugins/fetch).- **Retries** (gitoria should do better than GitHub): queue row per delivery in `deliveriesTable``{app, event, body, tries, nextAt, status}`; retry after 1 min, 5 min, 30 min, 2 h, then mark `failed`. The app can alsolist missed deliveries and redeliver: `GET /api/repos/:slug/deliveries`, `POST …/deliveries/:id/redeliver`.Retention 7 days, max 200 rows per app, otherwise a dead app fills the disk.- **App down**: push is never failed or slowed by it (like notifyPush: "Failures are silent (the push has succeeded)"). AfterN failed days the app is shown red in Settings; the app reconciles by asking `GET …/pulls` (state is derivable from git atany time because PRs are stored nowhere). This makes lost events harmless: the app should poll once on start.- Idempotency: the app must treat the same `delivery` id as already done. Receiver should be quick (ack, then work).## 4. Back-channel (app → gitoria), token check on every routeAuth for all: `Authorization: Bearer gap_…`; the route finds the app, checks the token's repo == the URL's repo and the right.Base: `https://<slug>.gitoria.worldapi.org/api/…` (org repos: `<org>.gitoria…/api/<repo>/…`, same as the page paths in GO34).Answers are JSON; 404 for a repo/PR the token does not reach (same "does not exist" rule as GO34).| route | right | what ||---|---|---|| `GET /api/pulls` | read | the PR list (JSON form of `pulls()`: id, title, source, target, state, head, base) || `GET /api/pulls/:id` | read | one PR, id = the `|||PR` commit sha || `GET /api/pulls/:id/diff` | read | unified diff `target...source` as text, with `?files=1` file list and `?max=` size cap; truncated flag || `GET /api/files?ref=&path=` | read | one file at a commit (`git show ref:path`), cap 1 MB; for context beyond the diff || `GET /api/commits/:sha` | read | message + parents + diff of one commit || `POST /api/pulls/:id/comments` | comment | `{text, file?, line?, side?, commit?}` general or line comment (Markdown, max 20000 chars) || `POST /api/pulls/:id/reviews` | comment | `{verdict: "comment"|"approve"|"changes", summary, comments:[…]}`, one review in one call || `PUT /api/pulls/:id/status` | status | `{state: "pending"|"success"|"failure", label, text, url?}` shown as a badge on /pulls || `GET /api/deliveries`, `POST /api/deliveries/:id/redeliver` | read | missed events |Not offered: merge, push, delete branch, settings, tickets. The owner clicks Merge.Where a comment goes: **gitoria#1 data**. A new `commentsTable` (pk @id, indexes `pr`, `app`); rendered on /pulls under the PRand a PR page. A verdict also becomes a status row. Since PRs are not stored, comments are keyed by `pr sha` and a line commentkeeps `commit` (the head sha it was written against) so a moved branch shows "outdated" instead of lying.Output hygiene: comment text is Markdown rendered by lib/markdown.hl — check that it escapes HTML (not checked here).Rate limit: per app token, e.g. 60 writes/min and 200 reads/min (gap: see section 6).## 5. Options### Option A — Minimal: signed webhook + read API, no stored comments (small, ~5 steps)Steps: (1) `appsTable` + R3 manual registration in Settings (URL, secret shown once, token shown once); (2) event raise intransport.hl + HMAC sign + one-shot POST; (3) `GET /api/pulls`, `…/diff`; (4) `/api/…` token check; (5) remove/rotate.The reviewer posts its review as a **ticket comment** through the tickets connect it already knows? No — only gitoria holds thetickets key. So in A the reviewer has no way to show results inside gitoria; it must show them on its own site. Weak first use case.Risks: small. Use when only a CI trigger is wanted.### Option B — Recommended: per-repo apps with connect flow, retry queue, comments and status (medium, ~10 steps)1. `lib/diff.hl`: PR diff + file list + commit diff (`git diff --no-color --no-ext-diff -M target...source`, size caps).Needed for gitoria's own UI too (README says "Not built").2. `lib/apps.hl`: `appsTable`, token `gap_`, `appOfToken`, rights, create/remove/rotate.3. Connect flow (R1) routes in api.hl + project.hl: `/settings/apps/add`, `/settings/apps/connected`, `/api/apps/exchange`(the same state/nonce/`ownsRepo` pattern as `connectStart`/`connectBack`); R3 as manual fallback.4. Event raising: parse before/after refs in transport.hl; PR opened / synchronize / merged detection (tip table).5. `deliveriesTable` + sender: HMAC-SHA256, POST, retry schedule, retention (framework gap: where does it run? see section 6).6. `commentsTable`, `statusTable`; routes of section 4 with token check and rights.7. Render comments and status badges on /pulls (components/pulls.hl) with owner delete.8. Settings → Apps page (list, last delivery status, remove, rotate, redeliver).9. Tests: HMAC vector, SSRF guard, token of repo A refused on repo B, private repo, retry after downtime, duplicate delivery.10. Docs: `docs/apps-api.md` for the external reviewer (events, payloads, curl examples) and README/DECISIONS entries.11. (Goal of section 9) A stable PR number per repo, a `closed` event for a PR whose branch is deleted or force-moved, the`preview` link field on the status route and its badge on /pulls. About +3 steps: B is then ~13 steps.Also split: steps 1 and 2–6 can ship in two PRs.### Option C — Full GitHub-App clone with generic scopes and a marketplace (large, 20+ steps)Per-app identities, user installation across many repos, scopes, org-wide install, event subscriptions per app, app manifest,OAuth-style user tokens, webhooks for every gitoria object (issues, releases), pagination and versioned API. Nothing inthe task asks for it. Do later, if more than one app exists and a second use case shows what a scope should be.### Variant of B: comments go into the linked ticketIf the repo is connected to tickets, the review could be posted by gitoria as a comment on the ticket named by the PR (`fixes #N`),using `commentTicket`. Pro: no comment table. Con: only PRs with a ticket reference; a review per line does not fit; tickets'role rules apply and the comment would be posted as the owner. Use as an add-on only, not the base.### Risks (all options)- **Secrets**: hook secret and token shown ONCE and stored hashed (token) / encrypted or at least never sent to a page(the HMAC secret must be readable by the server to sign: store it in `apps.db` file with mode 0600 like `tktKey` today,which sits in repos.db in plain text — same exposure class; flag it, don't hide it). Never log tokens (follow `connectLog`:"never the code, the state value or a key"). Timing: compare hashes, not strings, as `userOfToken` does via index lookup.- **SSRF through the registered hook URL** (gitoria's server will POST to a URL a user typed in R3): restrict to `https://`,host must resolve to a public address (refuse 127/8, 10/8, 172.16/12, 192.168/16, 169.254/16, ::1, fc00::/7, and the dockernetwork names); re-check at send time (DNS rebinding), do not follow redirects, cap response read, fixed timeout, no customheaders from the owner. The connect flow R1 narrows this to `worldapi.org` and subdomains (tickets rule) — a strongreason to prefer R1. FRAMEWORK GAP: hl:fetch README shows no way to pin the resolved address or refuse private ranges —the check has to be done before the call by resolving separately; hl has no documented DNS resolve call → ask Hybriel.- **Private repos (#34)**: a payload for a private repo goes only to an app the owner registered; the diff route answers 404to any other token; an app token never works across repos; a repo turned private later keeps its apps (decide: keep, owner'schoice); a repo moved with `tools/move-repo.hl` (name changes, "the old name forwards") — the app row must follow the repo'sid (`repo.id`), not the slug, and payloads must carry the new slug. The org case: apps of a private org see only the repo registered.- **Prompt injection / abuse by content**: the reviewer app (an LLM tool) reads attacker-controlled diffs; it must not holdany right beyond comment and status, which is why `merge` and `push` are not in the list.- **Load**: a diff of a huge commit blocks the single server (git runs by `hl:proc`, `callGit` has 300 s). Cap output, capconcurrency per token.- **Replay**: delivery id + timestamp in a header; the receiver should reject bodies older than 5 minutes.- **Comment spam**: per-app rate limit and a max number of comments per PR; owner can delete and remove the app.- **DECISIONS.md**: no decision of the creator covers apps. Section "pull requests" says the dev does the final click: theplan respects it (no app merge).## 6. Framework gaps (Hybriel / hl:web) — checked in HL-PRIMER and the plugin READMEs; not guessed1. **Background work / queue**: the primer says "Every call is awaited. There is no async". `hl:time` has `every(s)`, `after(s)`timers and `hl:proc` has `spawn`. A delivery sender must not run inside the push request (a slow app would delay `git push`;`fetch` blocks until answer or `timeoutMs`). A timer (`every(30)`) that reads `deliveriesTable` is likely the way; nothingin the primer says a function route may spawn work that outlives its request. **Gap line: no documented request-detachedtask.** Fallback: send deliveries from an `every` tick only, and let the push route just write a row (cheap, no blocking).2. **HMAC**: crypto README documents ES256, ECDH, HKDF, AES-GCM, base64url. Gitoria already uses `sha256` and `randomBytes` fromhl:crypto, and the primer lists `hash`/`verify`. **HMAC-SHA256 is not documented.** HMAC can be built from sha256 by hand(ipad/opad with the 64-byte block; needs bytes XOR) but a built-in is safer. Gap. Alternative in tokens-style: send thesecret as a header (`Authorization: Bearer`) — weaker (the secret travels), only if HMAC is not available.3. **SSRF guard / DNS**: no resolve or "refuse private ranges" option in hl:fetch (see section 5). Gap.4. **Raw request body in a function route**: transport.hl already reads `req.body` (a String of raw bytes) — fine for a POST withJSON. No gap. Request-body size limit exists (`uploadMax`) in WebFramework.5. **Response for a long diff**: no streaming; the diff is built in memory by `gitRaw` (capped by `lines`?) → needs an explicit cap.6. **Rate limit**: no limiter in the primer; build with a table or in memory by token and minute. Minor gap.7. **Function routes for write** with the session store by reference are described in api.hl (`&req, &sessions`); a bearer-tokenroute needs no session, so ordinary `(route, req) =>` works (as `gitKeys` and `gitAccess` do). No gap.8. **Dev tests**: no HTTP mock receiver in the repo's tests that I read (not checked tests/); a hook receiver for tests needs a tiny9. (Goal of section 9) **Timers in the app**: docker-compose.yml says "gitoria has no background jobs or timers". The retry queueand any expiry job would be the first. A timer is documented in hl:time (`every`), but is untested in gitoria and thestandby swap (two processes on one bind mount, see deploy.sh step 4) would run it twice: a job needs a lock row. Gap.10. (Goal of section 9) **Starting containers is not gitoria's job and not hl:web's**: no framework feature is involved; thedeployer is a separate service with its own access to docker. Not a gap, but it means Option B has no framework support for it.local route. Minor.## 7. Open questions (one word each)1. Who builds the reviewer and where does it run — the external reviewer in a separate repo, or a module inside gitoria? (the external reviewer decides; the plan assumes separate.)2. Reviewer hosted on worldapi.org (subdomain) or elsewhere? (decides whether R1 `return` can be limited to worldapi.org: yes/no)3. May the reviewer app merge PRs ever? (plan says no — yes/no)4. Must reviews also show inside gitoria's pages (/pulls), or may the app show them on its own site? (inside/outside)5. Org repos: may the org owner register an app for the whole org (all repos)? (yes/no)6. Private repos: does the reviewer (an LLM service, code leaves the server) get private repos too? (yes/no)7. Need a stable PR number (#1, #2…) instead of the commit sha? (yes/no)8. Should apps also be allowed for a second use (CI, notifier) from day one, or reviewer only? (reviewer/more)9. Does hybriel get HMAC and request-detached tasks, or does gitoria build around them? (hybriel/gitoria)10. Is the hook secret allowed in plain text in storage (like `tktKey`)? (yes/no)## 8. Not checkedlib/code.hl and the commit component (whether a commit diff view exists despite the README line), components/pulls.hl,markdown.hl HTML escaping, tests/, the fetch plugin README beyond its header, CodeRabbit's own docs (the GitHub App shape isknown from GitHub's docs only: webhook + installation token + REST review comments), Gitea/Forgejo webhook docs(shape follows GitHub's: `X-Gitea-Signature` HMAC-SHA256 hex — taken from memory, not fetched here, treat as unverified).## 9. PR-focused development: review containerscaramboleyo's goal (unchanged): "with the code reviwere in the making we then start to move to a PR focused development. full goalhere is to auto deploy PRs in an own review container. features can then be merged by me, when i accept them. smaller and utilitythings directly from you." Read for this: deploy.sh, docker-compose.yml, Dockerfile, CONCEPT.md.### (a) Does option B still fit?Yes. A deployer is a second registered app: same registration, token, signed events. What changes: a lost `closed` event leaves acontainer running, so the retry queue (section 3) is a must, and the deployer reconciles at start (`GET /api/pulls` vs its runningcontainers; state is derivable from git). Events that drive it: `opened` → build + start `pr-<n>`, status pending→success with url;`synchronize` → rebuild, replace; `closed` merged → remove container and data; `closed` not merged → same. Gitoria has no "closedwithout merge" today (a PR is only `open` or `merged`, pulls.hl): new, raised when the source branch disappears.### (b) What the deployer needs from gitoria1. Events with `number` and `head` sha (payload of section 3 plus `number`).2. **A stable PR number.** None today: the id is the sha of the `|||PR` commit and changes when that commit is rewritten. Containername/address `pr-<n>` needs a number never changed or reused: table `{repo, source branch, target → n}`, n = max+1 at first sight (~1 step).3. Read access to the code at `head`: an app right `clone` (read-only, this repo only, as the HTTPS git password like `idt_` keys) or`GET /api/archive?ref=<sha>` (tar, size cap).4. A status with a link: `PUT /api/pulls/:id/status {state, label, text, url}` shown as "preview: <url>" on /pulls. `url` must be httpson the preview zone the owner set for that app (no other host, no javascript:), so an app cannot put a foreign link on a repo page.5. Env/secrets for review containers: not stored by gitoria (question).### (c) How deploy works today (deploy.sh, docker-compose.yml, Dockerfile)- deploy.sh runs ON LOREANA: 6 gates (node tests, check-theme, Chrome) → backup of live storage/.sessions/.env to /media/SLOW1TB2 →rsync of the CODE (never storage/.env) to [email protected]:/CONTAINERS/projects/gitoria.worldapi.org → standby swap (standby on45014 answers 200, main 45004 restarts, standby stops) → sshd container rebuilt → public URL must answer 200 (up to 120 s).- The Dockerfile has no code (debian:12-slim + libssl3 + ca-certificates + git + openssh-client). Code = bind mount `./:/home/gitoria`,`bin/hybriel project.hl` compiles at each start (~20 s). `network_mode: host`, `HL_HOST=127.0.0.1`, port 45004. nginx ends TLS; vhost`gitoria.worldapi.org *.gitoria.worldapi.org`; wildcard DNS and certificate are the architect's. Ident knows ONE origin for login.compose says "gitoria has no background jobs or timers".- CONCEPT.md: "deploy.sh yes, until gitoria does it automatically" — automatic deploy is the stated end state, nothing says how.- A human runs the gates today; a PR deploy has nobody at the keyboard.Per-PR container, nothing built — it needs:- **Code**: `git archive <head>` into a folder on Byrodin; the bind-mount pattern needs no image build.- **Port**: one per container on 127.0.0.1 from a range with a used-ports table (main 45004, standby main+10).- **Address**: `pr-<n>.<slug>.gitoria.worldapi.org` has TWO labels below `*.gitoria…`: the wildcard cert covers one label, and gitoria readsthe first label as a repo/org slug (`slugOfHost`; one shared namespace, `pr-3` could clash). Prefer a separate zone with its own wildcardDNS, cert and an nginx map host→port (architect's, like today).- **Data**: its own empty storage, never the live bind mount or live `.env`; copying live data would copy users and private repos (#34).- **Login**: a review address is a new ident origin, or no login there (ident's rule, not gitoria's).- **Cleanup**: on closed/merged, plus a timer (older than N days, global cap); free folder, port, vhost; reconcile at deployer start.- **Security**: a PR runs its author's code on Byrodin. No live storage mount, no docker socket, and NOT `network_mode: host`(that would reach ident :45002 and gitoria :45004 on loopback). Cap concurrent builds.- **Who runs it**: not gitoria (no timers, no docker). A deployer service on Byrodin that talks to gitoria only through the API.### (d) "merged by me, when i accept them"- Code: the Merge button (`mergePullNow`, gitoria#17) works only for the repo owner (`withMerge`: `canMerge = owner && mergeable`).DECISIONS.md 2026-09-25 #13: "no, the final button click comes from the dev"; the "means" line (librarian's reading, not his words)says gitoria has no Merge button. His words fit an owner-click button; the code matches his words, the reading is off."merged by me" = the same: no code change; the librarian may fix the reading (not done here).- Reviewer and deployer never merge: no `merge` right, no such route. A `success` status is information only. Members can push butnot merge (owner only).- Both merge paths (button, `git merge` + push) must raise `closed`+`merged`.### (e) "smaller and utility things directly from you"- Direct pushes to main by the owner's agents stay allowed (`mayPush`; no protected branches, docs/git-backend.md "later"). Do not add any here.- Events: it is a `push` event with `ref = refs/heads/main`; no PR, so no review container and no `pull_request` event. The reviewersees it only if it also listens to `push` on main.- Whether a push to main (merge or direct) deploys LIVE is decided by nobody. Today it is a hand-run deploy.sh with gates and backup;an auto deploy would skip them unless the deployer repeats them. Question only; gitoria's part is the event.### New open questions (one word each; numbers continue section 7)11. Where does the deployer run and who builds it? (who) 12. Review address: separate zone or under `*.gitoria…`? (zone/gitoria)13. Login in review containers? (login/none) 14. Copy of live data into reviews? (yes/no; plan: no)15. Push to main deploys LIVE automatically? (yes/no) 16. Reviewer also looks at direct pushes to main? (yes/no)17. Merge disabled while status is `failure`? (yes/no) 18. Deploy gates per PR? (gates/none)19. Stable PR numbers #1, #2… never reused (replaces question 7)? (yes/no) 20. Containers for PRs of members, not only the owner? (yes/no)
Branches
Latest commits
- fe209ffeMerge branch 'w56-owner-members' into mainGitoria
- fa0754c8|||PR repository owner transfer and members API (#55)mre
- 8862e537Merge branch 'w55-rename-org' into mainGitoria
- 014d2b7fOne immutable readers snapshot per move for the left-organization event (#53)mre
- 1859d506Decide who hears a repo left its organization by its readers before the move (#53)mre
- 499f25f2Review fixes for the Settings organization move (#53)mre
- ed3b922b|||PR move a repository into an organization in Settings (#53)mre
- 74ec2af8Merge branch 'w54-repo-rename-pr' into mainGitoria
- 9f7ce8d8Preserve rename compatibility and live page titlesmre
- c3d95b6e|||PR separate names and addresses, rename repositories in Settings (#53)mre
- ce08920dMerge branch 'w52c-header-phone' into mainGitoria
- 0bab9e46|||PR header: ident status wraps on phones instead of clippingmre
- e7af3eceMerge branch 'w52b-approval-followup' into mainGitoria
- c01e66c6|||PR approvals follow-up: live Merge after status writes, helpers (#52)mre
- 841da497Merge branch 'w53-pulls-speed-pr' into mainGitoria
- 80307ae2|||PR pulls page cache: live PR numbers, complete scans onlymre
- 69141f65|||PR pulls page: cache the git part per repo by branch tipsmre
- 155861f6Merge branch 'w52-person-approval' into mainGitoria
- b5435de8|||PR person approvals: second Kunibert round (#52)mre
- 3a8b2fb8|||PR person approvals: Kunibert review fixes (#52)mre