Repository navigation
Fix version file codeflow PR reverts - #6883
Conversation
|
If previous flow was opposite direction, we need to check if a version file change got reverted in that PR. We do this by comparing the files at the commit we're flowing with the last flow target repo sha. |
There was a problem hiding this comment.
🟡 Changes recommended
Active issues leave first-backflow version-file reverts unpropagated and can cause backflow to fail with KeyNotFoundException when a forward-flow PR removes a pinned dependency.
2 open issues
What changed in this PR
Updates DARC’s two-way codeflow to propagate version-file changes reverted in a PR back between a repository and the virtual monorepo (VMR), addressing #6882.
Changes:
- Adds a common-base comparison option to JSON and dependency-file mergers.
- Enables that option for new flows following an opposite-direction flow.
- Adds revert-propagation regressions and updates resolver test expectations.
Codeflow tests could not be run in this review environment. Please run dotnet test test/Darc/Microsoft.DotNet.DarcLib.Codeflow.Tests.
| File | Description |
|---|---|
| test/Darc/Microsoft.DotNet.DarcLib.Tests/VirtualMonoRepo/VersionDetailsFileMergerTests.cs | Tests common-base dependency reversions and removals. |
| test/Darc/Microsoft.DotNet.DarcLib.Tests/VirtualMonoRepo/JsonFileMergerTests.cs | Tests propagation of reverted JSON sections. |
| test/Darc/Microsoft.DotNet.DarcLib.Tests/VirtualMonoRepo/ForwardFlowConflictResolverTests.cs | Updates mocks and assertions for common-base parameters. |
| test/Darc/Microsoft.DotNet.DarcLib.Tests/VirtualMonoRepo/BackflowConflictResolverTests.cs | Updates backflow merger expectations. |
| test/Darc/Microsoft.DotNet.DarcLib.Codeflow.Tests/TwoWayCodeflowTests.cs | Adds a two-way regression for version-file PR reverts. |
| src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VersionDetailsFileMerger.cs | Adds common-base dependency comparison. |
| src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/JsonFileMerger.cs | Adds common-base JSON comparison. |
| src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/ForwardFlowConflictResolver.cs | Selects and passes the common base after backflow. |
| src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/BackflowConflictResolver.cs | Selects and passes the common base after forward flow. |
Review effort: Balanced
| string? commonMergeBaseSha = !headBranchExisted | ||
| && lastFlows.LastBackFlow != null | ||
| && lastFlows.LastFlow is ForwardFlow lastForwardFlow | ||
| ? lastForwardFlow.RepoSha | ||
| : null; |
| repoComparisonSha, | ||
| vmrComparisonSha); | ||
| vmrComparisonSha, | ||
| commonMergeBaseSha); |


#6882