fix(prs): gitea_pr_get on a merged PR prints only "Pull request #N merged." and drops the PR details #23

Closed
opened 2026-10-24 00:58:39 +00:00 by dsh · 1 comment
Owner

Symptom

Reading a merged pull request returns a one-line merge notice instead of the PR. Title, state, author, branches, URL and body are all lost, so agents cannot inspect a merged PR with gitea_pr_get.

Repro

gitea_pr_get {owner:"dsh-plugins", repo:"dsh-gitea", number:18}
→ Pull request #18 merged.

gitea_pr_list {owner:"dsh-plugins", repo:"dsh-gitea", state:"all", limit:10}
→ #18 fix(labels): default bootstrap to the house taxonomy and make the dry run truthful
...

The PR's title is available in pr_list, so the data is present; only the rendering differs.

Observed vs expected

  • Observed: gitea_pr_get is hijacked by the merge formatter for any PR with merged: true.
  • Expected: #18 "fix(labels): ..." [merged] plus base/head/author/url and body (or a truncated body), like the open-PR path.

Root cause

lib/handlers/formatters.js:

if (name === 'gitea_pr_merge' || data.merged) {
  const prNum = data?.number != null ? ` #${data.number}` : ''
  return [{ type: 'text', text: `Pull request${prNum} merged.` }]
}

The || data.merged clause matches every merged PR before the generic data.number branch and before any gitea_pr_get formatter (there is none).

Proposed fix

Restrict the merge wording to name === 'gitea_pr_merge' || name === 'gitea_auto_merge', and add an explicit gitea_pr_get formatter (number, title, state, author, base←head, merged flag, html_url, body). Regression test: merged PR renders title + state; open PR unchanged.

Acceptance: gitea_pr_get on #18 shows its title and merged state, not just the merge notice.

Duplicate check

Searched issues for merged, pr get, formatter (state all) — no existing issue; #11/#5 covered list/empty rendering.

Layer

dsh-gitea plugin/tool (formatter).

## Symptom Reading a merged pull request returns a one-line merge notice instead of the PR. Title, state, author, branches, URL and body are all lost, so agents cannot inspect a merged PR with `gitea_pr_get`. ## Repro ``` gitea_pr_get {owner:"dsh-plugins", repo:"dsh-gitea", number:18} → Pull request #18 merged. gitea_pr_list {owner:"dsh-plugins", repo:"dsh-gitea", state:"all", limit:10} → #18 fix(labels): default bootstrap to the house taxonomy and make the dry run truthful ... ``` The PR's title is available in `pr_list`, so the data is present; only the rendering differs. ## Observed vs expected - Observed: `gitea_pr_get` is hijacked by the merge formatter for any PR with `merged: true`. - Expected: `#18 "fix(labels): ..." [merged]` plus base/head/author/url and body (or a truncated body), like the open-PR path. ## Root cause `lib/handlers/formatters.js`: ```js if (name === 'gitea_pr_merge' || data.merged) { const prNum = data?.number != null ? ` #${data.number}` : '' return [{ type: 'text', text: `Pull request${prNum} merged.` }] } ``` The `|| data.merged` clause matches every merged PR before the generic `data.number` branch and before any `gitea_pr_get` formatter (there is none). ## Proposed fix Restrict the merge wording to `name === 'gitea_pr_merge' || name === 'gitea_auto_merge'`, and add an explicit `gitea_pr_get` formatter (number, title, state, author, base←head, merged flag, html_url, body). Regression test: merged PR renders title + state; open PR unchanged. Acceptance: `gitea_pr_get` on #18 shows its title and merged state, not just the merge notice. ## Duplicate check Searched issues for `merged`, `pr get`, `formatter` (state all) — no existing issue; #11/#5 covered list/empty rendering. ## Layer dsh-gitea plugin/tool (formatter).
dsh closed this issue 2026-10-24 01:11:24 +00:00
Author
Owner

Fixed in 234cbd4 (PR #39).

gitea_pr_get now has its own formatter: number, title, [merged]/[open], author, head → base, URL, merge date and body (2 000-char cap). The merge wording is restricted to gitea_pr_merge/gitea_auto_merge, so a merged PR is no longer collapsed to “Pull request #N merged.”

Live: gitea_pr_get {number:18} → #18 "fix(labels): …" [merged] by @dsh, refs/pull/18/head → master, URL, Merged at: 2026-10-23T22:56:06Z, body.

Tests: test/pr-semantics.test.mjs.

Fixed in `234cbd4` (PR #39). `gitea_pr_get` now has its own formatter: number, title, `[merged]`/`[open]`, author, head → base, URL, merge date and body (2 000-char cap). The merge wording is restricted to `gitea_pr_merge`/`gitea_auto_merge`, so a merged PR is no longer collapsed to “Pull request #N merged.” Live: `gitea_pr_get {number:18}` → `#18 "fix(labels): …" [merged] by @dsh`, `refs/pull/18/head → master`, URL, `Merged at: 2026-10-23T22:56:06Z`, body. Tests: `test/pr-semantics.test.mjs`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
dsh-plugins/dsh-gitea#23
No description provided.