Refactor the QuickActions::InterpretService to extract commands without side effects
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=25094) </details> <!--IssueSummary end--> Some quick actions have side effects (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22485#note_110876125 or [approve](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/app/services/ee/quick_actions/interpret_service.rb#L85)). But it makes sense to be able to extract the commands that manipulate a record in order to validate them in one of the `BuildServices`. I think we could implement that as follows: - We rename the current `execute` method, to `extract`: that's what it actually does. This new `extract` method cannot execute anything, it just collects the information in a hash. - We extend the `dsl` so we can mark a command that will have side effects, the quick actions marked with this will be ignored in the `extract` method. - We add a new `execute` method, this collects the results from `perform` but also executes all commands marked to have side effects I think we could then figure out a way to test if the `perform` method tried to change anything.
issue