gitea-pr: show the diff a review comment was left against #98

Merged
branderson merged 1 commits from gitea-pr-hunks into main 2026-08-07 14:19:29 -07:00
Collaborator

Summary generated by LLM agent

gitea-pr comments rendered every inline review comment as path:?. Always, not sometimes: the jq asked for .line, and Gitea's review-comment objects have no line field, so // "?" was the only branch reachable.

[branderson @ README.md:?]
Check whether _the project_ wants it first. "They" is confusing when the subject hasn't been introduced.

The effect is not cosmetic. A reviewer writing "this is confusing" or "let's reword this" is pointing at a passage they can see and the reader cannot; all that survived the fetch was the filename. On a review of any size several comments land on the same file, and some say "this" about a phrase that occurs more than once, so acting on the review means guessing which passage was meant.

That happened on #96: a comment about historical content in a file with two candidate passages, one of which was load-bearing design rationale. Resolving it took a round trip.

The objects already carried it

diff_hunk is the exact text the comment was attached to, and position is its offset into the diff. Neither was being read. Now:

[branderson @ README.md @@118]
@@ -105,0 +115,4 @@
+dejima bounds what a session can reach. It has nothing to say about whether
+what that session wrote should exist. That part is yours.
+
+**Check whether they want it first.** A growing number of projects state that
--- comment ---
Check whether _the project_ wants it first. "They" is confusing when the subject hasn't been introduced.

position is an index into the diff rather than a file line, so it is printed as a diff offset rather than as something to jump to. Both fields are null-guarded: an outdated comment whose hunk Gitea no longer has renders (no hunk recorded) instead of the string null.

The hunk makes the output longer, deliberately. Scrolling costs nothing; guessing wrong costs a round trip through a human.

Testing

comments had no coverage at all. The shared curl stub in static.bats answered every read with [], so the reviews list came back empty, the per-review comment fetch never ran, and the rendering under test was never reached. The stub now answers the two review endpoints with shaped data and everything else exactly as before.

One test. Confirmed to fail against the previous gitea-pr, at the assertion for the hunk text rather than incidentally:

not ok 1 an inline review comment arrives with the diff it was left against
#   `[[ "$output" == *"a line the reviewer is looking at"* ]]' failed

static 202 and providers 65, both green. No other suite touches that stub.

Independent of #96 and touches none of its files.

**Summary generated by LLM agent** `gitea-pr comments` rendered every inline review comment as `path:?`. Always, not sometimes: the jq asked for `.line`, and Gitea's review-comment objects have no `line` field, so `// "?"` was the only branch reachable. ``` [branderson @ README.md:?] Check whether _the project_ wants it first. "They" is confusing when the subject hasn't been introduced. ``` The effect is not cosmetic. A reviewer writing "this is confusing" or "let's reword this" is pointing at a passage they can see and the reader cannot; all that survived the fetch was the filename. On a review of any size several comments land on the same file, and some say "this" about a phrase that occurs more than once, so acting on the review means guessing which passage was meant. That happened on #96: a comment about historical content in a file with two candidate passages, one of which was load-bearing design rationale. Resolving it took a round trip. ## The objects already carried it `diff_hunk` is the exact text the comment was attached to, and `position` is its offset into the diff. Neither was being read. Now: ``` [branderson @ README.md @@118] @@ -105,0 +115,4 @@ +dejima bounds what a session can reach. It has nothing to say about whether +what that session wrote should exist. That part is yours. + +**Check whether they want it first.** A growing number of projects state that --- comment --- Check whether _the project_ wants it first. "They" is confusing when the subject hasn't been introduced. ``` `position` is an index into the diff rather than a file line, so it is printed as a diff offset rather than as something to jump to. Both fields are null-guarded: an outdated comment whose hunk Gitea no longer has renders `(no hunk recorded)` instead of the string `null`. The hunk makes the output longer, deliberately. Scrolling costs nothing; guessing wrong costs a round trip through a human. ## Testing `comments` had no coverage at all. The shared curl stub in `static.bats` answered every read with `[]`, so the reviews list came back empty, the per-review comment fetch never ran, and the rendering under test was never reached. The stub now answers the two review endpoints with shaped data and everything else exactly as before. One test. **Confirmed to fail against the previous `gitea-pr`**, at the assertion for the hunk text rather than incidentally: ``` not ok 1 an inline review comment arrives with the diff it was left against # `[[ "$output" == *"a line the reviewer is looking at"* ]]' failed ``` `static` 202 and `providers` 65, both green. No other suite touches that stub. Independent of #96 and touches none of its files.
dejima-agent added 1 commit 2026-08-07 14:07:32 -07:00
gitea-pr: show the diff a review comment was left against
tests / sandbox (proxy) (pull_request_target) Successful in 2m5s
tests / runner-env (sandbox) (pull_request_target) Successful in 1m28s
tests / sandbox (static) (pull_request_target) Successful in 3m33s
tests / sandbox (providers) (pull_request_target) Successful in 3m59s
tests / sandbox (remote) (pull_request_target) Successful in 4m41s
tests / host-docker (pull_request_target) Successful in 4m55s
tests / runner-env (host-docker) (pull_request_target) Successful in 1m23s
tests / sandbox (project) (pull_request_target) Successful in 5m19s
tests / sandbox (config) (pull_request_target) Successful in 5m25s
tests / sandbox (audit) (pull_request_target) Successful in 8m1s
2222aef7d1
`gitea-pr comments` rendered every inline review comment as `path:?`. Not
sometimes: always. The jq asked for `.line`, and Gitea's review-comment
objects have no `line` field, so `// "?"` was the only branch that could ever
be taken.

The effect is not cosmetic. A reviewer writing "this is confusing" or "let's
reword this" is pointing at a passage they can see and the reader cannot. All
that survived the fetch was the file. On a review of any size, several
comments land on the same file, and some of them say "this" about a phrase
that occurs more than once, so acting on the review means guessing which
passage was meant and sometimes guessing wrong. That happened on #96, on a
comment about historical content in a file with two candidate passages, and
cost a round trip to resolve.

The objects do carry what is needed: `diff_hunk`, which is the exact text the
comment was attached to, and `position`, the offset into the diff. Both are
printed now, with the comment marked off from the quoted code so the two
cannot be read as one block.

The hunk makes the output longer, and that is the right trade: scrolling
costs nothing, and guessing wrong costs a round trip through a human.

## Testing

The shared curl stub answered every read with `[]`, which meant `comments`
had no coverage at all: the reviews list came back empty, so the per-review
comment fetch never ran and the rendering under test was never reached. The
stub now answers the two review endpoints with shaped data and everything
else as before.

One test, and it was confirmed to fail against the previous `gitea-pr`,
at the assertion for the hunk text rather than incidentally.

static 202 and providers 65, both green.
branderson approved these changes 2026-08-07 14:19:24 -07:00
branderson merged commit 0aef363910 into main 2026-08-07 14:19:29 -07:00
Sign in to join this conversation.