gitoria
All repositories: gitoria
7.9 KB
# W45 report — the PR page (gitoria#45, part of push API #38)Branch `w45-pr-page` (worktree /media/STORAGE/claude-scratch/gitoria/W45/wt, base main 0a46bf7). Nothing pushed, deployed or written to tickets.## Commits- 7a60283 raiseEvent can send to ONE app (`extra.onlyApp`, like `exceptApp`, never put in the body); lib/reviews.hl gets the people-side writes (personComment, personReply, personResolve, anyThreadOf, pullTalk, authorOfUser: type user, same seq counter as #44)- e2eff8f the page: lib/prpage.hl (all logic), components/pull.hl (page), `pullPage` in lib/api.hl, routes `/pulls/:n` and `/:orepo/pulls/:n` in project.hl, /pulls list links each title to its page (pullsync.hl `withNumbers` adds `pageHref`), the Pull requests tab stays active on `/pulls/N`- 483141d Settings: the Apps section and heading only for the owner (also shown to a signed-in non-owner who is mid connect-flow, because that section carries the "only the owner can connect X" message)- f719813 tests/pr-page.mjs (61 checks) + added to deploy.sh GATES- fb9e755 tests/browser.mjs: the old check "/pulls title links to the commit" now expects the PR page## What it does- `/pulls/N` (and `/<repo>/pulls/N` on an organization address): a function route; 200 for a PR number of a repo the viewer may see, real 404 (shell 404 page) for unknown, 0, 1x, -1, 1.5, abc, unknown repo. Keyed by repo id + number (`recordByNumber`), never a list position.- Shows title (ticket refs as on the list), #number, state, source → target, author, head, statuses on the CURRENT head (same badges), per connected app its current verdict (`currentVerdict`; "on an earlier head …" when not the current head; "no review yet"), the reviews (app, verdict, head, body), the threads (path:line, outdated/resolved mark, comments oldest first by seq) and the conversation (oldest first).- All bodies go through lib/markdown.hl blocks → components/markdown.hl: text nodes only. lib/markdown.hl escapes (checked: no HTML string is built); the gate proves `<script>` / `<img onerror>` in a review, an inline comment and a conversation comment appear as text.- Who may write: ONE helper `mayWritePull(user, record)` in lib/prpage.hl = signed in AND `mayPush` (owner, repo member, org owner/member). NOT HIS (my reading). Others get the page read-only (no form, no button, a hint). The faces check the same helper again (forged calls are refused: error, nothing stored, no event).- Writes: conversation comment, reply in any app's thread, resolve/reopen, "Review again: <app>" per connected app. Body ≤ 65,536 (65,537 refused, 65,536 ok), empty refused, unknown thread/number/app refused. A display name is required (as in tickets).- Events (sender = the person): `pull_comment/created` → every app; `review_comment/created` (pull, thread, comment) → that thread's app only; `review_thread/resolved|unresolved` → that app only (resolving an already resolved thread raises nothing); `review_requested/requested` → that app only.- After each action the face answers with the page read again and the client sets its lists (no reload); a reload shows the stored state.## Tests (LC_ALL=C, ports 8720–8729)- `node tests/pr-page.mjs`: 61 passed, 0 failed; run 4 times in a row after the hydration wait fix, all green. Real ident, real git push of a |||PR branch, two apps with a receiver, headless Chrome at 390 and 1280 (comment, reply, Resolve, Reopen, Review again by real clicks; no sideways overflow; buttons ≥ 44 px at 390; signed-out read-only; unknown number shows the 404 page). Screenshots: wt/.scratch/gate-prpage-{390,1280}-member.png, -390-readonly.png (I looked at the 390 and 1280 member shots: layout fine; the sticky header in the 390 full-page shot is a capture artifact).- Old-code check: the same gate fails without the change (no route: 404 for /pulls/1; the faces do not exist).- All GATES, with my own ports: theme 0 problems; browser 266/0 (after fb9e755; before it 265/1 — the expected title-link change); signin-return 3/0; security 82/0; private 158/0; ident-access 30/0; apps 95/0; pull-numbers 48/0; pull-ssh 20/0 (docker); app-token 42/0; reviews 98/0; events 52/0; pr-page 61/0; status 49/0. No flake except the first, own hydration race in my gate (fixed by waiting for the socket, as browser.mjs does).- Settings gate point inside pr-page: owner sees `Apps`; member, other user and signed-out do not.## Contract pointsCovered: §4 events table rows review_requested, review_comment, pull_comment, review_thread (shapes: `pull`, `thread`, `comment` as §5). §5 comment shape (author type user, seq in the repo counter). Not changed: contract, statuses.hl JSON, API routes/limits, docs/apps-api.md.Not covered / open:- Proof in the creator's own Chrome (lisbeth :9223) not done; only the headless gate Chrome (allowed for gates). Needs a run there before "done".- A page opened signed out does not gain the forms when the user signs in on that page (no reload); the forms appear on next load. (Membership is only known server side.)- `/pulls/:n` as a function route means a click from the list is a full page load, not an SPA navigation.- `outdated` is shown only for threads (as the contract defines it); reviews show "current head / earlier head".- Comment times are UTC (the contract's ISO); the rest of the app shows Vienna time.- Rate limits (#47) are not applied to the page faces.## DOCS / GAPDOCS: used HL-PRIMER (all), CODE-ORDER, COMPONENTS.md "hl:web — a function route and its request", §11 Routing, §9 `route`/`host`, §12 List rendering and Conditional rendering. Questions the docs did not answer:- GAP 1 (framework): a component rendered through `srv.page(...)` from a FUNCTION route is not served to the browser as a module unless some `component =` route names it (the browser got 404 for /components/pull.hl and the page never hydrated). Workaround in project.hl (a second `{ pattern = "/pulls/:n" component = PullPage }` after the function route, never reached). Repro: a route `{ pattern="/x/:n" function=(route,req)=>{ return srv.page({route={pattern=route.route.pattern component=P} kind='component' params={n='1'} path=req.path}, req.session, srv.hostOf(req.headers['host']), srv.requestHeaders(req.headers)) } }` with P naming no component route: SSR is fine, `/components/p.hl?v=…` is 404.- GAP 2 (docs): inside a hybrid literal `m = { route = {...} params = { n = route.params.n } }` the name `route` resolves to the key just defined in the same literal, not to the function parameter (got "reading 'n': the value is Null"). Not in the docs; copied orgRepoPage's style of avoiding it by computing values before the literal.- GAP 3 (docs): `if (!flag)` in a View is refused ("takes a member, a field path…"); needs a `noX` member. Documented in the error message only; the member must also be set on every client update.- Doc question: whether `if (canAct)` inside a `for` body reads the component's member on first render and after updates; it works (gate), but §12 says a `for` body reads only entries while an `if` branch reads component state, which is easy to misread.- Doc question: `emit server f(...)` as an argument (`apply(emit server f())`) did not wait/work reliably in the browser; `r = emit server …` then `apply(r)` works.## Risks- Deploy: new routes before `/:orepo` single-segment route; `/pulls/pulls` style names are not an issue (number must be digits).- reviews.hl `personResolve` rewrites the thread row the same way the app's resolve does; two people clicking at once: last write wins.- Event raising for people's actions happens after the write, before the face returns (rows only; nothing waits for a receiver).## Stopped / leftEverything I started was stopped (gate servers, ident, receiver, Chromes, docker container are ended by the gates themselves; checked `ss`, pgrep chrome by cwd, docker ps: nothing of mine left). The worktree and scratch files remain in /media/STORAGE/claude-scratch/gitoria/W45/. About 75 requests (over the ~60 cap: the hydration race and gate-port juggling in the full run).
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