fix(pr): comments posted by pr +comment are invisible on the PR page #376

Merged
wbtiger merged 1 commits from Taoyouce/gitlink-cli:fix/pr-comment-endpoint into master 2026-07-14 20:36:55 +08:00
Contributor

Bug

pr +comment (and the conversation note posted by pr +review) writes to POST /api/v1/:owner/:repo/issues/:issue_id/journals, which attaches the journal to the underlying issue record. But the PR conversation is rendered from GET /api/v1/:owner/:repo/pulls/:id/journals (Api::V1::Projects::Pulls::Journals::ListService scopes to @pull_request.journals), so comments posted by the CLI never appear on the pull request page.

Reproduction (production, gitlink.org.cn)

  1. gitlink-cli pr +comment -i <pr> -b "hello" → returns ok
  2. GET /api/v1/:owner/:repo/pulls/<pr>/journals{"total_count":0,"journals":[]} — the comment is missing from the PR conversation
  3. The journal instead shows up under GET /api/v1/:owner/:repo/issues/<issue_id>/journals, which the PR page does not read

Fix

Post to POST /api/v1/:owner/:repo/pulls/:id/journals with payload key note (the pulls journals contract) for both pr +comment and the review conversation note. This also drops the extra PR-detail fetch that was only needed to resolve the issue id.

Validation

  • Production-verified: after the fix, a comment posted via pr +comment appears in GET /pulls/:id/journals (probe created, listed, then deleted).
  • Unit tests updated to assert the new endpoint and note payload key; go test ./..., go vet, gofmt all clean.
## Bug `pr +comment` (and the conversation note posted by `pr +review`) writes to `POST /api/v1/:owner/:repo/issues/:issue_id/journals`, which attaches the journal to the underlying **issue** record. But the PR conversation is rendered from `GET /api/v1/:owner/:repo/pulls/:id/journals` (`Api::V1::Projects::Pulls::Journals::ListService` scopes to `@pull_request.journals`), so comments posted by the CLI never appear on the pull request page. ## Reproduction (production, gitlink.org.cn) 1. `gitlink-cli pr +comment -i <pr> -b "hello"` → returns ok 2. `GET /api/v1/:owner/:repo/pulls/<pr>/journals` → `{"total_count":0,"journals":[]}` — the comment is missing from the PR conversation 3. The journal instead shows up under `GET /api/v1/:owner/:repo/issues/<issue_id>/journals`, which the PR page does not read ## Fix Post to `POST /api/v1/:owner/:repo/pulls/:id/journals` with payload key `note` (the pulls journals contract) for both `pr +comment` and the review conversation note. This also drops the extra PR-detail fetch that was only needed to resolve the issue id. ## Validation - Production-verified: after the fix, a comment posted via `pr +comment` appears in `GET /pulls/:id/journals` (probe created, listed, then deleted). - Unit tests updated to assert the new endpoint and `note` payload key; `go test ./...`, `go vet`, `gofmt` all clean.
Taoyouce added 4 commits 2026-07-08 21:52:01 +08:00
3665a8698b fix(pr): post comments to the pull request journals endpoint
pr +comment (and the conversation note posted by pr +review) wrote to
POST /api/v1/:owner/:repo/issues/:issue_id/journals, which attaches
the journal to the underlying issue record. Those journals never show
up in GET /pulls/:id/journals — the list the PR conversation is built
from — so comments posted by the CLI were invisible on the pull
request page.

Post to POST /api/v1/:owner/:repo/pulls/:id/journals (payload key
"note") instead, which also drops the extra PR-detail fetch that was
only needed to resolve the issue id.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
wbtiger merged commit 14e611daa8 into master 2026-07-14 20:36:50 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Gitlink/gitlink-cli#376
No description provided.