fix(tools): empty and unrecognised results render as a bare OK #5
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#5
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
A bare
OKis returned for wildly different outcomes, so the caller cannot tell "nothing there" from "done" from "unrecognised response":gitea_issue_liston a repo with 0 issues (pvlb-infra/issue-tracker,pvlb-infra/forge-runner)gitea_labels liston a repo with no labelsgitea_labels createon successgitea_wiki get(a real object — see #4)This is not cosmetic: while bootstrapping
issue-trackerit hid #2 and #4 until the REST API was checked by hand, and it twice made a failed label assignment look successful.Root cause
Plus
wrap()intentionally returns{ok:true}with no data when an endpoint answers with an empty body (lib/handlers/common.js:175), which is correct — the formatter then has nothing to say.Fix
Never emit a bare
OK:No issues./No labels./No results.(per tool)title,name,number) or a short JSON snippetLabel "type/bug" created (id 13),Milestone "v1" created (id 4)){ok:true}with no data) →Done.— distinct fromOK, at least.Acceptance
grep -n "'OK'" lib/handlers/formatters.jsfinds no bare fallback.Additional data point from
t14btw(2026-10-23), same bare-OKfallback on non-empty results — so it is not limited to empty lists:gitea_flavor→OK(no flavor/version payload at all, although/api/v1/versionanswers17.0.0+gitea-1.22.0). A populated single-object tool definitely deserves its own formatter.gitea_labelslist andgitea_notificationsalso renderOK, which is ambiguous with the flavor case above.gitea_wiki gethas the same problem and is tracked separately as #4.Environment: DSH
0.2.0-rc.2,dsh-gitea0.7.40-dsh.1(link: checkout), Forgejo17.0.0+gitea-1.22.0.Fixed in
4d77e9f(fix(tools): render complete lists and never print a bare OK), merged tomaster(#11).OKfallback is gone (grep -n "'OK'" lib/handlers/formatters.js→ none).No issues.,No labels.,No pull requests., …, fallbackNo results.); unknown objects print identifying fields plus a ≤300-char JSON snippet;{ok:true}with no payload returnsDone.gitea_pr_liston this repo now answersNo pull requests.instead of a bareOK.