Allow updating the options of a decision

What does this MR do and why?

Allow updating options of a work item decision

The decision text of a manually recorded decision lives on its selected option, so until now there was no way to correct it. Selection edits stay limited to resolved decisions, since selecting is how a decision is resolved.

Depends on !256839 (merged), being the second of two MRs that support the updating of options.

Related to #629049 (closed)

Database review notes

Files

File
ee/app/services/work_items/decisions/update_service.rb Loads the decision's options (options_by_id, line 139) and issues one update! per edited option (line 28) inside the existing transaction. No new scopes.
ee/app/graphql/mutations/work_items/decisions/update.rb New options argument, capped at MAX_OPTIONS_PER_DECISION (5), which bounds the number of UPDATEs per request.
ee/app/graphql/types/work_items/decision_option_update_input_type.rb Input shape only; no SQL.

Queries

Query plans generated using local GDK as this is a new feature behind a feature flag

1. Load the decision's options — update_service.rb:139 (decision.options.index_by(&:id))

SELECT "work_item_decision_options".* FROM "work_item_decision_options"
WHERE "work_item_decision_options"."work_item_decision_id" = 21380
ORDER BY "work_item_decision_options"."id" ASC

Query plan: https://explain.depesz.com/s/2c2X#html

2. Update one option — update_service.rb:28 (option.update!)

UPDATE "work_item_decision_options"
SET "updated_at" = '2026-09-22 21:51:01.774632', "selected" = TRUE, "content" = 'Use Valkey', "description" = 'Redis-compatible'
WHERE "work_item_decision_options"."id" = 48518

Query plan: https://explain.depesz.com/s/K8dk#html

FE integration notes

workItemDecisionUpdate now takes an options argument (WorkItemDecisionUpdateInput.options, list of WorkItemDecisionOptionUpdateInput, max 5 entries). Each entry needs id (WorkItemsDecisionOptionID, required) plus any of content, description, selected.

For example:

mutation {
  workItemDecisionUpdate(input: {
    id: "gid://gitlab/WorkItems::Decision/42",
    options: [
      { id: "gid://gitlab/WorkItems::DecisionOption/7", content: "Use Valkey" },
      { id: "gid://gitlab/WorkItems::DecisionOption/8", selected: false }
    ]
  }) {
    decision {
      id
      options { nodes { id content selected } }
    }
    errors
  }
}

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #629049 (closed)

Edited by Richard Chan

Merge request reports

Loading
Loading