gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit1a687b151a687b15Merge branch 'w48-member-merge'mre1a687b15/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 Vinzenz'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

  • 1a687b15Merge branch 'w48-member-merge'mre
  • 166c775fW48 report, logmre
  • 1b4623f0Members merge pull requests: API route, button on /pulls and /pulls/N, one shared merge pathmre
  • 1075c38cW48 mission, logmre
  • 17bdd0d6V37/V39 missions, logmre
  • 146de5f8Re-vendor gitoria to Hybriel set-day39 (51e921d7)mre
  • e874e44dtests/status-keyed: app token lives 60 s so it outlives the gate's two restartsmre
  • 270b8d61deploy.sh: DEPLOY_STOP_START=1 stops, waits for the old pid, then starts (mpackdb freeze, replaces the standby swap)mre
  • 3f9235b8project.hl: drop the dummy /pulls/:n component route (hybriel#294 is fixed in day37)mre
  • c90daf19Re-vendor gitoria to Hybriel set-day37 (f6b3d45b)mre
  • 03b5bb08W39 report to reports/, drop scratch repro, mission + logmre
  • 154d333fMerge w39-create-api: POST /api/repos with a user token (#39)mre
  • 149dd512Rewrite W39 reportmre
  • e5385075Expect 401 for POST /api/repos without a tokenmre
  • 1a76055cDocument repository creation APImre
  • 4d779b3bAdd create-api gatemre
  • 88563122Add POST /api/repos for user tokensmre
  • b00860e3Create repositories with member checks in createRepoInmre
  • 0a38f236Report repository creation API blockermre
  • b5f72187Record malformed JSON blocker for repository creationmre