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
- 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
- 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