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
- f6d32341log: Apollo on budget and #25 nextmre
- d7184f53log: batch live, #25 evidencemre
- 5e25e816log: W61 mergedmre
- aafe330dTidy: drop evidence JSON (kept in scratch), collapse blank linesmre
- aca1fda1Merge W61: theme from layouts 17e0f03, Views refer to Style rules (gitoria#37 #27)mre
- 03cb650blog: W61 theme decisionmre
- 248bce85Report final style gates, CSS mappings and 136 whole-image comparisonsmre
- 153c344bRestore organization metadata exposed by the whole-image comparisonmre
- 917a1465Update status gate assertions for the referenced state rulemre
- 3cdb02c6Own settings feedback styles and explain connection-state classesmre
- 00d5d6c4Reference code-entry styles and nest code-browser media and pseudosmre
- 3c425eddReference PR content styles and explain dynamic state classesmre
- e46fa222Own shell feedback styles and retain documented selector formsmre
- c26084c4Reference repository list styles and nest its breakpointmre
- f3e196b5Document Markdown direct-child selector remaindersmre
- 70597528Reference pull list rules and explain runtime class predicatesmre
- 1ce7ac24Reference ticket row and feedback styles from its Viewmre
- 10cdf54bGive organization repository rows their own Style referencesmre
- 0d019521Document shared class selectors in the styles-only filemre
- c67404a7Scope token labels and feedback through the token Viewmre