Skip to content

Explain code changes

Release notes

This feature allows the merge request and issues of past changes to lines of code to be summarized so that you can have context around the why faster. Whether you are a new junior developer or an experienced developer, when it comes to knowing why a piece of code was changed is something that is encountered everyday. In the past that involves navigating through past commits and merge requests to piece together that context. Developers now can get a summary of changes in one-click.

Problem to solve

As a developer, I want to understand the context of past code changes to this section of code so that I can have a better understanding of the rationale used to change the code.

User experience goal

The user should be able to get a summary of past changes and a list of links to those past changes when the user highlights a few lines of code.

Proposal

To understand the why of a code change, users will look at the commit history via blame or a list of commits to that file and then navigate back to the linked merge request and/or issue for more context. This requires many actions and pages open to make sense of the code change https://gitlab.com/gitlab-org/ux-research/-/issues/2920#observations.

To solve this we would introduce an action that would let you "explain code history".

This action would do the following things:

  • Retrieve all commits that is related to the selected line of code
    • This would eliminate the need for the user to go through all of the blame views & clicks
  • From the commits we are able to find the related merge requests
  • Take all related merge request descriptions and summarize it.
  • Display back to the user
    • merge requests summary
    • list of merge request links collapsed in an accordion to help if there could be a long list

If the user doesn't get enough information from the merge requests, we could have a button that says "get issue summary" link to past issues and get the relevant issue descriptions.

We could also incorporate a future look ahead of changes by looking at open merge requests that contain the current file and summarize that. This would give the user context of past and future for the selected lines of code.

Further details

TBD

Documentation

TBD

Availability & Testing

TBD

Available Tier

TBD

Feature Usage Metrics

  • Count of usage
  • Number of links clicked per summary
  • Number of regressions of summary

What does success look like, and how can we measure that?

  • Becomes main use case of explaining code over current code explaination.

Is this a cross-stage feature?

This functionality can be leveraged by groupsource code and groupcode review

What is the competitive advantage or differentiation for this feature?

Links / references

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖