Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A critical guard gap still allows fresh-PR replay to revert target-only fixes during unrelated patch conflicts, and existing tests bypass or inject the guard rather than verify its protection.
2 open issues
What changed in this PR
This PR addresses #6822 by blocking opposite-direction flow recreation during existing PR updates, aiming to prevent conflict recovery from overwriting target-only changes.
Changes:
- Adds a blocking exception and recreation guard, with force/unsafe overrides.
- Updates blocked-flow notifications to explain the risk of reverting target-branch changes.
- Adds updater tests for blocking exceptions and adjusts notification tests.
Codeflow tests were not run in this review environment; please run dotnet test test/Darc/Microsoft.DotNet.DarcLib.Codeflow.Tests.
| File | Description |
|---|---|
test/ProductConstructionService/ProductConstructionService.DependencyFlow.Tests/PullRequestUpdaterTests.cs |
Adds a blocking-exception mock helper and updates notification matching. |
test/ProductConstructionService/ProductConstructionService.DependencyFlow.Tests/PullRequestCommenterTests.cs |
Updates duplicate-comment checks for the new notification. |
test/ProductConstructionService/ProductConstructionService.DependencyFlow.Tests/PendingCodeFlowUpdatesTests.cs |
Tests blocked PR state and outcomes for both exception types. |
src/ProductConstructionService/ProductConstructionService.DependencyFlow/PullRequestUpdaters/CodeFlowPullRequestUpdater.cs |
Uses the generalized blocked-flow notification. |
src/ProductConstructionService/ProductConstructionService.DependencyFlow/PullRequestCommentBuilder.cs |
Explains recreation risks and expands the force-update warning. |
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrCodeflower.cs |
Guards opposite-direction recreation for existing PR branches. |
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/Exceptions.cs |
Defines the blocking exception for opposite-direction recreation. |
Review effort: Balanced
| // Replaying an opposite-direction flow on top of an existing PR branch replaces the target with a snapshot | ||
| // of the source, which can overwrite changes that haven't been flown yet. We only allow it for unsafe or forced flows. | ||
| if (previousFlows.LastFlow.IsBackflow != currentIsBackflow | ||
| && headBranchExisted |
Member
Author
There was a problem hiding this comment.
this way a PR always gets created. I wonder if we should not create it instead and see it as a failed workitem and deal with it
premun
reviewed
Nov 16, 2026
…ndencyFlow/PullRequestCommentBuilder.cs Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


#6822