Associate code changes with the discussion that prompted them
Problem to solve
When a reviewer wants to verify the changes made in response to a code review, under some circumstances it can be difficult to identify a) which of many resolved discussions are relevant to the most recent changes, and b) which code changes are relevant to which discussions.
(This was discussed in the monthly ~Create meeting)
Further details
Suppose a merge request has been through a couple of cycles of code review, during which several discussions were resolved but a few were left unresolved. Then, after a final round of review, the merge request author makes several code changes and they resolve all the remaining discussions.
Now, if the reviewer wants to verify that the discussions were actually resolved they have to open each discussion one-by-one until they find the relevant ones. Then, if the changes were limited, the discussions will show that “X changed this line in version Y”. But if the changes touched multiple files the reviewer has to go through the diffs to find all the other relevant changes themselves.
Proposal
There are several potential options for improvement:
- https://gitlab.com/gitlab-org/gitlab-ce/issues/52095 will help by including the diff of the change referred to by “X changed this line in version Y”. But it would only show the line changed (and a few lines around the change).
- Multi-line comments could help link a change to a discussion when it spans more than one line. But it too is insufficient if the change involves multiple files.
- Allow a commit to be associated with a specific discussion and then show the diffs of just that commit in the discussion (e.g., via a special tag in a commit or a special push option). One downside is that authors might have to change their workflow (i.e., this wouldn't work if all the changes are included in a single commit).
- Present a list of discussions that were resolved since the last review (or with the most recent push).
- Combine (3) with the diff of the most recent push, to pair discussions with changes. Perhaps a set of clear associations (i.e., “X changed this line in version Y”), plus a set of unclear associations (e.g., a list of discussions that couldn't be associated with specific changes and a set of changes that couldn't be associated with specific discussions).
- Magic option: somehow do (5) automatically and precisely for all discussions/changes since the last review. Might require AI.
What does success look like, and how can we measure that?
- Reviewers are able to easily identify all changes relevant to specific discussions, even if all the discussions are resolved.
- Merge request authors aren't required to do extra work or change their workflow significantly.