feat(mobile): comment on a line of a pull request's diff
DA
1h ago+365+365+012345678901234567890123456789-26-26-01234567890123456789
Stacked on #10559 (and the stack under it, down to #10549). The sixth step of the iOS code viewer (STAG-3904): writing review comments, as Dean picked for v1.
Rebased Nov 23: the route is now line-comment, since main gained a comment route for a new PR comment. Replying in a thread was dropped from this PR, since main's thread screen (#10588) already docks a reply field.
What
- Long-press a line of code in a file's diff: the system's menu offers Comment on line N and Copy line. Headers, notes and thread cards offer none.
- Comment on line opens
…/<number>/line-comment?path=&line=&side=:- The line is quoted in the monospaced face under the file's name, and the comment field docks under it, taking the keyboard.
- A capsule in the composer's row says how Send sends it: Add to review (the default, as Dean picked) adds it to the member's pending review on GitHub; Comment now posts it alone.
- A comment GitHub took closes the screen, and the conversation is read again. A refusal says why above the line, in the PR page's words (
WriteNoteRow), and keeps the words.
How
- Writes: both use the PR page's own
usePullRequestWrites: one change at a time, notices, and the parts read again after GitHub answers.ADD_REVIEW_COMMENTcarries the head commit the files were read at (usePullRequestChangesnow returnsheadSha). - Side: a removed line comments on the old side, any other line on the new, decided in
DiffViewfrom the row's kind. - Quoting:
diffLineText(patch, line, side)quotes the line, with a test. - Words: the native menu's words come from JS (
Comment on line,Copy line). Its glyphs are the asset catalog's LucideMessageSquareandCopy. - Fixture: the Inbox fixture gives #128's changes read a head commit and its review thread a GitHub id.
pull-request-files.yamllong-presses a line, comments, and sends.
Not here: finishing the pending review (Comment, Approve, Request changes, Discard) from the phone. That's the next PR. Until then, a comment added to the review can be submitted from the desktop or GitHub.
Tests
- Ran:
packages/ui-native/src/diff-view-model.test.ts. The new case catches a comment quoting the added line for an old-side number it shares with a removed one. - Typechecked
@repo/mobileand@repo/host; ran oxlint and Biome. - Not run yet: the native context menu needs the native build. The Mac job builds the stack's top branch when it starts, and I'll point it here. Left to CI: the rest.
🤖 Generated with Claude Code