pr view --reviews omits review-comment anchor fields (line/position, diff_hunk, id) #37

Closed
opened 2026-07-18 11:25:07 -04:00 by alexion · 1 comment
Owner

What I ran into

Reviewing a PR, I ran gitea-axi pr view <n> --reviews --full to read a reviewer's inline comments and answer them.
The output tells me the author, the file path, and the comment body, but not which line (or diff position) each comment is attached to, and not the comment's id.

Several comments were things like "what does this do?" and "Wasn't this set earlier?" — meaningless without knowing the anchored line.
I could not answer them from gitea-axi's output alone, so I fell back to a raw GET /repos/{owner}/{repo}/pulls/{n}/reviews/{id}/comments call (and hand-parsing the token out of ~/.config/tea/config.yml) just to recover path + position + diff_hunk.

Real gap, not discovery

This is a real gap. The renderer deliberately projects each review comment down to three fields:

// src/commands/pr.ts:838-843
comments: commentLists[index]!.map((comment) => ({
  author: comment.user?.login ?? "",
  path: comment.path ?? "",
  body: truncate(comment.body ?? ""),
})),

The fetched PullReviewComment already carries the rest — diff_hunk, position, original_position, and id are all on the type (node_modules/gitea-js/dist/index.d.mts, interface PullReviewComment) and come back populated from fetchReviewComments.
There is no flag to surface them: --full only toggles body truncation, and pr view has no --fields for review-comment sub-fields.
So the data is fetched and then dropped on the floor.

Recommendation

Surface the anchor in the --reviews output for each comment. Minimally add:

  • line (or position / original_position) — the anchor, so a comment can be tied to code.
  • id — needed to target a specific comment for a reply/resolve/edit later (see the inline-reply and resolve issues).
  • diff_hunk, ideally trimmed to its last 1–2 lines — this alone makes a bare "what does this do?" answerable without a second call, since the hunk tail is the exact code the comment sits on.

Keeping it behind the existing --reviews (and honoring --full for the hunk) would have kept this whole task inside gitea-axi.

## What I ran into Reviewing a PR, I ran `gitea-axi pr view <n> --reviews --full` to read a reviewer's inline comments and answer them. The output tells me the author, the file path, and the comment body, but **not which line (or diff position) each comment is attached to**, and not the comment's id. Several comments were things like `"what does this do?"` and `"Wasn't this set earlier?"` — meaningless without knowing the anchored line. I could not answer them from gitea-axi's output alone, so I fell back to a raw `GET /repos/{owner}/{repo}/pulls/{n}/reviews/{id}/comments` call (and hand-parsing the token out of `~/.config/tea/config.yml`) just to recover `path` + `position` + `diff_hunk`. ## Real gap, not discovery This is a real gap. The renderer deliberately projects each review comment down to three fields: ``` // src/commands/pr.ts:838-843 comments: commentLists[index]!.map((comment) => ({ author: comment.user?.login ?? "", path: comment.path ?? "", body: truncate(comment.body ?? ""), })), ``` The fetched `PullReviewComment` already carries the rest — `diff_hunk`, `position`, `original_position`, and `id` are all on the type (`node_modules/gitea-js/dist/index.d.mts`, `interface PullReviewComment`) and come back populated from `fetchReviewComments`. There is no flag to surface them: `--full` only toggles body truncation, and `pr view` has no `--fields` for review-comment sub-fields. So the data is fetched and then dropped on the floor. ## Recommendation Surface the anchor in the `--reviews` output for each comment. Minimally add: - `line` (or `position` / `original_position`) — the anchor, so a comment can be tied to code. - `id` — needed to target a specific comment for a reply/resolve/edit later (see the inline-reply and resolve issues). - `diff_hunk`, ideally trimmed to its last 1–2 lines — this alone makes a bare "what does this do?" answerable without a second call, since the hunk tail is the exact code the comment sits on. Keeping it behind the existing `--reviews` (and honoring `--full` for the hunk) would have kept this whole task inside gitea-axi.
Author
Owner

Resolved by task 0034 (commit b6d247d), now on main: pr view --reviews surfaces each inline review comment's anchor fields (line/position, diff_hunk, id).

Resolved by task 0034 (commit b6d247d), now on `main`: `pr view --reviews` surfaces each inline review comment's anchor fields (line/position, diff_hunk, id).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: alexion/gitea-axi#37