gitoria

gitoria

All repositories: gitoria

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

7.0 KB

  1. # W46 — statuses an app sets on a PR, required before merge (gitoria#46)
  2. Branch `w46-status` (worktree `W46/wt`, base main 49533a5). Nothing pushed, deployed or written to tickets. Live was never touched.
  3. ## Built
  4. - `lib/statuses.hl` (new, the topic file): tables `statuses.db` (one row per repo id + head sha + context: state, title, summary, url, appId, appName, updated) and `statusreq.db` (required contexts per repo id). The PUT's work, the owner's require/remove, the badges, and the server-side merge check.
  5. - `lib/api.hl` `appStatus` + `project.hl` route `for (p of apiPatterns('/statuses/:sha'))`, so it answers on the repo address and on both organisation spellings. It uses `appOfRequest` (401 for no or bad token, 404 for another repo).
  6. - `lib/pulls.hl`: `mergePullNow` refuses unless every required context is `success` on the head that would be merged (the source branch tip, read on the server). The refusal says which: `Not merged: the required checks are not successful on the current head <8 hex>: kunibert (failure), lint (not set).` `pullsView` also carries the badges.
  7. - `components/pulls.hl`: small badges per PR for its current head (state, "<app>: <context>", title as text). `error` is its own class, italic, apart from `failure`. The Merge button turns off (`nomerge`) with the text "Merge waits for: …".
  8. - `components/settings.hl`: owner-only section "Required before merge" next to Apps, in the style of the Members/Apps forms. It has a context input, "Require it", a list with Remove, and an error line. A non-owner gets no section, and the server faces refuse non-owners.
  9. - `tests/status.mjs` (49 checks), added to `deploy.sh` GATES.
  10. - Commits: e5a0b64, c6162f0, 6b02279, plus "badges without decorative borders" (the theme check refused a border).
  11. ## Contract §5 Status: covered
  12. PUT → `200 {"status":{sha,context,state,title,summary,url,app:{id,name},updated}}`. A newer PUT of the same (sha, context) replaces the row. Validation gives 422 `invalid` with `details`:
  13. - state must be pending, success, failure or error;
  14. - context is one line, at most 100 characters;
  15. - title is one line, at most 200 characters;
  16. - summary is at most 65,536 characters (65,537 is refused);
  17. - url is https only or null.
  18. A sha that is not a commit of this repo gives 422 with `details: sha no_such_commit`. That covers a zero sha, a short sha, garbage, a tree sha and a commit that exists only in another repo. Bad JSON gives 400 `invalid_json`. A wrong method gives 405. The shown name is "<app name>: <context>" and the app id is stored.
  19. Not covered: the 429 limits and the 413 body limit (that is #47). The contract says nothing about a status for a sha that is not a PR head. I accept any commit of the repo, which matches "sha must be a commit of the repo".
  20. ## Tests (LC_ALL=C, ports only 8730–8739, runner `W46/run-gates.sh`, logs in `W46/gates/`)
  21. Final results, 0 failed everywhere:
  22. - signin-return 3 passed (after I passed the Chrome port range correctly: `GITORIA_SIGNIN_CHROME=8738-8739`)
  23. - check-theme 70 files, 0 problems
  24. - browser 266 passed (rerun after the last CSS change)
  25. - security 82
  26. - private 158
  27. - ident-access 30
  28. - apps 95
  29. - pull-numbers 48
  30. - pull-ssh 20
  31. - app-token 42
  32. - events 52
  33. - status 49 (rerun after the last CSS change)
  34. The first full run had two failures. theme found 2 decorative borders in my badge CSS; I removed them. signin-return failed only because I gave it a single Chrome port instead of a range. No flake.
  35. `tests/status.mjs` runs real HTTP and the real `git`, with a private ident. It covers:
  36. - PUT, replace (only one badge on /pulls), and every validation case;
  37. - no token 401, another app's token on this repo 404, no repo 404, unknown or foreign-repo sha 422;
  38. - required context: blocked on failure, pending and error. `error` shows as `badge error` and does not count as success. Success unblocks the button. A push after success blocks again (a "not set" on the new head, and the server refuses). A second required context must also pass, and the merge then goes through on the server (main moved);
  39. - Settings: signed out and a non-owner are refused, and the non-owner's page has no section;
  40. - the key and token never appear in the log;
  41. - after a restart, the token, the stored row and the requirement still work.
  42. The gate fails on old code in the obvious way: every required check goes red without `lib/statuses.hl`, because the route and faces do not exist. I did not run it against the base commit.
  43. ## DOCS / GAP
  44. - DOCS used: HL-PRIMER, CODE-ORDER, COMPONENTS "a function route and its request", §4 Styles, "List rendering", "Conditional rendering".
  45. - GAP 1: `context` is a reserved word and cannot be a parameter name. The error is `'context' is a reserved word and cannot be a name`. The compile message for the following lines is misleading ("Expected '{' after 'isolate'"). Repro: `static f = (userId, context) => { return context }`. I renamed my parameters to `ctxName`. The contract's JSON field `context` still reads fine as `j.context`, and `context =` works as a literal key.
  46. - GAP 2: inside a hybrid literal a named entry shadows a function parameter of the same name for the entries after it. `row = { app = app.id appName = app.name }` fails with "reading 'name': the value is String". I renamed the field `appId`. A tiny repro: `f = (app) => { return { app = app.id n = app.name } }`.
  47. - GAP 3 (already known in api.hl): `JSON.parse` of broken JSON ends the request. I used the same shape as `appExchange`: the body must look like `{…}` first, so a truncated object like `{"a":` that starts and ends with braces would still end the request.
  48. - A page's HTML carries the whole state as JSON as well as the markup, so tests must match the rendered elements, not plain text.
  49. ## Not done / open
  50. - **Proof in his Chrome on lisbeth :9223 at 390/800/1280 px is NOT done.** My budget went to the build and the gates. I did not use his Chrome, so no tab was opened or left. The gates run headless. Someone must look at the badges and the Settings section in his Chrome (phone, tablet, desktop) before this is called done. Style risk: the badges are flex-wrapped `inline-flex` pills on `--color-background-sunken`. I have not looked at them on screen.
  51. - No README/docs entry yet for the new files (README "Files", `docs/apps-api.md` says "Not built yet" as before). Not touched, because the contract is fixed.
  52. - The /pulls badge head is the source branch tip (via `rev-parse`), the same value the merge check uses. Gitoria's PR record `head` follows the push through `syncAndRaise`. If they ever differ for a moment, the status of the branch tip decides.
  53. - Statuses are not removed when a PR is gone. There is no retention or limit on the number of status rows per repo (only the required list is capped at 20).
  54. - A status on a head that is not currently a PR head is accepted and stored, and has no visible effect.
  55. ## Stopped / cleaned
  56. My gate servers, ident servers and test Chrome exited on their own: `ss -ltn | grep ':873'` is empty and no chrome has a cwd in W46. I killed one stuck copy of my first test run (PIDs 439025, 439026, 439035) after checking their cwd was in W46. Another worker's process under W44 (PID 623812) was left alone. I never touched lisbeth :9223.

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