gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchf2-api-bugs26117255|||PR apps API: review comments on files with spaces in their namemref2-api-bugs/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

  • 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
  • b88e39f1log: privacy cleanup donemre
  • bfd7826ddocs: neutral example organisation namemre