Introduce automated code changes with OpenRewrite (BUILD-1004)

[BUILD-1046] Create Jira tickets for refactorings as needed Created: 11/Apr/23  Updated: 08/May/23  Resolved: 26/Apr/23

Status: Closed
Project: Build
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Sub-task Priority: Neutral
Reporter: Michael Duerig Assignee: Michael Duerig
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Team: Foundation

 Description   

Use cases

The refactoring bot has broadly two use cases:

  1. Ongoing maintenance tasks. E.g. updating copyright headers.
  2. Interactive one off refactorings. E.g. library updates across multiple modules like the beanutils migration or the upcoming migration to the Jakarta namespace.

For both cases we need to find a way for SOC2 compliant approvals.

Analysis

In the first case the PRs created by the bot are routine updates and we should have a blanked approval from them. Changes to the respective refactoring spec OTOH affect all upcoming PRs and should thus undergo an approval.

In the second case the PRs created by the bot are specific and individual an we need to individually approve them. Changes to the respective refactoring should be easily possible as in this case the refactor bot is used as a tool for ongoing development. These should be covered by one blanked approval.

Proposed Solution

Require a ticket reference per refactoring and optionally one per module. The ones on the modules take precedence over the one from the refactoring. The refactor bot uses that ticket reference within the title of the PRs it creates. If no such ticket exists yet, it adds a tasks to the PRs for creating one.

When creating tickets we add a note to the approver on the kind of refactoring and specify the scope of the approval. For example:

  1. This is a change to the copyright header refactoring spec that will affect all future PRs created by this refactoring spec. The approval covers the proposed changes to the refactoring spec and all future PRs created by this version of the spec.
  2. This is an ongoing effort to migrate to the Jakarta namespace. The approval covers all necessary changes to the refactoring spec but not those of the PRs resulting from it. Those need individual approvals and thus individual ticket reference(s).

 

Initial discussion on Slack: https://magnolia-cms.slack.com/archives/C03B6DXN2KS/p1681208674400999


Generated at Sun Feb 11 23:47:38 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.