Repository navigation
Expand arrows on the Inbox's PR page and guided reviews - #2635
Merged
Merged
Conversation
The diffs on the PR page and in a thread's guided review showed only the patch's hunks. Modified files now get the "N unmodified lines" rows code review has, up to the whole file, and the box grows with what opens. Server (Bun only, the Inbox): - GET /api/inbox/pulls/file: one file at the head of the patch on screen and at the merge base, from a local clone that has the commit, else gh/glab. Same guards as /api/inbox/pulls/diff. 5 MB per file, cached by commit up to 64 MB, at most 6 reads at once. - GET /api/inbox/messages/:id/guide/file: only a path the guide's patch changes, only the blobs its index line names, so a tree that moved on shows no arrows rather than the wrong lines. Viewer: AllFilesCodeView takes an optional fetchFileContent; absent, it behaves as before. GuideReader takes fileContents and passes it through. A comment on an opened line carries outsideDiff and the code, because no forge takes an inline comment outside the PR's diff: it posts in the review's main comment. The store keeps both fields. Forks, binary or huge files, renamed, added or deleted files, and Code review off degrade to no arrows.
backnotprop
added a commit
that referenced
this pull request
Nov 5, 2026
…the review app's fill The owner decided there is no height limit in the Inbox: #2635 removes the cap for fitted hosts, so this drops --guide-file-fit-max, its 100cqh rule, GuideFileCard's max-height and their tests. GuideFileCard is back to #2632's. The pane stays an inline-size container for the note's room on the controls' row. From REVIEW_FOLD_PANEL_BELOW up the comments column takes the review app's bg-card/30 over --background; folded, the sheet stays a card over the diff.
…s for everyone, and only the patch's own text opens Boxes: a fitted file box is as tall as its content, with no scroller of its own. scrollWithPage answers what CodeView asks its root from the page, so Pierre's windowing, anchoring and line jumps run against the page. A file whose gap was opened stays mounted past the outer window. Arrows: the guide file route no longer needs Code review (no forge while it is off). The PR route checks both texts against the blob ids of the patch on screen, so a push behind the list, a merged PR or a retarget opens nothing. Comments on opened lines save; the arrows' rate limit no longer holds the next diff. Co-Authored-By: Claude <[email protected]>
…parator; a line under a stuck header Co-Authored-By: Claude <[email protected]>
… counts Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
…he page Mounting a guided review read every whole file and highlighted it on the main thread, so real code froze the page even if nobody opened a gap. The Inbox now mounts the review worker pool, and whole files reach Pierre through its loadDiffFiles seam on the first arrow click. Opening a comment on an opened line starts the same read, opens the range, then scrolls. The page holds the row being read itself: scroll anchoring is off on .ib-gbody, the first estimate matches what is drawn, and a box wholly above the viewport adds its change to the page's scroll. Folding from a stuck header brings the file to the top of the page. A tailnet guest's review asks nothing. A guide reads only a PR of its own project, and pulls/file only a path its diff changes. Co-Authored-By: Claude <[email protected]>
Takes #2640's rule early so the two merge cleanly: head_sha in both scopes, and readHeads holds only heads that held still. A file read uses that head, else the list's, and the client asks nothing when an answer has no head_sha, in either scope. Co-Authored-By: Claude <[email protected]>
…r-page-expand-context # Conflicts: # packages/server/inbox.ts
…ontext # Conflicts: # packages/inbox/components/GuidePane.tsx # packages/inbox/pulls/PullReview.tsx
… start with a reader A fork's commits are reachable by id from the base repository on both forges, so its files read like any other. A renamed and edited file opens too, its old side read at its old path. A forge that did not answer is no longer taken for "no such file": the arrows stay and the next click asks again, and nothing empty is kept. The worker pool moves from the Inbox's root to GuideReader, so a page with no diff holds none. A first read now shows on the arrows while it runs. Arrow rows with one button and with two now size alike, on the phone too. Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
…mber under -U0 `oldPath` comes from the guide's patch, so a `rename from ../../../../user` reached the forge route with the owner's token: fileContents now validates it. An empty answer or a 404 stays out of fileTexts and mergeBases, so a passing sign-in problem doesn't leave a file without arrows until restart. newLineOf treats git's zero-count side as the line before the hunk. Co-Authored-By: Claude <[email protected]>
Keeps both sides in ReviewPane (guest and onAsk), GuideReader (the worker pool wrapper with main's new props) and the imports of inbox-guides and inbox. Co-Authored-By: Claude <[email protected]>
Conflicts kept both sides: `guest` and `codeReview`, the outside-diff and outdated labels together, `fetchFileContent`/`fileContents` with `fileOpenIn`, #2640's readHead comment with hasCommit and fileContents, its key comment over ReaderPart, the union of imports, and both e2e tests (main's first). Co-Authored-By: Claude <[email protected]>
The push test leaves the Inbox's last read head on a commit the fake forge has no file texts for, so the arrows' read found nothing after it. Co-Authored-By: Claude <[email protected]>
backnotprop
marked this pull request as ready for review
November 5, 2026 18:59
With the page as the scroller, every page scroll reached Pierre's CodeView as a scroll of its own root, and Pierre turned its rows' pointer events off for 120 ms after each one. The Viewed and fold buttons on a file header stuck at the top missed a click right after a scroll (inbox-code-review.spec.ts:883 at scroll 216). Views that scroll with the page keep pointer events on.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Targets
main, with #2640 and #2661 merged in. This branch doesn't depend on #2639, which is on hold.Adds the "N unmodified lines" rows and arrows from Plannotator's code review to the Inbox's PR page and guided reviews, up to the whole file. In the Inbox a file's box is as tall as its content, with no height limit, and the page scrolls.
No height limit
In the
fitFileHeightshosts (the PR page and a thread's guided review) there is noMAX_DIFF_HEIGHTand no scroller inside the box. Hosts withoutfitFileHeightsare unchanged.The approach comes from diffshub: it has one
CodeViewwhose root is the page's scroller, and it stays fast becauseCodeViewonly draws the rows near the viewport. Our chain has a page with manyCodeViews in it, soscrollWithPage(packages/review-editor/utils/scrollWithPage.ts) makes eachCodeViewread.ib-gbody's scroll position instead of its own. The browser scrolls, and headers stick with plain CSS. We don't position rows, and we add no virtualizer..ib-gbodyturns browser scroll anchoring off (it never helped here, and Safari has none), the first estimate matches what is drawn, and a box wholly above the viewport adds its change in height to the page's scroll.Nothing is read until someone opens an arrow
Mounting a file used to read its whole text and tokenize it on the main thread, which froze the page on real code even if nobody opened a gap. Now
GuideReadermountsReviewWorkerPoolProvider, so highlighting is off the main thread, and whole files come through Pierre'sloadDiffFiles, called on the first arrow click. The pool's workers start with the first reader on screen and end with the last, so a page with no diff holds none. While a first read runs, the file's arrows pulse.Two consequences, both from not asking until someone opens an arrow:
Arrows for everyone
GET /api/inbox/messages/:id/guide/fileno longer needs Code review (with it on, it reads through the forge only for a PR of the message's own project), andGuidePaneno longer takescodeReviewor swaps its key. It reads only the repo's own blobs, so noghorglab. With Code review off, a guide whose blobs aren't local has no arrows and makes no forge call. A tailnet guest gets no reader, so no silent 403s.Server (Bun only, the Inbox)
GET /api/inbox/pulls/file?key&scope&path&old&new: only a path that diff changes; one file at the head of the patch on screen and at the merge base, from a local clone that has the commit, elsegh api/glab api. Guards are the same as/api/inbox/pulls/diff: owner or local, same origin, Code review off answers 409. Cap is 5 MB per file, with a 64 MB in-memory cache and at most 6 reads at once.indexline (patchBlobIds). If the text read doesn't hash to them, that file has no arrows. This covers a push after the stack list loaded, a merged PR whose merge base equals its head, and a head that moved during the read. The cache key includes the bases, for a retarget with the same head. A whole-stack GitLab patch with noindexline has no arrows.diff()'s.diff()answershead_shain both scopes, and remembers a head only when it held still during the read (the same rule as fix(inbox): keep a PR review's unsent comments and Viewed until a new commit #2640, so the two merge cleanly). A file read uses that head, else the list's. The client asks for nothing when an answer has nohead_sha.GET /api/inbox/messages/:id/guide/file?path: owner or local and same origin. It reads only a path the guide's patch changes, and only the blobs itsindexline names. The new side may come from the working tree while its bytes hash to that id.Comments on opened lines
No forge takes an inline comment outside the PR's diff, so a comment on an opened line carries
outsideDiffand the code, and the review posts it in its main comment. The store skips the hunk check for those comments but still checks that the file is in the patch. The export labels them "(not in the diff)" with a**Code:**block, as the review app does. An old-side opened line in the submission dialog names its side and has no link.When arrows don't open
Forks and renamed files open like any other file: a fork's commits are reachable by id from the base repository, on GitHub and on GitLab, and a renamed file's old side is read at its old path. An old path that leaves the repository reads nothing. The server keeps only texts and commits it got: an empty answer or a 404 is not kept, so a passing sign-in problem doesn't leave a file without arrows.
No arrows at all:
Arrows that go away on the first click, because only a read can tell:
Arrows that stay, so the next click retries: a failed forge read, offline, or a rate limit (which holds the host). Pierre logs the failure to the console.
Measured
Headless Chromium on the built binaries, with a fake
gh, against #2632 at014185e14. Other work was running on the machine, so treat small differences as noise. Fixtures: the first 5,000 lines ofpackages/inbox/App.tsxwith every line changed, and 100 real repo files. On #2632 the long file is capped at its height limit, so its frames column has nothing to measure.The #2632 columns are from an earlier run of the same scripts, before main's later merges, so they are not a same-moment comparison.
No whole file was read in any of these runs. Long tasks at reading pace: 3-4 on #2632 for 100 files (202-227 ms in all), 0-1 here (at most 98 ms). The long file: 1 here, 68-75 ms.
First arrow click on a real 5,000-line file: 509-840 ms in six clicks, longest task 143-279 ms. One earlier run, on a busy machine, took 2.2-2.4 s.
Workers: 0 on a page with no diff, 3 with a reader on screen. Opening a guide again after leaving it starts them again: first row 122-196 ms.
Scrolling 240 steps each way: 0 shifts of the row being read (Chromium on 100 files and on 100 real files, WebKit on 100 files), 0 movement standing still for 8 s, and a rail jump up lands at 16 px.
For the reviewer
scrollWithPageoverridesscrollTop,scrollToandgetBoundingClientRecton the root element. It depends onCodeViewasking only those and thescrollevent, and that's the same in 1.5.2 and diffshub's 1.6.4.guideScrollsWithPage.test.tsxmounts the realCodeViewand checks the rows drawn follow the page, so a Pierre change that stops asking those is caught there.scrollWithPage.test.tsonly covers the adapter's rules, on plain elements.CodeViewcounting a row that isn't drawn, a 32 px blank band. Once the file is read Pierre gives it a count or removes it.CodeViewrereads its height only then and the adapter answers the larger of the window and the screen. This happens only when moving to a taller monitor, or headless.review-core.ts:readGitObjectBytesis extracted fromreadDiffSideBytes, with no behaviour change.Testing
packages/review-editor/utils/scrollWithPage.test.ts(DOM): the adapter's rules.packages/inbox/guideScrollsWithPage.test.tsx(DOM, realCodeView): rows drawn follow the page's position.packages/server/inbox-file-contents.test.ts: guards, cap, cache eviction, fork, rate limit, blob mismatch, whole stack, GitLab, the guide route with Code review off, Code review turned off with the PR still listed, a guide in another project, a path the diff doesn't change, a comment in no hunk, on real git in a temp folder.packages/server/inbox-pulls.test.ts: a guest is refused onguide/file.packages/inbox/guideExpandContext.test.tsx,packages/guide-viewer/GuideView.test.tsx(DOM, real Pierre): no read before the first click, arrows, box height, degrade cases, a failed read keeps the arrows and retries, renamed files open, a pending read shows, a guest asks nothing, the reader's place on growth and fold.packages/inbox/guide/wholeFileReader.test.ts: only texts are kept; "none" and a failure ask again.tests/e2e/inbox-guides.spec.ts, two new tests: a thread with Code review off (arrows, no scroller inside the box, sticky header and its line, a comment on an opened line) and a guide with its blobs missing (first click removes the arrows, no console errors).tests/e2e/inbox-pull-requests.spec.ts: arrows from a fake forge with no read before the click, a worker running, a comment on an opened line posts in the main comment, an old-side comment quotes the old text, going to a comment after a reload opens its line (old side at its old number, with the sides 30 lines apart), and no workers on a page with no diff.The tests never run real
ghorglab, only scripted CLIs. By hand, the fork reads were checked read-only against public forges: GitHub'scontentsandcompareon a fork PR's head from the base repository, and GitLab'srepository/files/…/rawon a fork MR's head from the target project. The arrow-opening flow onReviewPanesharesGuideReaderand the store save, and has no browser run of its own; its guest path has a DOM test.