fix(tools): commit, PR-file and compare lists dump clipped raw JSON instead of a summary #25
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#25
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
Several list/compare tools print each row as a clipped raw JSON blob instead of the field summary their descriptions imply:
gitea_repo_commits,gitea_pr_files, andgitea_repo_compare. A 5-commit call produces ~1.5 KB of unreadable JSON.Repro
Observed vs expected
ca4117f Merge pull request #1 ... (pvlb-dev, 2026-08-06)per line; observed raw JSON.lib/handlers/formatters.js (+17/−3)per line; observed raw JSON.0 files changed/No changes; observedUnrecognised response+ JSON.Root cause
lib/handlers/formatters.jsgeneric array branch only rendersitem.number,item.path, oritem.name; commit rows havesha/commit, PR-file rows havefilename/additions/deletions, and compare returns an object withfilesbut noname/title, so all three fall through toclipSnippet. The object path also hitsdescribeUnknownObject, which prefixes the JSON withUnrecognised response.Proposed fix
Add explicit formatters:
gitea_repo_commits: short sha + first message line + author + date, withlistFooter.gitea_pr_files: filename +(+additions/−deletions)+ status.gitea_repo_compare: files/commits/ahead-behind summary, and a clear "No changes" line for an empty diff.Tests with the three recorded payloads; acceptance: no
Unrecognised responseand no per-row JSON for these tools.Duplicate check
Searched
formatter(state all); #2/#5/#7/#11 closed the generic formatter family but none names commits/files/compare. #3 coveredrepo_contentsonly.Layer
dsh-gitea plugin/tool (formatter).
Fixed in
56f41de(PR #41).gitea_repo_commitsrenderssha subject (author, date);gitea_pr_filesrendersfilename (+a/-d) [status];gitea_repo_comparerenders a commit/file summary (orCompare: No changes.) instead of per-row JSON /Unrecognised response.commitswas added toRECORD_KEYSso the count survivesslimRecord.Live: 3 commits, PR #18 files,
master...master→Compare: No changes.Tests:
test/qa-formatters.test.mjs.