gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainfe209ffeMerge branch 'w56-owner-members' into mainGitoriamain/reports/W47-REPORT.md

4.2 KB

  1. # W47 report — gitoria#47 limits, status read route, linked tickets, docs
  2. Branch `w47-limits` (worktree wt/ here), base 0a46bf7. One commit: "gitoria#47: rate limits per app (429, Retry-After), status read route, statuses and required on the pull, one JSON check for every write route". Not pushed, not deployed.
  3. ## Built
  4. - lib/limits.hl (new): per app id, fixed one-minute window, 300 reads (GET) / 60 writes (everything else). Env, gate only: GITORIA_LIMIT_READS, GITORIA_LIMIT_WRITES, GITORIA_LIMIT_WINDOW_MS. 429 `rate_limited` + `Retry-After` (whole seconds) via app-auth.hl `tooMany`.
  5. Counted in appOfRequest AFTER token + repo check (bad token / other repo cost nothing), and in appToken (a write). Apps/exchange (no auth) not counted.
  6. **Deploy swap**: counts are in the process. A restart/swap starts every app at 0; during the swap the two processes count apart (an app can get up to 2x). Proven in the gate (restart → Zed at zero).
  7. - v1.3: `GET {api}/statuses/<sha>` (same route as PUT, method dispatch in appStatus) → `{"statuses":[...]}` all apps; 404 not_found for unknown/foreign/malformed sha. status JSON has `app:{id,name}` and `head` (see doubt 1). pullObject has `statuses` (current head, all apps) and `required` (names).
  8. - Tickets (§4): list was already per contract (explicit always, bare only when connected). One fix: a number before a full stop ("Closes #5.", "Fixes proj#7.") was dropped because '.' counted as a name char; now listed. Covered both unconnected and connected.
  9. - 413/400: jsonOfRequest already did 413+400 for reviews/comments/replies/resolve; appStatus and appExchange had their own copy without 413 → now use jsonOfRequest. All write routes covered by the gate.
  10. - README: "Apps API" section + env row. docs/apps-api.md untouched.
  11. - tests/limits.mjs + tests/limits-probe.hl (connects a repo to a tickets project while the server is stopped), added to deploy.sh GATES. Ports 8734/8735 (env GITORIA_LIMITS_PORT / _IDENT_PORT). 53 checks.
  12. ## Gates (LC_ALL=C), all 0 failed
  13. signin 3, check-theme 76 files 0 problems, browser 266, security 82, private 158, ident-access 30, apps 95, pull-numbers 48, pull-ssh 20, app-token 42, reviews 98, events 52, status 49, limits 53. No flake.
  14. NOTE: other gates' default ports (8700-8709, 8720-8726, 8744, 8760, 8913/8914) are outside my range and 8700/8721 were taken by another worker, so I ran them with port env overrides inside 8730-8739 (script gates2.sh here; GITORIA_GATE_PORT/_IDENT_PORT/_CHROME, GITORIA_PULLS_PORT, GITORIA_PULLSSH_PORT/_SSH_PORT, GITORIA_REVIEWS_PORT, GITORIA_EVENTS_PORT, GITORIA_SEC_*, GITORIA_PRIV_*, GITORIA_IDA_*, GITORIA_SIGNIN_PORT). deploy.sh itself runs them on defaults.
  15. ## Contract points
  16. Covered: §6 429/413/400, Retry-After, 300/60 per app; §5 GET statuses, status.app, pull.statuses/required (also in GET pulls list and events since same pullObject; events gate unchanged and green); §4 tickets.
  17. Not covered: no explicit gate on the event body carrying statuses/required (same function as GET pulls/N).
  18. ## DOCS/GAP
  19. - DOCS/GAP: JSON.parse of broken JSON that still looks like an object (`{"a":}`) aborts the request (500); no safe parse. Repro: `x = JSON.parse('{"a":}')` in a .hl file → "JSON.parse: invalid JSON at line 1, column 6 … aborted due to 1 runtime error" (repro/p.hl). Not worked around; bodies not shaped like `{…}` get 400. Gate checks `{"a":`, `{`, `[1,2]`, `null`, `123`, ``, `hello` → 400, not the `{"a":}` case.
  20. ## Contract doubts (not changed)
  21. 1. §5 says status has `head`; live code (#46) emitted `sha`. I emit BOTH (`head` added). Drop `sha` once Kunibert uses `head`.
  22. 2. "an app writes only its own": nothing enforces it. One row per (sha, context): app B PUTting context "kunibert" replaces app A's row (appId/appName switch). Since a required context decides Merge, any connected app of the repo can fake success for another's context. Suggest 409/403 `context_owned` (or key rows by app+context). Not built (not in contract; needs the external reviewer's call).
  23. 3. Tickets name edge: `x-#12` / `end.#12` take the text before # as the project name. Minor.
  24. 4. GET statuses order = stored order, not specified.
  25. ## Risks
  26. - Fixed window allows a burst of 2x at a window edge. Limits not shared across the two swap processes. Token calls count as writes (60/min is plenty for 1-hour tokens).

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