gitoria
All repositories: gitoria
3.1 KB
# W49 — members read PRs by API with a gtr_ token (Apollo GO 2026-11-04)Task (Apollo, verbatim): "(1) yes. (2) GO too (Sol, small): conductors in the PR workflow need to read their PRs, reviews, threads and check states by API with their gtr_ token (members read-only; write stays as is)."(1) = a clear 401 for a gtr_ token on the app-only routes instead of "missing, unknown or expired token".## Rules- Read fully first: /media/STORAGE/projects/WorldAPI/worldapi-conductor/archive/2026-10-31/WORKER-RULES.md, /media/STORAGE/projects/hybriel/docs/HL-PRIMER.md, /media/STORAGE/projects/hybriel/docs/CODE-ORDER.md. Copy working shapes from the existing code (lib/api.hl apiMergePull is the model for gtr_ auth). No hand-written JS. A framework gap → DOCS line in the report, no workaround.- Work in a git worktree: `git worktree add /media/STORAGE/claude-scratch/gitoria/W49 -b w49-member-read main` from /media/STORAGE/projects/WorldAPI/gitoria.worldapi.org. Commit there; do NOT merge, push or deploy. Never touch live (byrodin) or his repos/data.- Ports for gate runs: 8720–8739 only (check `ss -ltn`).- Do not edit docs/apps-api.md (the external reviewer's contract); put the proposed contract text in the report.## What to build1. GET routes in lib/api.hl: appPulls, appPull, GET of appReviews, appThreads, GET of appComments, GET of appStatus (GET {api}/statuses/<sha>). Accept EITHER the app token (unchanged behaviour) OR a gtr_ token of a user for whom mayRead(uid, repo) and mayPush(uid, repo) hold (owner/member/org = "members"). Non-member gtr_ → 404 not_found (like a repo that does not exist). Rate limit: keep the app limit for apps; for users reuse whatever the existing gtr_ routes do (say so in the report).- listReviews/listThreads take the app (who.app): find out what the app is used for in reads (e.g. "own" flags) and pass the right neutral value for a user; no app-specific data must leak or break.- ONE helper (e.g. in lib/app-auth.hl: readerOfRequest(route, req) → { repo, app|null, user|null } or { error }), not copies per route.2. All POST/PUT (writes) stay app-only. A gtr_ token on any app-only route (writes, deliveries, redeliver, apps token routes that take gat_) → 401 with message "this route needs an app token (gat_); user tokens (gtr_) can read pulls, reviews, threads, comments and statuses and merge with POST /pulls/N/merge". Unknown/expired gat_ keeps the old message.3. Gate: extend tests (copy the shape of the member-merge gate added in W48, see tests/ and deploy.sh GATES): member gtr_ reads all 6 GETs 200 with the same body shape as the app; non-member gtr_ 404; no token 401; gtr_ on a POST review / PUT status → 401 with the new message; app token behaviour unchanged. Then run ALL gates (LC_ALL=C): `node theme/check-theme.mjs .`, `node tests/browser.mjs`, and every gate in deploy.sh GATES — all 0 failed.## ReportWrite /media/STORAGE/projects/WorldAPI/gitoria.worldapi.org/reports/W49-REPORT.md: commits, files changed, gate results with counts, rate-limit choice, the reviews/threads app-parameter decision, proposed docs/apps-api.md text for the external reviewer, DOCS lines. Then STOP.
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
- 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
- 2a89d8d0|||PR person approvals: Approve button for people; merge needs the required checks or a listed person's approval (#52)mre
- 83f0c953Report person approval verificationmre
- 3ae94b86Record browser failures and verify owned tab cleanupmre
- 54eec687Gate person approvals and merge alternativesmre
- 12b08829Add person approvals for pull request headsmre
- 55c84779Merge branch 'gp-gate-ports' into mainGitoria
- 57af42bbREADME: point to deploy.sh for the port listmre
- d63375d2README: gate commands with explicit portsmre
- feeaa701|||PR gates: explicit ports only, deploy.sh passes themmre
- 6cc1f943Merge branch 'records-1112' into mainGitoria
- 9448c438|||PR records: LOG, missions and reports since 11-09mre
- 6dc08a8eMerge branch 'p51-public-pr-reads' into mainGitoria