Skip to content

Conversation

@premun
Copy link
Member

@premun premun commented Dec 5, 2025

Rebase conflicts on all reverted files and we are able to resolve them using the crossing flow.

  • The reverts happen if there are 2 flows in the same direction with a conflict.
  • For 2 flows in the same direction, there's no crossing flow.
  • If we detect recreation of previous flows, we're technically unwinding the latest flow (or more) and recreating them. But that means, the latest flow in the same direction is now a crossing flow.
  • When we detect this, we set the lastFlows.CrossingFlow to the last flow in the same direction and the resolver of the gradual changes / reverted files then correctly fixes the files.

#5541

Copilot AI review requested due to automatic review settings December 5, 2025 13:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where rebase codeflow encounters conflicts on reverted files when there are two flows in the same direction. The solution detects when previous flows are being recreated and treats the last same-direction flow as a crossing flow, enabling proper conflict resolution for reverted files.

Key Changes:

  • Implements crossing flow detection for recreated flows in both forward and backward flow scenarios
  • Adds file revert resolution logic for files that were added then removed during rebase
  • Enhances conflict handling to commit changes when no conflicts exist during backflow

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrForwardFlower.cs Adds crossing flow detection when previous flows are recreated
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrBackflower.cs Implements crossing flow detection and conditional commit logic for conflict-free backflows
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrCodeflower.cs Refactors reverted file handling with new FileToBeRemovedContent constant and commit logic
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/CodeFlowConflictResolver.cs Adds TryRevertingAddedFile method and improves conflict abort logic
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/ForwardFlowConflictResolver.cs Integrates file revert resolution for forward flows
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/BackflowConflictResolver.cs Adds file revert resolution for backflows
src/Microsoft.DotNet.Darc/DarcLib/Models/VirtualMonoRepo/CodeFlowResult.cs Adds RecreatedPreviousFlows property to track flow recreation
test/Microsoft.DotNet.DarcLib.Codeflow.Tests/TwoWayCodeflowTests.cs Updates OutOfOrderMergesWithConflictsTest to test rebase-only scenarios with new flow verification
test/Microsoft.DotNet.DarcLib.Codeflow.Tests/ForwardFlowTests.cs Removes test ignore and fixes assertion for file content expectations
test/Microsoft.DotNet.DarcLib.Codeflow.Tests/BackflowTests.cs Adds comprehensive BackflowWithRevertsAndConflictsTest mirroring forward flow test
test/Microsoft.DotNet.DarcLib.Codeflow.Tests/Helpers/GitOperationsHelper.cs Changes CreateBranch to use -B flag and removes --ff-only from merge
eng/Create-CodeflowGraphVizGraph.ps1 Adds --first-parent flag to git blame commands

@premun
Copy link
Member Author

premun commented Dec 5, 2025

@dkurepa there is one failing test ForwardFlowWithConflictsDeepInPastTest which is hitting an NRE here:

Do you know what's the thinking behind that ! and whether it shouldn't be something more defensive?

@premun
Copy link
Member Author

premun commented Dec 5, 2025

@dkurepa let me know if 99541bb is a good fix

@dkurepa
Copy link
Member

dkurepa commented Dec 8, 2025

@dkurepa let me know if 99541bb is a good fix

I think so, yes, it's also an edge case that will only happen when we add a new VMR repo too

@premun premun changed the title Fix the reverts problem for rebase codeflow Fix handling fully-reverted files during rebase codeflow Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants