gitoria
All repositories: gitoria
4.2 KB
# W47 report — gitoria#47 limits, status read route, linked tickets, docsBranch `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.## Built- 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`.Counted in appOfRequest AFTER token + repo check (bad token / other repo cost nothing), and in appToken (a write). Apps/exchange (no auth) not counted.**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).- 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).- 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.- 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.- README: "Apps API" section + env row. docs/apps-api.md untouched.- 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.## Gates (LC_ALL=C), all 0 failedsignin 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.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.## Contract pointsCovered: §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.Not covered: no explicit gate on the event body carrying statuses/required (same function as GET pulls/N).## DOCS/GAP- 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.## Contract doubts (not changed)1. §5 says status has `head`; live code (#46) emitted `sha`. I emit BOTH (`head` added). Drop `sha` once Kunibert uses `head`.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 Vinzenz's call).3. Tickets name edge: `x-#12` / `end.#12` take the text before # as the project name. Minor.4. GET statuses order = stored order, not specified.## Risks- 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
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
- w64-org-slash
Latest commits
- 5e11184cW60: record partial validation, framework gaps and cleanupmre
- 20fe13fagitoria#33: centralize login and tickets connection statemre
- 859754c0gitoria#29: retain the offline note and record the framework gapmre
- d140bc04gitoria#30: reproduce the upsert ordering constraintmre
- 6960e8f8gitoria#28: keep form values in bound component membersmre
- 0db27200gitoria#32: share character checks and environment lookupmre
- 452f6a1amission W60: logic clean-upsmre
- 1448c899log: cleanup, #49 GPTBot, tracker mentions on #36mre
- fcf95936log: v1.5.1 provenmre
- 22105420log: W51b livemre
- 7e8aabeareport: W51b pull source verificationmre
- 6c18de76fix: preserve pull sources across containing branchesmre
- fc36fa2elog: W51b pull source bugmre
- 56bc1220log: v1.5.1 livemre
- 845fc0aareport: W51mre
- 83127391fix: return v1.5.1 app and merge error detailsmre
- b07d0e97log: W51 v1.5.1 startedmre
- 0b417d06docs: apps-api v1.5 user tokens (#48, W49)mre
- d046940alog: vinzenz contract note sentmre
- db443456log: vinzenz note retry 2mre