Fix issue/PR add-assignee hitting a nonexistent endpoint (#158) #161

Merged
stephen merged 1 commit from fix/158-issue-add-assignee-endpoint into main 2026-06-15 14:30:18 +00:00
Owner

Fixes #158.

fj issue edit --add-assignee <user> (and --remove-assignee, and the same flags on fj pr edit) errored with a spurious "not found" on an issue that exists.

Root cause: the assignee edit POSTed/DELETEd to /repos/{o}/{r}/issues/{n}/assignees. Forgejo has no such sub-resource (only labels do), so the request 404'd and the error UX rendered it as "not found: {o}/{r} #{n}". Confirmed live: GET .../issues/491/assignees returns 404 while the issue itself resolves.

Fix: assignees are set through the issue PATCH endpoint, which replaces the whole list. add_assignees/remove_assignees now read the current assignees and PATCH the merged set (union for add, difference for remove), keeping the additive CLI semantics. Works for PRs since they share the issues endpoint.

Tests updated from the old sub-resource mocks to the GET + PATCH flow. Local: fmt, clippy (-D warnings), and cargo test --all (514 passed) all green.

Fixes #158. `fj issue edit --add-assignee <user>` (and `--remove-assignee`, and the same flags on `fj pr edit`) errored with a spurious "not found" on an issue that exists. Root cause: the assignee edit POSTed/DELETEd to `/repos/{o}/{r}/issues/{n}/assignees`. Forgejo has no such sub-resource (only labels do), so the request 404'd and the error UX rendered it as "not found: {o}/{r} #{n}". Confirmed live: `GET .../issues/491/assignees` returns 404 while the issue itself resolves. Fix: assignees are set through the issue PATCH endpoint, which replaces the whole list. `add_assignees`/`remove_assignees` now read the current assignees and PATCH the merged set (union for add, difference for remove), keeping the additive CLI semantics. Works for PRs since they share the issues endpoint. Tests updated from the old sub-resource mocks to the GET + PATCH flow. Local: fmt, clippy (-D warnings), and `cargo test --all` (514 passed) all green.
Fix issue/PR add-assignee hitting a nonexistent endpoint (#158)
All checks were successful
ci / check (pull_request) Successful in 10m1s
ci / live-e2e (pull_request) Successful in 1m53s
ci / coverage (pull_request) Successful in 2m7s
2c0544c5f0
Forgejo has no /issues/{n}/assignees sub-resource (only labels do), so
add_assignees/remove_assignees got a 404 that surfaced as a spurious
"not found" on an issue that exists. Read the current assignees and
PATCH the issue with the merged set instead: additive for
--add-assignee, subtractive for --remove-assignee. The same path backs
fj pr edit. Tests updated to the GET + PATCH flow.
Sign in to join this conversation.
No reviewers
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
rasterstate/fj!161
No description provided.