fix(prs): gitea_pr_get on a merged PR prints only "Pull request #N merged." and drops the PR details #23
Labels
No labels
area/dsh
area/forgejo
experiment
priority/later
priority/next
priority/now
type/bug
type/task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
dsh-plugins/dsh-gitea#23
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
The PR's title is available in
pr_list, so the data is present; only the rendering differs.Observed vs expected
gitea_pr_getis hijacked by the merge formatter for any PR withmerged: true.#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:The
|| data.mergedclause matches every merged PR before the genericdata.numberbranch and before anygitea_pr_getformatter (there is none).Proposed fix
Restrict the merge wording to
name === 'gitea_pr_merge' || name === 'gitea_auto_merge', and add an explicitgitea_pr_getformatter (number, title, state, author, base←head, merged flag, html_url, body). Regression test: merged PR renders title + state; open PR unchanged.Acceptance:
gitea_pr_geton #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).
Fixed in
234cbd4(PR #39).gitea_pr_getnow 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 togitea_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.