fix(accounts): gitea_notifications, gitea_user_search and org members dump raw JSON #33

Closed
opened 2026-10-24 00:59:23 +00:00 by dsh · 1 comment
Owner

Symptom

Three everyday account reads dump raw JSON instead of a readable list: gitea_notifications, gitea_user_search, and gitea_org action:"members". Notifications are especially noisy — five rows expand to >1.5 KB of clipped JSON.

Repro

gitea_notifications {limit:5}
→ {"id":54,"updated_at":"2026-10-23T11:13:14Z","repository":{"id":14,"owner":{...}} (×5, raw JSON)

gitea_user_search {q:"dsh", limit:5}
→ {"id":2,"html_url":"https://git.pvlb.dev/dsh","full_name":"","login":"dsh"}

gitea_org {action:"members", org:"ml-lab", limit:10}
→ {"id":2,"html_url":"https://git.pvlb.dev/dsh","full_name":"","login":"dsh"}
  {"id":1,"html_url":"https://git.pvlb.dev/pvl","full_name":"","login":"pvl"}

Observed vs expected

  • Notifications: expected repository + subject title, type/reason, unread state, updated time; observed JSON.
  • Users: expected dsh (https://git.pvlb.dev/dsh) per line; observed JSON.
  • Org members: expected one login per line; observed JSON.

Root cause

lib/handlers/formatters.js generic array/object fallbacks: notification rows have no number/path/name, user rows have none of those either (login is only handled for single objects via if (data.login)), so clipSnippet/describeUnknownObject emits JSON. gitea_user_search's tool description says "Search users"; a bare login is enough.

Proposed fix

Add formatters:

  • gitea_notifications: unread marker, repo/issue #N title, reason/type, updated_at.
  • gitea_user_search / gitea_org members: login (html_url) or login — full_name.
  • empty lists already have messages; keep them.

Tests with the recorded payloads/caps. Acceptance: none of the three ever prints raw JSON for a normal response.

Duplicate check

Searched notifications/user (state all) — no existing issue; #5 covered empty/bare-OK, not these shapes.

Layer

dsh-gitea plugin/tool (formatter).

## Symptom Three everyday account reads dump raw JSON instead of a readable list: `gitea_notifications`, `gitea_user_search`, and `gitea_org action:"members"`. Notifications are especially noisy — five rows expand to >1.5 KB of clipped JSON. ## Repro ``` gitea_notifications {limit:5} → {"id":54,"updated_at":"2026-10-23T11:13:14Z","repository":{"id":14,"owner":{...}} (×5, raw JSON) gitea_user_search {q:"dsh", limit:5} → {"id":2,"html_url":"https://git.pvlb.dev/dsh","full_name":"","login":"dsh"} gitea_org {action:"members", org:"ml-lab", limit:10} → {"id":2,"html_url":"https://git.pvlb.dev/dsh","full_name":"","login":"dsh"} {"id":1,"html_url":"https://git.pvlb.dev/pvl","full_name":"","login":"pvl"} ``` ## Observed vs expected - Notifications: expected repository + subject title, type/reason, unread state, updated time; observed JSON. - Users: expected `dsh (https://git.pvlb.dev/dsh)` per line; observed JSON. - Org members: expected one login per line; observed JSON. ## Root cause `lib/handlers/formatters.js` generic array/object fallbacks: notification rows have no `number`/`path`/`name`, user rows have none of those either (`login` is only handled for single objects via `if (data.login)`), so `clipSnippet`/`describeUnknownObject` emits JSON. `gitea_user_search`'s tool description says "Search users"; a bare login is enough. ## Proposed fix Add formatters: - `gitea_notifications`: `unread` marker, `repo/issue #N title`, reason/type, updated_at. - `gitea_user_search` / `gitea_org members`: `login (html_url)` or `login — full_name`. - empty lists already have messages; keep them. Tests with the recorded payloads/caps. Acceptance: none of the three ever prints raw JSON for a normal response. ## Duplicate check Searched `notifications`/`user` (state all) — no existing issue; #5 covered empty/bare-OK, not these shapes. ## Layer dsh-gitea plugin/tool (formatter).
Author
Owner

Fixed in 56f41de (PR #41).

  • Notifications: • repo — subject [type, reason] (updated) with an unread marker.
  • User search: login (name) — url.
  • Org members: one login per line.

subject, reason and unread were added to RECORD_KEYS — they were being stripped before formatting.

Live: notifications/users/org members all render as readable lists.

Tests: test/qa-formatters.test.mjs.

Fixed in `56f41de` (PR #41). - Notifications: `• repo — subject [type, reason] (updated)` with an unread marker. - User search: `login (name) — url`. - Org members: one `login` per line. `subject`, `reason` and `unread` were added to `RECORD_KEYS` — they were being stripped before formatting. Live: notifications/users/org members all render as readable lists. Tests: `test/qa-formatters.test.mjs`.
dsh closed this issue 2026-10-24 01:25:27 +00:00
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#33
No description provided.