fix: Assume divergence until established otherwise #5955
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.
what
This modifies the divergence checking behavior to assume divergence unless proven otherwise. On any errors it will say that there is a divergence.
why
The documentation on the merge checkout strategy describe the issue where a failure to use the updated main branch can delete resources that are configured on the main branch. Depending on the resource in question, this could be an unforseeable change that could have disastrous consequences. The existing behavior seemed to assume safety unless proven unsafe. It would be incredibly bad for a series of poorly-timed transient network failures on fetches to result in an apply that destroys resources. Our usage prioritizes safety and we would prefer that the plan/apply bail if it cannot establish safety.
I realize that this is an opinionated change, but I suspect that most people who go out of their way to enable the merge strategy and undiverged requirement are expecting to make their processes as safe as possible. I was surprised by the behavior. If preferred, I could also lock this behavior behind an option. I'm not sure to what extent this would be a breaking change.
tests
references