Draft: Report /convert_to_ticket type rejections as quick action errors
What does this MR do and why?
When /convert_to_ticket fails because the Ticket type is disabled or archived, the quick action now reports an error instead of a regular message.
Issues::ConvertToTicketService returns the update failure reason from the WorkItems::UpdateService response, not from the model. The reason is work_item_type_unavailable for a rejected type, and update_failed for any other update failure. The quick action puts any update failure with a reason into a new execution_errors list on QuickActions::InterpretService. Pre-check failures (service desk disabled, underprivileged, already a ticket, invalid email) have no reason and stay messages.
The type rejection comes from enforce_work_item_type_availability, so that part only shows with the flag on. A failed update no longer leaves side effects behind, but that fix is in !261249.
Details
WorkItems::UpdateService rescues WorkItemTypeUnavailableError and returns the error with reason: :work_item_type_unavailable.
Notes::QuickActionsService delegates execution_errors to the interpret service.
Notes::CreateService#do_commands adds each execution error, and the quick action update error if there is one, to the note validation errors and to the quick actions status. The generic "Failed to apply commands." error is skipped when an execution error already explains the failure.
Notes::UpdateService adds the execution errors to the quick actions status. It only adds "Commands did not apply" when the status has no errors.
This MR conflicts with !260621 (merged) in app/services/notes/create_service.rb and app/services/notes/quick_actions_service.rb, because it is written against master. Whichever lands second keeps both: execution_errors read after the commands-executed check, the && execution_errors.empty? guard, and both delegates.
References
- Part of the split of !260607 (merged).
- Depends on !261249 (stacked).
- Conflicts with !260621 (merged) and !261247 (merged); see details.
How to set up and validate locally
- Disable the Ticket type for a project in the work item settings.
- Enable the flag with
Feature.enable(:enforce_work_item_type_availability). - Add a note with
/convert_to_ticket user@example.comto an issue. quickActionsStatus.errorMessageshas the "disabled or archived" error. No email participant and no "converted" note are created.- Enable the type and repeat. The conversion works.
Specs:
ee/spec/services/issues/convert_to_ticket_service_spec.rbee/spec/services/ee/notes/update_service_spec.rbee/spec/requests/api/graphql/mutations/notes/create/note_spec.rbspec/requests/api/notes_spec.rb
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist.
Generated with Claude Code