[bug] closeTicket sends resolution field even when the target transition has no resolution screen #9

Closed
opened 2026-07-07 10:39:17 -04:00 by jmcqueen · 1 comment
Owner

Found during end-to-end testing of #8.

POST /api/wxccai/ticket/:key/close always sends resolution: 'Done' (or the caller-supplied value) as part of the transition payload, even when the target transition doesn't have a Resolution field on its screen. This causes Jira to return:

{
  "errors": {
    "resolution": "Field 'resolution' cannot be set. It is not on the appropriate screen, or unknown."
  }
}

Repro (against a JSM ticket in a non-done state):

curl -X POST http://localhost:1866/api/wxccai/ticket/SS-XXXXX/close \
  -H 'Content-Type: application/json' \
  -d '{"transitionName":"Waiting for customer","resolution":null,"comment":"...","internal":true}'

Yields HTTP 400 even though resolution: null was explicitly passed. The route/service is still including the field in the transition payload.

Suggested fix in src/services/jira/issues.js#closeTicket / transitionTicket:

  1. If resolution is null / undefined / empty string, drop it from the payload entirely (don't send resolution: null).
  2. Consider only defaulting to "Done" when the target transition's to.statusCategory === "done" (introspect via getTransitions() output already available).
  3. Alternatively, add a separate POST /api/wxccai/ticket/:key/transition endpoint that skips the resolution logic entirely, for callers that want to transition without closing.

Workaround in the meantime: use the direct REST API (POST /rest/api/3/issue/{key}/transitions with just { transition: { id: '<id>' } }) for non-done transitions.

Low priority — doesn't block anything; the 'done' close path still works when the workflow validators are satisfied. Nice-to-have for admin/cleanup tooling.

**Found during end-to-end testing of #8.** `POST /api/wxccai/ticket/:key/close` always sends `resolution: 'Done'` (or the caller-supplied value) as part of the transition payload, even when the target transition doesn't have a Resolution field on its screen. This causes Jira to return: ```json { "errors": { "resolution": "Field 'resolution' cannot be set. It is not on the appropriate screen, or unknown." } } ``` **Repro** (against a JSM ticket in a non-done state): ```bash curl -X POST http://localhost:1866/api/wxccai/ticket/SS-XXXXX/close \ -H 'Content-Type: application/json' \ -d '{"transitionName":"Waiting for customer","resolution":null,"comment":"...","internal":true}' ``` Yields HTTP 400 even though `resolution: null` was explicitly passed. The route/service is still including the field in the transition payload. **Suggested fix** in `src/services/jira/issues.js#closeTicket` / `transitionTicket`: 1. If `resolution` is `null` / `undefined` / empty string, drop it from the payload entirely (don't send `resolution: null`). 2. Consider only defaulting to `"Done"` when the target transition's `to.statusCategory === "done"` (introspect via `getTransitions()` output already available). 3. Alternatively, add a separate `POST /api/wxccai/ticket/:key/transition` endpoint that skips the resolution logic entirely, for callers that want to transition without closing. **Workaround** in the meantime: use the direct REST API (`POST /rest/api/3/issue/{key}/transitions` with just `{ transition: { id: '<id>' } }`) for non-done transitions. Low priority — doesn't block anything; the 'done' close path still works when the workflow validators are satisfied. Nice-to-have for admin/cleanup tooling.
jmcqueen added this to the v1: Jira lifecycle GA milestone 2026-07-07 10:39:17 -04:00
jmcqueen added the
bug
label 2026-07-07 10:39:17 -04:00
Author
Owner

Fixed as part of the ticket-closure feature in commit 034e657 on branch cursor/close-tickets (see also #10).

closeTicket now inspects the target transition's status category and only sends the resolution field when the target is done. Non-done transitions (e.g. "Waiting for customer") no longer 400 with Field 'resolution' cannot be set. It is not on the appropriate screen, or unknown.

The route handler in wxccRoutes.js also stopped hard-defaulting resolution to 'Done' — that default is now applied deep inside closeTicket only when appropriate.

Verified via the SS-20948 close in #10 which exercises the same code path.

Fixed as part of the ticket-closure feature in commit [`034e657`](https://git.joesjavajoint.com/jmcqueen/wxccai/commit/034e657) on branch `cursor/close-tickets` (see also #10). `closeTicket` now inspects the target transition's status category and only sends the `resolution` field when the target is `done`. Non-done transitions (e.g. "Waiting for customer") no longer 400 with `Field 'resolution' cannot be set. It is not on the appropriate screen, or unknown.` The route handler in `wxccRoutes.js` also stopped hard-defaulting `resolution` to `'Done'` — that default is now applied deep inside `closeTicket` only when appropriate. Verified via the SS-20948 close in #10 which exercises the same code path.
Sign in to join this conversation.
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: jmcqueen/wxccai#9
No description provided.