Detect and abort non-linear codeflows#5195
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements detection and prevention of non-linear codeflows in the VMR (Virtual Mono Repository) system to address issue #4973. The changes ensure that commits being flowed maintain a linear history relative to previously flown commits, preventing potential merge conflicts and repository inconsistencies.
Key changes include:
- Addition of linearity verification logic for both forward and backward flows
- Creation of a new
NonLinearCodeflowExceptionto handle violation cases - Comprehensive test coverage for both forward flow and backflow scenarios
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| GitOperationsHelper.cs | Added CreateBranch helper method for test setup |
| ForwardFlowTests.cs | Added test to verify detection of non-linear forward flows |
| BackflowTests.cs | Added test to verify detection of double backflows into same branch |
| VmrForwardFlower.cs | Implemented linearity verification for forward flows |
| VmrCodeflower.cs | Added abstract method and call to verify codeflow linearity |
| VmrBackflower.cs | Implemented linearity verification for backflows |
| Exceptions.cs | Added NonLinearCodeflowException class |
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrForwardFlower.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrBackflower.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
This PR implements detection and prevention of non-linear codeflows in the VMR (Virtual Mono Repository) system to ensure code changes flow in a proper linear sequence.
- Adds linearity verification to prevent flowing commits that are not descendants of previously flown commits
- Introduces a new
NonLinearCodeflowExceptionto handle non-linear flow scenarios - Implements abstract method for linearity verification in both forward and backflow operations
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test/Microsoft.DotNet.DarcLib.Codeflow.Tests/Helpers/GitOperationsHelper.cs |
Adds CreateBranch helper method for test scenarios |
test/Microsoft.DotNet.DarcLib.Codeflow.Tests/ForwardFlowTests.cs |
Adds test for detecting non-linear forward flow scenarios |
test/Microsoft.DotNet.DarcLib.Codeflow.Tests/BackflowTests.cs |
Adds test for detecting double backflow scenarios |
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrForwardFlower.cs |
Implements linearity verification for forward flows |
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrCodeflower.cs |
Adds abstract method and calls linearity verification |
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrBackflower.cs |
Implements linearity verification for backflows |
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/Exceptions.cs |
Defines new exception for non-linear codeflow scenarios |
#4973